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 |
---|---|---|---|---|---|---|
Prints matrix to Standard Output | def print_matrix
width = @rows.flatten.max.to_s.size
if width > 4 then
width = width - 0.5
end
puts @rows.map { |a|
"|#{ a.map { |i|
outp = ""
num, den = i.to_fraction
if den == 1 then
outp += "#{num}"
else
outp += "#{num}/#{den}"
end
"#{outp.rjust(width)} |"
}.join }"
}
puts "↓"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_matrix\n @matrix.each do |m|\n print \"#{m}\\n\"\n end\n end",
"def print_matrix\n for i in 0...@number_of_rows\n for j in 0...@number_of_columns\n print @matrix[i][j]\n end\n puts ''\n end\n end",
"def print\n @maze[:matrix].each do |line|\n puts line.join\n end\n end",
"def print_matrix(matrix)\n matrix.each do |row|\n p row\n end\nend",
"def print_matrix(matrix)\n puts separator = '-' * matrix.first.length * 6 + '--'\n\n matrix.each do |row|\n line = ''\n row.each do |col|\n line += col.to_s.rjust(3).ljust(6)\n end\n puts \"|#{line}|\".yellow\n end\n\n puts separator\nend",
"def print_matrix(m)\n (0...m.length).each do |i|\n step = 0\n (0..i).each do |_j|\n print \"#{m[i - step][step]} \"\n step += 1\n end\n puts ''\n end\nend",
"def print_output_matrix(useMatrixLabel = false)\r\n if useMatrixLabel == true then label = 'outputs' end\r\n BatchMultipleRegression.print_matrix(@outputs, label, 3, ', ')\r\n end",
"def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n matrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end",
"def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n\tmatrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end",
"def display\t\n \tstring = \"\\n +-----------------------+\".green\n \t@matrix.each_index{ |i|\n \tstring += \"\\n |\".green\n v = @matrix[i]\n \tv.each_index{|j|\n \t\tif (v[j] != 0)\n \t\t\tstring += \" \" + v[j].to_s\n \t\telse \n \t\t\tstring += \" .\"\n \t\tend\n \t\t\t\t\n \t\tif (j == 2 || j == 5 || j == 8)\n \t\t\tstring += \" |\".green\n \t\tend\n \t\t}\n \t\tif (i == 2 || i == 5)\n \t\t\tstring += \"\\n |-------+-------+-------|\".green\n \t\tend\n \t}\n \tstring += \"\\n +-----------------------+\".green\n\tend",
"def pp_matrix(matrix)\n matrix.each { |x| puts x.map { |y| y.inspect[1...-1].split('').join(' ') + ' , ' }.join[0...-3] }\n print_new_line\nend",
"def printmatrices\n count = 0;\n @matrices.each do |matrix|\n puts \"Matrix \" + count.to_s\n count += 1\n for i in 0..3\n for o in 0..3\n print matrix[i][o]\n print \" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end\nend",
"def print_matrix(m, row = nil, col = nil, rbold = nil)\n print \"\\n\"\n for i in 0..m.size-1\n print \"|\\t\"\n for j in 0..m[i].size-1\n n = m[i][j]\n if n.is_a? Numeric\n n = n.round(2)\n #n = n.to_r.rationalize(Rational('0.005')) #printar em fração\n #n = n.numerator if n.denominator == 1\n\n if row==i&&col==j\n print n.to_s.reverse_color\n elsif rbold == i\n print n.to_s.bold.bg_blue\n else\n print n\n end\n else\n print n\n end\n print \"\\t\" \n end\n puts \"|\"\n end\n print \"\\n\"\nend",
"def output_matrices(p)\n m = matrixjson(p)\n m.each do |d|\n puts d[0]\n d[1].each do |mr|\n mr.each do |c|\n print \"#{c}#{c.to_s == \" \" || c < 10 ? ' ' : ''} \"\n end\n puts\n end\n puts\n end\nend",
"def print_mat(matrix, delim=nil)\n puts matrix.map{|x| delim ? x.join(delim) : x.inspect}\nend",
"def print_matrix\n persons = unique_points.to_a.sort{|x, y| x.id <=> y.id}\n print \"\\t \"\n #persons.each{ |p| print(\" #{p.id} \") }\n persons.each do |p|\n len = p.id.to_s.length\n len == 1 ? print(\" #{p.id} \") : print(\" #{p.id} \")\n end\n puts\n (0...persons.count).each do |i|\n p = persons[i]\n puts\n row = am[i]\n print(\"#{p.name} \")\n if p.name.length < 7\n print(\"\\t \")\n elsif p.name.length == 7\n print(\" \")\n else\n print(\"\")\n end\n row.each do |cell|\n len = cell.to_s.length\n if cell.nil?\n print(\" -- \")\n else\n len == 1 ? print(\" #{cell} \") : print(\" #{cell} \")\n end\n end\n print(\" #{p.id}\")\n end\n nil\n end",
"def to_s\n s = \"\"\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n s += \"#{@matrix[i][j].to_s}\\t\"\n j += 1\n end\n s += \"\\n\"\n i += 1\n end\n s\n end",
"def print_board\n @tablero.row_vectors().each_with_index { |row, i|\n print \"#{row.component(i)}\\n\"\n }\n #Imprime los numeros de las columnas\n (1..@tablero.row_vectors.size).each { |n|\n print \" #{n} \"\n }\n puts\n #Imprime las letras de las filas\n letras = (\"A\"..\"Z\").to_a\n (0...@tablero.row_vectors.size).each do |i|\n print \"#{letras[i]} \"\n @tablero.row_vectors()[i].each do |fila|\n print \" #{fila} | \"\n end\n puts\n print \" ----\" * @tablero.row_count\n puts\n end\n end",
"def print\n board_print = \"\"\n\n for x in 0..@matrix.length - 1\n for y in 0..@matrix[x].length - 1\n if @matrix[x][y] == \"KK\"\n board_print << @matrix[x][y]\n else\n board_print << format('%02d', @matrix[x][y]).to_s\n end\n\n board_print << \" \"\n end\n\n board_print << \"\\n\"\n end\n\n board_print << \"\\n\"\n puts board_print\n end",
"def output\n\tputs \" #{@array_map[0][0]} | #{@array_map[0][1]} | #{@array_map[0][2]} \" \n\tputs \"------------\"\n\tputs \" #{@array_map[1][0]} | #{@array_map[1][1]} | #{@array_map[1][2]} \"\n\tputs \"------------\"\n\tputs \" #{@array_map[2][0]} | #{@array_map[2][1]} | #{@array_map[2][2]} \"\n\tend",
"def display\n @mat.each do | _ ,row|\n row.each do |ele|\n if ele == \"1\"\n print ele\n else\n print \" \"\n end\n end\n puts \"\\n\"\n end\n end",
"def to_s\n set_current_position!\n matrix.reverse.map { |row| row.join(' ') }.join(\"\\n\")\n end",
"def display()\n\t\tmaze.each do|x| \n\t\t\tx.each {|j| print j}\n\t\t\tputs\n\t\tend\n\tend",
"def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\n end",
"def output_image\n @transformed_matrix.each do |element|\n puts element.join\n end\n end",
"def printInfo(adjacencyMatrix, degreeArray)#print the details of the matrix and its degrees\n\tputs\"M A T R I X :\"\n\tputs adjacencyMatrix.to_a.map(&:inspect) #print out the adjacency matrix *adapted from stack overflow*\n\tputs \"D E G R E E S OF N O D E S :\"\n\tputs degreeArray.inspect #print out all degrees in the array\n\tputs \"\\n\"\nend",
"def print_board\n print to_s\n # @board.each do |row|\n # row.each do |square|\n # print \" #{square.number} \"\n # end\n # puts \"\"\n # end\n end",
"def paintMatrix(a)\n\t\n\tputs \" | 1 | 2 | 3 | 4 | 5 | 6\".green\n\tputs \"\"\n\tfor i in 0..5\n\t\tif ( i != 0 )\n\t\tputs \" \"\n\t\tend\n\t\tfor j in 0..5\n\t\t\t\tprint \" | \".blue\n\t\t\t\tprint \"#{a[i][j]}\"\n\t\tend\n\t\tputs \"\"\n\tend\n\tputs\"\"\n\tend",
"def print\n @cell_board.each do |row|\n string_row_separator = '-'\n string_row = '|'\n row.each do |element|\n string_row += \" #{element.to_s} |\"\n string_row_separator += '----'\n end\n puts string_row\n puts string_row_separator\n end\n end",
"def print_graph()\n puts \"Adjacency Matrix\"\n @adjacent_list.each_with_index {|value, index| puts \"#{index} #{value} \\n\" }\n\n puts \"Indegree Matrix\"\n @indegree.each_with_index {|value, index| puts \"#{index} #{value} \\n\" }\n end",
"def print\n (1..5).each do |l|\n out = printByLine(l) + \"\\n\"\n STDOUT << (VROW.include?(l) ? out*@size : out )\n end\n end",
"def display_board(matrix, message = [])\n message.each{ |m| puts m }\n\n puts <<-eos\n A B C D E F G H I J\n +---------------------------------------+\n eos\n matrix.each_with_index do |x, i|\n puts <<-eos\n #{i+1} #{\" \" if i != 9}| #{x[0]} | #{x[1]} | #{x[2]} | #{x[3]} | #{x[4]} | #{x[5]} | #{x[6]} | #{x[7]} | #{x[8]} | #{x[9]} |\n |---|---|---|---|---|---|---|---|---|---|\n eos\n end\n\n puts <<-eos\n +---------------------------------------+\n eos\nend",
"def output\n return if rows.empty? # we got here with nothing to print to the screen\n auto_adjust_widths if width == :auto\n\n puts separator('first') if border\n\n rows.each_with_index do |row, index|\n row.output\n puts separator('middle') if border && (index != rows.size - 1)\n end\n\n puts separator('last') if border\n end",
"def show_distancematrix\n if not @distance_matrix\n calculate_distancematrix\n end\n\n # print in same format as bondmatrix\n @distance_matrix.pretty_print(@atoms)\n end",
"def to_s\n @matrix.inject('') do |combined_rows, row|\n formatted_row =\n row.inject('') { |combined_cells, cell| \"#{combined_cells} #{cell}\" }\n \"#{combined_rows}\\n#{formatted_row}\"\n end\n end",
"def print_board\r\n @squares.each do | i |\r\n print \" \"\r\n puts \"-\" * 33\r\n i.each do | val |\r\n print \" | \"\r\n print val\r\n end\r\n puts \" |\"\r\n end\r\n print \" \"\r\n puts \"-\" * 33\r\n puts \"\\n\"\r\n end",
"def to_s\n matS = \"\"\n for i in 0...@nF do\n for j in 0...@nC do\n matS = matS + @matriz[i][j].to_s + \" \"\n end\n matS = matS + \"\\n\"\n end\n matS\n end",
"def display\n print \"\\n\"\n @x.times{ |r|\n @y.times{|c| \n print @mat[r][c].is_alive ? \"X \" : \"- \"\n }\n print \"\\n\"\n }\n end",
"def print_to_terminal\n grid.each do |row|\n row.each do |element|\n print \"O \" if(element==1)\n print \"X \" if(element==-1)\n print \"- \" if(element==0)\n end\n print \"\\n\"\n end\n end",
"def print\n puts \"\"\n puts \"\"\n puts \"Generation #{@generation}\"\n puts \"#{@grid.rows} x #{@grid.cols}\"\n @grid.print()\n end",
"def write_matrix\n array = Array.new\n @left_system_of_equations.keys.each do |key|\n array << @left_system_of_equations[key]\n end\n @right_system_of_equations.keys.each do |key|\n array << @right_system_of_equations[key]\n end\n @array << array\n end",
"def print_input_matrix(useMatrixLabel = false)\r\n if useMatrixLabel == true then label = 'inputs' end\r\n BatchMultipleRegression.print_matrix(@inputs, label, 3, ', ')\r\n end",
"def display_print\n @grid.each_with_index do |row, row_idx|\n row.each_with_index do |element, column_idx|\n separator = (column_idx % 3 == 2) ? \" \" : \" \"\n print element.to_s + separator\n end\n puts\n puts if (row_idx % 3 == 2)\n end\n nil\n end",
"def print_board\n puts\n @board.each_with_index do |row, index|\n print \" \"\n row.each_with_index do |element, index|\n print \" \" + element.to_s.center(3, \" \") + \" \"\n if(index < row.length - 1)\n print \"|\"\n else\n print \"\\n\"\n end\n end\n\n if(index < @board.length - 1)\n print \" \"\n row.each_with_index do |element, index|\n print \"-----\"\n if(index < row.length - 1)\n print \"+\"\n else\n print \"\\n\"\n end\n end\n end\n end\n puts\n end",
"def print_grid\n rows = @grid.map do |row|\n row.join(\" \")\n end\n print rows.join(\"\\n\")\n end",
"def display ()\n @maze_table.each_with_index do |row, i|\n (0..row.size-1).each do |index|\n print \"+\" if row[index] == \"1\" && i % 2 == 0 && index % 2 == 0\n print \"-\" if row[index] == \"1\" && i % 2 == 0 && index % 2 == 1\n print \"|\" if row[index] == \"1\" && i % 2 == 1 \n print \" \" if row[index] == \"0\"\n end\n print \"\\n\"\n end\n end",
"def imprimir_Matriz\n\t\tx,y = 0,0\n\t\t\n\t\twhile x < row\n\t\t\twhile y < col\n\t\t\t\tprint(\"#{matriz[x][y]} \\t\")\n\t\t\t\tprint(\"\") \n\t\t\t\ty= y + 1\t\t\t\n\t\t\tend\n\t\t\tputs\n \t\t\tx = x + 1\n \t\t\ty = 0\n\t\tend\n\t\tputs \n\tend",
"def display_matrix( matrix )\n return if ! matrix.keys[0]\n\n state_names = matrix.keys\n event_names = matrix[matrix.keys[0]].keys\n len_ev = 8\n event_names.each { |k| len_ev = k.length if k.length > len_ev }\n\n printf( \"%*s \", len_ev, \"\" )\n state_names.each { |st| printf( \"%-6s \", st ) }\n printf( \"\\n\" )\n\n event_names.each do |ev|\n printf( \"%-*s \", len_ev, ev )\n state_names.each do |st|\n w = st.length > 6 ? st.length : 6\n printf( \"%-*s \", w, matrix[st][ev] )\n end\n printf( \"\\n\" )\n end\nend",
"def drawToSTDOUT\n for r in (0..6).step(3) do\n print \"+-----++-----++-----+\\n\"\n print \"| \\\\\"+@table[r].getTop.to_s+\"/ || \\\\\"+@table[r+1].getTop.to_s+\"/ || \\\\\"+@table[r+2].getTop.to_s+\"/ |\\n\"\n print \"|\"+@table[r].getLeft.to_s+\" × \"+@table[r+1].getRight.to_s+\"||\"+@table[r+2].getLeft.to_s+\" × \"+@table[r].getRight.to_s+\"||\"+@table[r+1].getLeft.to_s+\" × \"+@table[r+2].getRight.to_s+\"|\\n\"\n print \"| /\"+@table[r].getBottom.to_s+\"\\\\ || /\"+@table[r+1].getBottom.to_s+\"\\\\ || /\"+@table[r+2].getBottom.to_s+\"\\\\ |\\n\"\n print \"+-----++-----++-----+\\n\"\n end\n end",
"def output\n print_headings\n \n line_order.each do |line_name|\n stats = statistics[line_name]\n \n arr = [line_headings[line_name]] + column_order.collect {|col| stats[col]}\n print_line(arr)\n end\n \n print_separator\n print_summary\n end",
"def __write_matrix(name, mx, dict)\n __write_with_log(name) do |io| \n i = -1\n mx.each_value do |v|\n io.puts \"result__[#{i += 1}] = #{v.subs(dict)};\"\n end\n end\n end",
"def displayframecolumnvalues\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t\tnew_row='|'+row.join('|')+'|'\r\n\t\t\t\t@output.puts(new_row)\r\n\t\t\tend\r\n\t\tend",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print\n @grid.each { |row| p row }\n end",
"def print_board(array)\n system('cls')\n puts\n puts \"\\033[33m 1 2 3 4 5 6 7 8 \\033[0m\"\n array.each do |row|\n puts\"\\033[33m│\\033[0m #{(row.join\" \\033[33m││\\033[0m \")} \\033[33m│\\033[0m\"\n puts \"#{\"\\033[33m╞---╡\\033[0m\"*row.count}\"\n end\n puts \"\\033[33m╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛\\033[0m\"\nend",
"def display_board\n col_separator = ' | '\n row_separator = '--+---+--'\n\n @rows.each_with_index do |row, row_number|\n row.each_with_index do |col, col_number|\n print col.to_s\n print col_separator unless col_number + 1 >= row.length\n end\n puts ''\n puts row_separator unless row_number + 1 >= @rows.length\n end\n end",
"def print_table\n dimension_length = (@numbers_to_multiply.length)\n topColumn = \"\"\n for i in 0..dimension_length\n topColumn += \" #{@multiplication_table[0][i]} |\"\n end\n for x in 0..dimension_length \n rowValues = \"\"\n for y in 0..dimension_length\n nextEntry = @multiplication_table[x][y]\n rowValues << \" #{nextEntry} |\"\n end\n puts rowValues\n end\n end",
"def print_grid\n @grid.each do |arr|\n puts arr.join(\" \")\n end\n end",
"def to_s\n cad = \" \"\n for i in 0...nfil\n cad << \" [ \"\n for j in 0...ncol\n\tcad << \"#{mat[i][j]} \"\n end\n cad << \"]\"\n cad << \"\\n \"\n end\n return cad\n end",
"def print\n PascalRow.print_row_ary(row_ary, idx: idx, max_id: @max_id, max_padding: @max_padding)\n end",
"def view\n @board.each do |row|\n print \"|#{row}|\"\n puts\n end\n puts \" 1 2 3 4 5 6 7\"\n end",
"def to_s\n matString = \"\"\n for i in 0...@nFil do\n for j in 0...@mCol do\n matString = matString + @matriz[i][j].to_s + \" \"\n end\n matString = matString + \"\\n\"\n end\n matString\n end",
"def print_equation(matrix, vector)\n matrix.each_with_index do |row, row_idx|\n print row[0].negative? ? '- ' : ' '\n row.each_with_index do |value, col_idx|\n print \"#{value.abs.to_s.split('').join(' ')} #{VARIABLES[col_idx]}\" \\\n \"\\t#{col_idx + 1 < row.length ? signal(row[col_idx + 1]) : ''}\"\n end\n puts \" = #{vector[row_idx].to_s.split('').join(' ')}\"\n end\nend",
"def print_molecule\n puts @name\n @bondmatrix.pretty_print(@atoms)\n end",
"def output\r\n @orthonormalized_matrix.map{|vector| vector.to_a } \r\n end",
"def print_board\n horizontal_rule = \" -------------\"\n row_one = \" 1 2 3 \"\n row_two = \" a | #{@array[0][0]} | #{@array[0][1]} | #{@array[0][2]} |\"\n row_three = \" b | #{@array[1][0]} | #{@array[1][1]} | #{@array[1][2]} |\"\n row_four = \" c | #{@array[2][0]} | #{@array[2][1]} | #{@array[2][2]} |\"\n \n print row_one + \"\\n\", row_two + \"\\n\", horizontal_rule + \"\\n\", \n row_three + \"\\n\", horizontal_rule + \"\\n\", row_four + \"\\n\"\n end",
"def display\n i=0\n print \" \"\n 0.upto(9) do |x|\n print\" #{x} \"\n end\n 10.upto(@cols-1) do |x|\n print\" #{x}\"\n end\n print \"\\n\"\n print \" \"\n 0.upto(@cols-1) do\n print\"---\"\n end\n print \"\\n\"\n 0.upto(9) do |x|\n\t\t\tprint\" #{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n \t\tend\n 10.upto(@rows-1) do |x|\n\t\t\tprint\"#{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n end\n return nil\n\tend",
"def to_s\n \"Matrix[\" + @rows.collect{\n |row|\n \"[\" + row.collect{|e| e.to_s}.join(\", \") + \"]\" # no yield\n }.join(\", \")+\"]\"\n end",
"def print_board\n\n\t\t@board.each_with_index do |row, i|\n\n\t\t\trow.each do |space|\n\n\t\t\t\tprint \"|#{space}|\"\n\n\t\t\tend\n\n\t\t\tif i == 2\n\t\t\t\tputs \"\"\n\t\t\telse\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"---------\"\n\t\t\tend\n\n\t\tend\n\n\tend",
"def show_board\n @display.each do |row|\n puts row.join(' ')\n end\n end",
"def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end",
"def pretty_print(q) #:nodoc:\n if self.shape.size > 1 and self.shape[1] > 100\n self.inspect.pretty_print(q)\n elsif self.dim > 3 || self.dim == 1\n self.to_a.pretty_print(q)\n else\n # iterate through the whole matrix and find the longest number\n longest = Array.new(self.shape[1], 0)\n self.each_column.with_index do |col, j|\n col.each do |elem|\n elem_len = elem.inspect.size\n longest[j] = elem_len if longest[j] < elem_len\n end\n end\n\n if self.dim == 3\n q.group(0, \"\\n{ layers:\", \"}\") do\n self.each_layer.with_index do |layer,k|\n q.group(0, \"\\n [\\n\", \" ]\\n\") do\n layer.each_row.with_index do |row,i|\n q.group(0, \" [\", \"]\\n\") do\n q.seplist(self[i,0...self.shape[1],k].to_flat_array, lambda { q.text \", \"}, :each_with_index) { |v,j| q.text v.inspect.rjust(longest[j]) }\n end\n end\n end\n end\n end\n else # dim 2\n q.group(0, \"\\n[\\n \", \"]\") do\n self.each_row.with_index do |row, i|\n q.group(1, \" [\", \"]\\n\") do\n q.seplist(row.to_a, -> { q.text \", \" }, :each_with_index) do |v,j|\n q.text v.inspect.rjust(longest[j])\n end\n end\n q.breakable unless i + 1 == self.shape[0]\n end\n end\n end\n end\n end",
"def pretty_print(q = nil) #:nodoc:\n dim = @orientation == :row ? 1 : 0\n\n arr = (0...shape[dim]).inject(Array.new){ |a, i| a << self[i] }\n\n if q.nil?\n puts \"[\" + arr.join(\"\\n\") + \"]\"\n else\n q.group(1, \"\", \"\\n\") do\n q.seplist(arr, lambda { q.text \" \" }, :each) { |v| q.text v.to_s }\n end\n end\n end",
"def print_board\n if @board.nil?\n puts \"Board not initialized\"\n elsif @board.respond_to?(\"each\")\n @board.each do |row|\n row.each do |cell|\n print \"#{cell} \"\n end\n puts \"\\n\"\n end\n end\n puts \"\\n\"\n end",
"def print_board\n for num in 0..4 do\n print \" \" + @top_row[num].to_s + \" \"\n end\n puts \"\"\n for num in 0..4 do\n puts \"#{@left_column[num].to_s} #{@board[num]}\"\n end\nend",
"def puts2DArray(my2DArray)\r\n puts '['\r\n my2DArray.each do |row|\r\n puts \"[#{row.join(\", \\t\")}]\"\r\n end\r\n puts ']'\r\n end",
"def to_s\n aux = \"\"\n for i in 0...@f\n for j in 0...@c\n\tif((!@matriz[i].nil?) && (!@matriz[i][j].nil?))\n\t aux = aux + @matriz[i][j].to_s + \"\\t\"\n\telse\n\t aux = aux + \"0\\t\"\n\tend\n end\n aux = aux + \"\\n\"\n end\n aux\n end",
"def display\n\t\tputs \"\\n\"\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |col|\n\t\t\t\tprint \" \" + @board[row][col].to_s + \" \"\n\t\t\t\tprint \"|\" unless col == 2\n\t\t\tend\n\t\t\tputs row == 2 ? \"\\n\\n\" : \"\\n-----------\\n\"\n\t\tend\n\tend",
"def to_s\n for i in 0..@max_row - 1\n for j in 0..@max_column - 1\n print \"| \" + @board[i][j] + \" \"\n end\n\n puts \"|\"\n end\n end",
"def print_board\n col_numbers = [' ']\n (1..8).each do |row|\n row_items = []\n\n col_numbers << ' ' + row.to_s + ' '\n row_items << row\n \n (1..8).each do |col|\n row_items << @board[[row,col]].console_rep\n end\n\n puts row_items.join(' ')\n end\n puts col_numbers.join(' ')\n end",
"def print_board\n\t\tputs \"**********************************\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"| Actual board |\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"**********************************\"\n\t\t@board.each_index do |i|\n\t\t\t@board[i].each_index do |y|\n\t\t\t\tif y == 0\n\t\t\t\t\tprint 8 - i\n\t\t\t\tend\n\n\t\t\t\tif @board[i][y] == nil\n\t\t\t\t\tprint \"#{@board[i][y]} --\"\n\t\t\t\telse\n\t\t\t\t\tprint \" #{@board[i][y].piecename}\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tputs \"\\n\"\n\t\tend\n\t\tputs \" a b c d e f g h\"\n\t\tputs \"\\n\\n\\n\\n\"\n\tend",
"def print_state\n @@rows.times do |row|\n @@columns.times do |column|\n print '%4.4s' % @state_array[row * @@columns + column].to_s,\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def print_output()\n\t#print \"$array= \\n\"\n\t$array.each { |i| i.each {\n\t\t\t\t\t |j|\n\t\t\t\t\t case j\n\t\t\t\t\t when 4\n\t\t\t\t\t \tprint \"•\"\n\t\t\t\t\t when 3\n\t\t\t\t\t \tprint \"x\"\n\t\t\t\t\t when 2\n\t\t\t\t\t \tprint \"*\"\n\t\t\t\t\t when 1\n\t\t\t\t\t \tprint \"█\"\n\t\t\t\t\t when 0\n\t\t\t\t\t \tprint \" \"\n\t\t\t\t\t end }\n\t\t\t\t print \"\\n\"}\nend",
"def printMultiplicationTable(numArray)\n puts \"\\nPrime numbers multiplication table\"\n \n # Printing beautified first row with initial margin\n firstRow = \" \"\n numArray.each do |i|\n firstRow += alignTabularValue(i.to_s) + \" | \"\n end\n \n puts firstRow\n \n numArray.each do |i|\n printString = alignTabularValue(i.to_s) + ' | '\n numArray.each do |ii|\n result = (i * ii).to_s\n \n printString += alignTabularValue(result) + ' | '\n end\n puts printString\n end\n \n puts \"\\n\"\n end",
"def dump(vt, to: $stderr)\n to.puts \" .\" + ('-' * (vt.cols)) + \".\"\n (1 .. vt.rows).each do |row|\n to.puts \" |#{vt.row_plaintext(row)}|\"\n end\n to.puts \" '\" + ('-' * (vt.cols)) + \"'\"\nend",
"def print_maze(maze)\n $debug ? maze.each { |row| row.each { |col| print col.to_s.ljust(3)};puts} : maze.each { |row| row.each { |col| print col.to_s};puts}\nend",
"def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr.each_index do |x|\n result += '%3d:'%x\n if @arr[x]\n @arr[x].each do |val|\n result += val.nil? ? ' ' : '%3d'%val\n end\n end\n result += \"\\n\"\n end\n result\n end",
"def print_board\n\t\tprint \"\\n\"\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |column|\n\t\t\t\tprint @board[row][column]\n\t\t\t\tprint \" | \" unless column == 2\n\t\t\tend\n\t\t\t\n\t\t\tprint \"\\n---------\\n\" unless row == 2\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend",
"def output\r\n\t\t@image.each do |row|\r\n\t\t\trow.each do |pixel|\r\n\t\t\t\tprint pixel\r\n\t\t\tend\r\n\t\t\tputs\r\n\t\tend\r\n\tend",
"def to_s\n\t\t@tam_alto.times do |i|\n\t\t\t@tam_ancho.times do |j|\n\t\t\t\tprint @plano[i][j].to_s + \" \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\tend",
"def print_maze\n\t\tcount = 1\n\t\t@maze.each do |x|\n\t\t\tputs x.to_s\n\t\tend\n\tend",
"def print_board\n puts \"\\n[#{@spaces[1]}][#{@spaces[2]}][#{@spaces[3]}]\\n[#{@spaces[4]}][#{@spaces[5]}][#{@spaces[6]}]\\n[#{@spaces[7]}][#{@spaces[8]}][#{@spaces[9]}]\\n\\n\"\n end",
"def latex_matrix(matrix)\n output = \"\\\\begin{tabular}{|#{'r|' * matrix.first.length}}\\n\"\n output << \"\\\\hline\\n\"\n output << matrix.map { |line| line.join(' & ') }.join(\"\\\\\\\\\\n\\\\hline\\n\")\n output << \"\\\\\\\\\\n\"\n output << \"\\\\hline\\n\"\n output << \"\\\\end{tabular}\\n\"\n output\nend",
"def visualize_array\n(0...ROWS).each { |row|\n (0...COLS).each { |col|\n print row.to_s + \" \" + col.to_s + \" \"\n print \"(\" + (COLS*row + col).to_s + \") \" # index into board array\n }\n puts\n}\nend",
"def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def show_board\n \t@y.times do |y|\n \t\tputs ' '\n \t\t@x.times do |x|\n \t\t\tprint \"#{@board[y][x]} \"\n \t\tend\n \tend \n \tputs ' '\n end"
] | [
"0.8553344",
"0.7839165",
"0.7765039",
"0.7291293",
"0.72614694",
"0.71777624",
"0.7100341",
"0.70865875",
"0.70570606",
"0.69582385",
"0.6939778",
"0.693125",
"0.6866958",
"0.67701817",
"0.67550945",
"0.6732928",
"0.67040026",
"0.66058517",
"0.6577692",
"0.6567373",
"0.6557512",
"0.6527479",
"0.6514536",
"0.6504038",
"0.6493956",
"0.64777917",
"0.6406566",
"0.6386605",
"0.638109",
"0.63748837",
"0.6362423",
"0.6345034",
"0.6344099",
"0.6344061",
"0.6342235",
"0.632391",
"0.6302101",
"0.6300404",
"0.62947375",
"0.628915",
"0.6281756",
"0.6273991",
"0.6268573",
"0.62576926",
"0.62494594",
"0.62449574",
"0.62394947",
"0.62299544",
"0.6229406",
"0.62263304",
"0.622432",
"0.6216692",
"0.6213326",
"0.6213326",
"0.6213326",
"0.6213326",
"0.6213326",
"0.6213326",
"0.6188837",
"0.6187488",
"0.617681",
"0.61747915",
"0.61653465",
"0.61638474",
"0.6156624",
"0.6150445",
"0.61477774",
"0.6139059",
"0.6136038",
"0.6128042",
"0.6114628",
"0.6113549",
"0.6110704",
"0.6108542",
"0.60989636",
"0.60911494",
"0.6090006",
"0.60890335",
"0.6073419",
"0.6054166",
"0.60426277",
"0.60389453",
"0.6033876",
"0.60327464",
"0.60292697",
"0.6017858",
"0.60123914",
"0.60082155",
"0.6007331",
"0.600576",
"0.5999258",
"0.59981704",
"0.599387",
"0.59851146",
"0.59734774",
"0.59729666",
"0.59701383",
"0.59563553",
"0.59559363",
"0.5954685"
] | 0.8034365 | 1 |
Modify this selected driver using a new helper method in Driver: Add the new trip to the collection of trips for that Driver Set the driver's status to :UNAVAILABLE | def update_status(new_status)
raise ArgumentError.new"Invalid Status" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE
@status = new_status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver_helper(new_trip)\n # ... adds the newly requested trip to the collection of trips for that driver\n @trips << new_trip\n # ... and sets the driver's status to :UNAVAILABLE\n @status = :UNAVAILABLE\n end",
"def add_new_trip(trip)\n self.status = :UNAVAILABLE\n add_trip(trip)\n end",
"def request_trip\n request_trip_params = {\n date: Date.today,\n rating: rand(1..5),\n cost: rand(1..100),\n passenger_id: params[:passenger_id],\n driver_id: Driver.where(available: true).first.id,\n }\n #create the trip\n a_trip = Trip.new(request_trip_params)\n if a_trip.save\n #update status of driver\n driver_id = a_trip.driver_id\n a_trip.driver.available = false\n a_trip.driver.save\n redirect_to trip_path(a_trip.id) \n return\n else \n render :new \n return\n end\n end",
"def trip_complete\n @trip = Trip.find_by(id: params[:id])\n @driver = Driver.find_by(id: @trip.driver_id)\n if trip_params[:rating] != nil\n @driver[:available] = true\n @driver.save\n end\n end",
"def add_driven_trip(trip)\n @driven_trips << trip\n end",
"def add_driven_trip(trip)\n if trip.class != Trip\n raise ArgumentError, \"A Trip was not provided\"\n end\n @driven_trips.each do |item|\n if item == trip\n raise ArgumentError, \"Duplicated trip\"\n end\n end\n @driven_trips << trip\n end",
"def create_trip trip, driver_name\n\t\tif @drivers.has_key? driver_name\t\t\t\n\t\t\t@drivers[driver_name].add_trip trip\n\t\telse\n\t\t\tputs \"No driver #{driver_name} registered, created a new driver\"\n\t\t\tdriver = self.create_driver driver_name\n\t\t\tdriver.add_trip trip\n\t\tend\t\n\tend",
"def set_driver_trip_seat\n @driver_trip_seat = DriverTripSeat.find(params[:id])\n end",
"def personal_trips\n @personal_trips = trips.where(driver_id: 0)\n end",
"def add_trip(trip)\n if trip.class != Trip\n raise ArgumentError.new(\"Can only add trip instance to trip collection\")\n end\n @trips << trip\n end",
"def add_trip(trip)\n if trip.class != Trip\n raise ArgumentError, \"A Trip was not provided\"\n end\n @trips.each do |item|\n if item == trip\n raise ArgumentError, \"Duplicated trip\"\n end\n end\n @trips << trip\n end",
"def request_trip(passenger_id)\n dispatch_driver = find_available_drivers\n if dispatch_driver.length == 0\n raise ArgumentError.new(\"No available drivers\")\n end\n trip = Trip.new(\n id: @trips.last.id + 1,\n passenger: find_passenger(passenger_id),\n passenger_id: passenger_id,\n start_time: Time.now,\n end_time: nil,\n cost: nil,\n rating: nil,\n driver: dispatch_driver[0],\n driver_id: dispatch_driver[0].id,\n )\n dispatch_driver[0].add_trip(trip)\n dispatch_driver[0].status = :UNAVAILABLE\n trip.passenger.add_trip(trip)\n @trips << trip\n trip.connect(trip.passenger)\n trip.connect_driver(dispatch_driver[0])\n return trip\n end",
"def set_trip\n @trip = Trip.find(params['id'])\n end",
"def select\n self.trip.update(selected_itinerary: self)\n end",
"def set_trip\n @leg = trip.find(params[:id])\n end",
"def trips\n Trip.find_for_driver(@driver_id)\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find_by(id: params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\r\n @trip = Trip.find(params[:id])\r\n end",
"def plan\n super\n @trip.itineraries\n .find_by(trip_type: @outbound_trip_type, service: @outbound_service)\n .try(:select)\n @trip.save\n @trip\n end",
"def set_trip\n @trip = Trip.find(params[:trip_id])\n end",
"def set_trip\n @trip = Trip.find(params[:trip_id])\n end",
"def set_invoiced_trip\n @invoiced_trip = InvoicedTrip.find(params[:id])\n\n if @invoiced_trip.typeT == nil\n @truck = Truck.find(@invoiced_trip.truck_id)\n @driver = Driver.find(@invoiced_trip.DRIVER_id)\n @client = Client.find(@invoiced_trip.client_id)\n else\n\t@truck = @invoiced_trip.brand.to_s + \" \".to_s + @invoiced_trip.model.to_s + \" \".to_s + @invoiced_trip.vin.to_s\n @driver = \"\".to_s\n @client = Client.find(@invoiced_trip.client_id)\n end \n\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def connect(ride)\n rr = ride.becomes(RideRequest)\n time_distance = (rr.time - self.time).abs < 15.minutes\n if self.freeSeats > 0 && time_distance && self.direction == rr.direction && self.toCity == rr.toCity && self.fromCity == rr.fromCity && self.office_id == rr.office_id\n self.ride_requests << rr\n rr.status = 'active'\n self.status = 'active'\n self.decrement(:freeSeats)\n if rr.save && self.save\n true\n else\n false\n end\n else\n puts 'Cannot connect ride'\n puts \"free seats: #{self.freeSeats > 0}\"\n puts \"time distance: #{time_distance}\"\n puts \"direction: #{self.direction == rr.direction}\"\n puts \"to city: #{self.toCity == rr.toCity}\"\n puts \"from city: #{self.fromCity == rr.fromCity}\"\n puts \"office: #{self.office_id == rr.office_id}\"\n false\n end\n end",
"def request_trip(passenger_id)\n driver = find_available_driver\n passenger = find_passenger(passenger_id)\n\n if passenger.id == driver.id\n raise ArgumentError.new\n end\n\n input = {\n id: @trips.length + 1,\n passenger: passenger,\n start_time: Time.now.to_s,\n end_time: nil,\n cost: nil,\n rating: nil,\n driver: driver,\n }\n trip = Trip.new(input)\n\n driver.accept_trip(trip)\n find_passenger(passenger_id).add_trip(trip)\n @trips << trip\n return trip\n end",
"def update\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n if @trip_driver.update_attributes(trip_driver_params)\n format.html { redirect_to @trip_driver, notice: 'Trip driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip_driver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t# Check that the current user has not requested more than 3 trips, \n\t\t# That the user has not already requested this trip\n\t\t# and that the trip has available spaces and that the driver is not the requestor\n\t\tif current_user.trips_requested.size <= 5 && \n\t\t\t!(@trip.user_requests.include?(current_user._id)) && @trip.spaces > 0 && @trip.driver != current_user.id.to_s && !(current_user.trips_accepted.include?(@trip.id))\n\n\t\t\t@trip.user_requests << current_user._id\n\t\t\tcurrent_user.trips_requested << @trip._id.to_s\n\t\t\tcurrent_user.save!\n\t\t\t@trip.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\t# Error handling\n\t\t\tif current_user.trips_requested.size > 5\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'This user has requested too many requests!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.user_requests.include?(current_user._id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You have already requested this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.spaces <= 0\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There is no more space in this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.driver == current_user.id.to_s\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot request your own trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif current_user.trips_accepted.include?(@trip.id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"You've already been accepted on this trip!\"\n\t\t\t\t}, status: 422\n\t\t\telse\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'Something went wrong...'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend",
"def create_trip(trip_proxy)\n\n trip = Trip.new()\n trip.creator = current_or_guest_user\n trip.user = @traveler\n trip.trip_purpose = TripPurpose.find(trip_proxy.trip_purpose_id)\n\n # get the start for this trip\n from_place = TripPlace.new()\n from_place.sequence = 0\n place = get_preselected_place(trip_proxy.from_place_selected_type, trip_proxy.from_place_selected.to_i, true)\n if place[:poi_id]\n from_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n from_place.place = @traveler.places.find(place[:place_id])\n else\n from_place.raw_address = place[:address]\n from_place.lat = place[:lat]\n from_place.lon = place[:lon] \n end\n\n # get the end for this trip\n to_place = TripPlace.new()\n to_place.sequence = 1\n place = get_preselected_place(trip_proxy.to_place_selected_type, trip_proxy.to_place_selected.to_i, false)\n if place[:poi_id]\n to_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n to_place.place = @traveler.places.find(place[:place_id])\n else\n to_place.raw_address = place[:address]\n to_place.lat = place[:lat]\n to_place.lon = place[:lon] \n end\n\n # add the places to the trip\n trip.trip_places << from_place\n trip.trip_places << to_place\n\n planned_trip = PlannedTrip.new\n planned_trip.trip = trip\n planned_trip.creator = trip.creator\n planned_trip.is_depart = trip_proxy.arrive_depart == 'departing at' ? true : false\n planned_trip.trip_datetime = trip_proxy.trip_datetime\n planned_trip.trip_status = TripStatus.find_by_name(TripStatus::STATUS_NEW) \n \n trip.planned_trips << planned_trip\n\n return trip\n end",
"def set_trip\n @trip = current_user.trips.find(params[:id])\n end",
"def set_regular_trip\n @regular_trip = RegularTrip.find(params[:id])\n end",
"def set_trip\n \t@trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:trip_id])\n end",
"def set_trip\n @trip = current_user.trips.find(params[:trip_id])\n end",
"def create\n @ride = Ride.new(driver_ride_params.merge(\n driver: current_user,\n created_by: current_user,\n notification_subscriptions: [RideNotificationSubscription.new(\n user: current_user,\n app: :driver\n )],\n ))\n\n respond_to do |format|\n if @ride.save\n format.html { redirect_to driver_ride_path(@ride),\n notice: 'Ride was successfully created.' }\n format.json { render :show, status: :created, location: @ride }\n else\n format.html { render :new }\n format.json { render json: @ride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def connect(passenger, driver)\n @passenger = passenger\n passenger.add_trip(self)\n @driver = driver\n driver.add_trip(self)\n end",
"def make_new_trip(new_trip_data)\n trip = Trip.new(new_trip_data)\n trip.driver.add_trip(trip)\n trip.passenger.add_trip(trip)\n return trip\n end",
"def set_trip\n @trip = current_user.trips.find(params[:id])\n end",
"def create_trip\n # Only attempt to create trip if all the necessary pieces are there\n return false unless @itinerary && @trip && @service && @user\n \n label = request_label(:book, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/create_trip\", \n :post,\n head: headers,\n body: body_for_booking(@booking_options).to_json\n ).response!(label)\n end",
"def trip_status\n label = request_label(:status, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/trip_status\", \n :get,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label) # Always make fresh calls for status\n end",
"def set_class_trip\n @class_trip = ClassTrip.find(params[:id])\n end",
"def set_trip\n @trip = params[:id].present? ? Trip.find(params[:id]) : Trip.where(featured: true).first\n end",
"def trip(trip_id)\n Trip.new(self, trip_id)\n end",
"def set_ride_driver\n @ride_driver = RideDriver.find(params[:id])\n end",
"def new_driver\n address = params[:newdriveraddress]\n\n coordinates = GoogleAPIGeocoder.do_geocode(address)\n\n if coordinates.nil?\n render json: {success: false, travellers: session[:travellers].to_json, msg: 'Unable to find the location of the given address for the new driver. Please check that it is correct.'}\n else\n driver = Driver.create(name: params[:newdrivername],\n email: params[:newdriveremail],\n address: address,\n number_of_passengers: params[:newdrivernumber_of_passengers],\n latitude: coordinates[0],\n longitude: coordinates[1])\n\n unless session[:travellers].nil?\n session[:travellers] << driver\n else\n travellers = []\n travellers << driver\n session[:travellers] = travellers\n end\n\n if current_user.nil? && !session[:trip].nil?\n session[:trip].travellers << driver\n end\n\n render json: session[:travellers].to_json\n end\n end",
"def set_trip_type\n @trip_type = TripType.find(params[:id])\n end",
"def create\n @trip_driver = TripDriver.new(trip_driver_params)\n\n respond_to do |format|\n if @trip_driver.save\n format.html { redirect_to @trip_driver, notice: 'Trip driver was successfully created.' }\n format.json { render json: @trip_driver, status: :created, location: @trip_driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_driver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_trip\n id = params[:id] || params[:trip_id]\n @readonly = false\n\n if id !~ /[[:alnum:]]{10}/\n @trip = Trip.find(id)\n @trip.readonly!\n @readonly = true\n else\n @trip = Trip.find_by_slug(id)\n end\n end",
"def expand\n return false if legs.length < 2\n \n trip = device.trips.create\n trip.legs << legs.last\n trip.tags = self.tags\n trip.update_precalc_fields\n \n self.legs.reload\n self.update_precalc_fields\n \n trip\n end",
"def set_trip_route\n @trip_route = TripRoute.find(params[:id])\n end",
"def set_trip_request\n @trip_request = TripRequest.find_by_token!(params[:id])\n end",
"def create\n @trip = Trip.new(params[:trip])\n\t@trip.seat = params[:trip][:seat].to_i + 1\n\t\n\tif params[:trip][:on_demand] == 'Passager'\n\t\t@trip.on_demand = true\n\t\t@trip.driver = nil\n\telse\n\t\t@trip.on_demand = false\n\t\t@trip.driver = current_user\n\tend\n respond_to do |format|\n if @trip.save\n\t\t @trip.users << current_user\n\t\t @trip.save\n format.html { redirect_to(@trip, :notice => 'Le trajet à correctement été enregistré') }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@new_trip = Trip.new\n\tend",
"def trips \n trips_taken = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def return_scenario(id)\n\n rtb = ResourceTransportationBooking.find(id)\n agency_store = AgencyStore.find(rtb.agency_store_id) \n driver = Driver.find(agency_store.driver_id)\n\n if rtb.driver_id != agency_store.driver_id\n new_agency_store = AgencyStore.find_by_driver_id(rtb.driver_id)\n new_driver = Driver.find(new_agency_store.driver_id)\n new_driver.update_attribute(:already_assigned,false)\n new_agency_store.update_attribute(:booked,false) \n end\n\n # vehicle = Vehicle.find(agency_store.resource_id)\n # if vehicle.alternate_driver_assigned?\n # driver = Driver.find(vehicle.alternate_driver_id)\n # vehicle.update_attributes(:alternate_driver_assigned=>false,:alternate_driver_id=>nil)\n # else\n # driver = Driver.find(vehicle.driver_id)\n # end\n driver.update_attribute(:already_assigned,false)\n agency_store.update_attribute(:booked,false)\n rtb.update_attributes(:status=>'Returned',:request_returned_date=>Time.now)\n \n #driver.update_attribute(:already_assigned,false)\n\n disable_the_sub_category_when_that_sub_category_is_fully_reserved(agency_store.sub_category_id)\n end",
"def cancel_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip.driver === current_user.id\n\t\t\tcurrent_user.trips_driving.delete(trip_params[:trip_id])\n\t\t\t@trip.accepted_users.each do |user_index|\n\t\t\t\t@accepted_user = User.find_by(_id: user_index)\n\t\t\t\t@accepted_user.trips_accepted.delete(trip_params[:trip_id])\n\t\t\t\t@accepted_user.save!\n\t\t\t\tUserMailer.cancelled_trip(@accepted_user).deliver_now\n\t\t\tend\n\t\t\t@trip.user_requests.each do |user_index|\n\t\t\t\t@requested_user = User.find_by(_id: user_index)\n\t\t\t\t@requested_user.trips_requested.delete(trip_params[:trip_id])\n\t\t\t\t@requested_user.save!\n\t\t\tend\n\t\t\t@trip.destroy\n\t\t\tcurrent_user.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tdriver: current_user\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'Access Denied! The user is not the driver of this trip!'\n\t\t\t}, status: 422\n\t\tend\n\n\tend",
"def trips\n @trips = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.end_point = Station.find_by(uid: params[:station_id])\n render json: @trip.attributes.merge(station: @trip.end_point.attributes), location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end",
"def set_trip_point\n @trip_point = TripPoint.find(params[:id])\n end",
"def allocateViaPoints(simulator)\n _pickUpViaPoint = ViaPoint.new(@tripPos.pickUp, self, :pickUp,\n @tripGapDuration.pickUp, simulator,\n { :poiColor => @tripPoiColor.pickUp }) ;\n _dropOffViaPoint = ViaPoint.new(@tripPos.dropOff, self, :dropOff,\n @tripGapDuration.dropOff, simulator,\n { :poiColor => @tripPoiColor.dropOff }) ;\n \n @tripViaPoint = Trip.new(_pickUpViaPoint, _dropOffViaPoint) ;\n \n return self ;\n end",
"def set_land_trip\n @land_trip = LandTrip.find_by(user_id: current_user.id)\n end",
"def initialize(outbound_trip, return_trip_attrs={}, options={})\n @outbound_trip = outbound_trip\n @outbound_trip_type = @outbound_trip.trip_type\n @outbound_service = @outbound_trip.selected_service\n return_trip = @outbound_trip.build_return_trip(return_trip_attrs)\n\n # JTA does not want to link trips together.\n if @outbound_service.booking_api == \"trapeze\"\n return_trip.previous_trip = nil \n end \n\n return_trip_opts = {\n trip_types: [@outbound_trip_type].compact,\n available_services: Service.where(id: @outbound_service.try(:id))\n }.merge(options)\n super(return_trip, return_trip_opts)\n end",
"def persist_trip_info(params)\n return if (!self.wtg_for_trip_confirmation? && !self.wtg_for_inventory?) || params.blank? \n if params.present? \n params.each do |ti_attrs|\n if ti_attrs[:trip_type].present? && ti_attrs[:trip_type][:code] == \"P\" && ti_attrs[:trip_distance].present?\n TripInfo.persist_trip_info(params, self)\n # Because TripInfo updated the timestamp of self so we need to inform parent object\n # This is bad practice but the only solution with the current implementation\n self.updated_at = Vehicle.find(self.id).updated_at\n yard_facilities = YardFacility.for_yard_facility(self.yard.id,self.pickup_location_id);\n if !yard_facilities.empty?\n yard_facilities[0].update_attributes(:distance => ti_attrs[:trip_distance] )\n else\n yard_facility = YardFacility.new(yard_id: self.yard_id, facility_id: self.pickup_location_id, distance: ti_attrs[:trip_distance])\n yard_facility.save\n end\n break\n end\n end\n end\n end",
"def update\n\n @trip = Trip.find(current_trip(current_user))\n\n #出车人员改动\n if params[:workers_ids_] and params[:workers_ids_].size > 0\n #修改出车人员\n origin_workers_ids = @trip.workers_ids.split(',')\n param_workers_ids = params[:workers_ids_].clone\n @trip.workers_ids = param_workers_ids.join(',')\n #删除被删除的工作人员\n origin_workers_ids.each { |owi|\n if param_workers_ids.index(owi).nil?\n worker = Worker.find(owi)\n trip_user_delete(worker)\n @trip.workers.delete(worker)\n else\n param_workers_ids.delete(owi)\n end\n }\n #增加被添加的工作人员\n param_workers_ids.each { |wi|\n worker = Worker.find(wi)\n @trip.workers << worker\n #冲突\n if @trip.ing\n if in_trip?(worker)\n @trip.workers.delete(worker)\n @trip.errors.add(:workers, \"就在刚才,你选的工作人员被别人选了,概率很小哦~ 囧~~~ 选其它人吧。\")\n else\n trip_user_add(@trip, worker)\n end\n end\n }\n end\n\n #其它改动\n @trip.destination_id = params[:destination_id]\n @trip.departure_time = params[:departure_time]\n @trip.back_time = params[:back_time]\n @trip.note_id = params[:note_id]\n @trip.workers_names = @trip.generate_workers_names\n\n\n respond_to do |format|\n format.html do\n if params[:workers_ids_] and params[:workers_ids_].size > 0 and @trip.errors.empty? and @trip.save\n #submit为保存修改\n flash[:success] = \"修改已保存!\"\n sign_in(current_user)\n redirect_to '/workers/tour'\n else\n @cars = Car.where(\"current_trip = ? OR current_trip = ?\", @trip.id, 0).order(\"model\").all\n @drivers = Driver.where(\"current_trip = ? OR current_trip = ?\", @trip.id, 0).order(\"group_id\").all\n @drivership = @trip.drivership\n @selected_key = @trip.workers_ids.split(\",\")\n @in_trip_users_ids = in_trip_users(@trip)\n @trip.errors.add(:workers, \"工作人员不能为空\") unless params[:workers_ids_] and params[:workers_ids_].size > 0\n\n sign_in(current_user)\n render '/workers/status/tour'\n end\n end\n format.js\n end\n end",
"def get_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def update\n @test_ride = TestRide.find(params[:id])\n @control = BookingTimeControl.book_time_control_method(params)\n\n if @control == true\n if @test_ride.update(test_ride_params)\n render json: @test_ride, status: :ok\n\n # Send Notification & Email\n @test_ride.delay.test_ride_booking_notification(I18n.t('Notification.test_ride_updated'), I18n.t('Email.test_ride_booking_update_dealer'), I18n.t('Email.test_ride_booking_update_user'), params)\n else\n render json: @test_ride.errors, status: :unprocessable_entity\n end\n else\n render json: @control\n end\n end",
"def new\n @trip = Trip.new\n @trip.depart_time = Time.at(0)\n @trip.arrive_time = Time.at(0)\n @trip.return_time = Time.at(0)\n end",
"def create\n @trip = Trip.new(trip_params)\n\n # Retrieve the trip travellers from the session.\n travellers = session[:travellers]\n if travellers != nil\n travellers.each do |t|\n @trip.travellers << t\n end\n end\n\n destination_coordinates = GoogleAPIGeocoder.do_geocode(@trip.destination_address)\n\n if destination_coordinates.nil?\n @trip.delete\n redirect_to trip_plan_path, :alert => 'Invalid destination'\n end\n\n # Update the trip destination coordinates.\n @trip.update(destination_latitude: destination_coordinates[0])\n @trip.update(destination_longitude: destination_coordinates[1])\n\n\n if current_user != nil\n @trip.user_id = current_user.id\n @trip.save\n redirect_to edit_trip_plan_path(@trip)\n else\n session[:trip] = @trip\n redirect_to trip_plans_guest_edit_path\n end\n end",
"def trip_params\n params.require(:trip).permit(\n :user_id, :driver_id, :departure, :available_seats, :start_location,\n :end_location, :connection?, :transit, :cost\n )\n end",
"def ride_driver_params\n params.require(:trip_driver).permit(:user_id, :ride_id)\n end",
"def cancel_trip\n trip_duration = 20 # sets local variable\n self.trip_duration = 30 # uses the accessor to set the class variable\n end",
"def trip_params\n params.require(:trip).permit(:driver_id, :source_id, :destination_id, :departure_time, :seats, :users)\n end",
"def new_trip(operator, trip)\n @trip = trip\n @operator = operator\n @emails = Organisation.get_all_emails(trip.organisation)\n mail(\n to: @emails,\n subject: 'JetSetGo - New Trip created'\n )\n end",
"def set_guide_trip\n @guide_trip = GuideTrip.find(params[:id])\n end"
] | [
"0.85093874",
"0.7430142",
"0.6868667",
"0.64329904",
"0.6225026",
"0.6041754",
"0.5967702",
"0.5719129",
"0.55887836",
"0.5518418",
"0.5495147",
"0.5457348",
"0.5443099",
"0.5440385",
"0.541422",
"0.5326216",
"0.5322127",
"0.5311161",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.52699053",
"0.5269782",
"0.5243326",
"0.52210724",
"0.52190393",
"0.52190393",
"0.5204666",
"0.5175563",
"0.5175563",
"0.5175563",
"0.5170078",
"0.51636803",
"0.5148885",
"0.51346856",
"0.51277333",
"0.5125047",
"0.5116455",
"0.5103906",
"0.5086408",
"0.5067696",
"0.5049574",
"0.5042125",
"0.5008296",
"0.4989345",
"0.49892813",
"0.49891698",
"0.49783033",
"0.4957395",
"0.49566448",
"0.49556467",
"0.49545872",
"0.49540696",
"0.49486625",
"0.4904632",
"0.4898597",
"0.4891555",
"0.48855168",
"0.48511878",
"0.4848703",
"0.4842704",
"0.48202208",
"0.4812946",
"0.48035693",
"0.48007327",
"0.47990796",
"0.47779265",
"0.47424194",
"0.47333366",
"0.47177452",
"0.47034755",
"0.4694972",
"0.46907622",
"0.46893716",
"0.46840614",
"0.46822518",
"0.4677603",
"0.4677311",
"0.46666387",
"0.46618506",
"0.4657105"
] | 0.0 | -1 |
, only: [ :destroy, :edit, :update ] | def index
@keys = ApiKey.where(user_id: current_user.id).order(id: :desc).page params[:page] # kaminari
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit \n end",
"def edit \n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] | [
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7332429",
"0.7236012",
"0.7236012",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508",
"0.7197508"
] | 0.0 | -1 |
should use strategy pattern via ServiceObject and super | def property_conversation property, account
# super
unless valid_conversation_target? account
raise ArgumentError, "Account must be a tenant or system account, was: #{account}"
end
conversations_about(property).find_for(account).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service; raise NotImplementedError; end",
"def service\n raise \"Abstract method service in ModelBase was called\"\n end",
"def service; end",
"def strategy; end",
"def across_service_state\n super\n end",
"def create\n super(@@service)\n end",
"def service\n abstract_method_error\n end",
"def bi_service\n end",
"def factory_strategy; end",
"def method_missing(method_sym, *arguments, &block)\n if self.class.service_class(method_sym)\n # load service from cache if available\n service = instance_variable_get(\"@#{method_sym}\")\n return service if service\n\n service = self.class.service(method_sym, @api_client)\n service.service_manager = self\n instance_variable_set(\"@#{method_sym}\", service)\n else\n super\n end\n end",
"def service_request(service); end",
"def keyword_based_service?; end",
"def service_name\n raise \"please implement #service_name in your subclass #{self.class}\"\n end",
"def services\n\n end",
"def implementation; end",
"def implementation; end",
"def service\n @service ||= service_class.new(self, assessment: @assessment, submission: @submission)\n end",
"def initialize(service)\n @service = service\n end",
"def postage_service\n super || PostageService.default\n end",
"def initialize (service_name, application_context)\n super\n end",
"def services\n end",
"def method_missing(method_sym, *arguments, &block)\n # ignore classes\n return true if method_sym == :klass\n\n # load service from cache if available\n service = instance_variable_get(\"@#{method_sym.to_s}\")\n\n # service is not cached yet -> first request\n unless service\n # create a Core::ServiceLayer::Service\n current_user_identity_url = @current_user.service_url('identity', {region: @region, interface: 'public'}) rescue nil\n params = {\n auth_url: Core.keystone_auth_endpoint(current_user_identity_url),\n region: @region,\n }\n if @current_user\n params[:token] = @current_user.token\n params[:domain_id] = @current_user.domain_id\n params[:project_id] = @current_user.project_id\n end\n\n service = self.class.service(method_sym,params)\n service.services=self\n service.current_user = @current_user\n service.service_user = @service_user\n # new service is instantiated -> cache it for further use in the same controller request.\n instance_variable_set(\"@#{method_sym.to_s}\", service)\n end\n\n return service\n end",
"def service\n StockManagementService.new\n end",
"def service\n @service\n end",
"def object\n raise NotImplementedError\n end",
"def method_missing(method_sym, *arguments, &block)\n # ignore classes\n return true if method_sym == :klass\n \n # load service from cache if available\n service = instance_variable_get(\"@#{method_sym.to_s}\")\n \n # service is not cached yet -> first request\n unless service \n # construct the class name of requested service.\n # For example Openstack::IdentityService.\n # Services must be located in app/services/openstack\n service_class_name = \"Openstack::#{method_sym.to_s.classify}Service\"\n \n # load service class\n klazz = begin\n eval(service_class_name)\n rescue\n raise \"service #{service_class_name} not found!\"\n end\n\n # service must extend OpenstackServiceProvider::BaseProvider, see below.\n unless klazz < OpenstackServiceProvider::BaseProvider\n raise \"service #{service_class_name} is not a subclass of OpenstackServiceProvider::BaseProvider\" \n end\n\n service = klazz.new(@endpoint,@region,@current_user)\n # new service is instantiated -> cache it for further use in the same controller request.\n instance_variable_set(\"@#{method_sym.to_s}\", service)\n end\n \n return service\n end",
"def service; services.first; end",
"def proxy\n super\n end",
"def initialize\n super\n @strategy = :user\n end",
"def set_service\n @service = Service.find(params[:id])\n @service = @service.becomes(@service.type.constantize) if @service.valid?\n @service.current_request = request\n end",
"def strategy=(_arg0); end",
"def call\n # implement in subclasses\n end",
"def on_db_service(context, service)\n\tend",
"def api_service(service, **opt)\n opt[:user] = current_user unless opt.key?(:user)\n service = service.class unless service.is_a?(Class)\n service.instance(**opt)\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError\n end",
"def subject\n raise \"Override #subject in the service class\"\n end",
"def response_from_service\n\n end",
"def __getobj__\n raise \"Abstract class requires implementation\"\n end",
"def provider; end",
"def services\n\tend",
"def as_service\n @service ||= (plan.find_plan_service(self) || PlanService.new(self))\n end",
"def as_service\n @service ||= (plan.find_plan_service(self) || PlanService.new(self))\n end",
"def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end",
"def use(*)\n super\n end",
"def initialize\n @services = {}\n end",
"def run\n raise NotImplementedError, 'Services must implement #run'\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def provide\n raise NotImplementedError\n end",
"def method_missing( sym, *args, &block )\n if args.empty? && block.nil? && @registry[:services].has_key?( sym )\n return @registry[:services][ sym ]\n else\n super\n end\n end",
"def invoke\n raise NotImplementedError, \"Author of subclass forgot to implement #invoke\"\n end",
"def decorated_object_behavior\n #code\n end",
"def associate_to_service\n ThreeScale::Deprecation.silence do\n if parent\n self.service = parent.service\n elsif owner.is_a? Service\n self.service = owner\n end\n end\n end",
"def delegate_object_reader_method; end",
"def delegate_object; end",
"def service(nickname, reserved, distribution, type)\n end",
"def init_service (service_name, service_class)\n\n if service_name\n #\n # if there is a service previously registered under the same name,\n # make sure to stop before it gets 'overriden' in the\n # application context\n\n s = @application_context[service_name]\n s.stop if s.respond_to?(:stop)\n end\n\n s = service_class.new(service_name, @application_context)\n\n unless service_name\n #\n # making sure to register the service. service#new doesn't\n # register when there is no service_name\n\n s.service_name = \"#{service_class.name}::#{s.object_id}\"\n @application_context[s.service_name.to_s] = s\n end\n\n s\n end",
"def service\n return @service\n end",
"def call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError,\n \"Override #call and implement your application logic.\"\n end",
"def service_name; end",
"def bind_method(service_ref, controller, method_name, desc)\n method_key = method_name.to_s.underscore.to_sym\n controller_name = controller.name\n service_ref.class_eval do\n if desc.request_response?\n define_method(method_key) do |message, active_call|\n Gruf::Autoloaders.controllers.with_fresh_controller(controller_name) do |fresh_controller|\n c = fresh_controller.new(\n method_key: method_key,\n service: service_ref,\n message: message,\n active_call: active_call,\n rpc_desc: desc\n )\n c.call(method_key)\n end\n end\n elsif desc.client_streamer?\n define_method(method_key) do |active_call|\n Gruf::Autoloaders.controllers.with_fresh_controller(controller_name) do |fresh_controller|\n c = fresh_controller.new(\n method_key: method_key,\n service: service_ref,\n message: proc { |&block| active_call.each_remote_read(&block) },\n active_call: active_call,\n rpc_desc: desc\n )\n c.call(method_key)\n end\n end\n elsif desc.server_streamer?\n define_method(method_key) do |message, active_call, &block|\n Gruf::Autoloaders.controllers.with_fresh_controller(controller_name) do |fresh_controller|\n c = fresh_controller.new(\n method_key: method_key,\n service: service_ref,\n message: message,\n active_call: active_call,\n rpc_desc: desc\n )\n c.call(method_key, &block)\n end\n end\n else # bidi\n define_method(method_key) do |messages, active_call, &block|\n Gruf::Autoloaders.controllers.with_fresh_controller(controller_name) do |fresh_controller|\n c = fresh_controller.new(\n method_key: method_key,\n service: service_ref,\n message: messages,\n active_call: active_call,\n rpc_desc: desc\n )\n c.call(method_key, &block)\n end\n end\n end\n end\n end",
"def delegate_to_service(method_name, *args)\n super.chomp\n end",
"def format_service\n\n end",
"def invoke\n begin \n # RequestStore.available_services[@amfbody.service_class_name] ||=\n @service = @amfbody.service_class_name.constantize.new #handle on service\n rescue Exception => e\n puts e.message\n puts e.backtrace\n raise RUBYAMFException.new(RUBYAMFException.UNDEFINED_OBJECT_REFERENCE_ERROR, \"There was an error loading the service class #{@amfbody.service_class_name}\")\n end\n \n #call one or the other method depending in the ruby version we are using\n if RUBY_VERSION > RUBY_19\n caller = \"to_sym\"\n else\n caller = \"to_s\"\n end \n\n if @service.private_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.\")\n elsif !@service.public_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is not declared.\")\n end\n \n #clone the request and response and alter it for the target controller/method\n req = RequestStore.rails_request.clone\n res = RequestStore.rails_response.clone\n \n #change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n controller = @amfbody.service_class_name.gsub(\"Controller\",\"\").underscore\n action = @amfbody.service_method_name\n req.parameters['controller'] = req.request_parameters['controller'] = req.path_parameters['controller'] = controller\n req.parameters['action'] = req.request_parameters['action'] = req.path_parameters['action'] = action\n req.env['PATH_INFO'] = req.env['REQUEST_PATH'] = req.env['REQUEST_URI'] = \"#{controller}/#{action}\"\n req.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n \n #set conditional helper\n @service.is_amf = true\n @service.is_rubyamf = true\n \n #process the request\n rubyamf_params = @service.rubyamf_params = {}\n if @amfbody.value && !@amfbody.value.empty?\n @amfbody.value.each_with_index do |item,i|\n rubyamf_params[i] = item\n end\n end\n \n # put them by default into the parameter hash if they opt for it\n rubyamf_params.each{|k,v| req.parameters[k] = v} if ParameterMappings.always_add_to_params \n \n begin\n #One last update of the parameters hash, this will map custom mappings to the hash, and will override any conflicting from above\n ParameterMappings.update_request_parameters(@amfbody.service_class_name, @amfbody.service_method_name, req.parameters, rubyamf_params, @amfbody.value)\n rescue Exception => e\n raise RUBYAMFException.new(RUBYAMFException.PARAMETER_MAPPING_ERROR, \"There was an error with your parameter mappings: {#{e.message}}\")\n end\n\n #fosrias\n #@service.process(req, res)\n\n # call the controller action differently depending on Rails version\n if Rails::VERSION::MAJOR < 3\n @service.process(req, res)\n else\n @service.request = req\n @service.response = res\n @service.process(action.to_sym)\n end\n #fosrias\n \n #unset conditional helper\n @service.is_amf = false\n @service.is_rubyamf = false\n @service.rubyamf_params = rubyamf_params # add the rubyamf_args into the controller to be accessed\n \n result = RequestStore.render_amf_results\n \n #handle FaultObjects\n if result.class.to_s == 'FaultObject' #catch returned FaultObjects - use this check so we don't have to include the fault object module\n e = RUBYAMFException.new(result['code'], result['message'])\n e.payload = result['payload']\n raise e\n end\n \n #amf3\n @amfbody.results = result\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper[\"body\"] = result\n @amfbody.results = @wrapper\n end\n @amfbody.success! #set the success response uri flag (/onResult)\n end",
"def strategy=(s); end",
"def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end",
"def on_db_service(service)\n\tend",
"def method_missing(method, *args, &block) #:doc:\n super unless @wsdl.respond_to? method\n\n setup method, &block\n dispatch method\n end",
"def process_custom_method\n # da implementare per eventuali estensioni\n end",
"def initialize(strategy)\n @strategy = strategy\n end",
"def invoke\n\t\tbegin\n\t @service = Object.const_get(@amfbody.service_name).new #handle on service\n\t RequestStore.available_services[@amfbody.service_name] = @service\n\t\trescue LoadError => e\n\t\t\traise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"The file #{@amfbody.class_file_uri}#{@amfbody.class_file} was not loaded. Check to make sure it exists in: #{RequestStore.service_path}\")\n\t\trescue Exception => e\n\t\t raise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"There was an error loading file #{@amfbody.class_file_uri}#{@amfbody.class_file}.\")\n\t\tend\n\t\t\n\t\tif @service.private_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is declared as private, it must be defined as public to access it.\")\n\t\telsif !@service.public_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is not declared.\")\n\t\tend\n\t\t\t\t\n\t\t#clone the request and response and alter it for the target controller/method\n\t\treq = RequestStore.rails_request.clone\n\t\tres = RequestStore.rails_response.clone\n\t\t\n\t\t#change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n\t ct = @amfbody.target_uri.clone.split('Controller')[0].downcase\n\t sm = @amfbody.service_method_name\n\t\treq.parameters['controller'] = ct\n\t\treq.parameters['action'] = sm\n\t\treq.request_parameters['controller'] = ct\n\t\treq.request_parameters['action'] = sm\n\t\treq.request_parameters['amf'] = 'hello world'\n\t\treq.path_parameters['controller'] = ct\n\t\treq.path_parameters['action'] = ct\n\t\treq.env['PATH_INFO'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_PATH'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_URI'] = \"#{ct}/#{sm}\"\n\t\treq.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n\t\t\n\t\t#set conditional helper\n\t\t@service.is_amf = true\n\t\t@service.is_rubyamf = true\n \n #process the request\n\t\tif @amfbody.value.empty? || @amfbody.value.nil?\n\t\t @service.process(req,res)\n\t\telse\n\t\t @amfbody.value.each_with_index do |item,i|\t\t \n\t\t req.parameters[i] = item\n\t\t if item.class.superclass.to_s == 'ActiveRecord::Base'\n\t\t req.parameters[i] = item.original_vo_from_deserialization.to_hash\n if i < 1 #Only the first parameter will be \n req.parameters.merge!(item.original_vo_from_deserialization.to_hash) #merge in properties into the params hash\n #have to specifically check for id here, as it doesn't show up in any object members.\n if item.original_vo_from_deserialization.id != nil\n #This will override the above params[:id] attempt, because it's the original deserialized values.\n req.parameters[:id] = item.original_vo_from_deserialization.id\n end\n end\n\t req.parameters[item.class.to_s.downcase.to_sym] = item.original_vo_from_deserialization.to_hash\n\t \n\t\t elsif !item._explicitType.nil?\n\t\t t = item._explicitType\n\t\t if t.include?('.')\n\t\t t = t.split('.').last.downcase.to_s\n\t\t end\n \t\t req.parameters[t.to_sym] = item.to_hash\n \t\t if i < 1\n \t\t if item.class.to_s == 'Object' || item.class.to_s == 'OpenStruct'\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end\n \t\t \n \t\t elsif item.class.to_s == 'OpenStruct' || item.class.to_s == \"Object\"\n\t\t if i < 1\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end \t\t \n\t\t end\n end\n\t @service.process(req,res)\n end\n \n #unset conditional helper\n @service.is_amf = false\n\t\t@service.is_rubyamf = false\n \n\t\t#handle FaultObjects\n\t\tif @service.amf_content.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(@service.amf_content.code, @service.amf_content.message)\n\t\tend\n\t\t\n\t\t#amf3\n\t\t@amfbody.results = @service.amf_content\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper.body = @service.amf_content\n @amfbody.results = @wrapper\n\t\tend\n\t @amfbody.success! #set the success response uri flag (/onResult)\n\tend",
"def inherited( subclass )\n\t\t\tsuper\n\n\t\t\tverbs_copy = Strelka::DataUtilities.deep_copy( self.resource_verbs )\n\t\t\tsubclass.instance_variable_set( :@resource_verbs, verbs_copy )\n\n\t\t\topts_copy = Strelka::DataUtilities.deep_copy( self.service_options )\n\t\t\tsubclass.instance_variable_set( :@service_options, opts_copy )\n\t\tend",
"def perform\n raise NotImplementedError\n end",
"def realize_self\n raise NotImplementedError\n end",
"def service\n @service ||=\n if (c = self_class)\n name = c.safe_const_get(:SERVICE_NAME)\n name ||= c.module_parent_name.underscore.remove(/_service$/)\n name&.to_sym || super\n end\n end",
"def agent_interface\n super\n end",
"def interface; end",
"def interface; end",
"def ensure_service!\n service = params[:service] or raise \"no service given\"\n @service = Service(service, @realm) or raise \"invalid service\"\n end",
"def factory?; @factory; end",
"def overrides; end",
"def instantiate_service\n @service = ContestService.new\n end",
"def strategy_name; end",
"def service_name=(_arg0); end",
"def service\n context[:target]\n end",
"def create\n @service = Service.new(name: service_params[:name], current_request: request)\n @service = @service.becomes(service_params[:name].constantize) if @service.valid?\n @service.assign_attributes(service_params.merge({current_request: request}))\n @service.user = current_user\n\n respond_to do |format|\n if @service.save\n @service.authenticate\n format.html { redirect_to @service, notice: get_update_message('created') }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def private; end",
"def reference_resource\n return super if defined?(super)\n\n raise NotImplementedError\n end",
"def service_options(resource)\n # HERE BE DRAGONS!\n super if defined?(super)\n\n # Closure scoping for below.\n self_ = self\n\n # Patch the command method.\n old_command = resource.method(:command)\n resource.define_singleton_method(:command) do |val=nil|\n val = self_.send(:ruby_mixin_command, val) if val\n old_command.call(val)\n end\n end",
"def perform\n raise NotImplementedError\n end",
"def process_hook\n fail 'sub class to implement'\n end",
"def base_resolve(**)\n object\n end",
"def service_object\n EntitiesActionDispatcher.new(consul_scope)\n end",
"def abstract!; end",
"def delegating_method; end",
"def child_class_for(instance, service, params)\n self.class\n end",
"def map_proxy_state\n super\n end",
"def refinement\n raise NotImplementedError\n end"
] | [
"0.7492396",
"0.72055864",
"0.70344293",
"0.69078404",
"0.6783043",
"0.6523961",
"0.65002406",
"0.64547104",
"0.63432515",
"0.6265905",
"0.6211264",
"0.6209802",
"0.61822385",
"0.60989",
"0.608119",
"0.608119",
"0.60805404",
"0.60508704",
"0.6022361",
"0.6011483",
"0.5990224",
"0.5957383",
"0.58343613",
"0.5827158",
"0.5797886",
"0.5792197",
"0.5775457",
"0.57705617",
"0.5769235",
"0.57056713",
"0.5705346",
"0.56786805",
"0.56609255",
"0.56536597",
"0.56524974",
"0.56524974",
"0.5634337",
"0.5634337",
"0.56314737",
"0.5630004",
"0.5623278",
"0.56063515",
"0.5598045",
"0.5587445",
"0.5587445",
"0.5579052",
"0.5571539",
"0.5562078",
"0.556122",
"0.5559248",
"0.5557032",
"0.55368966",
"0.5517592",
"0.549171",
"0.54687506",
"0.5462724",
"0.545816",
"0.544677",
"0.5439102",
"0.54386955",
"0.54367036",
"0.54251516",
"0.54140234",
"0.5411956",
"0.5411224",
"0.54041606",
"0.5403161",
"0.5397734",
"0.53850603",
"0.53804946",
"0.53667474",
"0.5360045",
"0.53561515",
"0.5345851",
"0.53404266",
"0.5338575",
"0.53373224",
"0.53238577",
"0.5315881",
"0.53136986",
"0.53136986",
"0.5310723",
"0.5310006",
"0.53093475",
"0.5285886",
"0.52791",
"0.5275905",
"0.52742416",
"0.5273168",
"0.52626",
"0.525335",
"0.5252577",
"0.5252105",
"0.5250253",
"0.5248575",
"0.52477163",
"0.52468014",
"0.5245409",
"0.52429384",
"0.5241928",
"0.52401"
] | 0.0 | -1 |
this'll only work if run in an xsession | def xrandr_outputs
x11_user = self[:nat][:username] || 'nat'
xrandr_output = `su #{x11_user} -c "xrandr -q"`.split()
displays = []
xrandr_output.each_with_index do |word, i|
if word == 'connected'
displays << xrandr_output[i - 1]
end
end
displays
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gPXE; iPXE; end",
"def orgX(x)\n return @device.orgX(x) ;\n end",
"def private; end",
"def xenapi_session\n @session\n end",
"def xenapi_session\n @session\n end",
"def xwininfo\n @xwininfo ||= `xwininfo -id #{@id}`\n end",
"def global; end",
"def session=(_arg0); end",
"def sandbox; end",
"def sandbox; end",
"def send_kexinit; end",
"def send_kexinit; end",
"def exec; end",
"def exec; end",
"def raw_api_call(sttring)\n\t\teval \"ensure_xen_session.#{string}\"\n\tend",
"def probers; end",
"def open_session; end",
"def setup\n open_session\n end",
"def xapi\n @xapi ||= begin \n\n session = XenApi::Client.new( Chef::Config[:knife][:xenserver_host] )\n \n # get the password from the user\n password = Chef::Config[:knife][:xenserver_password] || nil\n username = Chef::Config[:knife][:xenserver_username] || \"root\"\n if password.nil? or password.empty?\n password = ask(\"Enter password for user #{username}: \" ) { |input| input.echo = \"*\" }\n end\n session.login_with_password(username, password) \n\n session\n end\n end",
"def mohamed() \r\n xt_login()\r\n xt_goToMonitor()\r\n xt_monitors_dragMonitorToGroup()\r\n\r\n\r\n\r\n #xt_logout()\r\n #xt_TearDown()\r\nend",
"def global?; end",
"def sandbox?; end",
"def sandbox?; end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def standalone; end",
"def raise\n # Unsure of the proper tool to use here. \"windowactivate\" seems to work.\n xdotool \"windowactivate #{@id}\"\n sleep $sleep_time\n end",
"def active; end",
"def active; end",
"def on_session_interact(session)\n\tend",
"def global?; true end",
"def set_scan_target\n hooked_browser = HB.first(:session => @params['hb_id'].to_s)\n if(hooked_browser != nil)\n xssrays_scan = XS.new(\n :hooked_browser_id => hooked_browser.id,\n :scan_start => Time.now,\n :domain => hooked_browser.domain,\n :cross_domain => CROSS_DOMAIN, #check also cross-domain URIs found by the spider\n :clean_timeout => CLEAN_TIMEOUT #check also cross-domain URIs found by the spider\n )\n xssrays_scan.save\n\n print_info(\"[XSSRAYS] Starting XSSRays on HB with ip [#{hooked_browser.ip.to_s}], hooked on domain [#{hooked_browser.domain.to_s}]\")\n end\n\n end",
"def idle?; end",
"def can_xp?\n false\n end",
"def rexml? ; false end",
"def load_session_info()\n\t\tbegin\n\t\t\t::Timeout.timeout(60) do\n\t\t\t \n #nothing\n \n end\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\t# Log the error but otherwise ignore it so we don't kill the\n\t\t\t# session if reporting failed for some reason\n\t\t\telog(\"Error loading sysinfo: #{e.class}: #{e}\")\n\t\t\tdlog(\"Call stack:\\n#{e.backtrace.join(\"\\n\")}\")\n\t\tend\n\tend",
"def setPxeEnv(node)\n if (@pxePrefix != nil)\n ns = \"[#{node.x},#{node.y}]\"\n url = @pxePrefix + ns\n debug \"PXE: #{url}\"\n NodeHandler.service_call(url, \"Error requesting PXE image\")\n end\n end",
"def running; end",
"def running; end",
"def allow_gpu_acceleration\n\n # Turn off X\n execute \"Turn off X\" do\n command \"systemctl set-default multi-user.target\"\n end\n\n # Update the xorg.conf to set up NVIDIA drivers.\n # NOTE: --enable-all-gpus parameter is needed to support servers with more than one NVIDIA GPU.\n execute \"Set up Nvidia drivers for X configuration\" do\n user 'root'\n command \"nvidia-xconfig --preserve-busid --enable-all-gpus\"\n end\n\n # dcvgl package must be installed after NVIDIA and before starting up X\n dcv_gl = \"#{node['cfncluster']['sources_dir']}/#{node['cfncluster']['dcv']['package']}/#{node['cfncluster']['dcv']['gl']}\"\n package dcv_gl do\n action :install\n source dcv_gl\n end\n\n # Configure the X server to start automatically when the Linux server boots and start the X server in background\n bash 'Launch X' do\n user 'root'\n code <<-SETUPX\n systemctl set-default graphical.target\n systemctl isolate graphical.target &\n SETUPX\n end\n\n # Verify that the X server is running\n execute 'Wait for X to start' do\n user 'root'\n command \"pidof X || pidof Xorg\"\n retries 5\n retry_delay 5\n end\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 active=(_arg0); end",
"def active=(_arg0); end",
"def xapi\n @xapi ||= begin\n\n ui.fatal 'Must provide a xapi host with --host ' unless locate_config_value(:xapi_host)\n verify = :verify_none\n verify = :verify_peer if locate_config_value(:xapi_ssl_verify) == true\n session = XenApi::Client.new(locate_config_value(:xapi_host), 10, verify)\n\n # get the password from the user\n password = locate_config_value(:xapi_password) || nil\n username = locate_config_value(:xapi_username) || 'root'\n if password.nil? || password.empty?\n password = h.ask(\"Enter password for user #{username}: \") { |input| input.echo = '*' }\n end\n session.login_with_password(username, password)\n\n session\n end\n end",
"def win; end",
"def pausable; end",
"def process_only(session, wait = T.unsafe(nil)); end",
"def test_xmlrpc_server\r\n require \"XRserver\"\r\n end",
"def isolated; end",
"def isolated; end",
"def x\n driver_quit\n exit # exit pry\n end",
"def _net_wm(id) ; %Q{xprop -id #{id} _NET_WM_PID} ; end",
"def active_window\n if File.exists?(wmii_namespace)\n 'wmiir cat /client/sel/ctl | sed 1q'\n else\n %q[xprop -root _NET_ACTIVE_WINDOW | awk '/#/ { print $(NF) ; exit } END { exit 1 }' || xdotool getwindowfocus]\n end\nend",
"def setPxeEnvMulti()\n if (@pxePrefix != nil)\n nsArray = []\n eachNode { |n|\n nsArray << \"[#{n.x},#{n.y}]\"\n }\n nset = \"[#{nsArray.join(\",\")}]\"\n url = @pxePrefix + nset\n debug \"PXE: #{url}\"\n NodeHandler.service_call(url, \"Error requesting PXE image\")\n end\n end",
"def txs()\n puts 'TXS'\n @s = @x\n end",
"def whiny; end",
"def master; end",
"def xml!; @xml = true; end",
"def external; 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 autorun; end",
"def smux_subagent\n super\n end",
"def session_options=(_arg0); end",
"def session_options=(_arg0); end",
"def activate; end",
"def setup(g,file,rs_name = nil)\r\n systemos #Determine whether the OS is Chinese or English\r\n base_xl = (file).gsub('/','\\\\').chomp('rb')<<'xls'\r\n if(ARGV.length != 0) # called from controller\r\n excel = xls_timestamp(g,base_xl,nil,ARGV[2]) # called ,connect to existing excel instance. # ARGV[2] is the result sub-folder name.\r\n g.attach_ie(excel[1][2]) # test site ip\r\n else\r\n excel = xls_timestamp(g,base_xl,'ind',rs_name) # independent, start new excel instance\r\n g.open_ie(excel[1][2])\r\n support(g,excel[0])\r\n g.ver_info(excel[0])\r\n end\r\n return excel\r\nend",
"def pending\n Xlib::x_pending @raw\n end",
"def xdotool(command)\n puts \"\\n#{command}\" if $debug\n # Run xdotool with the specified command in a shell.\n # \"strip\" is necessary for pesky newlines\n `xdotool #{command}`.strip\nend",
"def active?; end",
"def windows?; end"
] | [
"0.5556326",
"0.53993505",
"0.5367444",
"0.53507286",
"0.53507286",
"0.53036565",
"0.5296256",
"0.52846456",
"0.522453",
"0.522453",
"0.51919454",
"0.51919454",
"0.5191126",
"0.5191126",
"0.5158548",
"0.51399696",
"0.5114664",
"0.5091032",
"0.5088097",
"0.5084292",
"0.5084011",
"0.5074998",
"0.5074998",
"0.50588626",
"0.50588626",
"0.50588626",
"0.50588626",
"0.5053257",
"0.5041335",
"0.50143474",
"0.50143474",
"0.50077385",
"0.50074065",
"0.4972436",
"0.4957043",
"0.49505216",
"0.4950158",
"0.49491578",
"0.49473822",
"0.49313426",
"0.49313426",
"0.49282655",
"0.49204165",
"0.49204165",
"0.49204165",
"0.49204165",
"0.49204165",
"0.49204165",
"0.49204165",
"0.49204165",
"0.49204165",
"0.48873287",
"0.48873287",
"0.48868677",
"0.48826665",
"0.48824623",
"0.48796186",
"0.48726735",
"0.48660204",
"0.48660204",
"0.4859829",
"0.48588637",
"0.4858304",
"0.4850598",
"0.4850547",
"0.48452258",
"0.48396444",
"0.4838837",
"0.48364422",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.48358622",
"0.4811896",
"0.47883797",
"0.47703043",
"0.47703043",
"0.47675347",
"0.4767216",
"0.4766959",
"0.47628665",
"0.475284",
"0.47495276"
] | 0.0 | -1 |
Get process information by command 'ps auxw | grep serverId | grep pid' | def get_ps_info args={}, &block
return if OS.windows?
pid = args[:pid]
EM.system('sh', proc{ |process|
process.send_data "ps auxw | grep " + pid.to_s + " | grep -v 'grep'\n"
process.send_data "exit\n"
}) { |output, status|
if status.exitstatus == 0
format args, output, &block
else
block.call status, nil if block
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_pids\n `lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`\n end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def ps_running\n cmd(\"ps\", \"-q\").lines.map(&:strip)\n end",
"def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend",
"def processes()\n\t\t\t\tprocesses = ProcessList.new()\n\t\t\t\tprocesslist = `ps auxww`\n\t\t\t\tprocessregex = /^(\\S+)\\s+([0-9]+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)$/\n\t\t\t\tprocesslist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = processregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tinfo = ProcessInfo.new()\n\t\t\t\t\t\tinfo.username = match[1]\n\t\t\t\t\t\tinfo.pid = match[2].to_i()\n\t\t\t\t\t\tinfo.flags = match[8]\n\t\t\t\t\t\tinfo.starttime = match[9]\n\t\t\t\t\t\tinfo.runtime = match[10]\n\t\t\t\t\t\tinfo.program = match[11]\n\t\t\t\t\t\tinfo.cpu = match[3].to_f()\n\t\t\t\t\t\tinfo.mem = match[4].to_f()\n\t\t\t\t\t\tif(processes.has_key?(info.pid))\n\t\t\t\t\t\t\traise(DuplicateProcessError, \"Process #{info.pid} appeared twice in the process listing\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprocesses[info.pid] = info\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(processes)\n\t\t\tend",
"def processes\n process_cmd = case RUBY_PLATFORM\n when /djgpp|(cyg|ms|bcc)win|mingw/ then 'tasklist /v'\n when /solaris/ then 'ps -ef'\n else\n 'ps aux'\n end\n `#{process_cmd}`\nend",
"def get_pids\n pids_ports = []\n pids = `pgrep -f thin`.split\n pids.each do |t|\n # only works for linux i'm affraid\n # using lsof (list open files) \n\n # removed by someara to address munin permissions issue\n ## port = `lsof -p #{t} | grep LISTEN`.split[8]\n ## port = port.split(\":\")[1]\n port = `ps -ef | grep #{t} | grep -v grep | grep thin | awk '{ print $10 }' | awk -F: '{ print $2 }' | tr --delete '()'`.chomp\n pids_ports << [t,port]\n end\n pids_ports\n end",
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file)\n cmdline = IO.read(cmdline_file).split(?\\x00)\n else\n cmdline = ProcTable.ps(Process.pid).cmdline.split(' ')\n end\n\n if RUBY_PLATFORM =~ /darwin/i\n cmdline.delete_if{ |e| e.include?('=') }\n process[:name] = cmdline.join(' ')\n else\n process[:name] = cmdline.shift\n process[:arguments] = cmdline\n end\n\n process[:pid] = Process.pid\n # This is usually Process.pid but in the case of containers, the host agent\n # will return to us the true host pid in which we use to report data.\n process[:report_pid] = nil\n process\n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def ps_cmd(pid)\n case RbConfig::CONFIG['arch']\n when /solaris|bsd/\n `ps -o comm,ppid -p #{pid}`\n when /linux/\n `ps -o cmd,ppid #{pid}`\n else\n raise 'UnknownOS'\n end.split(\"\\n\").last.split\nend",
"def pid(*args)\n result = self.info(\"--pid\", *args).collect{ |str| str.scan(REGEX_PID) }\n result.flatten!.compact!\n\n result.first.strip.to_i\n end",
"def pid\n pid = nil\n begin\n pid = capture :pgrep, \"-o -f resque-pool\"\n rescue SSHKit::Command::Failed\n end\n \n pid \n end",
"def daemon_process\n pid = nil\n Sys::ProcTable.ps do |process|\n if process.cmdline =~ /#{__FILE__}/ and process.pid != Process.pid\n pid = process.pid\n break\n end\n end\n pid\nend",
"def getpid\n @resource.fail \"Either stop/status commands or a pattern must be specified\" unless @resource[:pattern]\n ps = Facter[\"ps\"].value\n @resource.fail \"You must upgrade Facter to a version that includes 'ps'\" unless ps and ps != \"\"\n regex = Regexp.new(@resource[:pattern])\n self.debug \"Executing '#{ps}'\"\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n return ary[1]\n end\n }\n }\n\n nil\n end",
"def pid; ::Process.pid end",
"def system_pids\n pids = `ps -e -o pid`.split(\"\\n\")\n pids.delete_at(0) # PID (header)\n pids.each(&:'strip!')\n end",
"def up_ids\n with_fig(%w(ps -q)) do |exec_obj|\n exec_obj.run\n\n # parse stdout..\n re = Regexp.new '^[0-9a-zA-Z]+'\n res = []\n\n exec_obj.stdout.split(\"\\n\").each do |line|\n next unless line.match(re)\n res << line.chomp.strip\n end\n\n return res\n end\n nil\n end",
"def list_processes\n check_connection\n @fields = @protocol.process_info_command\n @result_exist = true\n store_result\n end",
"def gather_psinfo\n `#{@ps_cmd}`.split(/\\n/).map do |line|\n if line =~ /\\s*(\\d+) (.+)$/\n [$1.to_i, $2]\n else\n nil\n end\n end.compact\n end",
"def status_server\n return -1 unless FileTest.exist?(PID_FILE)\n\n begin\n Process.getpgid(server_pid)\n return 0\n rescue\n return 1\n end\nend",
"def pgrep(uuid)\n command = %Q(/usr/bin/pgrep -u $(id -u #{uuid}))\n pids, _, rc = Utils.oo_spawn(command, quiet: true, timeout: 300)\n\n case rc\n when 0\n pids.split(\"\\n\")\n when 1\n Array.new\n else\n raise RuntimeError, %Q(watchman search for running processes failed: #{command} (#{rc}))\n end\n end",
"def call\n `ps -o rss -p #{@pid}`.split(\"\\n\").last.to_i\n end",
"def processes\n request('getAllProcessInfo')\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def daemon_pids\n prog_name = Log2mail::PROGNAME\n own_pid = Process.pid\n # FIXME: finding daemon pids by using pgrep is NOT 'optimal' :-)\n `pgrep -f #{prog_name}`.split.map(&:to_i) - [own_pid]\n end",
"def all_processes\n `ps -eo pid,ppid`.lines.reduce(Hash.new []) do |hash, line|\n pid, ppid = line.split.map(&:to_i)\n hash[ppid] = [] unless hash.key?(ppid)\n hash[ppid] << pid\n hash\n end\n end",
"def infoFor(regex)\n info = `ps -eo pcpu,pid,pmem,args | sort -k 1 -r | grep #{regex} | head -1`\n info.split\n end",
"def pid\n $PROCESS_ID\n end",
"def get_full_ps_info(pid)\n ps_fullcmd = @ps_fullcmd_fmt % pid\n # p ps_fullcmd\n output = `#{ps_fullcmd}`\n return output\n end",
"def remote_processes\n stdout = ''\n self.exec!(\"ps -o pid,ppid,cmd -u #{self.options[:user]}\") do |_channel, stream, data|\n stdout << data if stream == :stdout\n end\n # Sample output:\n # PID PPID CMD\n # 2202 1882 /bin/sh /usr/bin/startkde\n # 2297 2202 /usr/bin/ssh-agent /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sa\n # 2298 2202 /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sayantamd/.gnupg/gpg-\n # 2301 1 /usr/bin/dbus-launch --exit-with-session /usr/bin/startkde\n # 2302 1 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session\n\n @remote_processes = []\n ps_line_rexp = Regexp.compile('^(\\d+)\\s+(\\d+)\\s+(.+?)$')\n stdout.split(\"\\n\").each do |line|\n line.strip!\n next if line.blank? || line.match(/^PID/i)\n matcher = ps_line_rexp.match(line)\n process = OpenStruct.new\n process.pid = matcher[1].to_i\n process.ppid = matcher[2].to_i\n process.cmd = matcher[3]\n @remote_processes.push(process.freeze)\n end\n\n @remote_processes\n end",
"def report_pid\n @process[:report_pid]\n end",
"def pid\n @pid ||= Process.pid\n end",
"def param_from_pid( param )\n tuples = {}\n `ps -eo pid,#{param}`.split(\"\\n\").each_with_index() do |row, index|\n next unless index > 0\n cols = row.split(' ')\n tuples[cols[0]] = cols[1]\n end\n tuples\nend",
"def report_pid\n @process[:report_pid]\n end",
"def get_process_name\n processes = client.sys.process.get_processes\n current_pid = session.sys.process.getpid\n processes.each do |proc|\n return proc['name'] if proc['pid'] == current_pid\n end\n return nil\n end",
"def pidof(program)\n pids = []\n full = cmd_exec('ps -elf').to_s\n full.split(\"\\n\").each do |pid|\n pids << pid.split(' ')[3].to_i if pid.include? program\n end\n pids\n end",
"def pid\n @sock.cmd(\"String\" => \"pid\", \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end",
"def ppid\n Process.ppid\n end",
"def foreman_pids\n `ps aux | grep \"[f]oreman: master\" | awk '{ print $2 }'`.split(\"\\n\")\n end",
"def cmd_getpid(*args)\n print_line(\"Current pid: #{client.sys.process.getpid}\")\n\n return true\n end",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def get_process_pids(image_name)\n pid_array = Array.new\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n pid_array << line.split(/ +/)[1]\n end\n end\n return pid_array\n end",
"def service_pid\n _pid_file_pid\n end",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def os_x_raw_ps\n\t\t`COLUMNS=9999 ps ax -o \"pid uid ppid rss cpu command\"`\n\tend",
"def pid() end",
"def pid() end",
"def pid() end",
"def find_pids(name)\n\tproc_pid = []\n\t@client.sys.process.get_processes.each do |proc|\n\t\tif proc['name'].downcase == name.downcase\n\t\t\tproc_pid << proc['pid']\n\t\tend\n\tend\n\treturn proc_pid\nend",
"def get_all_pid\n all_pid = Array.new\n Dir.foreach(\"/proc\") do |pid|\n if (File.exists?(\"/proc/#{pid}/status\"))\n all_pid.push(pid)\n end\n end\n return(all_pid)\n end",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def existing_instances(filter=\"\")\r\n instances_raw = `ps xao pid,pgid,command | grep '#{process_name} #{name_grep_string} #{filter}' | grep -iv #{Process.pid} | awk '{print $1 \"\\t\" $2 \"\\t\" $3}'`\r\n instances_raw.split(\"\\n\").map do |row|\r\n pid, group, command = row.split(\"\\t\")\r\n ProcessInfo.new(pid.to_i, group.to_i, command)\r\n end\r\n end",
"def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend",
"def pid_from_window(id)\n\tIO.popen(_net_wm(id)) { |p| p.readline.chomp }.split[2].to_i\nend",
"def get_pid(proc_name)\n processes = client.sys.process.get_processes\n processes.each do |proc|\n if proc['name'] == proc_name && proc['user'] != \"\"\n return proc['pid']\n end\n end\n return nil\n end",
"def is_process_alive(pid)\n ps_ret = `ps | grep #{pid} | grep -v 'grep'`\n #puts \"PS: [#{ps_ret}]\"\n ps_ret != \"\" ? true : false\n end",
"def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to_i\n #`ps -o rss -p #{$$}`.strip.split.last.to_i * 1024\n `ps -o rss= -p #{Process.pid}`.to_i \nend",
"def pid\n @pid ||= Process.pid\n end",
"def pid\n @pid ||= Process.pid\n end",
"def pid\n matched = exit_info.scan(/pid ([0-9]+)/).first\n matched.first.to_i if matched\n end",
"def each_process name, &block\n Sys::ProcTable.ps do |process|\n if process.comm.strip == name.strip && process.state != 'zombie'\n yield process.pid.to_i, process.state.strip\n end\n end\nend",
"def status_info\n { \n :time => Time.now, :pid => Process.pid, :started => @started,\n :max_conns => @maxconns, :conns => @threads.length, :systimes => Process.times,\n :shutdown => @shutdown, :dead => @dead, :total_conns => @total_conns\n }.inspect\n end",
"def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end",
"def process_id\n return @process_id\n end",
"def grep_rsync_process\n ps = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n ps = ssh.exec! \"ps -ef | grep rsync\"\n end\n ps.split(\"\\n\")\n end",
"def srv_running\n return unless RUBY_PLATFORM =~ /linux/\n cmdobj = Mixlib::ShellOut.new(\"ps -ef | grep #{@new_resource.name} | grep java\")\n cmdobj.run_command.stdout.split(\"\\n\").reject { |e| e.include? \"sh -c\" }.size >= 1 # true or false\nend",
"def processes\n\t\tif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos = `uname -s`.chomp\n\t\t\tif os == \"Linux\"\n\t\t\t\tresolve_unix_uids(linux_processes)\n\t\t\telsif os == \"Darwin\" or os == \"FreeBSD\"\n\t\t\t\tos_x_processes\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend\n\tend",
"def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end",
"def pid\n `cat #{pid_file_path}`.gsub(\"\\n\", \"\")\n end",
"def _pid\n @@_pid ||= Process.pid\n end",
"def find_process_id(process_name)\n process = remote_processes.find { |p| p.cmd.include?(process_name) }\n process ? process.pid : nil\n end",
"def has_process(process)\n @commands << \"ps aux | grep '#{process}' | grep -v grep\"\n end",
"def pid\n File.open( pid_path ) { |f| return f.gets.to_i } if File.exist?(pid_path)\n end",
"def pid\n cmd = shell_out(%w{sv status} + [new_resource.service_name])\n if !cmd.error? && md = cmd.stdout.match(/run: #{new_resource.service_name}: \\(pid (\\d+)\\)/)\n md[1].to_i\n else\n nil\n end\n end",
"def pid; end",
"def pid; end",
"def pid; end",
"def parse_ps(line)\n\t\tm = line.split(\" \", 6)\n\t\tparams = {}\n\t\tparams[:pid] = m[0]\n\t\tparams[:uid] = m[1]\n\t\tparams[:parent_pid] = m[2].to_i\n\t\tparams[:mem] = m[3].to_i\n\t\tparams[:cpu] = m[4].to_i\n\t\tparams[:cmdline] = m[5]\n\t\tparams[:command] = params[:cmdline].split(\" \").first\n\t\tparams\n\tend",
"def parse_ps(line)\n\t\tm = line.split(\" \", 6)\n\t\tparams = {}\n\t\tparams[:pid] = m[0]\n\t\tparams[:uid] = m[1]\n\t\tparams[:parent_pid] = m[2].to_i\n\t\tparams[:mem] = m[3].to_i\n\t\tparams[:cpu] = m[4].to_i\n\t\tparams[:cmdline] = m[5]\n\t\tparams[:command] = params[:cmdline].split(\" \").first\n\t\tparams\n\tend",
"def get_pid\n\t\tEventMachine::get_subprocess_pid @signature\n\tend",
"def remote_process_exists?(pid_file)\n capture(\"ps -p $(cat #{pid_file}) ; true\").strip.split(\"\\n\").size == 2\n end",
"def pid(*) end",
"def pid\n @pid\n end",
"def process_exists?(pid)\n run(\"ps -p #{pid}\").success?\n end",
"def pid\n end",
"def test_s_pid\n assert_instance_of(Fixnum, Process.pid)\n assert_equal($$, Process.pid)\n IO.popen(\"-\") do |pipe|\n if !pipe\n puts Process.pid\n puts Process.ppid\n exit\n end\n assert_equal(pipe.pid, pipe.gets.to_i)\n assert_equal(Process.pid, pipe.gets.to_i)\n pipe.close\n end\n end",
"def cmd_from_pid(pid)\n\tcmd = File.open(\"/proc/#{pid}/cmdline\") { |i| i.read }.split(/\\0/)\nend",
"def worker_pids\n work_units.all(:select => 'worker_pid').map(&:worker_pid)\n end",
"def running?\n processes = if node[\"platform_family\"] == \"windows\" then\n `powershell.exe -Command \\\"(Get-Process | Where-Object {$_.Name -eq \\'*aria*\\'}).count\\\"`.chop.to_i\n else \n cmd = Mixlib::ShellOut.new(\"pgrep -f #{new_resource.name}\")\n pgrep = cmd.run_command\n pgrep.stdout.length\n end\n processes > 0\nend",
"def processes\n\t\tif ::File.directory? \"/proc\"\n\t\t\tresolve_unix_uids(linux_processes)\n\t\telsif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos_x_processes\n\t\tend\n\tend",
"def collect\n parse_process_list(multiline('top -l 1 -o mem -stats pid,mem,command'), split_tokens: 3) do |tokens| \n [tokens.first, tokens.last, hostname, plain_memory_value(tokens[1])]\n end\n end",
"def find_procname(pid)\n\tname = nil\n\t@client.sys.process.get_processes.each do |proc|\n\t\tif proc['pid'] == pid.to_i\n\t\t\tname = proc['name']\n\t\tend\n\tend\n\treturn name\nend",
"def pid()\n #This is a stub, used for indexing\n end",
"def get_ps_pids(pids = [])\n current_pids = session.sys.process.get_processes.keep_if { |p| p['name'].casecmp('powershell.exe').zero? }.map { |p| p['pid'] }\n # Subtract previously known pids\n current_pids = (current_pids - pids).uniq\n current_pids\n end",
"def pid(params)\n Felixwrapper.configure(params)\n pid = Felixwrapper.instance.pid\n return nil unless pid\n pid\n end",
"def process_id\n attributes.fetch(:processId)\n end"
] | [
"0.74520993",
"0.7438365",
"0.7126289",
"0.71195465",
"0.70977867",
"0.7040693",
"0.69930017",
"0.69849795",
"0.6941538",
"0.6887157",
"0.68529695",
"0.68377346",
"0.6791492",
"0.6788745",
"0.6778669",
"0.67205286",
"0.6692933",
"0.666617",
"0.66612226",
"0.66494066",
"0.6629769",
"0.6606909",
"0.66017514",
"0.66001165",
"0.65861386",
"0.65861386",
"0.6579963",
"0.6576966",
"0.6572989",
"0.6571418",
"0.6526934",
"0.6503297",
"0.6450657",
"0.638105",
"0.63752663",
"0.6364164",
"0.63594913",
"0.6347881",
"0.633703",
"0.63336456",
"0.63221985",
"0.63154054",
"0.63135207",
"0.63135207",
"0.6309994",
"0.630424",
"0.6285806",
"0.6285806",
"0.6265879",
"0.6265879",
"0.6265879",
"0.6264486",
"0.626063",
"0.6259899",
"0.6259899",
"0.62405896",
"0.6224453",
"0.6221924",
"0.62210894",
"0.61679107",
"0.61618346",
"0.6147959",
"0.6147959",
"0.61435544",
"0.6136546",
"0.61224395",
"0.6091205",
"0.6061216",
"0.6027015",
"0.6024684",
"0.60030574",
"0.60000306",
"0.5990805",
"0.59525555",
"0.59523237",
"0.5941915",
"0.5925384",
"0.5919792",
"0.5917221",
"0.5917221",
"0.5917221",
"0.58959734",
"0.58959734",
"0.5887202",
"0.588637",
"0.5881109",
"0.5844405",
"0.5833324",
"0.580743",
"0.5800294",
"0.57979447",
"0.57956344",
"0.5755575",
"0.5754817",
"0.57252604",
"0.5722992",
"0.5713356",
"0.57045275",
"0.56986105",
"0.5694187"
] | 0.744078 | 1 |
Convert process information into required format | def format args, data
time = get_current_time
data = data.gsub(/^\s+|\s+$/, '')
data = data.split(/\s+/).select { |str|
Float str rescue nil
}
ps_info = {}
ps_info[:time] = time
ps_info[:server_id] = args[:server_id]
ps_info[:server_type] = args[:server_id].split('-')[0]
pid = ps_info[:pid] = args[:pid]
ps_info[:cpu_avg] = data[1]
ps_info[:mem_avg] = data[2]
ps_info[:vsz] = data[3]
ps_info[:rss] = data[4]
if OS.mac?
ps_info[:usr] = ps_info[:sys] = ps_info[:gue] = '0'
block_given? and yield nil, ps_info
return
end
EM.system('pidstat -p ' + pid) { |output,status|
if status.exitstatus == 0
data = output.gsub(/^\s+|\s+$/, '')
data = data.split(/\s+/).select { |str|
Float str rescue nil
}
ps_info[:usr] = data[1]
ps_info[:sys] = data[2]
ps_info[:gue] = data[3]
block_given? and yield nil, ps_info
else
block_given? and yield status, nil
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file)\n cmdline = IO.read(cmdline_file).split(?\\x00)\n else\n cmdline = ProcTable.ps(Process.pid).cmdline.split(' ')\n end\n\n if RUBY_PLATFORM =~ /darwin/i\n cmdline.delete_if{ |e| e.include?('=') }\n process[:name] = cmdline.join(' ')\n else\n process[:name] = cmdline.shift\n process[:arguments] = cmdline\n end\n\n process[:pid] = Process.pid\n # This is usually Process.pid but in the case of containers, the host agent\n # will return to us the true host pid in which we use to report data.\n process[:report_pid] = nil\n process\n end",
"def format_task_process\n XES::Trace.new.tap do |trace|\n trace.concept_name = \"task process %s\" % Util::UUID.generate\n trace.attributes << XES.string(\"pione:traceType\", \"task_process\")\n trace.events = @task_process_log.records.map do |record|\n XES::Event.new.tap do |event|\n # standard attributes\n event.concept_name = record.name\n # event.org_resource = record.caller\n event.time_timestamp = record.timestamp\n event.lifecycle_transition = record.transition\n\n # pione extension attributes\n event.attributes << XES.string(\"pione:ruleType\", record.rule_type)\n event.attributes << XES.string(\"pione:inputs\", record.inputs)\n event.attributes << XES.string(\"pione:parameters\", record.parameters)\n end\n end\n end\n end",
"def parse_oleprocinfo(proc_info)\n\t\tcommand = proc_info.Name\n\t\tpid = proc_info.ProcessId\n\t\tuid = 0\n\t\tcmdline = proc_info.CommandLine\n\t\trss = proc_info.MaximumWorkingSetSize\n\t\ttime = proc_info.KernelModeTime.to_i + proc_info.UserModeTime.to_i\n\n\t\t{\n\t\t\t:pid => pid,\n\t\t\t:uid => uid,\n\t\t\t:command => command,\n\t\t\t:cmdline => cmdline,\n\t\t\t:mem => rss,\n\t\t\t:cpu => time,\n\t\t}\n\tend",
"def parse_oleprocinfo(proc_info)\n\t\tcommand = proc_info.Name\n\t\tpid = proc_info.ProcessId\n\t\tuid = 0\n\t\tcmdline = proc_info.CommandLine\n\t\trss = proc_info.MaximumWorkingSetSize\n\t\ttime = proc_info.KernelModeTime.to_i + proc_info.UserModeTime.to_i\n\n\t\t{\n\t\t\t:pid => pid,\n\t\t\t:uid => uid,\n\t\t\t:command => command,\n\t\t\t:cmdline => cmdline,\n\t\t\t:mem => rss,\n\t\t\t:cpu => time,\n\t\t}\n\tend",
"def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def process_walk\n\t\tprint_status('Enumerating Running Process.....')\n\t\tpsz=[] #process name\n\t\t@manager.walk('mib-2.25.4.2.1.2') { |x| psz << x.value }\n\t\tif psz.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\tps_present = [['PID', 'Process', 'Path']]\n\t\t\tpidz=[] #PID valud\n\t\t\t@manager.walk('mib-2.25.4.2.1.1') { |x| pidz << x.value }\n\n\t\t\tpathz=[] #Path of process\n\t\t\t@manager.walk('mib-2.25.4.2.1.4') do |path|\n\t\t\t\tif path.value.chomp != '' and not path.nil?\n\t\t\t\t\tpathz << path.value\n\t\t\t\telse\n\t\t\t\t\tpathz << \" - \"\n\t\t\t\tend\n\t\t\tend\n\t\t\tcount=0\n\t\t\twhile count.to_i < psz.size\n\t\t\t\tps_present << [[ \"#{pidz[count]}\", \"#{psz[count]}\", \"#{pathz[count]}\" ]]\n\t\t\t\tcount = count.to_i + 1\n\t\t\tend\n\n\t\t\ttable = ps_present.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend",
"def gather_psinfo\n `#{@ps_cmd}`.split(/\\n/).map do |line|\n if line =~ /\\s*(\\d+) (.+)$/\n [$1.to_i, $2]\n else\n nil\n end\n end.compact\n end",
"def load_process_definition\n\n pdef, prep = load_process_def\n\n [ pdef, prep.to_a.to_json ]\n end",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def os_x_processes\n\t\traw = os_x_raw_ps.split(\"\\n\").slice(1, 99999)\n\t\traw.map do |line|\n\t\t\tparse_ps(line)\n\t\tend\n\tend",
"def parse_ps(line)\n\t\tm = line.split(\" \", 6)\n\t\tparams = {}\n\t\tparams[:pid] = m[0]\n\t\tparams[:uid] = m[1]\n\t\tparams[:parent_pid] = m[2].to_i\n\t\tparams[:mem] = m[3].to_i\n\t\tparams[:cpu] = m[4].to_i\n\t\tparams[:cmdline] = m[5]\n\t\tparams[:command] = params[:cmdline].split(\" \").first\n\t\tparams\n\tend",
"def parse_ps(line)\n\t\tm = line.split(\" \", 6)\n\t\tparams = {}\n\t\tparams[:pid] = m[0]\n\t\tparams[:uid] = m[1]\n\t\tparams[:parent_pid] = m[2].to_i\n\t\tparams[:mem] = m[3].to_i\n\t\tparams[:cpu] = m[4].to_i\n\t\tparams[:cmdline] = m[5]\n\t\tparams[:command] = params[:cmdline].split(\" \").first\n\t\tparams\n\tend",
"def as_process(xml)\n xml.process(version: version,\n priority: priority,\n note: note,\n lifecycle: lifecycle,\n laneId: lane_id,\n elapsed: elapsed,\n attempts: attempts,\n datetime: created_at.to_time.iso8601,\n status: status,\n name: process)\n end",
"def process_tree\n return @process_tree if @process_tree\n @process_tree = {}\n ps.split(\"\\n\").each do |p|\n f = p.split\n pid = f.shift.to_i\n ppid = f.shift.to_i\n cmd = f.join ' '\n\n # create entry for this pid if not present\n @process_tree[pid] = {\n :children => []\n } unless @process_tree.key? pid\n\n # fill this entry\n @process_tree[pid][:ppid] = ppid\n @process_tree[pid][:pid] = pid\n @process_tree[pid][:cmd] = cmd\n\n # create entry for parent process if not present\n @process_tree[ppid] = {\n :children => []\n } unless @process_tree.key? ppid\n\n # fill parent's children\n @process_tree[ppid][:children] << pid\n end\n @process_tree\n end",
"def processes()\n\t\t\t\tprocesses = ProcessList.new()\n\t\t\t\tprocesslist = `ps auxww`\n\t\t\t\tprocessregex = /^(\\S+)\\s+([0-9]+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)$/\n\t\t\t\tprocesslist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = processregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tinfo = ProcessInfo.new()\n\t\t\t\t\t\tinfo.username = match[1]\n\t\t\t\t\t\tinfo.pid = match[2].to_i()\n\t\t\t\t\t\tinfo.flags = match[8]\n\t\t\t\t\t\tinfo.starttime = match[9]\n\t\t\t\t\t\tinfo.runtime = match[10]\n\t\t\t\t\t\tinfo.program = match[11]\n\t\t\t\t\t\tinfo.cpu = match[3].to_f()\n\t\t\t\t\t\tinfo.mem = match[4].to_f()\n\t\t\t\t\t\tif(processes.has_key?(info.pid))\n\t\t\t\t\t\t\traise(DuplicateProcessError, \"Process #{info.pid} appeared twice in the process listing\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprocesses[info.pid] = info\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(processes)\n\t\t\tend",
"def getProcessInfo\n rProcessInfo = nil\n rProcessParams = nil\n\n if (@Context.Properties[:Execute] != nil)\n lSymProcess = @Context.Properties[:Execute][:Process]\n rProcessInfo = @Context.Processes[lSymProcess]\n if (rProcessInfo == nil)\n raise RuntimeError.new(\"No process info associated to #{lSymProcess.to_s}\")\n end\n rProcessParams = @Context.Properties[:Execute][:Parameters] || {}\n end\n\n return rProcessInfo, rProcessParams\n end",
"def processes\n request('getAllProcessInfo')\n end",
"def sanitize_process_info(tags={})\n return nil if tags.empty?\n\n tags.each_with_object({}) do |(k, v), hash|\n hash[to_utf8(k)] = to_utf8(v)\n end\n end",
"def get_full_ps_info(pid)\n ps_fullcmd = @ps_fullcmd_fmt % pid\n # p ps_fullcmd\n output = `#{ps_fullcmd}`\n return output\n end",
"def format_rule_process\n XES::Trace.new.tap do |trace|\n trace.concept_name = \"rule_process %s\" % Util::UUID.generate\n trace.attributes << XES.string(\"pione:traceType\", \"rule_process\")\n trace.events = @rule_process_log.records.map do |record|\n XES::Event.new.tap do |event|\n # standard attributes\n event.concept_name = record.name\n event.org_resource = record.caller\n event.time_timestamp = record.timestamp\n event.lifecycle_transition = record.transition\n\n # pione extension attributes\n event.attributes << XES.string(\"pione:ruleType\", record.rule_type)\n end\n end\n end\n end",
"def normalize_process_status(body)\n return if body['processingStatus'].nil?\n\n processing_status = body['processingStatus']['id']\n TopdeskAPI::Resources::TicketStatus.name(processing_status)\n end",
"def status_info\n { \n :time => Time.now, :pid => Process.pid, :started => @started,\n :max_conns => @maxconns, :conns => @threads.length, :systimes => Process.times,\n :shutdown => @shutdown, :dead => @dead, :total_conns => @total_conns\n }.inspect\n end",
"def process_id\n attributes.fetch(:processId)\n end",
"def update_pids\n # memory isn't recorded with exceptions. need to set #last_memory_reading+ to -1 as\n # the memory used could have changed. for the next request the memory change will not be recorded.\n #\n # NOTE - the failure regex was not matching with a Rails Development log file.\n if has_line_type?(:failure) and processing = has_line_type?(:processing)\n pid_memory[:last_memory_reading] = -1\n elsif mem_line = has_line_type?(:memory_usage)\n memory_reading = mem_line[:memory]\n pid_memory[:current_memory_reading] = memory_reading\n # calcuate the change in memory\n unless pid_memory[:current_memory_reading] == -1 || pid_memory[:last_memory_reading] == -1\n # logged as kB, need to convert to bytes for the :traffic Tracker\n memory_diff = (pid_memory[:current_memory_reading] - pid_memory[:last_memory_reading])*1024\n if memory_diff > 0\n self.attributes[:memory_diff] = memory_diff\n end # if memory_diff > 0\n end # unless\n \n pid_memory[:last_memory_reading] = pid_memory[:current_memory_reading]\n pid_memory[:current_memory_reading] = -1\n end # if mem_line\n return true\n end",
"def read_proc_file(file)\n\t\tdata = ::File.read(file).split(\" \")\n\t\tuid = ::File.stat(file).uid\n\t\tpid = data[0]\n\t\tcommand = data[1].match(/^\\((.*)\\)$/)[1]\n\t\tcmdline = ::File.read(\"/proc/#{pid}/cmdline\").gsub(/\\0/, ' ')\n\t\tparent_pid = data[3].to_i\n\t\tutime = data[13].to_i\n\t\tktime = data[14].to_i\n\t\tvss = data[22].to_i / 1024\n\t\trss = data[23].to_i * 4\n\t\ttime = utime + ktime\n\n\t\t{\n\t\t\t:pid => pid,\n\t\t\t:uid => uid,\n\t\t\t:command => command,\n\t\t\t:cmdline => cmdline,\n\t\t\t:parent_pid => parent_pid,\n\t\t\t:mem => rss,\n\t\t\t:cpu => time,\n\t\t}\n\tend",
"def read_proc_file(file)\n\t\tdata = ::File.read(file).split(\" \")\n\t\tuid = ::File.stat(file).uid\n\t\tpid = data[0]\n\t\tcommand = data[1].match(/^\\((.*)\\)$/)[1]\n\t\tcmdline = ::File.read(\"/proc/#{pid}/cmdline\").gsub(/\\0/, ' ')\n\t\tparent_pid = data[3].to_i\n\t\tutime = data[13].to_i\n\t\tktime = data[14].to_i\n\t\tvss = data[22].to_i / 1024\n\t\trss = data[23].to_i * 4\n\t\ttime = utime + ktime\n\n\t\t{\n\t\t\t:pid => pid,\n\t\t\t:uid => uid,\n\t\t\t:command => command,\n\t\t\t:cmdline => cmdline,\n\t\t\t:parent_pid => parent_pid,\n\t\t\t:mem => rss,\n\t\t\t:cpu => time,\n\t\t}\n\tend",
"def process\n return @args[:process]\n end",
"def param_from_pid( param )\n tuples = {}\n `ps -eo pid,#{param}`.split(\"\\n\").each_with_index() do |row, index|\n next unless index > 0\n cols = row.split(' ')\n tuples[cols[0]] = cols[1]\n end\n tuples\nend",
"def get_process_stat\n self.get_all_pid.each do |pid|\n uid = self.get_uid_of_pid(pid)\n username = Etc::getpwuid(uid).name\n\n statline = IO.read(\"/proc/#{pid}/stat\")\n stat = statline.split(' ')\n #time = stat[13].to_i+stat[14].to_i+stat[15].to_i+stat[16].to_i\n time = stat[13].to_i+stat[14].to_i\n if (!@currprocstat.has_key?(username))\n @currprocstat[username] = 0\n end\n @currprocstat[username] = @currprocstat[username] + time \n\n iowait = stat[41].to_i\n if (!@currprociowait.has_key?(username))\n @currprociowait[username] = 0\n end\n @currprociowait[username] += iowait\n end\n end",
"def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend",
"def list_processes\n check_connection\n @fields = @protocol.process_info_command\n @result_exist = true\n store_result\n end",
"def process_detail_params\n params.require(:process_detail).permit(:process_name, :parent_process_id, :cost, :currency_type_id, :uom_detail_id)#, :project_detail\n end",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend",
"def all_processes\n `ps -eo pid,ppid`.lines.reduce(Hash.new []) do |hash, line|\n pid, ppid = line.split.map(&:to_i)\n hash[ppid] = [] unless hash.key?(ppid)\n hash[ppid] << pid\n hash\n end\n end",
"def process_names\n @processes.map { |p| @names[p] }\n end",
"def get_ps_info args={}, &block\n return if OS.windows?\n\n pid = args[:pid]\n\n EM.system('sh', proc{ |process|\n process.send_data \"ps auxw | grep \" + pid.to_s + \" | grep -v 'grep'\\n\"\n process.send_data \"exit\\n\"\n }) { |output, status|\n if status.exitstatus == 0\n format args, output, &block\n else\n block.call status, nil if block\n end\n }\n end",
"def info_string\n \"#{step}: #{process}\"\n end",
"def report(process_pids)\n ret = {}\n return ret if pid_stats_map.size == 0\n age_sec = 0\n cpu_pct = 0\n resident_set_bytes = 0\n threads = 0\n virtual_mem_bytes = 0\n pid_stats_map.each do |pid, stat|\n unless process_pids.include? pid\n pid_stats_map.delete(pid)\n next\n end\n age_sec += stat.perf_detail[:age_seconds]\n threads += stat.perf_detail[:threads]\n resident_set_bytes += stat.perf_detail[:mem][:resident_set_bytes]\n virtual_mem_bytes += stat.perf_detail[:mem][:virtual_mem_bytes]\n cpu_pct += process_cpu_pct stat.perf_detail[:cpu]\n end\n ret[:age_seconds] = age_sec\n ret[:threads] = threads\n ret[:mem] = {}\n ret[:mem][:resident_set_bytes] = resident_set_bytes\n ret[:mem][:virtual_mem_bytes] = virtual_mem_bytes\n ret[:cpu_pct] = cpu_pct\n ret\n end",
"def system_info\n si = SysInfo.new\n si.to_hash\n rescue \n {}\n end",
"def parseMemoryUsage(nodeInfo, str)\n\t #saveAssertion \"processInfo\", str\n\t b = str.scan(/[\\w\\.]+/)\n\t nodeInfo.pcpu = b[0]\n\t nodeInfo.pmem = b[1]\n\t nodeInfo.rss = b[3]\n\t nodeInfo.rsz = b[4]\n end",
"def parse_proc_stat\n file = '/proc/stat'\n puts \"Parsing #{file}\" if (@config[:verbose]) \n data = File.read(file)\n\n parsed = parse_proc_type_1(data)\n parsed[\"intr_total\"] = parsed[\"intr\"].slice(0,1)\n\n parsed.keys.grep(/^cpu/).sort.each do |cpu_id|\n [\"user_ticks\", \"user_nice_ticks\", \"system_ticks\", \"idle_ticks\", \"iowait_ticks\", \"irq_ticks\", \"softirq_ticks\"].zip(parsed[cpu_id]).each do |label,value|\n full_label = \"#{prefix}.stats.#{cpu_id}.#{label}\"\n prop_name = \"stats.#{label}\"\n emit_stats(prop_name, full_label, value)\n end\n end\n [\"btime\", \"ctxt\", \"intr_total\", \"softirq\", \"procs_blocked\", \"procs_running\", \"processes\"].each do |stat|\n full_label = \"#{prefix}.stats.#{stat}\" \n prop_name = \"stats.#{stat}\"\n value = parsed[stat].first\n \n emit_stats(prop_name, full_label, value)\n end\n end",
"def collect\n parse_process_list(multiline('top -l 1 -o mem -stats pid,mem,command'), split_tokens: 3) do |tokens| \n [tokens.first, tokens.last, hostname, plain_memory_value(tokens[1])]\n end\n end",
"def process_detail_params\n params.require(:process_detail).permit(:process_name, :parent_process_id, :cost, :belongs_to, :belongs_to, :belongs_to)\n end",
"def processes\n\t\tif ::File.directory? \"/proc\"\n\t\t\tresolve_unix_uids(linux_processes)\n\t\telsif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos_x_processes\n\t\tend\n\tend",
"def processes\n\t\tif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos = `uname -s`.chomp\n\t\t\tif os == \"Linux\"\n\t\t\t\tresolve_unix_uids(linux_processes)\n\t\t\telsif os == \"Darwin\" or os == \"FreeBSD\"\n\t\t\t\tos_x_processes\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend\n\tend",
"def process_id\n return @process_id\n end",
"def system_pids\n pids = `ps -e -o pid`.split(\"\\n\")\n pids.delete_at(0) # PID (header)\n pids.each(&:'strip!')\n end",
"def determine_ports\n ports = @info[:ports] = {}\n\n netstat = @shell.query('NETSTAT', \"netstat -ntlp|awk '{print $4, $NF}'\")\n netstat.lines.each do |line|\n net, process = line.split(/\\s+/, 2)\n process = process.split(/\\//, 2)[1]\n net = net.gsub(/([0-9.:]+):([0-9]+)/, '\\1 \\2')\n net, port = net.split(/ /, 2)\n\n ports[net] ||= {}\n ports[net][port] = process\n end\n end",
"def processes\n workflow_status.process_statuses.map do |process|\n WorkflowProcessPresenter.new(view: view, process_status: process)\n end\n end",
"def initialize(process); end",
"def proc_meminfo\n\n unless defined?(@proc_meminfo)\n\n @proc_meminfo = {}\n\n meminfo = IO.readlines('/proc/meminfo')\n meminfo.each do |meminfo_line|\n\n pairs = meminfo_line.strip.split(':', 2)\n key = pairs[0].strip\n value = pairs[1].strip\n\n # Remove \"kB\" from the value and multiply it by 1024.\n value = value.to_i * 1024\n\n @proc_meminfo[key] = value\n\n end\n\n end\n @proc_meminfo\n\n end",
"def remove_process_fix(opts)\n opts = check_params(opts,[:fix_info])\n super(opts)\n end",
"def process_state_params\n params.require(:process_state).permit(:id, :process_name, :process_action, :process_state, :process_info, :process_pid, :simulate_only, :start_time, :end_time, :region)\n end",
"def report_pid\n @process[:report_pid]\n end",
"def process_name\n\n\t\t::Pantheios::Core.process_name\n\tend",
"def process_id=(value)\n @process_id = value\n end",
"def processes\n process_cmd = case RUBY_PLATFORM\n when /djgpp|(cyg|ms|bcc)win|mingw/ then 'tasklist /v'\n when /solaris/ then 'ps -ef'\n else\n 'ps aux'\n end\n `#{process_cmd}`\nend",
"def procession\n @procession ||= fetch_procession\n end",
"def set_process_fix(opts)\n opts = check_params(opts,[:fix_info])\n super(opts)\n end",
"def _process_module_to_load(index, my_process, a_process)\n name = a_process[:process_module]\n\n if name.nil?\n PrcLib.warning(':process_module is empty. Process not properly loaded.')\n return\n end\n\n name = name.to_s if name.is_a?(Symbol)\n\n unless Lorj.processes.key?(name)\n PrcLib.warning(\"Unable to find Process module '%s'. Process not \"\\\n 'properly loaded.', name)\n return\n end\n\n module_process = Lorj.processes[name]\n my_process[:process_name] = name\n my_process[:process_path] = module_process.process\n my_process[:lib_name] = module_process.lib_name\n\n if a_process[:controller_path]\n my_process[:controller_path] = a_process[:controller_path]\n return my_process\n end\n\n _process_module_set_ctr(my_process, module_process.controllers,\n a_process[:controller_name])\n\n _process_load_data(config, index, name, module_process.defaults_file,\n PRC::SectionConfig)\n\n _process_load_data(Lorj.data, index, name, module_process.data_file)\n\n # TODO: Implement Object definition as a config layer.\n # _process_load_definition(definition, index, name,\n # module_process.definition)\n\n my_process\n end",
"def processes\n GoodData::Process.all\n end",
"def report_pid\n @process[:report_pid]\n end",
"def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n\t\tsystem_data[:version] = version\n\t\tsystem_data[:kernel] = kernel_version\n\t\tsystem_data[:hostname] = kernel_version.split(\" \")[1]\n\t\treturn system_data\n\tend",
"def infoFor(regex)\n info = `ps -eo pcpu,pid,pmem,args | sort -k 1 -r | grep #{regex} | head -1`\n info.split\n end",
"def create\n seperator = '###PROMPT###'\n\n organization = 'user1'\n hostname = processing_log_params[:hostname]\n os_version = '15.0.3'\n\n log = Log.find(processing_log_params[:log_id])\n parsed_log = log.content.gsub(/^\\[.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\\..*201[7|8|9]\\] /, \"\")\n .gsub(/^\\s*RP\\/.*:#{hostname}#\\s*/, seperator) # プロンプトごとにセパレータを付与。プロンプト内のホスト名は残さない(cisco_logedit.rbの踏襲))\n .gsub(/^(-+\\s*show running-config[^-]+.*-+)$/, seperator + '\\1') # system.tech 内の show running-config コマンドを分割ポイントとする('---(コマンド)---' となっている)\n .gsub(/^(\\-{3,}\\s*[^\\[\\]-]+\\[[^\\[\\]]+\\]\\s*\\-{3,})$/, '') # showtechファイル内のコマンド終了行は不要なので削除\n .gsub(/^(\\+{3,}\\s*[^\\[\\]+]+\\[[^\\[\\]]+\\]\\s*\\+{3,})$/, seperator + '\\1') # showtechファイル内のコマンド開始行ごとにセパレータを付与。開始行は残す(cisco_logedit.rbの踏襲)\n .split(seperator)\n\n cmd_logs = parsed_log.inject([]) do |cmd_logs, cmd|\n result = cmd.lines\n command_name = remove_prompt(result.first&.chomp, hostname)&.gsub(/\\s*$/, '')\n\n # コマンドが空であれば無効な行としてスルー\n next cmd_logs if command_name.blank?\n\n cmd_logs << {\n name: command_name,\n name_without_pipe: command_name.split('|').first.gsub(/\\s*$/, ''),\n result: result.join\n }\n end\n\n plugins = PluginLoader.instance.plugins\n cmd_logs.each do |cmd_log|\n appliers = plugins.select {|p| p.apply_to?(key: organization, cmd_name: cmd_log[:name], os_version: os_version) }\n\n appliers.each do |p|\n cmd_log[:result] = p.process_something(cmd_log[:result])\n end\n end\n new_content = cmd_logs.map {|cmd_log| cmd_log[:result]}.join\n\n processed_log = ProcessedLog.new(log: log, content: new_content)\n if processed_log.save\n redirect_to processed_log_path(processed_log), notice: 'ProcessedLog was successfully created.'\n else\n render :new\n end\n end",
"def proc_name\n data = read_cpuinfo.match(/model name\\s*:\\s*(.+)/)[1]\n\n return data.strip\n end",
"def process_class\n get_class_for :process_class,\n RailsWorkflow.config.process_class\n end",
"def process\n save_as(:processed)\n end",
"def swap_memory_info\n\n if PlatformInfo.linux?\n\n {\n :total => proc_meminfo['SwapTotal'],\n :used => proc_meminfo['SwapTotal'] - proc_meminfo['SwapFree'],\n :cached => proc_meminfo['SwapCached'],\n :free => proc_meminfo['SwapFree']\n }\n\n elsif PlatformInfo.osx?\n\n swapusage = capture_command_output('sysctl', 'vm.swapusage')[0].strip\n swap = {}\n swap_pairs = swapusage.gsub(/^vm\\.swapusage\\:\\s+/, '').split(/\\s{2,}/)\n swap_pairs.each do |swap_pair|\n\n items = swap_pair.split('=', 2)\n key = items[0].strip\n value = items[1].strip.to_i * 1024 * 1024 # Convert MB to bytes\n\n swap[key] = value\n\n end\n\n {\n :total => swap['total'],\n :used => swap['used'],\n :free => swap['free']\n }\n \n else\n unsupported_platform\n end\n\n end",
"def _process_format(format); end",
"def _process_format(format); end",
"def plist(psname)\n counter = 0\n %x{ps h -o rss,size,vsize,pcpu -C #{psname}}.each do |ps|\n rss,size,vsize,cpu = ps.split\n counter += 1\n puts \"#{psname}_#{counter}.value #{rss}\"\n\n end\n return\nend",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def stats\n # Memory stats may show more processes than status.\n status = passenger_status\n passenger_memory_stats.each_pair.inject({}) do |hash, (pid, stats)|\n hash[pid] = stats\n stats.merge! status[pid] if status[pid]\n\n hash\n end\n end",
"def to_s\n process || \"(objectClass=*)\"\n end",
"def initialize(process)\n self.process = process\n end",
"def to_hash\n {\n 'command' => command,\n 'output' => output,\n 'exit_code' => exit_code,\n 'start_time' => start_time,\n 'finish_time' => finish_time,\n 'duration' => duration\n }\n end",
"def info(input)\n return nil unless pdf?(input)\n command = \"pdfinfo #{input.shellescape}\"\n result = command_stdout(command)\n info = {}\n result.each_line do |line|\n key, value = line.chomp.split(':')\n info[key] = value.strip\n end\n info\n end",
"def to_hash\n {\n :argv => @argv,\n :started => @started.to_i,\n :ended => @ended.to_i,\n :elapsed => elapsed,\n :pid => @pid,\n :retval => ((@status.nil? and @status.exited?) ? nil : @status.exitstatus)\n }\n end",
"def diagnose\n result = {}\n result[:process_erb] = @process_erb\n result[:process_local] = @process_local\n result[:process_global] = @process_global\n result[:global_config] = diagnose_component(:global_yaml, global_config_file)\n result[:project_config] = diagnose_component(:yaml, config_file)\n result[:local_config] = diagnose_component(:local_yaml, local_config_file)\n result[:combined_config] = diagnose_component(:combined_hash)\n result\n end",
"def to_ps\n ret = \"#{self.class.name}:\\n\"\n c = 0\n @fields.each_pair do |p|\n field = p[1]\n next if field.nil?\n if field.is_a?(NumField) || field.is_a?(ApduList)|| field.is_a?(VarNumField)\n if field.optfield.nil? || field.optfield.value == 1\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, field.hexstr)\n else\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \"--\")\n end\n c = 0\n else #only for bitfield\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \" \" * c + field.bitstr)\n c += field.length\n end\n end\n return ret\n end",
"def physical_memory_info\n\n if PlatformInfo.linux?\n\n {\n :total => proc_meminfo['MemTotal'],\n :used => proc_meminfo['MemTotal'] - proc_meminfo['MemFree'],\n :cached => proc_meminfo['Cached'],\n :free => proc_meminfo['MemFree'] \n }\n\n elsif PlatformInfo.osx?\n\n hw_memsize = capture_command_output('sysctl', 'hw.memsize')[0]\n total_memory = hw_memsize.split(':')[1].strip.to_i\n\n # Parse the header information produced by top -l 1 to figure out the\n # physical memory stats.\n top = capture_command_output('top', '-l', '1')\n top_phys_mem = top.select { |t| t =~ /^PhysMem\\:/ }.first.strip.gsub(/^PhysMem\\:\\s+/, '')\n top_phys_mem_pairs = top_phys_mem.split(',')\n\n phys_mem = {}\n top_phys_mem_pairs.each do |top_phys_mem_pair|\n items = top_phys_mem_pair.strip.split(/\\s+/)\n key = items[1].gsub(/\\W/, '')\n value = items[0].to_i * 1024 * 1024 # Convert MB to bytes\n phys_mem[key] = value\n end\n\n {\n :total => total_memory,\n :used => phys_mem['used'],\n :free => phys_mem['free']\n }\n\n else\n unsupported_platform\n end\n\n end",
"def to_info_hash\n return {} if @output.empty?\n meta = @output.split(\" \")\n # Count backwards as an image's path may contain a space\n {\n path: meta[0..-9].join(\" \"),\n format: meta[-8],\n dimensions: meta[-7].split(\"x\").map(&:to_i),\n depth: meta[-5],\n size: meta[-3]\n }\n end",
"def to_config\n \" PROCESSOR #{@name} #{self.class.name.to_s.class_name_to_filename} #{@item_name} #{@value_type}\\n\"\n end",
"def up_ids\n with_fig(%w(ps -q)) do |exec_obj|\n exec_obj.run\n\n # parse stdout..\n re = Regexp.new '^[0-9a-zA-Z]+'\n res = []\n\n exec_obj.stdout.split(\"\\n\").each do |line|\n next unless line.match(re)\n res << line.chomp.strip\n end\n\n return res\n end\n nil\n end",
"def get_process_array(wmi)\r\n # This looks clumsy, but the processes object doesn't support #map. :)\r\n processes=wmi.ExecQuery(\"select * from win32_process where name='WINWORD.EXE'\")\r\n ary=[]\r\n processes.each {|p|\r\n ary << p.ProcessId\r\n }\r\n processes=nil\r\n ary\r\nend",
"def application_process_params\n params.require(:application_process).permit(:application_ids, :name, :description)\n end",
"def save_pid\n @deployment.pid = Process.pid\n @deployment.save!\n end",
"def save_pid\n @deployment.pid = Process.pid\n @deployment.save!\n end",
"def all_processes\r\n h = CALLS[\"kernel32!CreateToolhelp32Snapshot:LL=L\"].call(0x2, 0)\r\n if h != -1\r\n pi = [(9*4)+2048,0,0,0,0,0,0,0,0,\"\\x00\"*2048].pack(\"LLLLLLLLLa2048\")\r\n if CALLS[\"kernel32!Process32First:LP=L\"].call(h, pi) != 0\r\n yield str2process_info(pi)\r\n while CALLS[\"kernel32!Process32Next:LP=L\"].call(h, pi) != 0\r\n yield str2process_info(pi)\r\n end\r\n end\r\n else\r\n raise WinX.new(:create_toolhelp32_snapshot)\r\n end\r\n end",
"def pid_memory\n file_format.pids[self[:pid]] ||= { :last_memory_reading => -1, :current_memory_reading => -1 }\n end",
"def parse_program(prog)\n prog_bytes = to_bytes(prog)\n data = {}\n raise \"Invalid program\" unless prog[0, 4] == 'PROG'\n name = prog[4...16]\n data[:name] = program_name(prog)\n\n HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)|\n # single byte value\n value = prog_bytes[ms_offset]\n data[key] = value\n # high resolution value\n value_hr = (value << 2) | ((prog_bytes[ls_offset] >> ls_pos) & 0x03)\n data[:\"#{key}_hr\"] = value_hr\n if units\n # converted value:\n data[:\"#{key}_#{units}\"] = CONVERTERS[units][value_hr]\n end\n end\n\n CONV_PARAMS.each do |(key, offset, bit_pos, bit_len, units)|\n value = bits(prog_bytes[offset], bit_pos, bit_len)\n data[key] = CONVERTERS[units][value]\n if value != data[key]\n data[:\"#{key}_value\"] = value\n end\n end\n\n data[:seq_notes] = (96..426).step(22).map{|offset| note_name prog_bytes[offset]}\n (data[:step_length]...data[:seq_notes].size).each do |i|\n data[:seq_notes][i] = ''\n end\n # puts data[:seq_notes].join(' ')\n\n data[:lfo_rate_vis] = data[:lfo_bpm_sync] == 'ON' ? data[:lfo_rate_bpm] : data[:lfo_rate_hr]\n data[:eg_int_abs] = data[:eg_int_signed].abs\n data[:lfo_int_abs] = data[:lfo_int_signed].abs\n data\nend",
"def get_process_with_http_info(process_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProcessApi.get_process ...'\n end\n # verify the required parameter 'process_id' is set\n if @api_client.config.client_side_validation && process_id.nil?\n fail ArgumentError, \"Missing the required parameter 'process_id' when calling ProcessApi.get_process\"\n end\n # resource path\n local_var_path = '/processes/{processId}'.sub('{' + 'processId' + '}', process_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', 'partner-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 => 'GetProcess')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProcessApi#get_process\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def msg_info_to_csv(base_file_name,x)\n # first parm is base file name then \n # expect single hash where key is msgid and value is \n # instance of log_msg_info class\n if !$msg_info_open then \n $msg_info_out = File.new($diag_dir + $directory_separator + $base_file_name + \"_msg_info.csv\",\"w\")\n $msg_info_open = true\n _title_line = \"server guid,server host,msg id,startup,processing status,create time,msg size,processing duration,\" +\n \"delivery begin time,in-queue wait duration,ident id,task id,\" +\n \"timeout value,method name,msg data store,data msg cmd,class name, instance number,error text,msg role,msg zone, create pid, process pid,priority,Args,worker id\"\n $msg_info_out.puts(_title_line)\n # don't make any assumptions about msg id begin or end values,\n # just process what you have....\n end\n x.each { |key, instance|\n# if key == 2 || key == '2' then\n# puts \"\"\n# end\n if instance.msg_queued_time == nil || instance.msg_queued_time == \"\" then\n if instance.deliver_begin_time.class != instance.create_time.class then\n# puts \"#{File.basename(__FILE__)}:#{__LINE__}\"\n instance.msg_queued_time = -1\n else\n instance.msg_queued_time = instance.deliver_begin_time - instance.create_time\n end\n end\n instance.data_msg_cmd = instance.data_msg_cmd.tr('[]',' ').strip if instance.data_msg_cmd != nil\n if instance.msg_class_name == nil then # if the message has no class name\n\n if instance.data_msg_cmd == nil then \n# puts \"#{__FILE__}:#{__LINE__}- #{instance.inspect}\"\n instance.msg_class_name = instance.msg_role\n else \n\n _work_array = instance.data_msg_cmd.split(\".\") # lets try to build one from the msg cmd\n if _work_array.size > 1 then # if the msg cmd has a '.' then assume that to be the class\n instance.msg_class_name = _work_array[0].tr('[',' ').strip # and inject it into the msg_class_name value\n end\n end \n end\n if $Startups[$startup_cnt][\"server_guid\"] != nil then\n if !$msg_server_guid.has_key?($Startups[$startup_cnt][\"server_guid\"]) || $msg_server_guid.empty? then\n $msg_server_guid[$Startups[$startup_cnt][\"server_guid\"]] = 1\n else\n $msg_server_guid[$Startups[$startup_cnt][\"server_guid\"]]+= 1\n end\n end\n\n if $Startups[$startup_cnt][\"hostname\"] != nil then\n if !$msg_server_host.has_key?($Startups[$startup_cnt][\"hostname\"]) || $msg_server_host.empty? then\n $msg_server_host[$Startups[$startup_cnt][\"hostname\"]] = 1\n else\n $msg_server_host[$Startups[$startup_cnt][\"hostname\"]] += 1\n end\n end\n if instance.msg_delivery_complete_status != nil then\n if !$msg_processing_status.has_key?(instance.msg_delivery_complete_status) || $msg_processing_status.empty? then\n $msg_processing_status[instance.msg_delivery_complete_status] = 1\n else\n $msg_processing_status[instance.msg_delivery_complete_status] += 1\n end\n end\n if instance.ident_id != nil then\n if !$msg_ident_id.has_key?(instance.ident_id) || $msg_ident_id.empty? then\n $msg_ident_id[instance.ident_id] = 1\n else\n $msg_ident_id[instance.ident_id] += 1\n end\n end\n if instance.task_id != nil then\n if !$msg_task_id.has_key?(instance.task_id) || $msg_task_id.empty? then\n $msg_task_id[instance.task_id] = 1\n else\n $msg_task_id[instance.task_id] += 1\n end\n end\n if instance.msg_method_name != nil then\n if !$msg_method_name.has_key?(instance.msg_method_name) || $msg_method_name.empty? then\n $msg_method_name[instance.msg_method_name] = 1\n else\n $msg_method_name[instance.msg_method_name] += 1\n end\n end\n if instance.msg_data_store != nil then\n if !$msg_data_store.has_key?(instance.msg_data_store) || $msg_data_store.empty? then\n $msg_data_store[instance.msg_data_store] = 1\n else\n $msg_data_store[instance.msg_data_store] += 1\n end\n end\n if instance.data_msg_cmd != nil then\n if !$msg_data_msg_cmd.has_key?(instance.data_msg_cmd) || $msg_data_msg_cmd.empty? then\n $msg_data_msg_cmd[instance.data_msg_cmd] = 1\n else\n $msg_data_msg_cmd[instance.data_msg_cmd] += 1\n end\n end\n if instance.msg_class_name != nil then\n if !$msg_class_name.has_key?(instance.msg_class_name) || $msg_class_name.empty? then\n $msg_class_name[instance.msg_class_name] = 1\n else\n $msg_class_name[instance.msg_class_name] += 1\n end\n end\n if instance.error_text != nil then\n if !$msg_error_text.has_key?(instance.error_text) || $msg_error_text.empty? then\n $msg_error_text[instance.error_text] = 1\n else\n $msg_error_text[instance.error_text] += 1\n end\n end\n if instance.msg_role != nil then\n if !$msg_role.has_key?(instance.msg_role) || $msg_role.empty? then\n $msg_role[instance.msg_role] = 1\n else\n $msg_role[instance.msg_role] += 1\n end\n end\n if instance.msg_zone != nil then\n if !$msg_zone.has_key?(instance.msg_zone) || $msg_zone.empty? then\n $msg_zone[instance.msg_zone] = 1\n else\n $msg_zone[instance.msg_zone] += 1\n end\n end\n# if instance.msg_args != nil then\n if !$msg_args.has_key?(instance.msg_args) || $msg_args.empty? then\n $msg_args[instance.msg_args] = 1\n else\n $msg_args[instance.msg_args] += 1\n end\n# end\n $msg_info_out.puts(\"#{$Startups[$startup_cnt][\"server_guid\"]},#{$Startups[$startup_cnt][\"hostname\"]},\" +\n \"#{key},#{instance.msg_startup_cnt},#{force_empty_string(instance.msg_delivery_complete_status)},#{instance.create_time},\" +\n \"#{instance.msg_size},#{instance.msg_process_duration},#{instance.deliver_begin_time},#{instance.msg_queued_time},\" +\n \"#{instance.ident_id},#{instance.task_id},#{instance.timeout_duration},#{force_empty_string(instance.msg_method_name)},\" +\n \"#{force_empty_string(instance.msg_data_store)},#{force_empty_string(instance.data_msg_cmd)},#{force_empty_string(instance.msg_class_name)},#{instance.msg_instance_id},\" +\n \"#{force_empty_string(instance.error_text)},\" +\n \"#{force_empty_string(instance.msg_role)},#{force_empty_string(instance.msg_zone)},\" +\n \"#{instance.put_pid},#{instance.process_pid},#{instance.msg_priority},#{force_empty_string(instance.msg_args)},#{instance.worker_id}\")\n \n }\n if x.size > 1 then # if only a single element in hash then leave open as updates are dribbling ine\n #otherwise expect it is final cleanup with many instances\n # and close up at that point\n $msg_info_out.close\n $msg_info_open = nil\n end\n end",
"def format_parcel_id(pid)\n \"#{pid[0..1]} #{pid[2..3]} #{pid[4..5]} #{pid[6]} #{pid[7..9]} #{pid[10..12]}.#{pid[13..15]}\"\n end",
"def child_process(result)\n end",
"def get_process_pids(image_name)\n pid_array = Array.new\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n pid_array << line.split(/ +/)[1]\n end\n end\n return pid_array\n end",
"def set_process_detail\n @process_detail = ProcessDetail.find(params[:id])\n end",
"def set_process_detail\n @process_detail = ProcessDetail.find(params[:id])\n end"
] | [
"0.7030795",
"0.65685403",
"0.6195479",
"0.6195479",
"0.6183281",
"0.6039276",
"0.5970406",
"0.58084816",
"0.5759076",
"0.5759076",
"0.5752947",
"0.5752947",
"0.57230866",
"0.5687424",
"0.56417674",
"0.5616874",
"0.5593775",
"0.5573327",
"0.5570639",
"0.5551441",
"0.5549775",
"0.5545489",
"0.5512008",
"0.5447452",
"0.544583",
"0.544583",
"0.5437211",
"0.5431664",
"0.53853124",
"0.53636837",
"0.5360677",
"0.5339992",
"0.53304565",
"0.53304565",
"0.5287464",
"0.52830744",
"0.52746797",
"0.5267673",
"0.52558815",
"0.5232172",
"0.5223272",
"0.5216273",
"0.52088475",
"0.5204629",
"0.5187256",
"0.5174432",
"0.51624054",
"0.51105994",
"0.5088734",
"0.50861377",
"0.5083007",
"0.5082363",
"0.50710464",
"0.5061229",
"0.50556403",
"0.50436443",
"0.50407434",
"0.49860966",
"0.49689603",
"0.49131095",
"0.49086446",
"0.48953396",
"0.48913687",
"0.48790053",
"0.48721805",
"0.48562217",
"0.48518562",
"0.48380914",
"0.48290157",
"0.482876",
"0.48241106",
"0.48241106",
"0.4821177",
"0.47972035",
"0.47950938",
"0.47934908",
"0.47930545",
"0.47911292",
"0.478919",
"0.47875163",
"0.478694",
"0.47869375",
"0.47816086",
"0.47738597",
"0.477341",
"0.47730264",
"0.4770362",
"0.476589",
"0.47604936",
"0.47604936",
"0.4759288",
"0.47578126",
"0.47575092",
"0.47550333",
"0.4751979",
"0.4751012",
"0.474653",
"0.474543",
"0.47449845",
"0.47449845"
] | 0.59142554 | 7 |
Timecomplexity: O(n^2), Inplace will be using Knuth series :3n+1 | def shell_sort(a)
n=a.length
h=1
while (h<n/3) #for computing increment factor "h"
h= (3*h)+1
end
while h>=1
# Logic of insertion sort with inrement steps of "h"
for i in h...n
j=i
while j>=h
if a[j-h]>a[j]
temp=a[j]
a[j]=a[j-h]
a[j-h]=temp
end
j-=h
end
end
h/=3
end
return a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n result = (result + k - 1) % i + 1\n end\n \n result\nend",
"def josephus_survivor(n,k)\n arr = (1..n).to_a\n\n while arr.length > 1\n idx = k % arr.length\n\n if arr.length > k\n arr = arr.drop(k) + arr.take(k - 1)\n elsif arr.length == k \n arr = arr[0...-1]\n else\n arr = arr.drop(idx) + arr.take(idx - 1)\n end\n end\n \n arr[0]\nend",
"def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend",
"def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend",
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solve2( n = 150_000_000 )\n # Brute force.\n sum = 10\n i = 20\n\n while i < n\n if 0 != i % 3\n i2 = i*i\n\n # Must verify that the primes are consecutive (i.e. there aren't any\n # primes hiding between entries).\n if (i2 + 1).miller_rabin? &&\n (i2 + 3).miller_rabin? &&\n (i2 + 7).miller_rabin? &&\n (i2 + 9).miller_rabin? &&\n !(i2 + 11).miller_rabin? &&\n (i2 + 13).miller_rabin? &&\n !(i2 + 17).miller_rabin? &&\n !(i2 + 19).miller_rabin? &&\n !(i2 + 21).miller_rabin? &&\n !(i2 + 23).miller_rabin? &&\n (i2 + 27).miller_rabin?\n \n sum += i\n i += 315410\n end\n end\n\n # From observation that 10 | a_n in similar sequences.\n i += 10\n end\n\n sum\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",
"def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end",
"def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend",
"def solution(a)\n # we could do radix sort and then loop over all the items in order to find the missing element\n # in the ordered list or use the Gauss theorem: https://study.com/academy/lesson/finding-the-sum-of-consecutive-numbers.html\n #\n # if we use the Gauss theorem we can do:\n # sum = (1 + N+1) * ( N / 2 )\n #\n # if (1 + N+1) % 2 == 1 we need to sum also (n+1+1)/2 + 1\n #\n # then remove every item from the sum: the remainder is the missing number\n len = a.length\n sum = (1 + len + 1) * ((len + 1) / 2)\n sum += ((len + 1) / 2.0).ceil unless (len + 1) % 2 == 0\n\n a.reduce(sum) do |sum, i|\n sum - i\n end\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend",
"def first_lucas(n)\n (0..n - 1).collect { |num| nth_lucas num }\nend",
"def pretentious_primes(arr, nth)\n\n arr.map do |ele|\n primes = 0\n i = ele\n\n if nth > 0\n while primes < nth\n i += 1\n primes += 1 if is_prime?(i)\n end\n i\n else \n while i > 0 && primes < -(nth)\n i -= 1\n primes += 1 if is_prime?(i)\n end\n i == 0 ? nil : i\n end\n end\n\nend",
"def pretentious_primes(arr, n)\n pretentious_primes = []\n\n if n > 0\n arr.each do |x|\n primes = []\n i = (x + 1)\n while primes.length <= n\n primes << i if prime?(i)\n i +=1\n end\n pretentious_primes << primes[n-1]\n end\n elsif n < 0\n arr.each do |x|\n primes = []\n i = (x - 1)\n while primes.length <= -n\n if i <= 1\n primes << nil\n else\n primes << i if prime?(i)\n end\n i -=1\n end\n pretentious_primes << primes[(-n)-1]\n end\n else\n pretentious_primes = arr\n end\n pretentious_primes\nend",
"def compute(n)\n a = []\n a.push(1)\n a.push(1)\n n -=1\n first = 1\n second = 1\n n.times do\n third = first + second\n first = second\n second = third\n a.push(third)\n end\n #first\n a\nend",
"def boustrophedon_at(k,n)\n raise ArgumentError.new \"k must be < size\" unless k < size\n raise ArgumentError.new \"n must be < size\" unless n < size\n return 0 if n < 0 || k < n\n @b_cache ||= []\n @b_cache[k] ||= []\n\n @b_cache[k][n] ||= if k==0\n self[k]\n else\n boustrophedon_at(k,n-1) + boustrophedon_at(k-1,k-n)\n end\n end",
"def k_numbers_missing(arr,n)\n nums_missing = (1..n).to_a.length - arr.length\n\n expected_sum = (1..n).to_a.reduce(:+)\n actual_sum = arr.reduce(:+)\n\n expected_factorial = (1..n).to_a.reduce(:*)\n actual_factorial = arr.reduce(:*)\n\n sum_diff = expected_sum - actual_sum\n combos = all_number_combos(sum_diff,nums_missing)\n\n combos.each do |combo|\n set = expected_factorial\n combo.each do |num|\n if set / num == actual_factorial\n return combo\n else\n set = set / num\n end\n end\n end\nend",
"def euler29(n)\n terms = []\n 2.upto(n) do |i|\n 2.upto(n) do |j|\n if terms.include?(i ** j) == false\n terms << i ** j\n end\n end\n end\n \n terms.length\nend",
"def fibs(j,k)\n\t@goal = 4000000\n\ti = j\n\tj = k\n\tk = i + j\n unless k > @goal\n \t@fib_array << k\n fibs(j,k)\n end\nend",
"def three_sum(nums)\n n = nums.length\n result = []\n for i in 0...n-2\n req_sum = 0\n hsh = Hash.new\n curr_sum = req_sum - nums[i]\n \n for j in (i+1)...n\n num = curr_sum - nums[j]\n if hsh[num]\n elements = [nums[i], num, nums[j]].sort\n result << elements unless result.include?(elements)\n end\n hsh[nums[j]] = true\n end \n end\n result\nend",
"def sieve(n) # quickly makes array of all primes from 2 to n\n s = 3.step(n, 2).to_a # make array of odd integers from 3 to n. Skip evens. \n s.each do |p|\n next if p.nil? # go to next element if p has been marked empty\n break if p * p > n # p only needs to go up to sqrt(n)\n\n k, pval = 0, 0\n\n while pval < n\n pval = p * (p + k) # jump forward 2p at a time: p*p, p*p + 2p, p*p + 4p, etc.\n\n # Set all those multiples to nil. i = (pval - 3)/2 translates pvals to index i\n\n s[(pval - 3) / 2] = nil \n k += 2 \n end\n\n end\n s.compact! # removes all nil elements from array\n s.unshift(2).sort # adds 2 as 1st element\nend",
"def three_sum(nums)\n return [] if !nums || nums.size < 3\n ans = []\n i = 0 \n size = nums.size\n nums = nums.sort\n while i < size do \n if nums[i] == nums[i - 1] && i > 0 \n i += 1\n next\n end\n\n a = nums[i]\n target = -1 * a\n two_sum(nums[(i + 1)...size], target, a, ans)\n i += 1\n end\n ans\nend",
"def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend",
"def linear_search(n)\n\t(1..100).to_a.shuffle.each do |x|\n\t\tif x == n\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def fibo(n)\n (1..n).inject([]) { |memo, i| [1, 2].include?(i) ? memo << i : memo << (memo.last + i) }\nend",
"def josephus_survivor(n,k)\n # (1..n) people are put into the circle\n items = (1..n).to_a\n Array.new(n){items.rotate!(k-1).shift}.last\nend",
"def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend",
"def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def prime_factorization(n)\n return [n] if is_prime?(n)\n\n # factors(n).each do |factor|\n # return [prime_factorization(factor), prime_factorization(n/factor)].flatten\n # end\n factor = factors(n)[0]\n prime_factorization(factor) + prime_factorization(n/factor)\n \n \nend",
"def josephus(items,k)\n n = -1\n out = []\n while items.length > 0 do \n n = (n + k) % items.length \n out.push(items.slice!(n))\n n -= 1 \n end\n out\nend",
"def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\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 fibonacci_iterative(n)\n arr = [1,1]\n return arr.take(n) if n <= 2\n (3..n).each do |el|\n arr << arr[-1] + arr[-2]\n end\n arr[-1]\nend",
"def mersenne_prime(n)\n arr = []\n k = 2\n i = 3\n until arr.length == n\n if is_prime?(i)\n arr << i\n k += 1\n i = (2 ** k).to_i - 1\n else\n k += 1\n i = (2 ** k).to_i - 1\n end\n end\n arr[-1]\nend",
"def left_rotate_array_optimized(arr, d, n)\n \n gcd = gcd(d, n) - 1\n \n (0..gcd).each do |i|\n temp = arr[i]\n j = i\n while 1\n k = j + d\n k = k - n if k >=n\n break if k == i\n arr[j] = arr[k]\n j = k\n end\n arr[j] = temp\n end\n return arr\nend",
"def dbl_linear(n)\n result = [1] # base\n\n i = 0 # pointer for 2x + 1\n j = 0 # pointer for 3x + 1\n\n until result.size == n + 1 # because n is an index (size - 1)\n list1 = 2 * result[i] + 1\n list2 = 3 * result[j] + 1\n min = [list1, list2].min\n\n result << min\n\n i += 1 if min == list1\n j += 1 if min == list2\n end\n\n result.last\nend",
"def fibo_finder(n)\n\tfib = [0,1]\n\t(n+1).times do |i| \t\n \t\tfib << fib[i-1] + fib[i-2] unless i == 0 || i == 1 \t\n\tend\n\tfib[n]\nend",
"def solve(n, k)\n k.times do\n nums.push(nums.shift)\n end\n return nums\nend",
"def fibonacci(n) # O(n) O(n)\n raise ArgumentError if n < 0\n return fib_helper([0, 1], 2, n)\nend",
"def josephus(n,k)\n if(n == 1)\n return 0\n end\n\n (josephus(n-1, k) + k) % n\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def hamming(n)\n seen = [1]\n i,j,k = 0,0,0\n\n until seen.size >= n\n seen << [seen[i] * 2, seen[j] * 3, seen[k] * 5].min\n i += 1 if seen[i] * 2 == seen.last\n j += 1 if seen[j] * 3 == seen.last\n k += 1 if seen[k] * 5 == seen.last\n end\n\n seen.last\nend",
"def ideal_numbers(n)\n # perfects = []\n # factors = proper_factors(n)\n\n # while perfects.length <= n \n # factors.each do |factor|\n # sum = aliquot_sum(n)\n \n # if factor == perfect_number?(factor)\n # perfects << factor\n # end \n # end \n # end\n\n perfect_nums = []\n\n i = 1\n while perfect_nums.length < n \n perfect_nums << i if perfect_number?(i)\n i += 1\n end \n\n perfect_nums\nend",
"def fib_method(n)\r\n\tfib_array = []\r\n\ti = 0\r\n\t\twhile i < n do\r\n\t\t\tif i == 0 || i == 1\r\n\t\t\tfib_array.push(i)\r\n\t\t\telse\r\n\t\t\tfib_array.push(fib_array[i-2] + fib_array[i-1])\r\n\t\t end\r\n\t\ti +=1 \r\n\tend \r\n\tfib_array\r\nend",
"def bhaskara_brouncker(n)\r\n\t\tt = sqrt = isqrt(n)\r\n\t\tu, u1 = 0, sqrt\r\n\t\tc, c1 = 1, n - sqrt ** 2\r\n\t\ta, a1 = 1, sqrt\r\n\t\tb, b1 = 0, 1\r\n\r\n\t\tuntil 1 == c1\r\n\t\t\tt = (sqrt + u1) / c1\r\n\t\t\tu1, u = t * c1 - u1, u1\r\n\t\t\tc1, c = c + t * (u - u1), c1\r\n\t\t\ta1, a = a + t * a1, a1\r\n\t\t\tb1, b = b + t * b1, b1\r\n\t\tend\r\n\r\n\t\treturn a1, b1\r\n\tend",
"def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def fib_it(n)\n fib_array = [1, 1]\n return fib_array if n == 2\n return [1] if n == 1\n\n (3..n).count { fib_array << fib_array[-2] + fib_array[-1] }\n\n fib_array\nend",
"def fibonacci3(num)\n array = [0,1]\n def inner(num,array)\n array += [array[-1] + array[-2]]\n if array[-1] < num\n array = inner(num,array)\n end\n return array\n end\n array = inner(num,array)\n return array\nend",
"def ullman(nums, t, k)\n return false if nums.size < k\n nums.sort[0...k].reduce(:+) < t\nend",
"def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend",
"def solution(h)\n n = h.size\n return 0 if n == 0\n stack = [h.first]\n blocks = 0\n (1...n).each { |y|\n if h[y] != stack.last\n while !stack.empty? && h[y] < stack.last\n stack.pop\n blocks += 1\n end\n stack << h[y] unless stack.last == h[y]\n end # != last\n }\n blocks += stack.count\nend",
"def rearrangeLastN(l, n)\n return l if n == 0\n fast, slow = l, l\n n.times do\n if fast\n fast = fast.next\n end\n end\n return l unless fast\n while fast.next\n slow = slow.next\n fast = fast.next\n end\n\n result = slow.next\n slow.next = nil\n fast.next = l\n result\nend",
"def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend",
"def tribonacci(signature, n)\n #your code here\n (n - 3).times do\n signature << signature.last(3).sum\n end\n signature.first(n)\nend",
"def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend",
"def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end",
"def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend",
"def removNb(n)\n results = []\n (2..n).each do |a|\n b = (n*(n+1)/2.0-a)/(a + 1)\n results << [a, b.to_i] if b % 1 == 0 && b < n && b > 2\n end\n results\nend",
"def solution(h)\n h.inject([1, [h.first]]) do |(blocks, stack), n|\n next [blocks+1, stack.push(n)] if stack.last < n\n stack.pop while stack.any? && stack.last > n\n next [blocks, stack] if stack.last == n\n \n [blocks+1, stack.push(n)]\n end.first\nend",
"def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend",
"def n_naught_brute_vs_recursive(a)\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n\n while time_brute < time_recursive do\n a << a.sample\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n end\n\n result = a.length\nend",
"def fold_array(array, runs)\n solution = []\n\n\n if runs ==1 and array.length == 1\n solution.push(array[0])\n return solution\n####################\n elsif runs == 1\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n return solution\n#######################\n elsif runs == 2\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n nextrun = solution\n if nextrun.length.even?\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-2) do |x|\n solution[x] = nextrun[x] + nextrun[array.length - (x+1)]\n end\n solution.push(nextrun[mid] + nextrun[mid - 1])\n else\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n end\n return nextrun\n########################\n elsif runs == 3\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n nextrun = solution\n if nextrun.length.even?\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-2) do |x|\n solution[x] = nextrun[x] + nextrun[array.length - (x+1)]\n end\n solution.push(nextrun[mid] + nextrun[mid - 1])\n else\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n end\n ######\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n return nextrun\n #return [nextrun[0] + nextrun[1]] if nextrun.length == 2\n\n\n end\n\n\n\nend",
"def primes(n, k = 1, acc = [])\n if n <= k then acc\n else primes(n - 1, k, if prime?(n) then acc.push(n) else acc end)\n end\nend",
"def r(p,n,a,s)\n j = p[a-1] - s - 1\n v = 0\n i = 0\n for i in 0..(j-1) do\n v += b(i) * b(n-i-1)\n end\n v +\n (j <= 1 ? 0 : b(n-j-1) * (r(p,j,a+1,s) - 1)) +\n (n-j-1 <= 1 ? 1 : r(p,n-j-1,a+j+1,s+j+1))\n end",
"def lcs_phase_two(arr)\n return arr.max if arr.max < 0 #edge case\n\n current = 0\n largest = 0\n\n arr.each do |ele|\n current += ele\n current = 0 if current < 0 #bookmark\n largest = current if largest < current\n end\n\n largest\nend",
"def solution(n)\n number = 1\n stop = false\n while !stop\n results = []\n (1..n).each do |divider| \n if number % divider != 0\n results << false\n else\n results << true\n end\n end\n if results.count {|x| x == false } > 0\n stop = false\n number += 1\n else \n stop = true\n end \n end\n number\nend",
"def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def goldbach(n, primes = primes(n))\n\n if primes.empty? then [0, n]\n else\n b, *rest = primes\n\n a = _other(n, b, rest)\n\n if a == nil\n goldbach(n, rest)\n else\n [a, b]\n end\n end\nend",
"def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end",
"def abund? n\n arr = []\n tail = Math.sqrt n\n (1..tail).each do |x|\n if n % x == 0\n arr << x\n arr << n/x\n end\n arr.pop if x*x == n\n end\n n < arr.sum\nend",
"def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend",
"def euler_rec n=999\r\n return 0 if n == 0\r\n n % 3 == 0 || n % 5 == 0 ? n + euler_rec(n -1) : euler_rec(n - 1)\r\nend",
"def tribonacci(signature,n)\n res = []\n n.times {\n res.push(signature.count > 0 ? signature.shift : res[-3..-1].reduce(:+))\n }\n res\nend",
"def shuffle(nums, n)\n current_index = 1\n (0..n - 1).each do |i|\n nums.insert(current_index, nums.delete_at(i + n))\n current_index += 2\n end\n nums\nend",
"def kaprekar n\n k = max_permutation(n) - min_permutation(n)\n if k == n then k else kaprekar k end\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend",
"def candies(n, arr)\n cc = []\n cc[0] = 1\n 1.upto(n-1) do |i|\n if arr[i] > arr[i-1]\n cc[i] = cc[i-1] + 1\n else\n cc[i] = 1\n end\n end\n p cc\n (n-2).downto(0) do |i|\n if arr[i] > arr[i+1] && cc[i] <= cc[i+1]\n cc[i] = cc[i+1] + 1\n end\n end\n p cc\n cc.reduce(:+)\nend",
"def pretentious_primes(arr, n) \n arr.map { |ele| nth_prime(ele,n) }\nend",
"def brute_force (n)\n if n <= 1\n return false\n elsif n == 2\n return true\n #elsif n % 2 == 0 return false\n elsif n.even?\n return false\n else\n m = Math.sqrt(n)\n i = 3 #fuck ruby's lack of good for loops\n while i <= m\n return false if n % i == 0\n i += 2\n end\n end\n return true\n end",
"def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"def answer(n, a)\n count = 0\n n.times do |nn|\n next if a[nn] != nn + 1\n a[nn], a[nn + 1] = a[nn + 1], a[nn]\n count += 1\n end\n count\nend",
"def main\n\n sum = 0\n\n (0..999).each do |i|\n sum += check(i)\n end\n\n puts \"Total - O(n) #{sum}\"\n\n # Needed to refresh following: https://en.wikipedia.org/wiki/Arithmetic_progression\n sum2 = sum_multiples(3, 1000) + sum_multiples(5, 1000) - sum_multiples(15, 1000)\n\n # Refreshed Big O too : http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o \n puts \"Total - O(1) #{sum2}\"\n\nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort.each_cons(3) { |e| return 1 if e[0] + e[1] > e[2] }\n return 0\nend",
"def fibs(n)\n list = [0, 1]\n if n == 0\n return []\n elsif n == 1\n return [0]\n elsif n == 2\n return [0, 1]\n else \n counter = 2\n while counter < n\n sum = 0\n list.each_with_index do |element, index|\n if index >= list.length - 2\n sum += element\n end\n end\n list.push(sum)\n counter += 1\n end\n end\n return list\nend",
"def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend",
"def nth_ugly_number(n, a, b, c)\n# a-b, a-c, b-c, ab-c\n ab_lcm = a.lcm(b) # there are some a present in b\n ac_lcm = a.lcm(c) # there are some a present in c\n bc_lcm = b.lcm(c) # there are some b present in c\n abc_lcm = ab_lcm.lcm(c) # there are some a*b in c (because c is the biggest)\n \n # using set theory for binary search\n # a + b + c - ab_lcm - ac_lcm - bc_lcm + abc_lcm\n (1..2*10**9).bsearch{|x| x/a + x/b + x/c - x/ab_lcm - x/ac_lcm - x/bc_lcm + x/abc_lcm >= n}\nend",
"def sieve_of_e(n)\n a = (0...n).to_a\n a[0] = nil\n a[1] = nil\n (2..Math.sqrt(n)).each do |i|\n if a[i]\n it = 0\n j = i * i\n while j <= n\n a[j] = nil\n it += 1\n j = i * i + i * it\n end\n end\n end\n a.select{|i| i}\nend",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def knot_hash(input)\n sequence = input.bytes.to_a\n sequence << [17, 31, 73, 47, 23]\n sequence = sequence.flatten\n list = (0..255).to_a\n\n @current_position = 0\n @skip_size = 0\n # list = (0..4).to_a\n # sequence = [3, 4, 1, 5]\n\n # sequence = '1,2,3'.bytes.to_a\n # sequence << [17, 31, 73, 47, 23]\n # sequence = sequence.flatten\n\n 64.times do\n sequence.each do |seq|\n puts \"STARTING SEQ #{seq}\"\n if @current_position + seq > list.size\n puts \"wrapping\"\n ending_array = list[@current_position..-1]\n ending_array_size = ending_array.size\n puts \"ending array is #{ending_array.inspect}\"\n beginning_array = list[0...seq - ending_array.size]\n puts \"beginning array is #{beginning_array.inspect}\"\n beginning_array_size = beginning_array.size\n array_to_modify = ending_array + beginning_array\n puts \"array_to_modify is #{array_to_modify.inspect}\"\n array_to_modify.reverse!\n puts \"reversed array_to_modify is #{array_to_modify.inspect}\"\n # array_to_modify.rotate(@current_position)\n array_to_modify[0...ending_array_size].each_with_index do |a,i|\n list[@current_position+i] = a\n end\n puts list.inspect\n\n array_to_modify[-beginning_array_size..-1].each_with_index do |a,i|\n list[i] = a\n end\n\n puts list.inspect\n else\n puts \"not wrapping\"\n array_to_modify = list[@current_position...@current_position+seq]\n array_to_modify.reverse!\n array_to_modify.each_with_index do |a,i|\n list[@current_position + i] = a\n end\n puts list.inspect\n\n end\n\n if @current_position + seq + @skip_size > list.size\n @current_position = (@current_position + seq + @skip_size) % list.size\n else\n @current_position = @current_position + seq + @skip_size\n end\n puts \"@current_position is #{@current_position}\"\n @skip_size += 1\n end\n @list = list\n end\n\n foo = []\n @list.each_slice(16) do |chunk|\n foo << chunk.inject(:^)\n end\n\n result = []\n foo.each do |hex|\n if hex.to_s(16).size == 1\n result << '0' + hex.to_s(16)\n else\n result << hex.to_s(16)\n end\n end\n\n result.join\nend",
"def sieve(n)\r\n # Create two arrays (l and empty store)\r\n l = Array.new(n, 1)\r\n store = Array.new\r\n for i in 2 .. n\r\n next unless l[i]\r\n # num.step(limit, step ) {|i| block } => num\r\n # Start at num to limit of step:\r\n # E.g. 4.step(100, 2) = 4, 6, 8\r\n (i**2).step(n, i) {|x| \r\n l[x] = nil \r\n }\r\n store << i \r\n end\r\n store\r\nend",
"def solve(nums, k)\n k.times do\n nums.push(nums.shift)\n end\n return nums\nend",
"def sieve1(n)\n\tprimes = []\n\ta = Array.new(n, true)\n\t2.step(Math.sqrt(n).to_i) do |i|\n\t\tif a[i]\n\t\t\tprimes.push(i)\n\t\t\t\n\t\t\ti.step(n-1, i) do |k|\n\t\t\t\ta[k] = false\n\t\t\tend\n\t\tend\n\tend\n\n\tMath.sqrt(n).to_i.step(n-1) do |i|\n\t\tif a[i]\n\t\t\tprimes.push(i)\n\t\tend\n\tend\n\n\treturn primes\nend",
"def solve( n = 100_000_000 )\n # Assuming the largest valid sum of squares is S = a^2 + (a - 1)^2 < n,\n # first find a and set aside space to cache that many running sums.\n len = (1 + Math.sqrt( 2*n )) / 2\n sos = Array.new( len )\n\n seen = []\n sos[0] = 1\n\n (1...len).each do |i|\n # Precompute the ∑ i^2 for all i <= a. \n ds = i*i + 2*i + 1\n sos[i] = sos[i - 1] + ds\n\n seen << sos[i] if sos[i].palindrome?\n\n # Most of the sum of square values will exceed n, so subtract lower sums\n # to check shorter runs.\n (i - 2).downto( 0 ) do |j|\n diff = sos[i] - sos[j]\n break unless diff < n\n\n # Update our total if the shorter run a[j] + a[j + 1] + ... + a[i] is\n # a palindrome.\n seen << diff if diff.palindrome?\n end\n end\n\n seen.uniq.reduce( :+ )\n end"
] | [
"0.6438931",
"0.6313318",
"0.6169534",
"0.6132016",
"0.60377884",
"0.5976135",
"0.5955118",
"0.5922008",
"0.5896151",
"0.5890872",
"0.5864034",
"0.5852935",
"0.58461004",
"0.5845946",
"0.5842953",
"0.5841691",
"0.5818798",
"0.58128834",
"0.57915366",
"0.57756793",
"0.57729983",
"0.5769407",
"0.5760365",
"0.57544225",
"0.57436633",
"0.5739534",
"0.57329565",
"0.57314056",
"0.5714085",
"0.57006776",
"0.56909364",
"0.5689376",
"0.568587",
"0.5676002",
"0.5672322",
"0.5670931",
"0.566716",
"0.56655276",
"0.5633796",
"0.563321",
"0.5629853",
"0.562724",
"0.56240046",
"0.56228435",
"0.56131613",
"0.5594621",
"0.55916214",
"0.5585506",
"0.5579164",
"0.5565721",
"0.5562389",
"0.5558194",
"0.5557817",
"0.5557285",
"0.5547661",
"0.5541738",
"0.55397755",
"0.55381083",
"0.5537367",
"0.5537121",
"0.5528252",
"0.5522149",
"0.550882",
"0.5506293",
"0.5503617",
"0.55025893",
"0.54989314",
"0.54961836",
"0.5489752",
"0.54876035",
"0.5485033",
"0.5483576",
"0.54812175",
"0.5480415",
"0.54802525",
"0.54762775",
"0.54718804",
"0.5469508",
"0.5468927",
"0.5461519",
"0.5459413",
"0.54593587",
"0.5457582",
"0.5453266",
"0.54486936",
"0.54459345",
"0.5444382",
"0.5441087",
"0.54365355",
"0.5433956",
"0.54332566",
"0.54298556",
"0.5427639",
"0.54251313",
"0.5422596",
"0.5421146",
"0.5420018",
"0.54194736",
"0.54169446",
"0.54163474",
"0.54125553"
] | 0.0 | -1 |
Warning: if somebody applies parameter values via JSON, this will compare that.... probably shouldn't be doing that though if it's NoEcho there's a good reason bother checking synthesized_value? that would be the indicator..... | def audit_impl(cfn_model)
violating_rdsinstances = cfn_model.resources_by_type('AWS::RDS::DBInstance')
.select do |instance|
if instance.masterUsername.nil?
false
else
!references_no_echo_parameter_without_default?(cfn_model,
instance.masterUsername)
end
end
violating_rdsinstances.map(&:logical_resource_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value?(value); end",
"def value?(value); end",
"def value?(value) true end",
"def has_value?(p0) end",
"def is_value?\n true\n end",
"def check_value(value)\n case value\n when 'true'\n true\n when 'false'\n false\n else\n value\n end\n end",
"def value?(p0) end",
"def value?(value) value.is_a?(String) end",
"def has_value?(value); end",
"def test_equality_w_and_echo\n assert_eq interpret(\"var=33; :var == 33 && echo('ok')\"),\"ok\\n\" \n end",
"def check_for_valid_comparison(property, value)\r\n #We want to ignore certain things for translation as defined here.\r\n status = !(check_for_hyperlink(value) or check_for_number(value) or check_for_hex(value) or check_for_embed(value) or check_for_ignore(property))\r\n end",
"def expected_value; end",
"def expected_value; end",
"def just_u_value?()\n @construction.check_keyword?(\"U-VALUE\")\n end",
"def check test\n test = test.gsub(/={1,2}(?!~)/,\"==\").gsub(/(\\[[^\\]]*\\])/,'\\1.to_v')\n (eval(test) ? true : false) rescue false\n end",
"def string?\n !@arg[:textValue].nil?\n end",
"def must_have_value?\n return false\n end",
"def has_value? value; value? value; end",
"def perform?(subscriber)\n # puts \"#{is}\"\n if is.eql?(\"=\")\n is = '==' \n end\n # puts \"#{is}\"\n value = cast_value(self.value)\n value = \"\\\"#{value}\\\"\" if value.class.name == \"String\"\n # puts \"*** CHECKING : subscriber.#{whenn} #{is} #{value}\"\n eval \"subscriber.#{whenn} #{is} #{value}\"\n end",
"def checkParameter(value)\n if %W['' none false #{nil} null 0].include?(value.to_s.downcase)\n nil\n elsif value.to_s.downcase == 'default'\n block_given? ? yield : value\n else\n value\n end\n end",
"def just_u_value?()\n @construction.check_keyword?(\"U-VALUE\")\n end",
"def true?\n self.value == '1'\n end",
"def skip_value?(value); end",
"def can_have_value?\n return true\n end",
"def can_have_value?()\n return true\n end",
"def has_value?(value)\n each_value.include?(convert_value_to_parameters(value))\n end",
"def single_value?\n return false\n end",
"def can_have_value?\n return false\n end",
"def value?(value)\n wrap(value, ->(a, b) { a == b })\n end",
"def no_echo_parameter_without_default?(cfn_model, key_to_check)\n if key_to_check.is_a? Hash\n if key_to_check.key? 'Ref'\n if cfn_model.parameters.key? key_to_check['Ref']\n parameter = cfn_model.parameters[key_to_check['Ref']]\n\n return truthy?(parameter.noEcho) && parameter.default.nil?\n else\n return false\n end\n else\n return false\n end\n end\n # String or anything weird will fall through here\n false\nend",
"def has_value?\n true\n end",
"def has_value?\n false\n end",
"def valid_value?(value)\n send(@params[:format], value)\n end",
"def good?(value)\n value\n end",
"def validate_value value\n true\n end",
"def params_valid(param,value)\n unless param.nil?\n if value == param\n return true\n else\n return false\n end \n else\n return false\n end\n end",
"def test?\n params[''] == 'test'\n end",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend",
"def eval_response(response)\n return (response == \"OK\")\n end",
"def literal_value(param)\n case param[:type]\n when \"integer\", \"decimal\", \"boolean\"\n param[:value][:value]\n else\n \"\\\"#{param[:value][:value]}\\\"\"\n end\n end",
"def vash_valid_value?(x); self.class.option_value?(x); end",
"def valid_value?\n if ape_type == 'utf8' || ape_type == 'external'\n # :nocov:\n if RUBY_VERSION >= '1.9'\n # :nocov:\n begin\n map!{|v| v.to_s.encode('UTF-8')}\n rescue EncodingError\n return false\n end\n end\n string_value.unpack('U*')\n end\n rescue ArgumentError\n false\n else\n true\n end",
"def param_exec_value_change(param, value)\n if param[:type] == 'bool'\n if value == 'true'\n param[:value] = true\n else\n param[:value] = false\n end\n else\n param[:value] = value\n end\n write_output \"updated #{param[:string]} (#{param[:id].red}) to #{param[:value].to_s.green}\"\n set_param_value(param)\n true\n end",
"def query_variable?(obj)\n begin\n obj.to_s =~ /^\\?/ ? true : false\n rescue\n false\n end\n end",
"def test?\n params[''] == 'test'\n end",
"def value? value\n include? value\n end",
"def unquoted?(value)\n !quoted?(value)\n end",
"def test_boolean_query_params_treated_as_strings\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/hello?test_arg_first_bool\", log_http_options)\n assert_response_code(200, response)\n record = wait_for_log(response)[:hit_source]\n assert_equal(\"true\", record[\"request_query\"][\"test_arg_first_bool\"])\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/hello?test_arg_first_bool=foo\", log_http_options)\n assert_response_code(200, response)\n record = wait_for_log(response)[:hit_source]\n assert_equal(\"foo\", record[\"request_query\"][\"test_arg_first_bool\"])\n end",
"def is_propvalue?(); @type == GRT_PROPVALUE; end",
"def test?\n params['test'] == '1'\n end",
"def emit_value?\n !mlhs? && !no_value_parent?\n end",
"def process_true(exp)\n \"Qtrue\"\n end",
"def value\n true\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def interpret(value)\n value == \"\" ? nil : value\n end",
"def test?\n value_for('test') == 'true'\n end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def test? value\n ! type.test( value )\n end",
"def is_name_value?(val)\n val.is_a?(String) || val.is_a?(Symbol)\n end",
"def string_interpolation?(value = @value)\n !value.index(INTERPOLATION).nil?\n end",
"def value_valid?\n return true\n end",
"def has_value?(value)\n super(convert_value(value))\n end",
"def test?\n params['test'] == 'test'\n end",
"def test?\n params['test'] == 'test'\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def allow_value_matcher; end",
"def ignore_interpolation? arg, suspect\n return unless string_interp? arg\n return true unless arg[1].chomp.empty? # plain string before interpolation\n\n first_interp = arg.find_nodes(:evstr).first\n return unless first_interp\n\n first_interp[1].deep_each do |e|\n if suspect == e\n return false\n end\n end\n\n true\n end",
"def textfields_exact(value)\n eles_by_json _textfield_exact_string value\n end",
"def value_if_true\n return @value_if_true\n end",
"def ace_value?(value)\n value.size == 2\n end",
"def js_value_settle\n %Q{\n if ($('#{dom_id(:operator)}').value=='blank') {\n $('#{dom_id(:value_div)}').hide();\n }\n else {\n $('#{dom_id(:value_div)}').show();\n }\n }\n end",
"def string_value?(value)\n string = value.to_s\n [NonWordMatcher, KeywordMatcher].any? { |matcher|\n matcher.match string\n }\n end",
"def check_params; true; end",
"def is_equal_value?\n return true unless value_to_compare?\n assigns[@name] == @options[:with]\n end",
"def value?\n @_value ||= ![\n :class, :module, :if, :elseif, :unless,\n :else, :try, :catch, :finally, :while, :for_in,\n :for_seg, :return, :exec\n ].include?(@action)\n end",
"def match?(value, depth: 0)\n status \"\", depth: depth\n if case expr = operands.first\n when RDF::Literal then value.language == expr.to_s.to_sym\n else false\n end\n status \"matched #{value}\", depth: depth\n true\n else\n status \"not matched #{value}\", depth: depth\n false\n end\n end",
"def true?\n self.value == '1'\n end",
"def func1 val # Val should be inside round brackets ().\r\n if val = 1 # Requires == to check status\r\n return true # Indent both returns as they relate to the if and else.\r\n else\r\n return false\r\n end\r\nend",
"def single_value?\n @single_value\n end",
"def value_or_false(value)\n if value\n if value == \"false\"\n return false\n else\n return value.to_s\n end\n else\n return false\n end\n end",
"def double_quotes_required?(string); end",
"def double_quotes_required?(string); end",
"def echo(value); end",
"def echo(value); end",
"def tst_result\n passed? ? \"p\" : \"f\"\n end",
"def value?(value)\n Vpim::Methods.casecmp?(@value, value.to_str)\n end",
"def validate_value(property,value) #:nodoc:\n valid = false\n # Check static strings\n property.values.each do |al_val|\n valid = true if al_val.downcase.eql?(value.downcase)\n end\n # Check regular expressions\n unless valid\n property.expressions.each do |xp_val|\n valid = true if value =~ xp_value\n end\n end\n # check short hand\n unless valid\n property.refs.each do |ref|\n real = @policy.property(ref)\n if real\n valid = validate_value(real,value)\n end\n end\n end\n # We will check media above.\n return valid\n end",
"def literal?\n @value.is_a?(String) || @value.is_a?(Integer)\n end",
"def pry_command?(val)\n !!command_matched(val).first\n end",
"def value?(value)\n\t\treturn self.value == value\n\tend",
"def value?(value)\n\t\treturn self.value == value\n\tend",
"def select_param?(param_name, value)\n puts session[param_name]\n session[param_name] and session[param_name].include? value ? ' SELECTED ' : ''\n end",
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def evaluate_answer(key,answer,options)\n correct = false\n if options['q_struct'][key].eval != \"no\"\n new_value = options['q_struct'][key].eval\n if new_value.match(/^get|^set/)\n if new_value.match(/^get/)\n new_value = eval\"[#{new_value}]\"\n answer = new_value.join\n options['q_struct'][key].value = answer\n else\n options['q_struct'][key].value = answer\n eval\"[#{new_value}]\"\n end\n correct = true\n else\n correct = eval\"[#{new_value}]\"\n if correct == true\n options['q_struct'][key].value = answer\n end\n end\n else\n correct = true\n end\n answer = answer.to_s\n if options['verbose'] == true\n handle_output(options,\"Information:\\tSetting parameter #{key} to #{answer}\")\n end\n return correct\nend",
"def value_present?\n !@value.nil?\n end",
"def valid_value?(value)\n valid_or_optional?(value) { valid_primitive?(value) }\n end",
"def maybe_json?(got, expected)\n return expected == got if expected.is_a?(Array)\n !expected.match(got.join(' ')).nil?\n end",
"def value_omission?\n source.end_with?(':')\n end",
"def parse_response( key, val, * )\n #key is method input is coming from, val is user input\n if key === 'greet_user'\n val.length == 3 && val.match(/Y|y+E|e+S|s/)\n elsif key === 'print_temp_prompt'\n TemperatureConverter::TEMP_SCALES.include? val\n elsif key === 'get_temp_input'\n if( val.match(/[a-zA-Z\\W].+/) )\n false\n else\n ( val.match(/\\d{1,4}/) )\n end\n else\n false\n end\nend",
"def param_check_bool(param, value)\n if value != 'true' && value != 'false'\n write_output 'Error'.red + \" : argument must be 'true' or 'false' when setting param #{param[:string]}\\n\"\n return false\n end\n param_exec_value_change(param, value)\n end"
] | [
"0.64242643",
"0.64242643",
"0.6256839",
"0.62534386",
"0.61853254",
"0.608591",
"0.6059123",
"0.603685",
"0.5994732",
"0.59817123",
"0.5942141",
"0.5918781",
"0.5918781",
"0.5898913",
"0.5885031",
"0.5875498",
"0.5867212",
"0.5864767",
"0.58645684",
"0.5843261",
"0.5828332",
"0.5810634",
"0.57981336",
"0.57801783",
"0.57789725",
"0.5758234",
"0.5750173",
"0.5747805",
"0.57416594",
"0.5714379",
"0.5710083",
"0.5702565",
"0.56841797",
"0.5676337",
"0.5654682",
"0.5653041",
"0.5633141",
"0.5620413",
"0.5620413",
"0.56178045",
"0.5610639",
"0.56092566",
"0.5597598",
"0.5592779",
"0.55925226",
"0.55907726",
"0.55848944",
"0.55641556",
"0.55584604",
"0.55581933",
"0.55510855",
"0.55471826",
"0.5534163",
"0.5520284",
"0.5517356",
"0.55111897",
"0.55107355",
"0.55066156",
"0.5498269",
"0.5497271",
"0.5478374",
"0.5476397",
"0.5470745",
"0.54646385",
"0.54646385",
"0.54606664",
"0.5438218",
"0.54357946",
"0.5419015",
"0.54160756",
"0.54087275",
"0.5404415",
"0.54023695",
"0.5399596",
"0.5395719",
"0.5384115",
"0.5378161",
"0.537226",
"0.53593147",
"0.535753",
"0.5349685",
"0.53473204",
"0.53473204",
"0.53422624",
"0.53422624",
"0.53380466",
"0.53360367",
"0.53318816",
"0.5327396",
"0.532389",
"0.5323464",
"0.5323464",
"0.5322142",
"0.532008",
"0.5315157",
"0.5303757",
"0.5301905",
"0.5295088",
"0.5289006",
"0.5286579",
"0.52857095"
] | 0.0 | -1 |
Available fetching options: fetch_shared_tables_count fetch_shared_maps_count fetch_users | def initialize(group, fetching_options = {})
@group = group
@fetching_options = fetching_options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_fetch_size\n 100\n end",
"def fetch_users\n user_relational_query = get_model_query\n @total_filtered_users = user_relational_query.count\n\n return if @total_filtered_users < 1\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @users = user_relational_query.limit(@page_size).offset(offset).all\n # No need to query kyc detail if filter applied is kyc_submitted_no\n if @allowed_filters[GlobalConstant::User.is_kyc_submitted_filter].to_s != GlobalConstant::User.kyc_submitted_false\n @user_kyc_details = UserKycDetail.using_client_shard(client: @client).\n where(user_id: @users.collect(&:id)).all.index_by(&:user_id)\n end\n end",
"def fetch_hash_all\n fetch_many0(nil, Hash)\n end",
"def size\n\n fetch_all(:count => true)\n end",
"def fetch_users\n fetch_assignee + fetch_watchers\n end",
"def fetch_all!\n fetch_all(true)\n end",
"def fetch\n feeds = [{}]\n\n case params[:fetch_type]\n when 'all'\n ids = []\n friends = Friend.where(\"(friend_one = ? OR friend_two = ?) AND is_accepted = true\", params[:user_id], params[:user_id])\n friends.each do |f|\n if f.friend_one == params[:user_id]\n ids.push(f.friend_two)\n else\n ids.push(f.friend_one)\n end\n end\n\n follows = Follow.where(follower_id: params[:user_id])\n follows.each do |f|\n if !ids.include?(f.following_id)\n ids.push(f.following_id)\n end\n end\n\n groups = Group.joins(:group_users).where(:group_users => {user_id: params[:user_id]})\n gids = []\n groups.each do |g|\n gids.push(g.id)\n end\n\n feeds = paginate Feed.where({user_id: ids, group_id: gids}).order('created_at DESC')\n when 'friends'\n ids = []\n friends = Friend.where(\"(friend_one = ? OR friend_two = ?) AND is_accepted = true\", params[:user_id], params[:user_id])\n friends.each do |f|\n if f.friend_one == params[:user_id]\n ids.push(f.friend_two)\n else\n ids.push(f.friend_one)\n end\n end\n feeds = paginate Feed.where(user_id: ids).order('created_at DESC')\n when 'follows'\n feeds = paginate Feed.joins(:follow).where(:follows => {follower_id: params[:user_id]}).order('created_at DESC')\n when 'groups'\n groups = Group.joins(:group_users).where(:group_users => {user_id: params[:user_id]})\n gids = []\n groups.each do |g|\n gids.push(g.id)\n end\n\n feeds = paginate Feed.where({group_id: gids}).order('created_at DESC')\n when 'user'\n feeds = paginate Feed.where(user_id: params[:activity_id]).order('created_at DESC')\n when 'group'\n feeds = paginate Feed.where(group_id: params[:activity_id]).order('created_at DESC')\n\n end\n\n render json: feeds.to_json(:include => :user)\n end",
"def fetch\n fetch_response.results\n end",
"def fetch_all\n fetch_many0(nil, Array)\n end",
"def _fetch\n cache_get(:_fetch) || @opts[:fetch]\n end",
"def fetch_user_kyc_details\n ar_relation = UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id, status: GlobalConstant::UserKycDetail.active_status)\n ar_relation = ar_relation.filter_by(@filters)\n ar_relation = ar_relation.sorting_by(@sortings)\n\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @user_kycs = ar_relation.limit(@page_size).offset(offset).all\n @total_filtered_kycs = ar_relation.count\n end",
"def fetch_hash(with_table=nil)\n @result.fetch_hash with_table\n end",
"def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n page = 1\n\n begin\n log.info \" Requesting set #{page} (limit #{per_page}, offset #{offset})\"\n set = handle_timeouts(MAX_CONSECUTIVE_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n log.info \" Fetched #{set.size} records\"\n\n records += set\n offset += per_page\n page += 1\n end until set.size < per_page\n\n records\n end",
"def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end",
"def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n\n begin\n set = handle_timeouts(MAX_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n\n records += set\n offset += per_page\n end until set.empty?\n\n records\nend",
"def fetch_user_data\n @username = params[:username]\n @configured_sources = params[:source_ids] || []\n @result_set = Hash.new\n @configured_sources.each do |source|\n feed_result = fetch_feed(source,@username)\n @result_set[source] = feed_result\n end\n \n end",
"def fetch_social\n social_fs\n social_ts\n end",
"def fully_fetched\n true\n end",
"def fetch_statistics\n user = AdminUser.find(get_logged_in_user_id)\n if user.designation == \"supervisor\"\n new_complaints = ComplaintStatus.where(admin_user_id: user.id, status: \"pending\").count\n pending_complaints = 0\n completed_complaints = ComplaintStatus.where(admin_user_id: user.id, status: \"completed\").count\n elsif user.designation == \"ward officer\"\n ward = WardOffice.find(user.municipal_id)\n new_complaints = ComplaintStatus.where(admin_user_id: user.id).count\n pending_complaints = ComplaintStatus.where(district_office_id: ward.district_office_id, ward_office_id: user.municipal_id,\n category: user.designation, status: \"pending\").count\n completed_complaints = ComplaintStatus.where(district_office_id: ward.district_office_id, ward_office_id: user.municipal_id,\n category: user.designation, status: \"completed\").count\n elsif user.designation == \"district officer\"\n new_complaints = ComplaintStatus.where(admin_user_id: user.id, status: \"new\").count\n pending_complaints = ComplaintStatus.where(district_office_id: user.municipal_id, status: \"pending\").count\n completed_complaints = ComplaintStatus.where(district_office_id: user.municipal_id, status: \"completed\").count\n end\n render json: {new_complaint: new_complaints, pending_complaint: pending_complaints, completed_complaint: completed_complaints}\n end",
"def fetch_count\n if refresh_cache?\n execute_count\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n cached.has_count? ? cached.count : execute_count\n elsif cached.is_a?(Fixnum)\n cached\n elsif cached.respond_to?(:count)\n cached.count\n else\n cached # what else can we do? return it\n end\n end",
"def fetch\n conversation_users = paginate ConversationUser.where(conversation_id: params[:conversation_id])\n\n render json: conversation_users.to_json(:include => :user)\n end",
"def fetch_hash_many(n)\n fetch_many0(n, Hash)\n end",
"def fetch; end",
"def fetch; end",
"def fetch\n end",
"def fetch!\n info \"FETCH\"\n Fetcher.run @dbi, @collections, @settings, @logger do |*args| update_db(*args) end # results will be passed to the update function\n end",
"def get_users\n @get_users = Rails.cache.fetch(\"get_aside_users\", :expires_in => 1.hours) do\n if @current_user.present?\n Core::User.active.where(\"verified = 1 AND id != #{@current_user.id}\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n else\n Core::User.active.where(\"verified = 1\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n end\n end\n end",
"def fetch(&block)\n block.call(true, 20)\n end",
"def get_all\n\t\tif !params.has_key?(\"count\") or params[:count].empty?\n\t\t\tparams[:count]= 50\n\t\tend\n\t\tif !params.has_key?(\"start\") or params[:start].empty? \n\t\t\tparams[:start] = 0 \n\t\tend\n\t\tusers = []\n\t\tUser.all.limit(params[:count]).offset(params[:start]).each do |u|\n\t\t\thash = u.attributes \n\t\t\thash[:client] = u.client ? u.client.name : nil\n\t\t\tusers.push(hash)\n\t\tend\n\t\trespond({ status: 0, users: users, start: params[:start] })\n\tend",
"def fetch\n @raw_result = opts_for_cache_proxy[:raw] == true\n\n result = if refresh_cache?\n execute_find(@raw_result)\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n if cached.has_ids? && @raw_result\n self.cached # return it unmodified\n elsif cached.has_ids?\n fetch_from_cache # return a list of active records after applying options\n else # true if we have only calculated the count thus far\n execute_find(@raw_result)\n end\n else\n cached # some base type, return it unmodified\n end\n end",
"def fetch_many(n)\n fetch_many0(n, Array)\n end",
"def fetch_users\n\n result = CacheManagement::ClientApiCredentials.new([@client_id]).fetch[@client_id]\n return validation_error(\n 'cum_lu_6',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if result.blank?\n\n if is_xhr_request?\n\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: false\n )\n\n @ost_sdk_obj = ost_sdk.services.users\n\n list_params = {}\n list_params[:page_no] = @page_no unless @page_no.nil?\n list_params[:order_by] = @order_by unless @page_no.nil?\n list_params[:order] = @order unless @page_no.nil?\n list_params[:airdropped] = @airdropped unless @airdropped.nil?\n\n service_response = @ost_sdk_obj.list(list_params)\n\n return service_response unless service_response.success?\n\n @api_response_data = service_response.data\n\n else\n\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: true\n )\n\n @ost_spec_sdk_obj = ost_sdk.services.users\n api_spec_service_response = @ost_spec_sdk_obj.create({name: \"{{uri_encoded name}}\"})\n\n return api_spec_service_response unless api_spec_service_response.success?\n\n api_spec_service_response.data[:request_uri].gsub!(GlobalConstant::SaasApi.base_url, GlobalConstant::SaasApi.display_only_base_url)\n\n @api_response_data[:api_console_data] = {\n user: {\n create: api_spec_service_response.data\n }\n }\n\n end\n\n success\n\n end",
"def e_counts\n Rails.cache.fetch(\"#{cache_key}/e_counts\", expires_in: 12.hours) do\n User.all.count\n end\n end",
"def fetch_data\n\n UserKycDetail.find_in_batches(batch_size: 100) do |batched_records|\n batch_ued_ids = []\n user_id_to_ukd_map = {}\n\n batched_records.each do |record|\n user_id_to_ukd_map[record.user_id] = record\n batch_ued_ids << record.user_extended_detail_id\n end\n\n UserExtendedDetail.where(id: batch_ued_ids).each do |user_extended_detail|\n user_kyc_detail = user_id_to_ukd_map[user_extended_detail.user_id]\n\n r = Aws::Kms.new('kyc', 'admin').decrypt(user_extended_detail.kyc_salt)\n unless r.success?\n @failed_kms_decrypt_ued_ids << user_extended_detail.id\n next\n end\n\n kyc_salt_d = r.data[:plaintext]\n\n case_data = generate_case_data(kyc_salt_d, user_extended_detail, user_kyc_detail)\n\n populate_ethereum_addr_case_data_map(case_data)\n end\n\n end\n\n end",
"def fetch\n infos = []\n client.search(url, query).take(limit).each do |result|\n response = Hashie::Mash.new(result.to_hash)\n infos << store_info(response)\n end \n infos.reject(&:blank?)\n #TODO: Exception need to handled\n rescue Twitter::Error\n Rails.logger.error(\"Twitter fetch throwing error check the connection\")\n end",
"def fetch(opts)\n @opts.merge!(opts)\n ofx_req = build_query(opts[:type] || @opts[:type])\n do_query(ofx_req)\n end",
"def fetch_all(key); end",
"def fetch_fields\n @result.fetch_fields\n end",
"def fetch_users(limit)\n system_users = %w[AFL APL LSC MSEL SAIS WELCH reserve Nanjing ILS1]\n ds = @db[@illiad_table].where(\n userinfo1: nil,\n userinfo3: nil,\n emailaddress: nil,\n nvtgc: @nvtgc\n ).exclude(\n username: system_users,\n cleared: %w[DIS]\n ).order_by(\n :userinfo3\n ).limit(limit)\n rescue Sequel::Error => e\n p 'ERROR: ' + e.message + ds\n end",
"def fetch_request\n NSFetchRequest.new.tap do |req|\n req.predicate = predicate\n req.fetchLimit = limit if limit\n req.fetchOffset = offset if offset\n req.sortDescriptors = sort_descriptors unless sort_descriptors.empty?\n end\n end",
"def fetch_user_extended_detail\n @user_extended_detail_obj = UserExtendedDetail.using_client_shard(client: @client).\n get_from_memcache(@user_kyc_detail.user_extended_detail_id)\n end",
"def perform\n request \"/users/self\" do |json|\n user = json[\"user\"]\n checkin_count = user[\"checkins\"][\"count\"].to_i\n load_checkins(checkin_count)\n end\n end",
"def fetch_outlets(outlet: nil, limit_num: 6)\n if outlet\n articles = following.where(\"outlet_name > ?\", outlet)\n else\n articles = following\n end\n articles.limit(limit_num)\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def fetch_records\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n\n ar_relation = UserActivityLog.using_client_shard(client: @client).where(\n user_id: @user_kyc_detail.user_id,\n log_type: GlobalConstant::UserActivityLog.admin_log_type\n )\n\n @total_action_logs = ar_relation.count\n\n @logs_ars = ar_relation.limit(@page_size).offset(offset).order('id DESC').all\n return if @logs_ars.blank?\n\n admin_ids = @logs_ars.collect(&:admin_id).compact.uniq\n return if admin_ids.blank?\n\n @admin_details = Admin.where(id: admin_ids).index_by(&:id)\n end",
"def get_counts\n #1 - @friend_count -> gets the number of current friends you have.\n @friend_count = current_user.active_friends.size\n \n #2 - @pending_count -> gets the number of pending friend requests you have.\n @pending_count = current_user.pending_friend_requests_to.map(&:friend).size\n end",
"def index\n set_records_count_header @application.users\n @users = @application.users.offset(params[:offset] || 0).limit(params[:limit] || 6).all\n render json: @users\n end",
"def fetch_latest_everything\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\t\t@task_lists = @client.execute(api_method: @gtasks.tasklists.list).data.items\n\t\t@tasks = Hash.new\n\t\t@task_lists.each do |list|\n\t\t\t@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"def fetch_data\n return @data if @data[\"/type/reflect/any_master\"]\n @data = Ken.session.mqlread(FETCH_DATA_QUERY.merge!(:id => id))\n end",
"def fetch_user_profiles(*screen_names)\n arr = []\n Array(screen_names).each_slice(100) do |batch|\n profiles = init_client.users(batch)\n arr.concat profiles.collect(&:to_h)\n end\n\n return arr\n end",
"def real_get(k, opt = {})\n if k.is_a?(Array)\n do_op(:multi_get, column_family, k, opt)\n elsif opt[:count]\n do_op(:get, column_family, k, opt)\n else\n opt = opt.clone\n opt[:count] = DEFAULT_COUNT\n columns = Cassandra::OrderedHash.new\n loop do\n chunk = do_op(:get, column_family, k, opt)\n columns.merge!(chunk)\n if chunk.size == opt[:count]\n # Assume there are more chunks, use last key as start of next get\n opt[:start] = chunk.keys.last\n else\n # This must be the last chunk\n break\n end\n end\n columns\n end\n end",
"def real_get(k, opt = {})\n if k.is_a?(Array)\n do_op(:multi_get, column_family, k, opt)\n elsif opt[:count]\n do_op(:get, column_family, k, opt)\n else\n opt = opt.clone\n opt[:count] = DEFAULT_COUNT\n columns = Cassandra::OrderedHash.new\n loop do\n chunk = do_op(:get, column_family, k, opt)\n columns.merge!(chunk)\n if chunk.size == opt[:count]\n # Assume there are more chunks, use last key as start of next get\n opt[:start] = chunk.keys.last\n else\n # This must be the last chunk\n break\n end\n end\n columns\n end\n end",
"def retrieved_records\n results.count\n end",
"def fetch_setup_details\n\n r = super\n return r unless r.success?\n\n r = SaasApi::Client::FetchStats.new.perform(client_id: @client_id)\n @api_response_data[:client_stats] = r.data if r.success?\n\n success\n\n end",
"def fetch\n super\n if [:followers, :followings, :repos].any? {|assoc| self.send(assoc).empty?}\n api_obj.fetch(:followers, :followings, :repos)\n @followers = @followings = @projects = nil\n end\n self\n end",
"def fetch!(options = {}, &block)\n fetch(options.merge(save: true), &block)\n end",
"def fetch(force=false)\n if @fetch.nil? || force\n query = @query.dup\n query[:q] = query[:q].join(\" \")\n perform_get(query)\n end\n\n @fetch\n end",
"def fetch\n\n set_id_to_cache_key_map\n\n cache_keys_to_fetch = []\n @id_to_cache_key_map.each do |_, keys|\n cache_keys_to_fetch.push(keys[:kit])\n end\n\n data_from_cache = Memcache.read_multi(cache_keys_to_fetch)\n\n ids_for_cache_miss = []\n @ids.each do |id|\n ids_for_cache_miss << id if data_from_cache[@id_to_cache_key_map[id][:kit]].nil?\n end\n\n if ids_for_cache_miss.any?\n\n fetch_data_rsp = fetch_from_db(ids_for_cache_miss)\n\n data_to_set = fetch_data_rsp.data || {}\n\n # to ensure we do not always query DB for invalid ids being cached, we would set {} in cache against such ids\n @ids.each do |id|\n data_to_set[id] = {} if data_from_cache[@id_to_cache_key_map[id][:kit]].nil? && data_to_set[id].nil?\n end\n\n set_cache(data_to_set) if fetch_data_rsp.success?\n\n end\n\n @ids.inject({}) do |data, id|\n data[id] = data_from_cache[@id_to_cache_key_map[id][:kit]] || data_to_set[id]\n data\n end\n\n end",
"def index\n @users = User.active.includes(:friends, :followings, :profile => [:country]).page(params[:page])\n .per(12).order('last_action_at DESC')\n @user_roles = User::Role.order('title ASC')\n @keywords = Keyword.skills.where.not(users_count: nil).limit(13).order('users_count DESC')\n #@users = User.all.page(params[:page]).per(12).order('last_action_at DESC')\n\n end",
"def fetch_hash!\n fetch0(Hash, true)\n end",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def fetch_users(limit)\n system_users = %w[AFL APL LSC MSEL SAIS WELCH reserve Nanjing ILS1 welchharrison]\n ds = @db[@illiad_table].where(\n nvtgc: @nvtgc,\n cleared: 'No'\n ).exclude(\n username: system_users\n ).exclude(\n cleared: %w[DIS]\n ).exclude(\n Sequel.ilike(:UserName, '%@%')\n ).order_by(:nvtgc).order_by(:userinfo3).limit(limit)\n # ap ds.sql exit\n rescue Sequel::Error => e\n p 'ERROR: ' + e.message + ds\n end",
"def doGetMaxCountPerRequest()\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end",
"def fetch_full_user_friend_ids(screen_name, options = {})\n opts = HashWithIndifferentAccess.new(options)\n retries = opts.delete(:retry) == false ? 0 : 8\n be_verbose = opts.delete(:verbose) == false ? false : true\n all_friends = []\n while opts[:cursor] != 0\n puts \"Friends collected: #{all_friends.count}; cursor: #{opts[:cursor]}\" if be_verbose\n begin\n cursor = fetch_user_friend_ids(screen_name, opts)\n rescue Twitter::Error::TooManyRequests => err\n if retries > 0\n retries -= 1\n sleep_time = retries > 3 ? 5 : err.rate_limit.reset_in + 1\n puts \"Error: #{err}\", \"Sleeping for #{sleep_time}\" if be_verbose\n sleep sleep_time\n else\n raise err\n end\n rescue => err\n if TWITTER_500_ERRORS.include?(err.class) && retries > 0\n retries -= 1\n # sleep for two minutes\n sleep_time = 120\n puts \"Error: #{err}\", \"Sleeping for #{sleep_time}\" if be_verbose\n sleep sleep_time\n retry\n else\n raise err\n end\n else\n all_friends.concat cursor.attrs[:ids]\n opts[:cursor] = cursor.attrs[:next_cursor] || 0\n end\n end\n\n return all_friends\n end",
"def fetch_insights\n graph = InsightService.new(self.influencer.access_token)\n\n self.number_of_followers = graph.get_number_of_likes(self.account_id)\n self.daily_page_views = graph.get_daily_page_views(self.account_id)\n #\n # self.number_of_posts = graph.get_number_of_posts(self.account_id)\n #\n if self.number_of_posts.present?\n self.number_of_posts = rand(self.number_of_posts..self.number_of_posts+10)\n else\n self.number_of_posts = rand(1000..5000)\n end\n\n self.post_reach = graph.get_post_reach(self.account_id)\n self.number_of_post_reach_of_post = graph.get_post_reach_of_post(self.account_id)\n self.profile_picture_url = graph.get_page_profile_picture(self.account_id)\n self.about = graph.get_page_about(self.account_id)\n self.category = graph.get_page_category(self.account_id)\n self.url = \"https://www.facebook.com/#{self.account_id}\"\n #\n # Only first time, facebook data will be called for 15 days, but in next update it will only fetch data for one day\n #\n if self.insights_updated_at.present?\n self.likes_by_country = graph.get_likes_by_country(self.account_id, 2.days.ago, self.likes_by_country)\n self.reach_by_country = graph.get_reach_by_country(self.account_id, 2.days.ago, self.reach_by_country)\n self.likes_by_city = graph.get_likes_by_city(self.account_id, 2.days.ago, self.likes_by_city)\n self.reach_by_city = graph.get_reach_by_city(self.account_id, 2.days.ago, self.reach_by_city)\n self.likes_by_gender_age_month = graph.get_likes_by_gender(self.account_id, 2.days.ago, self.likes_by_gender_age_month)\n self.likes_by_gender_age_week = graph.get_likes_by_gender(self.account_id, 2.days.ago, self.likes_by_gender_age_week)\n else\n self.likes_by_country = graph.get_likes_by_country(self.account_id, 15.days.ago, nil)\n self.reach_by_country = graph.get_reach_by_country(self.account_id, 15.days.ago, nil)\n self.likes_by_city = graph.get_likes_by_city(self.account_id, 15.days.ago, nil)\n self.reach_by_city = graph.get_reach_by_city(self.account_id, 15.days.ago, nil)\n self.likes_by_gender_age_month = graph.get_likes_by_gender(self.account_id, 12.month.ago, nil)\n self.likes_by_gender_age_week = graph.get_likes_by_gender(self.account_id, 1.week.ago, nil)\n end\n\n self.insights_updated_at = DateTime.now\n\n unless self.new_record?\n self.save(validate: false)\n end\n end",
"def fetch_hash\n fetch0(Hash, false)\n end",
"def list_all(name, options)\n records = find(:all, :limit => options[:limit], :offset => options[:offset])\n if options[:skip_count]\n record_count = records.size\n else\n\t\t record_count = count\n\t end\n\t return records, record_count\n end",
"def total_count\n fetch.json.[](:total_count)\n end",
"def get_users(count=42, offset=0)\n # Build a Filter String with a corresponding array of\n # prepared filters for the sql execution\n # (prepared statements prevent sql injection)\n prepared_filters = []\n filter_string = \"\"\n\n ALLOWED_FILTERS.each do |filter_name|\n if params.has_key?(filter_name) && \"All\" != params[filter_name]\n filter_string += \" AND #{filter_name} LIKE ?\"\n prepared_filters << params[filter_name]\n end\n end\n\n # If no user filters provided we will defalt to California\n filter_string = \"AND location LIKE '%CALIFORNIA%'\" if filter_string.empty?\n\n prepared_filters << count.to_i\n prepared_filters << offset.to_i\n\n # Connect to the database\n Database.new.execute(\n \"SELECT pictures.username,\n pictures.url,\n profiles.created_at,\n profiles.location\n FROM pictures\n JOIN profiles ON profiles.username = pictures.username\n WHERE size = 'small' #{filter_string}\n ORDER BY profiles.created_at DESC\n LIMIT ? OFFSET ?\",\n prepared_filters\n )\n end",
"def fetch_header\n header = {}\n header[:predicate_count] = pred_count\n header\n end",
"def fetch_multi(*ids)\n options = ids.extract_options!\n if IdentityCache.should_cache?\n\n require_if_necessary do\n cache_keys = ids.map {|id| rails_cache_key(id) }\n key_to_id_map = Hash[ cache_keys.zip(ids) ]\n\n objects_by_key = IdentityCache.fetch_multi(*key_to_id_map.keys) do |unresolved_keys|\n ids = unresolved_keys.map {|key| key_to_id_map[key] }\n records = find_batch(ids, options)\n records.compact.each(&:populate_association_caches)\n records\n end\n\n cache_keys.map {|key| objects_by_key[key] }.compact\n end\n\n else\n find_batch(ids, options)\n end\n end",
"def shared_objects_among_orgs\n shared_objects = {}\n visualization_types_sql = \"SELECT COUNT(*), visualizations.type FROM shared_entities, visualizations WHERE entity_id=visualizations.id::uuid GROUP BY type\"\n db = ::SequelRails.configuration.environment_for(Rails.env)\n conn = Sequel.connect(db)\n conn.fetch(visualization_types_sql).all.each do |vt|\n if vt[:type] == 'table'\n shared_objects['datasets'] = vt[:count]\n elsif vt[:type] == 'derived'\n shared_objects['visualizations'] = vt[:count]\n end\n end\n conn.disconnect\n return shared_objects\n end",
"def index\n @users = User.fetch_all_customers\n end",
"def get_all_user_data\n load_user_data(nil)\n end",
"def request_count; end",
"def get_related_users(query='', results=10, start=0)\r\n get_related('Users',query, results, start)\r\n end",
"def scrooge_fetch_remaining\n @attributes.fetch_remaining if scrooged?\n end",
"def need_to_fetch?\n @need_to_fetch = true if @need_to_fetch.nil?\n @need_to_fetch\n end",
"def fetch; @data = pager.fetcher[self.begin, pager.per_page]; end",
"def load_more_search_result\n @users=[]\n @users = @login_user.search_query(session[:search_opt],params[:page].to_i)\n render :partial => \"search_user_result\"\n #render :text => \"yes\"\n end",
"def load\n params.permit!\n @user = current_user\n @users = []\n @lat, @lng = params[:lat].to_f, params[:lng].to_f\n location = [@lat, @lng].join(',')\n if $REDIS.lrange(CoffeeShop.trim_location(location), 0, -1).length < 10\n Thread.new do \n CoffeeShop.preload_local_coffee_shops(@lat, @lng)\n end\n end\n @nearby_hangouts = Hangout.find_by_location(\n 0.07, :lat => @lat, :lng => @lng\n )\n @nearby_hangouts.each do |hangout|\n @users.concat(hangout.attending_users)\n end\n render \"api/users/load\"\n end",
"def count_people(query={})\n self.simple_client.get(\"/api/v1/people/count?#{query.to_query}\")[\"count\"]\n end",
"def do_get_server_data_count(address, server_machine_id)\n do_get_server_data address, server_machine_id, true\n end",
"def fetch_facebook_friends\n\t\treturn fetch_facebook_friends_or_subscribers_or_subscribedto(\"friends\")\n\tend",
"def include_gathered_data\n compile_user_data if @@aggregate.length == 6\n end",
"def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"def get_no_of_users\n\t\tusers.select(:id).count\n\tend",
"def all_fetched_entries\n @entry_cache.all_entries\n end",
"def fetch_from_cache\n if paginate?\n\n # Return a paginated collection\n if cached.ids.empty?\n\n # No ids, return an empty WillPaginate result\n [].paginate(opts_for_paginate)\n\n elsif combined_options.include?(:order)\n\n # An order has been specified. We have to go to the database\n # and paginate there because the contents of the requested\n # page will be different.\n klass.paginate(cached.ids, { :total_entries => cached.ids.size }.merge(opts_for_find.merge(opts_for_paginate)))\n\n else\n\n # Order is unchanged. We can paginate in memory and only select\n # those ids that we actually need. This is the most efficient.\n paged_ids = cached.ids.paginate(opts_for_paginate)\n paged_ids.replace(klass.find_all_by_id(paged_ids, opts_for_find(paged_ids)))\n\n end\n\n elsif cached.ids.empty?\n\n # We are returning a regular (non-paginated) result.\n # If we don't have any ids, that's an empty result\n # in any language.\n []\n\n elsif combined_options.include?(:order)\n\n # An order has been specified, so use it.\n klass.find_all_by_id(cached.ids, opts_for_find)\n\n else\n\n # No order has been specified, so we have to maintain\n # the current order. We do this by passing some extra\n # SQL which orders by the current array ordering.\n offset, limit = combined_options.delete(:offset) || 0, combined_options.delete(:limit) || cached.count\n ids = cached.ids[offset, limit]\n\n klass.find_all_by_id(ids, opts_for_find(ids))\n end\n end",
"def num_custom_lookup_table_entries\n return @num_custom_lookup_table_entries unless @num_custom_lookup_table_entries.nil?\n if flags.has_custom_lookup_table\n @num_custom_lookup_table_entries = (num_custom_lookup_table_entries_m1 + 1)\n end\n @num_custom_lookup_table_entries\n end",
"def fetch\n # NOTE: have sample data from TCP K072\n puts params\n resp = {}\n resp['sEcho'] = params[:sEcho]\n resp['iTotalRecords'] = Work.count()\n \n # generate order info based on params\n search_col_idx = params[:iSortCol_0].to_i\n cols = [nil,nil,nil,nil,'wks_work_id',\n 'wks_tcp_number','wks_title','wks_author',\n 'work_ocr_results.ocr_completed','work_ocr_results.ocr_engine_id',\n 'work_ocr_results.batch_id','work_ocr_results.juxta_accuracy',\n 'work_ocr_results.retas_accuracy']\n dir = params[:sSortDir_0]\n order_col = cols[search_col_idx]\n order_col = cols[4] if order_col.nil?\n\n # stuff filter params in session so they can be restored each view\n session[:search] = params[:sSearch]\n session[:gt] = params[:gt]\n session[:batch] = params[:batch]\n session[:set] = params[:set]\n session[:from] = params[:from]\n session[:to] = params[:to]\n session[:ocr] = params[:ocr]\n session[:font] = params[:font]\n \n # generate the select, conditional and vars parts of the query\n # the true parameter indicates that this result should include\n # all columns necessry to populate the dashboard view.\n sel, where_clause, vals = generate_query()\n\n # build the ugly query\n limits = \"limit #{params[:iDisplayLength]} OFFSET #{params[:iDisplayStart]}\"\n order = \"order by #{order_col} #{dir}\"\n if session[:ocr] == 'ocr_sched'\n # scheduled uses a different query that needs a group by to make the results work\n sql = [\"#{sel} #{where_clause} group by work_id, batch_id #{order} #{limits}\"] \n else\n sql = [\"#{sel} #{where_clause} #{order} #{limits}\"] \n end\n \n sql = sql + vals\n\n # get all of the results (paged)\n results = WorkOcrResult.find_by_sql(sql)\n \n # run a count query without the paging limits to get\n # the total number of results available\n pf_join = \"left outer join print_fonts on pf_id=wks_primary_print_font\"\n if session[:ocr] == 'ocr_sched'\n # search for scheduled uses different query to get data. Also need slightly\n # differnent query to get counts\n count_sel = \"select count(distinct batch_id) as cnt from works #{pf_join} inner join job_queue on wks_work_id=job_queue.work_id \"\n else\n count_sel = \"select count(*) as cnt from works #{pf_join} left outer join work_ocr_results on wks_work_id=work_id \"\n end\n sql = [\"#{count_sel} #{where_clause}\"]\n sql = sql + vals\n filtered_cnt = Work.find_by_sql(sql).first.cnt\n \n # jam it all into an array of objects that match teh dataTables structure\n data = []\n results.each do |result|\n rec = result_to_hash(result) \n data << rec \n end\n \n resp['data'] = data\n resp['iTotalDisplayRecords'] = filtered_cnt\n render :json => resp, :status => :ok\n end",
"def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend",
"def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier])\n\n #Take the provisioning profile name into account\n #if Sigh.config[:provisioning_name].to_s.length > 0\n #filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }\n #if Sigh.config[:ignore_profiles_with_different_name]\n #results = filtered\n #else\n #results = filtered if (filtered || []).count > 0\n #end\n #end\n\n if results \n return [results]\n else\n return []\n end\n \n\n\n #return results if Sigh.config[:skip_certificate_verification]\n\n #return results.find_all do |a|\n ## Also make sure we have the certificate installed on the local machine\n #installed = false\n #a.certificates.each do |cert|\n #file = Tempfile.new('cert')\n #file.write(cert.download_raw)\n #file.close\n #installed = true if FastlaneCore::CertChecker.installed?(file.path)\n #end\n #installed\n #end\n end",
"def fetch(params)\n Resque.logger.info \"Requestable.fetch received #{params.inspect}\"\n past = Time.now\n total = api_count(params)\n remain_requests = (total/250.to_f).ceil\n Resque.logger.info \"pages to request total: #{remain_requests}\"\n batch_num = (remain_requests / BATCH_SIZE.to_f).ceil\n Resque.logger.info \"batch number: #{batch_num}\"\n chap_start = 1\n chap_end = 0\n entity = params.fetch(:entity)\n Resque.logger.info \"entity name: #{entity}\"\n cache = $redis\n pages = []\n batch_num.times do\n entity_url = entity.pluralize\n if remain_requests > BATCH_SIZE\n chap_end += BATCH_SIZE\n remain_requests -= BATCH_SIZE\n else\n chap_end += remain_requests\n end\n hydra = Typhoeus::Hydra.new(max_concurrency: 30)\n\n chap_start.upto(chap_end) do |page|\n pages << page\n # queue up current batch\n request = Typhoeus::Request.new(\n \"https://api.rechargeapps.com/#{entity_url}?#{params[:query]}&limit=250&page=#{page}\",\n # followlocation: true,\n headers: HEADER\n )\n # error logging callbacks\n request.on_complete do |res|\n @used = res.headers['x-recharge-limit'].to_i\n if res.success?\n puts \"#{entity.upcase} request queued\"\n elsif res.timed_out?\n Resque.logger.error \"(HYDRA request) TIMED OUT: #{res.response_headers}\"\n elsif res.code.zero?\n Resque.logger.error \"(HYDRA request) Couldnt get an http response #{res.return_message}\"\n else\n Resque.logger.error(\"(HYDRA request) HTTP request failed: #{res.code}\")\n end\n end\n\n request.on_success do |res|\n # @used = res.headers['x-recharge-limit'].to_i\n # Resque.logger.info res.headers['x-recharge-limit']\n key = \"#{entity}_pull:#{Time.now.strftime(\"%Y%m%d\")}#{page.to_s.rjust(3, '0')}\"\n hash_set(cache, key, res.response_body)\n end\n\n hydra.queue(request)\n chap_start = chap_end\n end\n hydra.run\n batch_throttle(@used)\n end\n Resque.logger.info \"Pages iterated: #{pages.inspect}\"\n Resque.logger.info(\"RUN TIME per #{total} records: #{(Time.now - past)}\")\n end",
"def detail_index\n render :json => User.find(params[:user_id]).topics.includes(:posts, :followships), :methods => [:posts_size, :followers_size]\n end",
"def fetch\n if @fetch.nil?\n response = perform\n @fetch = Hashie::Mash.new(response[\"d\"])\n end\n\n @fetch\n end",
"def index\n sort_field = params[\"sort_field\"] || :social_connection_index\n sort_order = params[\"sort_order\"] || :desc\n page = params[\"page\"] || 1\n limit = params[\"limit\"] || 10\n searchTerm = params[\"searchTerm\"] || \"\"\n\n limit = limit.to_i\n offset = (page.to_i - 1) * limit\n\n users = User.all.order(sort_field => sort_order, :id => \"desc\").\n where(User.arel_table[:name].matches(\"%#{searchTerm}%\"))\n\n total = users.count\n users = users.offset(offset).limit(limit)\n users = users.select(User.column_names - [\"created_at\", \"updated_at\"])\n\n response = {\n users: users,\n page: page,\n total: total,\n limit: limit\n }\n\n respond_to do |format|\n format.json { render :json => response }\n end\n end",
"def fetch(request) \n\t\ttable_name = @model.table_name\n\t\tdata = request.data\n\t\t# check the advanced cretira\n\t\tunless request.advancedCriteria.nil?\t\t\t\n\t\t\tquery = buildAdvancedCriteria(request, table_name)\n\t\t\t@obj_items = @model.find_by_sql(query) \n\t\telse\n\t\t\tunless request.data.empty?\n\t\t\t\tquery = buildStandardCriteria(request, table_name)\n\t\t\t\t@obj_items = @model.find_by_sql(query) \n\t\t\telse\n\t\t\t\t@obj_items = @model.find(:all) \n\t\t\tend\n\t\tend\t\t \n\t\tobjs_count = @obj_items.count\n\t\t# get the count of the obj_items \n\t\tendRow = (objs_count > 0)?objs_count - 1 : objs_count\n\n\t\t# make the Response result object \n\t\tresponse = DSResponse.new\n\t\tresponse.data = @obj_items\n\t\tresponse.startRow = 0\n\t\tresponse.endRow = endRow\n\t\tresponse.status = 0\n\t\tresponse.totalRow = objs_count \n\n\t\treturn response \n end"
] | [
"0.63299304",
"0.60855144",
"0.6006225",
"0.5989355",
"0.5889129",
"0.5881579",
"0.57205945",
"0.56973296",
"0.56465566",
"0.5623438",
"0.5613248",
"0.5575314",
"0.55628705",
"0.5471719",
"0.5465353",
"0.54437387",
"0.5442435",
"0.540514",
"0.54021883",
"0.5395425",
"0.5380757",
"0.53536737",
"0.53434515",
"0.53434515",
"0.53416854",
"0.5290532",
"0.52766824",
"0.5271625",
"0.5256817",
"0.52301985",
"0.5211387",
"0.5191248",
"0.5176915",
"0.5160702",
"0.5147045",
"0.5124704",
"0.5110359",
"0.50990224",
"0.5063517",
"0.50551105",
"0.50464",
"0.502752",
"0.5020104",
"0.501869",
"0.5016344",
"0.49985206",
"0.4998456",
"0.4997458",
"0.4962716",
"0.4958475",
"0.49528858",
"0.49528858",
"0.4950583",
"0.49396086",
"0.49268886",
"0.49226034",
"0.4921515",
"0.49093336",
"0.49082816",
"0.4906782",
"0.49014363",
"0.49014363",
"0.4888974",
"0.48716694",
"0.48677826",
"0.48674527",
"0.48662314",
"0.48658425",
"0.4850678",
"0.48433387",
"0.48432043",
"0.48332816",
"0.48248863",
"0.48241022",
"0.4817381",
"0.4812989",
"0.48096973",
"0.480338",
"0.48016685",
"0.4797795",
"0.47967",
"0.4791137",
"0.47892404",
"0.47885025",
"0.47876704",
"0.47852606",
"0.4785245",
"0.47766408",
"0.47741607",
"0.47735563",
"0.47708976",
"0.47707948",
"0.4759459",
"0.47589168",
"0.47574985",
"0.47554174",
"0.4750714",
"0.47456226",
"0.4739071",
"0.47389898",
"0.47387588"
] | 0.0 | -1 |
GET /votes GET /votes.json | def index
@votes = Vote.all
@commitees = Commitee.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def votes(options = {})\n get('/votes', options)\n end",
"def getvotes\n @the_question = Question.find(params[:id])\n render json: [{question: @the_question}, {votes: @the_question.votes_for}] and return\n end",
"def get_votes\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def votes\n @votes ||= ArkEcosystem::Client::API::Votes.new(@client)\n end",
"def index\n @votes = @votable.votes\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # results.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end",
"def get_votes\n\t\t@voters.each{ |voter| @votes << voter.vote(@candidates) }\n\tend",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = @change.votes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @votes = @retort.votes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n # @votes = Vote.all\n end",
"def show\n @vote = @votable.votes.find(params[:id])\n end",
"def index\n @caption_votes = CaptionVote.all\n render json: @caption_votes\n end",
"def index\n @votes = Vote.top\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def show\n @postvote = Postvote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @postvote }\n end\n end",
"def show\n @postvote = Postvote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @postvote }\n end\n end",
"def show\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def get_votes\n ids = @posts.map(&:id)\n votes = Vote.where(\"post_id in (:ids) and ((user_id IS NOT null and user_id = :user_id) or (ip_address = :ip))\", {:ids => ids, :user_id => current_user, :ip => request.remote_ip})\n votes.map{|vote| {:id => vote.post_id.to_s, :positive => (vote.rating > 0) ? true : false } }\n end",
"def index\n render json: Question.all.order(:votes => :desc)\n end",
"def index\n @posts = Post.all\n @vote = Vote.new\n respond_to do |format|\n format.json{render json:@posts}\n format.html\n end\n\n end",
"def show\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply_vote }\n end\n end",
"def show\n @vote_post = VotePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote_post }\n end\n end",
"def answers_by_votes(options={})\n parse_answers(request(singular(id) + \"answers/votes\", options))\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n @votings = Voting.all\n end",
"def show\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_vote }\n end\n end",
"def show\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_vote }\n end\n end",
"def show\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n end",
"def show\n @voter = Voter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voter }\n end\n end",
"def post_votes\n []\n end",
"def show\n @vote = @change.votes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @votes = Vote.find(:all, :conditions => {:event_id => @event} )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def show\n @vote = @retort.votes.find(params[:id])\n\n respond_to do |format|\n format.html do\n render :layout => false\n end\n format.xml { render :xml => @vote }\n end\n end",
"def index\n @model_votes = ModelVote.all\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def index\n @rep_votes = RepVote.all\n end",
"def index\n @user_votes = UserVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_votes }\n end\n end",
"def show\n @comm_vote = CommVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comm_vote }\n end\n end",
"def index\n @fraction_votes = FractionVote.all\n end",
"def getcount\n\t\tRails.logger.info 'Called VotesController#getcount'\n\t\tupcount = VoteStore.get_up_count(params[:id])\n\t\tdowncount = VoteStore.get_down_count(params[:id])\n\t\tRails.logger.info \"Up: #{upcount}\"\n\t\tRails.logger.info \"Down: #{downcount}\"\n\t\trender json: {count: (upcount-downcount)}\n\tend",
"def index\n @upvotes = Upvote.all\n end",
"def index\n @fundamental_alliance_leader_votes = Fundamental::AllianceLeaderVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_alliance_leader_votes }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n @vote.read\n\n @comment = Comment.new\n @subcomment = SubComment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n\t\t@question = Question.find(params[:id])\n @answers = Answer.where(\"question_id = ?\", @question.id).order('upvote DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: { question: @question, answers: @answers } }\n\t\tend\n\tend",
"def index\n @api_v1_answer_upvotes = Api::V1::AnswerUpvote.all\n end",
"def vote\n if user_signed_in?\n @idea = Idea.find(params[:idea_id])\n vote = params[:vote]\n @ideavote = IdeaVote.where(:user_id => current_user.id, :idea_id => params[:idea_id]);\n \n # back out the old vote\n vote_changed = false\n had_vote = false\n \n if @ideavote.count > 0\n had_vote = true\n if @ideavote[0].vote != vote\n vote_changed = true\n end\n \n if @ideavote[0].vote == \"yae\"\n @idea.yae_votes-=1\n else \n @idea.nay_votes-=1\n end\n @ideavote[0].destroy\n end\n \n # apply the new vote\n if !had_vote || vote_changed\n @newideavote = IdeaVote.new()\n @newideavote.user_id = current_user.id\n @newideavote.idea_id = @idea.id\n @newideavote.vote = vote\n @newideavote.save \n if vote == \"yae\"\n @idea.yae_votes+=1\n else \n @idea.nay_votes+=1\n end\n end\n \n @idea.rank = @idea.calculate_rank\n @idea.save\n \n respond_to do |format|\n format.json { \n render :json => @idea.to_json(:methods => [:vote_tally, :category_name, :user_alias]) \n }\n end\n \n end\n end",
"def get_votes\n res = []\n unless session[:drupal_user_id].nil?\n res = Rails.cache.fetch 'votes-from-' + session[:drupal_user_id].to_s do\n u = User.find_by_uid(session[:drupal_user_id])\n unless u.nil?\n r = Vote.where(voter_id: u.id).map { |v| v.voteable_id }\n else\n r = []\n end\n\n r\n end\n end\n\n res\n end",
"def index\n @commentvotes = @comment.commentvotes.all\n end",
"def new\n @vote = @parent.votes.new(params[:vote])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def index\n @votes = Vote.paginate(:page => params[:page]||1,:per_page => Vote_PerPage,:conditions => \"user_id =#{current_user.id}\",:order => \"id desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def voted_by(name)\n get_data(\"user/#{name}/voted\")\n end",
"def show\n @vote_record = VoteRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote_record }\n end\n end",
"def show\n @proposal = Proposal.find(params[:id])\n\n @proposal.votes.each do |v|\n if v.user == current_user\n @vote = v\n end\n end\n if can? :vote, @proposal\n if @vote.nil?\n @vote = @proposal.votes.new\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end",
"def index\n @votes = Vote.all\n if params[:poll]\n @poll = Poll.find(params[:poll])\n if Vote.find_by_ip_and_poll_id(request.remote_ip, @poll.id) == nil\n redirect_to \"#{new_vote_url}?poll=#{@poll.id}\", notice: 'You have not voted for this poll yet. Cast a vote to view results.' \n else\n #format.html { redirect_to \"#{votes_url}?poll=#{@poll.id}\", notice: 'View results.' }\n end\n else\n @poll = Poll.new\n end\n \n end",
"def index\n @svotes = Svote.all\n end",
"def vote\n\tend",
"def index\n @votings = Voting.all.order(:id)\n end",
"def vote_up\n current_user = User.find(session[:user_id])\n @the_question = Question.find(params[:id])\n\n current_user.vote_for(@the_question)\n \n render json: [{question: @the_question}, {votes: @the_question.votes_for}]\n end",
"def invited_users\n render json: @moot.list_users_can_vote\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: [@proposal, @vote] }\n end\n end",
"def show\n @voters = @post.voters\n end",
"def new\n @api_v1_post_vote = PostVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end",
"def new\n @vote = Vote.new\n @vote.user_id = current_user.id\n\n # assign @books depending on state of election\n if (ConfigParameter.find_by_name(\"second_round_started\").value == \"false\" )\n @books = Book.all\n else\n # if second round of voting has started, books are a subset of Book.all:\n # - don't include books that got no votes\n # - take at least half of the number of existing books as before\n @books = Book.all.select {|book| book.votes.count > 0}\n end\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def vote_on\n if Vote.voteOn(params[:activity_id], params[:user_id], params[:rating])\n\t\t\t@activity = Activity.find(params[:activity_id])\n\t\t\t@activity.viewer = User.find_by_id(params[:user_id])\n render :json=>@activity\n end\n return :text=>'There was an error voting for this activity', :status=>:service_unavailable\n end",
"def vote\n @user = User.find(cookies[:user_id])\n suggestion = Suggestion.find_by(name: params[:suggestion_name])\n \n if suggestion.nil?\n flash[:error] = \"Invalid vote\"\n respond_to do |format|\n format.json{ render :json => { :error => \"Invalid vote\" }, :status => 400}\n end\n return\n elsif !@user.can_vote?\n flash[:error] = \"Out of votes\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You may not vote again until next month\" }, :status => 409}\n end\n return\n elsif Vote.has_voted?(@user.id, suggestion.id)\n flash[:error] = \"Already voted for this\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You already voted for this\" }, :status => 409}\n end\n return\n end\n \n suggestion.voted\n @user.vote\n Vote.create(user_id: @user.id, suggestion_id: suggestion.id)\n \n # Needed to track votes in rspec:\n @user_votes = @user.remaining_votes\n @suggestion_votes = suggestion.votes\n \n respond_to do |format|\n format.json{ head :ok }\n return\n end\n end",
"def index\n @vote_candidates = VoteCandidate.all\n authorize VoteCandidate\n end",
"def index\n @emitted_votes = EmittedVote.all\n end",
"def new\n @postvote = Postvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @postvote }\n end\n end",
"def votes_count\n votes.size\n end",
"def index\n @wore_it_votes = WoreItVote.all\n end"
] | [
"0.84528613",
"0.7669005",
"0.7550046",
"0.75408536",
"0.75396514",
"0.75396514",
"0.75396514",
"0.75396514",
"0.75396514",
"0.7527788",
"0.7526703",
"0.7353587",
"0.7104424",
"0.6984962",
"0.6984962",
"0.6984962",
"0.6984962",
"0.6984962",
"0.6984962",
"0.6984962",
"0.6984962",
"0.6976754",
"0.696524",
"0.6950927",
"0.6944245",
"0.6944245",
"0.6944245",
"0.6944245",
"0.6944245",
"0.6944245",
"0.6903047",
"0.6900872",
"0.68537974",
"0.6809136",
"0.67556965",
"0.6739829",
"0.6735361",
"0.6735361",
"0.672888",
"0.6601679",
"0.6601679",
"0.6506051",
"0.6470504",
"0.6426641",
"0.6415924",
"0.640834",
"0.6399189",
"0.6396594",
"0.63775164",
"0.6345651",
"0.6345651",
"0.6345651",
"0.6345407",
"0.6345278",
"0.63251966",
"0.6320358",
"0.62918127",
"0.62760633",
"0.6273698",
"0.6227786",
"0.6207889",
"0.6207889",
"0.6207889",
"0.6196213",
"0.61941934",
"0.61499983",
"0.6137023",
"0.61210513",
"0.60951793",
"0.6091776",
"0.6063267",
"0.6052446",
"0.60433877",
"0.6032638",
"0.60159785",
"0.60129917",
"0.6002948",
"0.60009676",
"0.600087",
"0.5995828",
"0.5991795",
"0.5991147",
"0.597509",
"0.59671",
"0.59632856",
"0.5961159",
"0.59373915",
"0.593455",
"0.59306484",
"0.5923051",
"0.59222746",
"0.59188426",
"0.59188426",
"0.59188426",
"0.5911033",
"0.59031254",
"0.58948725",
"0.5892743",
"0.5887123",
"0.5880122",
"0.5866465"
] | 0.0 | -1 |
GET /votes/1 GET /votes/1.json | def show
@vote = Vote.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def votes(options = {})\n get('/votes', options)\n end",
"def getvotes\n @the_question = Question.find(params[:id])\n render json: [{question: @the_question}, {votes: @the_question.votes_for}] and return\n end",
"def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # results.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end",
"def index\n @votes = @votable.votes\n end",
"def show\n @vote = @votable.votes.find(params[:id])\n end",
"def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end",
"def get_votes\n @votes = Vote.all\n end",
"def show\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def votes\n @votes ||= ArkEcosystem::Client::API::Votes.new(@client)\n end",
"def index\n @votes = @change.votes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def show\n @postvote = Postvote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @postvote }\n end\n end",
"def show\n @postvote = Postvote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @postvote }\n end\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n @votes = Vote.all\n end",
"def index\n # @votes = Vote.all\n end",
"def index\n @votes = @retort.votes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n @votes = Vote.top\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def show\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply_vote }\n end\n end",
"def show\n @vote = @change.votes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @vote_post = VotePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote_post }\n end\n end",
"def index\n @caption_votes = CaptionVote.all\n render json: @caption_votes\n end",
"def show\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_vote }\n end\n end",
"def show\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_vote }\n end\n end",
"def show\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment_vote }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def show\n @vote = @retort.votes.find(params[:id])\n\n respond_to do |format|\n format.html do\n render :layout => false\n end\n format.xml { render :xml => @vote }\n end\n end",
"def index\n @posts = Post.all\n @vote = Vote.new\n respond_to do |format|\n format.json{render json:@posts}\n format.html\n end\n\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def show\n @comm_vote = CommVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comm_vote }\n end\n end",
"def show\n @voter = Voter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voter }\n end\n end",
"def new\n @api_v1_post_vote = PostVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n @vote.read\n\n @comment = Comment.new\n @subcomment = SubComment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote }\n end\n end",
"def get_votes\n\t\t@voters.each{ |voter| @votes << voter.vote(@candidates) }\n\tend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def show\n @vote_record = VoteRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vote_record }\n end\n end",
"def index\n render json: Question.all.order(:votes => :desc)\n end",
"def index\n @votes = Vote.find(:all, :conditions => {:event_id => @event} )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def index\n @votings = Voting.all\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def show\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: [@proposal, @vote] }\n end\n end",
"def show\n @proposal = Proposal.find(params[:id])\n\n @proposal.votes.each do |v|\n if v.user == current_user\n @vote = v\n end\n end\n if can? :vote, @proposal\n if @vote.nil?\n @vote = @proposal.votes.new\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @vote = @parent.votes.new(params[:vote])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @rep_votes = RepVote.all\n end",
"def new\n @vote = @change.votes.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def show\n\t\t@question = Question.find(params[:id])\n @answers = Answer.where(\"question_id = ?\", @question.id).order('upvote DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: { question: @question, answers: @answers } }\n\t\tend\n\tend",
"def show\n @voteable = Vote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def index\n @model_votes = ModelVote.all\n end",
"def index\n @fraction_votes = FractionVote.all\n end",
"def new\n @postvote = Postvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @postvote }\n end\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def show_votes # :nologin: :prefetch:\n pass_query_params\n @naming = find_or_goto_index(Naming, params[:id].to_s,\n include: [:name, :votes])\n end",
"def show\n @vote = Vote.find(params[:id])\n @vote_options = VoteOption.find(:all,:conditions => \"voter_id=#{@vote.id}\")\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vote }\n end\n end",
"def set_voting\n @voting = Voting.find(params[:id])\n end",
"def set_voting\n @voting = Voting.find(params[:id])\n end",
"def set_voting\n @voting = Voting.find(params[:id])\n end",
"def show\n @movie = Movie.find(params[:id])\n @vote = Vote.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end",
"def index\n @api_v1_answer_upvotes = Api::V1::AnswerUpvote.all\n end",
"def new\n @vote = Vote.new\n @vote.user_id = current_user.id\n\n # assign @books depending on state of election\n if (ConfigParameter.find_by_name(\"second_round_started\").value == \"false\" )\n @books = Book.all\n else\n # if second round of voting has started, books are a subset of Book.all:\n # - don't include books that got no votes\n # - take at least half of the number of existing books as before\n @books = Book.all.select {|book| book.votes.count > 0}\n end\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def index\n @votes = Vote.paginate(:page => params[:page]||1,:per_page => Vote_PerPage,:conditions => \"user_id =#{current_user.id}\",:order => \"id desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @votes }\n end\n end",
"def vote\n\tend",
"def answers_by_votes(options={})\n parse_answers(request(singular(id) + \"answers/votes\", options))\n end",
"def index\n @user_votes = UserVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_votes }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n if current_user\n vote = Vote.find_by_entry_id_and_user_id(@entry.id, current_user.id)\n @voted_value = vote ? vote.value : 0\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def index\n @votings = Voting.all.order(:id)\n end",
"def index\n @votes = Vote.all\n if params[:poll]\n @poll = Poll.find(params[:poll])\n if Vote.find_by_ip_and_poll_id(request.remote_ip, @poll.id) == nil\n redirect_to \"#{new_vote_url}?poll=#{@poll.id}\", notice: 'You have not voted for this poll yet. Cast a vote to view results.' \n else\n #format.html { redirect_to \"#{votes_url}?poll=#{@poll.id}\", notice: 'View results.' }\n end\n else\n @poll = Poll.new\n end\n \n end",
"def index\n @upvotes = Upvote.all\n end",
"def voted_by(name)\n get_data(\"user/#{name}/voted\")\n end",
"def get_votes\n ids = @posts.map(&:id)\n votes = Vote.where(\"post_id in (:ids) and ((user_id IS NOT null and user_id = :user_id) or (ip_address = :ip))\", {:ids => ids, :user_id => current_user, :ip => request.remote_ip})\n votes.map{|vote| {:id => vote.post_id.to_s, :positive => (vote.rating > 0) ? true : false } }\n end",
"def show\n id = params[:id]\n @voter = Voter.find(id)\n end",
"def new\n @vote = @retort.votes.new\n\n respond_to do |format|\n format.html {\n render :layout => false\n }\n format.xml { render :xml => @vote }\n end\n end",
"def show\n @voters = @post.voters\n end",
"def post_votes\n []\n end"
] | [
"0.78972834",
"0.74997",
"0.74689794",
"0.74660367",
"0.74557495",
"0.74557495",
"0.74557495",
"0.74557495",
"0.74557495",
"0.73750776",
"0.72750264",
"0.72750264",
"0.72750264",
"0.72750264",
"0.72750264",
"0.72750264",
"0.72750264",
"0.72750264",
"0.72478855",
"0.72051424",
"0.71244633",
"0.71075976",
"0.7072882",
"0.7036682",
"0.7035993",
"0.6977843",
"0.6933385",
"0.6933385",
"0.68820447",
"0.68820447",
"0.68820447",
"0.68820447",
"0.68820447",
"0.68820447",
"0.6828357",
"0.68154794",
"0.67644453",
"0.6723448",
"0.6715012",
"0.6701561",
"0.66316783",
"0.66155094",
"0.66155094",
"0.66155094",
"0.6572173",
"0.6572173",
"0.6565727",
"0.6513167",
"0.64950615",
"0.64950615",
"0.64950615",
"0.6478867",
"0.6467392",
"0.6444293",
"0.63932484",
"0.63758755",
"0.6360158",
"0.63580275",
"0.6353008",
"0.63148516",
"0.630152",
"0.62664145",
"0.62664145",
"0.62664145",
"0.6243041",
"0.62192976",
"0.6205282",
"0.6200046",
"0.6192972",
"0.6158318",
"0.6151552",
"0.61118394",
"0.60856813",
"0.6084546",
"0.6076402",
"0.60730284",
"0.60730284",
"0.60730284",
"0.60666376",
"0.60631037",
"0.6049848",
"0.6049848",
"0.6049848",
"0.6045468",
"0.60296226",
"0.60152316",
"0.60137993",
"0.6009321",
"0.6007483",
"0.6007183",
"0.6006493",
"0.6003456",
"0.60010016",
"0.5995003",
"0.59850985",
"0.5967841",
"0.5967496",
"0.59663147",
"0.59584945",
"0.5947251"
] | 0.6782198 | 36 |
POST /votes POST /votes.json | def create
@vote = Vote.new(vote_params)
respond_to do |format|
if @vote.save
format.html { redirect_to @vote, notice: 'Vote was successfully created.' }
format.json { render :show, status: :created, location: @vote }
else
format.html { render :new }
format.json { render json: @vote.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n votes = params[:vote]\n voter = params[:voter_id]\n\n if votes\n votes.each do |k,v|\n @vote = Vote.new({:voter_id => voter,\n :position_id => v,\n :candidate_id => k })\n @vote.save\n end\n end\n\n\n redirect_to '/vote'\n\n #respond_to do |format|\n #if @vote.save\n #format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n #format.json { render json: @vote, status: :created, location: @vote }\n #else\n #format.html { render action: \"new\" }\n #format.json { render json: @vote.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def create\n @vote = @votable.votes.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to build_path_vote(@vote), notice: 'Vote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vote }\n else\n format.html { render action: 'new' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @idea = Idea.find(params[:idea_id])\n @vote = @idea.votes.new(params[:vote])\n @vote.username = current_user.to_s\n respond_to do |format|\n if @vote.save \n format.json { render json: @vote, status: :created, location: @vote }\n else \n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new(params[:vote])\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new(params[:vote])\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_vote\r\n\t\tuser.votes.create(value: 1, post: self)\r\n\tend",
"def create_vote\n\t\tuser.votes.create(value: 1, post: self)\n\tend",
"def create_vote\n user.votes.create(value: 1, post: self)\n end",
"def create\n @vote = @parent.votes.new\n# change this later for user login feature\n @vote.user_id = session[:user_id]\n\n respond_to do |format|\n if @vote.save\n @vote.update_post\n format.html { redirect_to :back, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_vote\n user.votes.create(value: 1, post: self)\n end",
"def create_vote\n self.user.votes.create(value: 1, post: self)\n end",
"def create_vote\n self.user.votes.create(value: 1, post: self)\n end",
"def votes(options = {})\n get('/votes', options)\n end",
"def create\n @postvote = Postvote.new(params[:postvote])\n\n respond_to do |format|\n if @postvote.save\n format.html { redirect_to @postvote, notice: 'Postvote was successfully created.' }\n format.json { render json: @postvote, status: :created, location: @postvote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @postvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_answer_votes\n\t\tif @answer.vote_not_present?(current_user)\n vote = @answer.votes.new\n vote.user = current_user\n end\n if vote.save\n render json: { success: true,message: \"Vote Successfully Created.\"},:status=>200\n else\n render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n end\n\tend",
"def add_vote(id, verdict)\n id = to_id(id)\n params = {\n data: {\n type: \"vote\",\n attributes: {\n verdict: verdict\n }\n }\n }\n _post(\"/#{name}/#{id}/votes\", params) { |json| json }\n end",
"def create\n @vote = Vote.new(params[:vote])\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, flash: { success: '投票创建成功。' } }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = current_user.votes.build(vote_params)\n if @vote.save\n redirect_to @vote, notice: 'Vote was successfully submitted'\n else\n render action: 'new'\n end\n end",
"def create\n vote = Vote.new\n @idea = Idea.find(params[:id])\n @idea.votes << vote\n @idea.save\n vote.save\n current_user.votes << vote\n current_user.save\n respond_to do |format|\n format.html\n format.js {}\n end\n end",
"def create\n @voting = Voting.new(voting_params)\n\n respond_to do |format|\n if @voting.save\n format.html { redirect_to @voting, notice: 'Voting was successfully created.' }\n format.json { render :show, status: :created, location: @voting }\n else\n format.html { render :new }\n format.json { render json: @voting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if(Post.find(params[:post_vote][:post_id]).user_id != params[:post_vote][:user_id]) # only vote if it's not the same user who wrote the post!\n @api_v1_post_vote=PostVote.find_by_post_id_and_user_id(params[:post_vote][:post_id], params[:post_vote][:user_id])\n if @api_v1_post_vote.nil?\n @api_v1_post_vote = PostVote.new(params[:post_vote])\n else\n @api_v1_post_vote.vote = params[:post_vote][:vote]\n end\n\n respond_to do |format|\n if @api_v1_post_vote.save\n #format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully created.' }\n format.json { render json: @api_v1_post_vote, status: :created }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @api_v1_post_vote.errors.messages.values, status: 400 }\n end\n end\n else\n render json: \"Can't vote for yourself.\", status: 400\n end\n end",
"def create\n @vote = Vote.find_or_initialize_by(vote_params)\n if @vote.persisted?\n @vote.deleted = !@vote.deleted\n end\n\n respond_to do |format|\n if @vote.save\n format.json { render :show, status: :created, location: @vote }\n else\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new\n end",
"def create\n @voting = Voting.new(voting_params)\n\n respond_to do |format|\n if @voting.save\n flash[:success] = 'Voting was successfully created.'\n format.html { redirect_to votings_path }\n format.json { render :show, status: :created, location: @voting }\n else\n format.html { render :new }\n format.json { render json: @voting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = @retort.votes.new(params[:vote])\n @vote.user = current_user\n\n respond_to do |format|\n if @vote.save\n flash[:notice] = 'Vote was successfully created.'\n format.html { redirect_to(@retort) }\n format.xml { render :xml => @vote, :status => :created, :location => [@retort, @vote] }\n else\n flash[:error] = 'Vote could not be created.'\n format.html { redirect_to(@retort) }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vote_post = VotePost.new(params[:vote_post])\n\n respond_to do |format|\n if @vote_post.save\n format.html { redirect_to @vote_post, notice: 'Vote post was successfully created.' }\n format.json { render json: @vote_post, status: :created, location: @vote_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = @bet.votes.new(vote_params)\n @vote.ip_addr = params[:vote][:uuid]\n\n tmp_vote = Vote.where(ip_addr: @vote.ip_addr, bet_id: @bet.id)\n\n if @bet.ended?\n render json: {\n bet: @bet,\n error: \"EXPIRED\",\n msg: \"Bets are closed.\"\n }, status: :ok\n return\n\n elsif tmp_vote.any?\n render json: {\n status: 'error',\n error: \"ALREADY_VOTED\",\n msg: \"You've already voted on this\"\n }, status: :ok\n return\n else\n\n if @vote.answer != \"a\" and @vote.answer != \"b\"\n render json: {\n status: 'error',\n error: \"INVALID_ANSWER\",\n msg: \"Invalid answer: #{@vote.answer}\"\n }, status: :unprocessable_entity\n return\n end\n\n\n if @vote.save\n\n render json: {\n vote: @vote,\n status: \"success\",\n error: nil\n }, status: :created, location: api_v1_bet_votes_url(@bet, @vote)\n\n else\n render json: {\n status: \"error\",\n error: \"unprocessable_entity\",\n msg: @vote.errors.full_messages\n }, status: :unprocessable_entity\n end\n\n end\n\n end",
"def create\n puts \"IS THIS WORKING NOWWWW?\"\n\n @previous_votes = Vote.where(:post_id => params[:post_id],:user_id => @current_user.id).all\n if @previous_votes.blank?\n @vote = Vote.new(params[:vote])\n @vote.post_id = params[:post_id]\n @vote.user_id = @current_user.id\n else\n @vote = nil\n end\n\n respond_to do |format|\n if @vote\n @vote.save\n format.html { redirect_back_or(posts_url, \"Thank you for voting!\", \"valid\")}\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html {redirect_back_or(posts_url, \"You can't vote for a post more than once!\", \"invalid\")}\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @vote = Vote.new(vote_params)\n\n vote = current_user.votes.create!(vote_params)\n video = Video.find_by_youtube_id(vote.video_id)\n p \"enqueuing votes by interval for video: #{video.youtube_id}\"\n EventFactory::calculate_votes_by_intervals(video)\n\n render json: {data: vote}\n # respond_to do |format|\n # if @vote.save\n # format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n # format.json { render :show, status: :created, location: @vote }\n # else\n # format.html { render :new }\n # format.json { render json: @vote.errors, status: :unprocessable_entity }\n # end\n # end\n rescue\n render json: {error: 'error creating vote'}\n end",
"def new\n @vote = @parent.votes.new(params[:vote])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @api_v1_post_vote = PostVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end",
"def create_vote\n \t\t#self.votes.create(value: 1, user: self.user )\n \t#\tvotes.create(value: 1, user: user )\n\t \tuser.votes.create(value: 1, post: self)\n \tend",
"def vote_params\n params.require(:vote).permit(:username, :answer)\n end",
"def vote_params\n params.require(:vote).permit(:post_id, :up, :user_id)\n end",
"def create\n @reply_vote = ReplyVote.new(params[:reply_vote])\n\n respond_to do |format|\n if @reply_vote.save\n format.html { redirect_to @reply_vote, notice: 'Reply vote was successfully created.' }\n format.json { render json: @reply_vote, status: :created, location: @reply_vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upvote\n\t@post = Post.find(params[:id])\n\t@post.votes = @post.votes + 1\n puts @post.votes\n\n\n\n\trespond_to do |format|\n if @post.update(post_par2)\n\t\tformat.html { redirect_to @post, notice: 'Post was successfully upvoted.' }\n\t\tformat.json { render :show, status: :ok, location: @post }\n end\n\tend\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end",
"def create_vote\n user.answer_votes.create(value: 1, answer: self)\n end",
"def create\n jsonString = request.body.read\n jsonHash = JSON.parse(jsonString)\n\n #CHECK IF VOTE EXIST. IF EXIST, EDIT Vote Integer. IF NOT, CREATE Vote.\n if CaptionVote.where(user_id: jsonHash['user_id'], caption_id: jsonHash['caption_id']).any?\n #Vote Entry Exist. Update Vote\n @caption_vote = CaptionVote.where(user_id: jsonHash['user_id'], caption_id: jsonHash['caption_id'])\n if @caption_vote.update(vote: jsonHash[\"vote\"])\n render json: {caption_vote: @caption_vote, total_votes: total_votes(jsonHash['caption_id'])}\n else\n render json: @caption_vote.errors\n end\n else\n #Vote Entry Don't Exist. Create Vote\n @caption_vote = CaptionVote.new(jsonHash)\n if @caption_vote.save\n render json: {caption_vote: @caption_vote, total_votes: total_votes(jsonHash['caption_id'])}\n else\n render json: {'error': @caption_vote.errors}, status: 401\n end\n end\n end",
"def create\n @vote = Vote.new(vote_params)\n @vote.save\n redirect_to :action => :thanks\n end",
"def create_vote\n user.answer_votes.create(value: 1, answer: self)\n end",
"def vote_params\n params.require(:vote).permit(:value, :review_id, :voter_id)\n end",
"def create\n @api_v1_answer_upvote = Api::V1::AnswerUpvote.new(api_v1_answer_upvote_params)\n\n respond_to do |format|\n if @api_v1_answer_upvote.save\n format.html { redirect_to @api_v1_answer_upvote, notice: 'Answer upvote was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_answer_upvote }\n else\n format.html { render :new }\n format.json { render json: @api_v1_answer_upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @emitted_vote = EmittedVote.new(emitted_vote_params)\n\n respond_to do |format|\n if @emitted_vote.save\n format.html { redirect_to @emitted_vote , notice: 'Emitted vote was successfully created.' }\n format.json { render 'show' , status: :created , location: @emitted_vote }\n else\n format.json { render json: @emitted_vote.errors , status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.find(params[:postID])\n if (@post.checkIfVoted(@post.id.to_s, session[:user_id].to_s)[0]!=nil )\n redirect_to @post, notice: 'You have already voted for this post.'\n elsif @post.postUserID.to_s == session[:user_id].to_s\n redirect_to @post, notice: 'You can not vote for yourself'\n else\n @vote = Vote.new(params[:vote])\n @vote.postID = params[:postID]\n @vote.userID = session[:user_id]\n\n @post.increment(:votes)\n @post.save\n # @post.voted((@post.votes+1).to_s,@post.id.to_s)\n #@post.increment(votes)\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @post, notice: 'Vote successfully.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @vote = Vote.new(params[:vote].merge(:user => current_user))\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to(@vote, :notice => 'Vote was successfully created.') }\n format.xml { render :xml => @vote, :status => :created, :location => @vote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vote_params\n params.require(:vote).permit(:answer_id, :poll_id)\n end",
"def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def new\n @postvote = Postvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @postvote }\n end\n end",
"def create\n\t\tif @question.vote_not_present?(current_user)\n vote = @question.votes.new\n vote.user = current_user\n end\n if vote.save\n render json: { success: true,message: \"Vote has Successfully Created.\"},:status=>200\n else\n render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n end\n\tend",
"def create\n @model_vote = ModelVote.new(model_vote_params)\n\n respond_to do |format|\n if @model_vote.save\n format.html { redirect_to @model_vote, notice: 'Model vote was successfully created.' }\n format.json { render :show, status: :created, location: @model_vote }\n else\n format.html { render :new }\n format.json { render json: @model_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def create\n @vote = Vote.new vote_params\n @vote.user = current_user\n if @vote.save\n @vote.votable.create_trophy_if_warranted\n end\n respond_with @vote\n end",
"def create\n @svote = Svote.new(svote_params)\n \n respond_to do |format|\n if @svote.save\n format.html { redirect_to @svote, notice: 'Svote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @svote }\n else\n format.html { render action: 'new' }\n format.json { render json: @svote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getvotes\n @the_question = Question.find(params[:id])\n render json: [{question: @the_question}, {votes: @the_question.votes_for}] and return\n end",
"def index\n @posts = Post.all\n @vote = Vote.new\n respond_to do |format|\n format.json{render json:@posts}\n format.html\n end\n\n end",
"def vote_up\n current_user = User.find(session[:user_id])\n @the_question = Question.find(params[:id])\n\n current_user.vote_for(@the_question)\n \n render json: [{question: @the_question}, {votes: @the_question.votes_for}]\n end",
"def create\n @vote = Vote.new(vote_params)\n @restaurant = Restaurant.find(params[:restaurant_id])\n if @vote.vote == 1\n @restaurant.add_up_vote\n end\n if @vote.vote == 2\n @restaurant.add_down_vote\n end\n @restaurant.save\n respond_to do |format|\n if @vote.save\n format.html { redirect_to restaurants_path, notice: \"Vote was successfully created.\" }\n format.json { render :show, status: :created, location: @vote }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @votes = @votable.votes\n end",
"def init_votes params, current_user_id\n #create votes for each user in the game\n game.users.each do |user|\n event_votes.create_vote_for_game user, params, current_user_id\n end\n reload\n\n Userpost.create_event_created(self)\n\n end",
"def create\n @vote = Vote.new(params[:vote])\n @vote.user_id = session[:user_id]\n if params[:type].eql? \"post\"\n @vote.post_id = params[:post_id]\n else\n @vote.comment_id = params[:comment_id]\n end\n @vote.save\n redirect_to post_url(Post.find(params[:post_id]))\n=begin\n respond_to do |format|\n if @vote.save\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render json: @vote, status: :created, location: @vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def create\n @reply_vote = ReplyVote.new(params[:reply_vote])\n @reply_vote.user = current_user\n @reply_vote.reply=Reply.find(params[:reply_id])\n\n respond_to do |format|\n if @reply_vote.save\n format.html { redirect_to posts_path, notice: 'Reply vote was successfully created.' }\n format.json { render json: posts_path, status: :created, location: @reply_vote }\n else\n format.html { redirect_to posts_path, :flash => {:alert => \"You can only vote once per reply!\"} }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @post.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back\n end",
"def create\n @vote = @change.votes.new(params[:vote])\n\n respond_to do |format|\n if @vote.save\n flash[:notice] = t('votes.new.success')\n format.html { priority_change_vote(@priority,@change,@vote) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def votes\n @votes ||= ArkEcosystem::Client::API::Votes.new(@client)\n end",
"def new_vote(new_vote,voter_name)\n # puts \"iNSERT NEW VOTES WITH VOTES #{new_vote.inspect}\"\n\n self.votes = Array.new\n hash = Hash.new\n hash[new_vote] = voter_name\n self.votes << hash\n new_pg_vote(self.votes,self)\n\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def vote_params\n params.require(:vote).permit(:value)\n end",
"def upvote\n # Increase the vote count. You would probably also want to perform other checks to\n # make sure the same IP doesn't upvote multiple times, etc.\n @question.votes += 1\n if @question.save\n # Render out the new vote count.\n render json: { votes: @question.votes } # Sends back a 200 status, jQuery's success callback will be called\n else\n # You could also render back some error JSON if you wanted\n head :bad_request # Sends back a 403 status, jQuery's error callback will be called\n end\n end",
"def vote\n @user = User.find(cookies[:user_id])\n suggestion = Suggestion.find_by(name: params[:suggestion_name])\n \n if suggestion.nil?\n flash[:error] = \"Invalid vote\"\n respond_to do |format|\n format.json{ render :json => { :error => \"Invalid vote\" }, :status => 400}\n end\n return\n elsif !@user.can_vote?\n flash[:error] = \"Out of votes\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You may not vote again until next month\" }, :status => 409}\n end\n return\n elsif Vote.has_voted?(@user.id, suggestion.id)\n flash[:error] = \"Already voted for this\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You already voted for this\" }, :status => 409}\n end\n return\n end\n \n suggestion.voted\n @user.vote\n Vote.create(user_id: @user.id, suggestion_id: suggestion.id)\n \n # Needed to track votes in rspec:\n @user_votes = @user.remaining_votes\n @suggestion_votes = suggestion.votes\n \n respond_to do |format|\n format.json{ head :ok }\n return\n end\n end",
"def create\n @voter = Voter.new(params[:voter])\n\n respond_to do |format|\n if @voter.save\n format.html { redirect_to @voter, notice: 'Voter was successfully created.' }\n format.json { render json: @voter, status: :created, location: @voter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new(vote_params)\n\n respond_to do |format|\n if @vote.save\n\n tracker = Generic.get_mixpanel_tracker\n tracker.track(vote_params[:user_id], 'Vote')\n\n Generic.send_notificatioin(params[:vote][:user_id], 'חבר/ה שלך הצביע/ה באפליקציית iVote.')\n\n format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n format.json { render :show, status: :created, location: @vote }\n else\n format.html { render :new }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote_params\n params.require(:vote).permit(:proposal_id, :round, :vote, :comments)\n end",
"def create\n @comment_vote = CommentVote.new(params[:comment_vote])\n\n respond_to do |format|\n if @comment_vote.save\n format.html { redirect_to @comment_vote, notice: 'Comment vote was successfully created.' }\n format.json { render json: @comment_vote, status: :created, location: @comment_vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: [@proposal, @vote] }\n end\n end",
"def vote\n #params[:answer_id][:vote]\n #it can be \"1\" or \"-1\"\n @post = Post.find(params[:post_id])\n @post.vote!(params[:post_id][:votes])\n redirect_to :action => 'index'\n end",
"def vote_params\n params[:vote]\n end",
"def create\n @vote = Vote.new(vote_params)\n if vote_params['positive'] == 'true'\n @vote.positive = true\n elsif\n vote_params['positive'] == 'false'\n @vote.positive = false\n end\n\n @vote.player ||= @player\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to new_vote_path(fbuid: @vote.player.fbuid, prev_vote: @vote)}\n format.json { render action: 'show', status: :created, location: @vote }\n else\n format.html { render action: 'new' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_guest_vote\n user = current_or_guest_user\n if user.first_name == \"guest\"\n if session[:votes].nil?\n session[:votes] = [params[:post_id]]\n else\n session[:votes].push(params[:post_id])\n end\n end\n redirect_to '/posts'\n end",
"def vote_params\n params.require(:vote).permit(:vote_for)\n end",
"def vote(token, pollnum, choices)\n\t\turl = \"/polls/#{pollnum}/vote\"\n\t\theaders = { 'Content-Type' => 'application/json',\n\t\t\t'Authorization' => 'Bearer #{token}'}\n\t\tarray = Array.new\n\t\tchoices.each do |key, value| \n\t\t\tentry = Hash.new\n\t\t\tentry['choice'] = key\n\t\t\tentry['kind'] = value\n\t\t\tarray.push(entry)\n\t\tend\n\t\tresult = HTTParty.post(url, {:headers => headers, :body => array.to_json})\n\t\treturn result\n\tend",
"def vote\n\tend",
"def create\n @fraction_vote = FractionVote.new(fraction_vote_params)\n\n respond_to do |format|\n if @fraction_vote.save\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully created.' }\n format.json { render :show, status: :created, location: @fraction_vote }\n else\n format.html { render :new }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @vote_post = VotePost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote_post }\n end\n end",
"def upvote\n @post.likes.create(user_id: current_user.id)\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n format.js\n end\n end",
"def create\n @voter = Voter.new(voter_params)\n\n respond_to do |format|\n if @voter.save\n format.html { redirect_to @voter, notice: 'Voter was successfully created.' }\n format.json { render :show, status: :created, location: @voter }\n else\n format.html { render :new }\n format.json { render json: @voter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote\n #create vote object\n @comment = Comment.find(params[:id])\n #@post = Post.find(params[:post_id])\n\n @vote = Vote.create(voteable: @comment, creator: current_user, vote: params[:vote])\n\n respond_to do |format|\n format.html do\n if @vote.valid?\n flash[:notice] = \"Your vote was counted.\"\n else\n flash[:error] = \"You can only vote for once for a comment.\"\n end\n redirect_to :back #go back to whatever url you came from\n end \n format.js do \n format.js\n end\n end\n end",
"def vote\n\t\t@review = Review.find(params[:id])\n\n\t\tif params[:type] == 'up'\n\t\t\t@review.add_or_update_evaluation(:up_votes, 1, current_user)\n\t\tend\n\n\t\t# Both up and down votes affect total votes\n\t\t@review.add_or_update_evaluation(:total_votes, 1, current_user)\n\t\t\n\t\tflash[:success] = \"Thanks for voting!\"\n\t\tredirect_to :back\n\tend",
"def vote_params\n params.require(:vote).permit(:user_id, :value)\n end",
"def create\n @commentvote = @comment.commentvotes.new(commentvote_params)\n @commentvote.user = current_user\n\n respond_to do |format|\n if @commentvote.save\n format.html { redirect_to [@comment, @commentvote], notice: 'Commentvote was successfully created.' }\n format.json { render :show, status: :created, location: @commentvote }\n else\n format.html { render :new }\n format.json { render json: @commentvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vote = Vote.new\n set_item = SetItem.find_by(id: params[:set_item_id])\n @vote.set_item_id = params[:set_item_id]\n @vote.audience_member_id = params[:audience_member_id]\n @vote.event_id = params[:event_id]\n\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to live_event_url(set_item.event.code) }\n format.json { render action: 'show', status: :created, location: @vote }\n else\n format.html { redirect_to live_event_url(set_item.event.code) }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @post_id = params[:post_id]\n @vote = Vote.new\n create\n #respond_to do |format|\n # format.html # login.html.erb\n # format.json { render json: @vote }\n #end\n end"
] | [
"0.70822227",
"0.7028233",
"0.70230967",
"0.69423336",
"0.69423336",
"0.6890193",
"0.6846321",
"0.6825699",
"0.6821856",
"0.6799433",
"0.6770842",
"0.6770842",
"0.67705065",
"0.67561966",
"0.6693474",
"0.66906375",
"0.6684874",
"0.6663655",
"0.66523963",
"0.6618081",
"0.658516",
"0.6575919",
"0.6544765",
"0.6539413",
"0.6521802",
"0.6507902",
"0.6504627",
"0.6504065",
"0.64550185",
"0.6431338",
"0.64157206",
"0.64153296",
"0.64146847",
"0.6387994",
"0.63647085",
"0.6344315",
"0.6336837",
"0.6336837",
"0.6336837",
"0.63220036",
"0.6317875",
"0.6315829",
"0.63104576",
"0.6298177",
"0.62889606",
"0.62691003",
"0.62543565",
"0.6254036",
"0.62481743",
"0.62336344",
"0.6233499",
"0.6228324",
"0.62004435",
"0.6199831",
"0.6199831",
"0.6199831",
"0.6199831",
"0.6199831",
"0.61899954",
"0.6180235",
"0.6178496",
"0.61765546",
"0.6172308",
"0.61687124",
"0.6156056",
"0.61470443",
"0.61429983",
"0.6137215",
"0.61325896",
"0.6131637",
"0.6129526",
"0.61214155",
"0.6117757",
"0.6117283",
"0.6117158",
"0.61135715",
"0.61095995",
"0.61050946",
"0.60992736",
"0.60870194",
"0.6086467",
"0.60803443",
"0.607372",
"0.6072204",
"0.60675156",
"0.6054579",
"0.60533017",
"0.6032721",
"0.60321546",
"0.6028982",
"0.60178286",
"0.6016159",
"0.60119855",
"0.60096866",
"0.60094476",
"0.6009299",
"0.60083467",
"0.60046154"
] | 0.68469757 | 8 |
PATCH/PUT /votes/1 PATCH/PUT /votes/1.json | def update
=begin
respond_to do |format|
if @vote.update(vote_params)
format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }
format.json { render :show, status: :ok, location: @vote }
else
format.html { render :edit }
format.json { render json: @vote.errors, status: :unprocessable_entity }
end
end
=end
if @vote.update(vote_params)
flash[:notice] = 'Dane zostały zmienione!'
redirect_to @vote
else
render :action => 'edit'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @vote = @votable.votes.find(params[:id])\n\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to build_path_vote(@vote), notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_vote.update_attributes(params[:api_v1_post_vote])\n format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to @vote, flash: { success: '投票更新成功。' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote }\n else\n format.html { render :edit }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote }\n else\n format.html { render :edit }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote }\n else\n format.html { render :edit }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote }\n else\n format.html { render :edit }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to @vote, notice: \"Vote was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n previous_value = @vote.vote\n\n respond_to do |format|\n if @vote.update_attributes(vote_params)\n InformCommitteeMembers.vote_changed(@vote.proposal, current_user, previous_value, @vote.vote)\n format.html { redirect_to [@proposal, @vote], notice: 'Vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = @retort.votes.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n flash[:notice] = 'Vote was successfully updated.'\n format.html { redirect_to(@retort) }\n format.xml { head :ok }\n else\n flash[:error] = 'Vote could not be updated.'\n format.html { redirect_to(@retort) }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @issue.votes = 0\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @voting.update(voting_params)\n format.html { redirect_to @voting, notice: 'Voting was successfully updated.' }\n format.json { render :show, status: :ok, location: @voting }\n else\n format.html { render :edit }\n format.json { render json: @voting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote].merge(:user => current_user))\n format.html { redirect_to(@vote, :notice => 'Vote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n flash[:notice] = 'Vote was successfully updated.'\n format.html { redirect_to(@vote) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n flash[:notice] = 'Vote was successfully updated.'\n format.html { redirect_to(@vote) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @postvote = Postvote.find(params[:id])\n\n respond_to do |format|\n if @postvote.update_attributes(params[:postvote])\n format.html { redirect_to @postvote, notice: 'Postvote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @postvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @postvote = Postvote.find(params[:id])\n\n respond_to do |format|\n if @postvote.update_attributes(params[:postvote])\n format.html { redirect_to @postvote, notice: 'Postvote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @postvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n format.html { redirect_to polls_url, notice: 'Vote was successfully cast.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n format.html { redirect_to([:admin,@vote], :notice => 'Vote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vote_post = VotePost.find(params[:id])\n\n respond_to do |format|\n if @vote_post.update_attributes(params[:vote_post])\n format.html { redirect_to @vote_post, notice: 'Vote post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vote_post.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @voting.update(voting_params)\n flash[:success] = 'Voting was successfully updated.'\n format.html { redirect_to votings_path }\n format.json { render :show, status: :ok, location: @voting }\n else\n format.html { render :edit }\n format.json { render json: @voting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = @change.votes.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n flash[:notice] = t('votes.new.success')\n format.html { priority_change_vote(@priority,@change,@vote) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_vote.update(model_vote_params)\n format.html { redirect_to @model_vote, notice: 'Model vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_vote }\n else\n format.html { render :edit }\n format.json { render json: @model_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n if @reply_vote.update_attributes(params[:reply_vote])\n format.html { redirect_to @reply_vote, notice: 'Reply vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @svote.update(svote_params)\n format.html { redirect_to @svote, notice: 'Svote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @svote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voter = Voter.find(params[:id])\n\n respond_to do |format|\n if @voter.update_attributes(params[:voter])\n format.html { redirect_to @voter, notice: 'Voter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vote = Vote.find(params[:id])\n\n respond_to do |format|\n if @vote.update_attributes(params[:vote])\n flash[:notice] = 'Vote was successfully updated.'\n format.html { redirect_to @event }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caption_vote.update(caption_vote_params)\n format.html { redirect_to @caption_vote, notice: 'Caption vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @caption_vote }\n else\n format.html { render :edit }\n format.json { render json: @caption_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upvote\n\t@post = Post.find(params[:id])\n\t@post.votes = @post.votes + 1\n puts @post.votes\n\n\n\n\trespond_to do |format|\n if @post.update(post_par2)\n\t\tformat.html { redirect_to @post, notice: 'Post was successfully upvoted.' }\n\t\tformat.json { render :show, status: :ok, location: @post }\n end\n\tend\n end",
"def update\n respond_to do |format|\n if @rep_vote.update(rep_vote_params)\n format.html { redirect_to @rep_vote, notice: 'Rep vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @rep_vote }\n else\n format.html { render :edit }\n format.json { render json: @rep_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n if @comment_vote.update_attributes(params[:comment_vote])\n format.html { redirect_to @comment_vote, notice: 'Comment vote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n if @comment_vote.update_attributes(params[:comment_vote])\n format.html { redirect_to @comment_vote, notice: 'Comment vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_answer_upvote.update(api_v1_answer_upvote_params)\n format.html { redirect_to @api_v1_answer_upvote, notice: 'Answer upvote was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer_upvote }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer_upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:choice][:option_a_votes] = @choice.option_a_votes + params[:choice][:option_a_votes].to_i\n params[:choice][:option_b_votes] = @choice.option_b_votes + params[:choice][:option_b_votes].to_i\n\n respond_to do |format|\n if @choice.update(choice_params)\n format.html { redirect_to @choice, notice: 'Choice was successfully updated.' }\n format.json { render :show, status: :ok, location: @choice }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @choice.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @jam = Jam.find(params[:id])\n if params[:vote] == 'up'\n @jam.up_votes = @jam.up_votes + 1\n @jam.save\n elsif params[:vote] == 'down'\n @jam.down_votes = @jam.down_votes + 1\n @jam.save\n end\n respond_to do |format|\n if @jam.update_attributes(params[:jam])\n format.html { redirect_to @jam, notice: params }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t# find our post\n\t\tid = params[:id]\n\t\t@post = Post.find(id)\n\n\t\t# increment the number of votes\n\t\tif params[:tweet] == \"true\"\n\t\t\t@post.votes = @post.votes + 1\n\t\t\t@post.save\n\t\telsif params[:flagged] == \"true\"\n\t\t\t@post.flagged = @post.flagged + 1\n\t\t\t@post.save\n\t\tend\n\t\t\n\t\t# TODO: ask Tom what this does again\n\t\trender :json => @post\n\tend",
"def update\n authorize @vote_candidate\n respond_to do |format|\n if @vote_candidate.update(vote_candidate_params)\n format.html { redirect_to @vote_candidate, notice: 'Vote candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote_candidate }\n else\n format.html { render :edit }\n format.json { render json: @vote_candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote.update(vote_params)\n\n tracker = Generic.get_mixpanel_tracker\n tracker.track(vote_params[:user_id], 'Vote Update')\n\n Generic.send_notificatioin(params[:vote][:user_id], 'חבר/ה שלך הצביע/ה באפליקציית iVote.')\n \n format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote }\n else\n format.html { render :edit }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def patch!\n request! :patch\n end",
"def update\n @comment_vote = CommentVote.find(params[:id])\n\n respond_to do |format|\n if @comment_vote.update_attributes(params[:comment_vote])\n temp_id = 0\n Comment.find(:all).each do |temp_comment|\n if temp_comment.id == @comment_vote.comment_id\n temp_id = temp_comment.post_id\n end\n end\n Post.find(:all).each do |post|\n if post.id == temp_id\n post.update_attribute('modified_date', Date.current )\n post.update_attribute('modified_time', Time.now )\n end\n end\n format.html { redirect_to @comment_vote, notice: 'Comment vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @voter.update(voter_params)\n format.html { redirect_to @voter, notice: 'Voter was successfully updated.' }\n format.json { render :show, status: :ok, location: @voter }\n else\n format.html { render :edit }\n format.json { render json: @voter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @voter.update(voter_params)\n format.html { redirect_to @voter, notice: 'Voter was successfully updated.' }\n format.json { render :show, status: :ok, location: @voter }\n else\n format.html { render :edit }\n format.json { render json: @voter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vote.update(vote_params)\n redirects_to @vote, notice: \"vote was update\"\n else\n render action: 'edit'\n end\n end",
"def update\n @comm_vote = CommVote.find(params[:id])\n\n respond_to do |format|\n if @comm_vote.update_attributes(params[:comm_vote])\n format.html { redirect_to @comm_vote, notice: 'Comm vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comm_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def set_vote\n @vote = Vote.find(params[:id])\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @voteaction.update(voteaction_params)\n format.html { redirect_to @voteaction, notice: 'Voteaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @voteaction }\n else\n format.html { render :edit }\n format.json { render json: @voteaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @commentvote.update(commentvote_params)\n format.html { redirect_to [@comment, @commentvote], notice: 'Commentvote was successfully updated.' }\n format.json { render :show, status: :ok, location: @commentvote }\n else\n format.html { render :edit }\n format.json { render json: @commentvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @three_vote = ThreeVote.find(params[:id])\n\n respond_to do |format|\n if @three_vote.update_attributes(params[:three_vote])\n format.html { redirect_to(@three_vote, :notice => 'ThreeVote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @three_vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fraction_vote.update(fraction_vote_params)\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction_vote }\n else\n format.html { render :edit }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote_comment.update(vote_comment_params)\n format.html { redirect_to @vote_comment, notice: 'Vote comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote_comment }\n else\n format.html { render :edit }\n format.json { render json: @vote_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @upvote.update(upvote_params)\n\n format.html { redirect_to @upvote, notice: 'Upvote was successfully updated.' }\n format.json { render :show, status: :ok, location: @upvote }\n else\n format.html { render :edit }\n format.json { render json: @upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote_poll.update(vote_poll_params)\n format.html { redirect_to define_admin_routes({resourceName: 'VotePoll', objectId: @vote_poll.id}), notice: 'PollVote was successfully updated.' }\n # format.html { redirect_to @vote_poll, notice: 'Vote poll was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote_poll }\n else\n format.html { render :edit }\n format.json { render json: @vote_poll.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update\n respond_to do |format|\n if @cla_vote.update(cla_vote_params)\n format.html { redirect_to @cla_vote, notice: 'Cla vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @cla_vote }\n else\n format.html { render :edit }\n format.json { render json: @cla_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def set_voting\n @voting = Voting.find(params[:id])\n end",
"def set_voting\n @voting = Voting.find(params[:id])\n end",
"def set_voting\n @voting = Voting.find(params[:id])\n end",
"def upvote\n recipe_id = Mongo::ObjectID.from_string(params[:id])\n Recipe.upvote(recipe_id, current_user.id)\n render :nothing => true\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update_votes(count)\n update votes: @data[:votes] + count do |data|\n self.data = data\n end\n end",
"def uvote\n question = Question.find(params[:question_id])\n if params[:action].to_i == 1\n question.upvote += 1\n else\n question.downvote += 1\n end\n question.save!\n\n render :json => {:success => 1}\nend",
"def update\n @summary_vote = SummaryVote.find(params[:id])\n\n respond_to do |format|\n if @summary_vote.update_attributes(params[:summary_vote])\n flash[:notice] = 'SummaryVote was successfully updated.'\n format.html { redirect_to(@summary_vote) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @summary_vote.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.71522504",
"0.70373183",
"0.7028216",
"0.7028216",
"0.7028216",
"0.7028216",
"0.70155066",
"0.70155066",
"0.70155066",
"0.70155066",
"0.70155066",
"0.70155066",
"0.70152915",
"0.6791049",
"0.67769694",
"0.67085785",
"0.67085785",
"0.67085785",
"0.67085785",
"0.6676926",
"0.65935594",
"0.6592312",
"0.6584041",
"0.6583585",
"0.6555803",
"0.6545699",
"0.6545699",
"0.65201956",
"0.65201956",
"0.6477039",
"0.64718544",
"0.6453327",
"0.64465195",
"0.64426196",
"0.64304316",
"0.64101213",
"0.6345948",
"0.6344738",
"0.634238",
"0.6322739",
"0.6322068",
"0.62993073",
"0.6271195",
"0.6257486",
"0.6255805",
"0.6225063",
"0.6207365",
"0.62001634",
"0.6197679",
"0.6148975",
"0.6134682",
"0.6118368",
"0.6118368",
"0.6118368",
"0.61051476",
"0.60979563",
"0.6086872",
"0.6086872",
"0.6041579",
"0.6016638",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.600591",
"0.5989192",
"0.59809613",
"0.59763587",
"0.5964887",
"0.59592557",
"0.59219396",
"0.5910727",
"0.5907333",
"0.5904395",
"0.5900244",
"0.58836395",
"0.58810526",
"0.5874596",
"0.5874596",
"0.5874596",
"0.58736247",
"0.5871786",
"0.58716106",
"0.5870193",
"0.58688337",
"0.5864431"
] | 0.6108921 | 54 |
DELETE /votes/1 DELETE /votes/1.json | def destroy
@vote.destroy
respond_to do |format|
format.html { redirect_to votes_url, notice: 'Vote was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n\n\n @vote = Vote.find(params[:id])\n\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = @votable.votes.find(params[:id])\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to build_path_votes }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy_votes\n \t@vote = Vote.where(id:params[:id])[0]\n render json: {success: false, message: 'Invalid Vote ID !'}, status: 400 if @vote.nil?\n \tend",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @postvote = Postvote.find(params[:id])\n @postvote.destroy\n\n respond_to do |format|\n format.html { redirect_to postvotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @postvote = Postvote.find(params[:id])\n @postvote.destroy\n\n respond_to do |format|\n format.html { redirect_to postvotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote.destroy\n respond_to do |format|\n format.html { redirect_to votes_url, notice: \"Vote was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote.destroy\n redirects_to votes_url\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice => 'Un-vote successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to proposal_url(@proposal) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote = @change.votes.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(votes_url) }\n end\n end",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to reply_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote = @retort.votes.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(retort_votes_url(@retort)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote = Vote.find(params[:id])\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_votes_url(@event)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vote.destroy\n end",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @vote_post = VotePost.find(params[:id])\n @vote_post.destroy\n\n respond_to do |format|\n format.html { redirect_to vote_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment_vote = CommentVote.find(params[:id])\n @comment_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @svote.destroy\n respond_to do |format|\n format.html { redirect_to svotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comm_vote = CommVote.find(params[:id])\n @comm_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to comm_votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voting.destroy\n respond_to do |format|\n format.html { redirect_to votings_url, notice: 'Voting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rep_vote.destroy\n respond_to do |format|\n format.html { redirect_to rep_votes_url, notice: 'Rep vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three_vote = ThreeVote.find(params[:id])\n @three_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(three_votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @summary_vote = SummaryVote.find(params[:id])\n @summary_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to(summary_votes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_v1_answer_upvote.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answer_upvotes_url, notice: 'Answer upvote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @vote_record = VoteRecord.find(params[:id])\n @vote_record.destroy\n\n respond_to do |format|\n format.html { redirect_to vote_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fraction_vote.destroy\n respond_to do |format|\n format.html { redirect_to fraction_votes_url, notice: 'Fraction vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to \"/\"\n # @vote_d.destroy\n # respond_to do |format|\n # format.html { redirect_to vote_ds_url, notice: 'Vote d was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @voteaction.destroy\n respond_to do |format|\n format.html { redirect_to voteactions_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @song_up_vote = SongUpVote.find(params[:id])\n @song_up_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to song_up_votes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_vote.destroy\n respond_to do |format|\n format.html { redirect_to model_votes_url, notice: 'Model vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @cla_vote.destroy\n respond_to do |format|\n format.html { redirect_to cla_votes_url, notice: 'Cla vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caption_vote.destroy\n respond_to do |format|\n format.html { redirect_to caption_votes_url, notice: 'Caption vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @voter = Voter.find(params[:id])\n @voter.destroy\n\n respond_to do |format|\n format.html { redirect_to voters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @debate_vote.destroy\n respond_to do |format|\n format.html { redirect_to debate_votes_url, notice: 'Debate vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proxy_votes_collected.destroy\n respond_to do |format|\n format.html { redirect_to proxy_votes_collected_index_url, notice: 'Proxy votes collected was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wore_it_vote.destroy\n respond_to do |format|\n format.html { redirect_to wore_it_votes_url, notice: 'Wore it vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commentvote.destroy\n respond_to do |format|\n format.html { redirect_to comment_commentvotes_path(@comment), notice: 'Commentvote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @voter = Voter.find(id)\n @voter.destroy\n respond_to do |format|\n format.html { redirect_to voters_url, notice: 'Voter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def delete_the_votes\n ActsAsVotable::Vote.destroy_all\n end",
"def destroy\n @votereply = Votereply.find(params[:id])\n @votereply.destroy\n\n respond_to do |format|\n format.html { redirect_to(votereplies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @voting.destroy\n respond_to do |format|\n format.html {\n flash[:success] = 'Voting was successfully deleted.'\n redirect_back fallback_location: votings_url\n }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html {\n flash[:danger] = 'Could not delete voting.'\n redirect_back fallback_location: votings_url\n }\n format.json { head :no_content }\n end\n end\n\n end",
"def destroy_answer_votes\n\t\tif @vote.destroy\n\t\t# response to the JSON\n\t\trender json: { success: true,message: \"Vote Successfully Deleted.\"},:status=>200\n \treturn\n else\n render :json=> { success: false, message: \"Vote is not available\" },:status=> 404\n \treturn\n end\n\tend",
"def destroy\n @vote_comment.destroy\n respond_to do |format|\n format.html { redirect_to vote_comments_url, notice: 'Vote comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mote = Mote.find(params[:id])\n @mote.destroy\n\n respond_to do |format|\n format.html { redirect_to motes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.votes.destroy_all\n @comment.destroy\n redirect_to(@comment.story)\n end",
"def destroy\n\t\tif @vote.destroy\n \t\t# response to the JSON\n \t\trender json: { success: true,message: \"Vote Successfully Deleted.\"},:status=>200\n \treturn\n\t else\n\t render :json=> { success: false, message: \"Vote is not available\" },:status=> 404\n\t \treturn\n\t end\n\tend",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete!\n request! :delete\n end",
"def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @avote.destroy\n respond_to do |format|\n format.html { redirect_to avotes_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @vote_card.destroy\n respond_to do |format|\n format.html { redirect_to vote_cards_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_alliance_leader_vote = Fundamental::AllianceLeaderVote.find(params[:id])\n @fundamental_alliance_leader_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_alliance_leader_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @votacion.destroy\n respond_to do |format|\n format.html { redirect_to votacions_url, notice: 'Votacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @vote_candidate\n @vote_candidate.destroy\n respond_to do |format|\n format.html { redirect_to vote_candidates_url, notice: 'Vote candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dailynote = Dailynote.find(params[:id])\n @dailynote.destroy\n\n respond_to do |format|\n format.html { redirect_to dailynotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @votecomment = Votecomment.find(params[:id])\n @votecomment.destroy\n redirect_to(posts_path)\n end",
"def destroy\n\t\t@vote = Vote.find_by(vote_params)\n\t\tif @vote\n\t\t\t@link = @vote.link\n\t\t\tif @vote.destroy\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html {redirect_to :back}\n\t\t\t\t\tformat.js\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:error] = 'failed vote'\n\t\t\t\tredirect_to :back\n\t\t\tend\n\t\tend\n\tend",
"def destroy\n @vint = Vint.find(params[:id])\n @vint.destroy\n\n respond_to do |format|\n format.html { redirect_to vints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @votaciones_hist.destroy\n respond_to do |format|\n format.html { redirect_to votaciones_hists_url, notice: 'Votaciones hist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7982334",
"0.78841865",
"0.78841865",
"0.78841865",
"0.78626317",
"0.7856752",
"0.784971",
"0.78488326",
"0.78488326",
"0.78488326",
"0.78488326",
"0.78488326",
"0.78488326",
"0.78488326",
"0.78149915",
"0.78149915",
"0.7678894",
"0.7565376",
"0.7565376",
"0.7565376",
"0.7565376",
"0.75605655",
"0.75605655",
"0.7558168",
"0.75264436",
"0.75247467",
"0.7495581",
"0.7452308",
"0.7414689",
"0.74105793",
"0.73929447",
"0.7357767",
"0.73548305",
"0.73443353",
"0.7341289",
"0.7315222",
"0.7207949",
"0.71861464",
"0.7169946",
"0.7139772",
"0.7131505",
"0.7079764",
"0.7048882",
"0.70319456",
"0.7029701",
"0.7024823",
"0.701456",
"0.697906",
"0.6944903",
"0.69402766",
"0.6930186",
"0.69275206",
"0.6905821",
"0.6903826",
"0.69003147",
"0.6896769",
"0.68948644",
"0.6877615",
"0.6865282",
"0.68323475",
"0.67612296",
"0.6757251",
"0.6714742",
"0.67116463",
"0.6701932",
"0.6679922",
"0.6671574",
"0.66662323",
"0.6655559",
"0.665393",
"0.6646134",
"0.66439563",
"0.66294545",
"0.6625201",
"0.66176236",
"0.66176236",
"0.66102743",
"0.66062903",
"0.6602634",
"0.65864277",
"0.6581378",
"0.6577327",
"0.65747976",
"0.6572937",
"0.65698445",
"0.65613073",
"0.65567404",
"0.65544325",
"0.6553512",
"0.65532976",
"0.6537714",
"0.6532998",
"0.6529703",
"0.65280163",
"0.65194404",
"0.65178216"
] | 0.75354135 | 27 |
Use callbacks to share common setup or constraints between actions. | def set_vote
@vote = Vote.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 set_actions\n actions :all\n end",
"def define_action_helpers?; 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 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 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 before_action \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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 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 my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; 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 duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def vote_params
params.require(:vote).permit(:vote, :district_id, :commitee_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 user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; 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 safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
Example For n = 29, the output should be addTwoDigits(n) = 11. | def addTwoDigits(n)
result = 0
n.to_s.split("").each {|number| result += number.to_i }
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_digits(num)\n return num if num.to_s.length == 1\n add_digits(num.to_s[0].to_i + add_digits(num.to_s[1..-1]).to_i)\nend",
"def add_digits(num)\n return num if num.to_s.length == 1\n int_array = split_digits(num)\n sum = add_array_ints(int_array)\n return add_digits(sum)\n end",
"def add_digits(num)\n return num if num < 10\n sum = 0\n num.to_s.split(\"\").each do |num|\n sum += num.to_i\n end\n add_digits(sum)\nend",
"def add_digits(number)\nend",
"def sum_digits(n)\n return n if n <= 9\n n % 10 + sum_digits(n / 10)\nend",
"def add_digits(num)\n return 0 if num == 0\n (num - 1) % 9 + 1\nend",
"def two_to_sum(n)\n result = 2 ** n\n \n result.to_s.split('').map {|x| x.to_i }.reduce(:+)\nend",
"def add_digits(num)\n num = num.to_s\n \n while num.length > 1\n new_num = num.split('').map(&:to_i).sum\n \n num = new_num.to_s\n end\n \n num.to_i\nend",
"def add_double(num)\n double = num.to_i * 2\n return double unless double > 9\n double.to_s[0].to_i + double.to_s[1].to_i\nend",
"def digits_sum(n)\n n.to_s.split('').inject(0){|a,b|a+=b.to_i}\nend",
"def sum_of_even_digits(n) #adds every even digit\n n = n.to_s.split(//)\n reverse_cc = n.reverse.values_at(1,3,5,7,9,11,13,15).compact\n sum_evens = 0\n reverse_cc.each do |cc_number|\n doubled = cc_number.to_i * 2\n sum_evens += get_digit(doubled)\n end\n return sum_evens\nend",
"def digit_sum(num, digits)\n if digits == 1\n num\n else\n num % 10 + digit_sum(num / 10, digits - 1)\n end\nend",
"def super_digit(n, sum=0) \n return sum + n if n / 10 == 0\n return super_digit(super_digit(n/10, sum+(n%10)))\nend",
"def sumdig_r(n)\n return n if n < 10\n (n%10) + sumdig_r(n/10)\nend",
"def super_digit(n)\n sum = 0\n\n if n < 10\n return sum + n\n else\n until n < 10\n sum += (n % 10)\n n /= 10\n end\n\n sum += n\n end\n\n return super_digit(n = sum)\nend",
"def super_digit(n)\n return n if n < 10\n\n sum = 0 \n\n while n > 0\n digit = n % 10\n n /= 10\n sum += digit\n end\n\n super_digit(sum)\n\nend",
"def add_num(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend",
"def plus_one(digits)\n carry = 0\n if (digits[-1] + 1) >= 10\n digits[-1] = (digits[-1] + 1) % 10\n carry = 1\n ((digits.size- 2).downto 0).each do |i|\n if (digits[i] + carry) < 10\n digits[i] = digits[i] + carry\n carry = 0\n break\n else\n digits[i] = (digits[i] + carry) % 10\n carry = 1\n end\n end\n else\n digits[-1] = digits[-1] + 1\n end\n digits.insert(0,carry) if carry == 1\n digits\nend",
"def compute_number(digits)\n digits.length == 1 ? (digits.to_i) : (digits[-1].to_i + 10*compute_number(digits[0..-2]))\nend",
"def sum_digits(num)\n\nend",
"def super_digit(n)\n return n if n < 10\n sum = n.to_s.chars.map(&:to_i).sum\n return super_digit(sum)\nend",
"def add(num_1, num_2)\n\tnum_1.to_i + num_2.to_i\n#add(2, 4)\nend",
"def super_digit(n)\n return n if n < 10 \n return super_digit(n.to_s.chars.map(&:to_i).sum)\nend",
"def numsum(n)\n result = 0\n while n >= 1\n digit = (n % 10).floor\n result += digit\n (n /= 10).floor\n end\n puts result\nend",
"def sumdigit_r(num)\n if num < 10\n num\n else\n sumdigit_r(num/10) + num % 10\n end\nend",
"def super_digit(n)\n return n if n <= 9\n \n until n < 10\n sum = 0\n sum += (n % 10)\n sum += (n / 10)\n n = sum\n end\n\n return sum\nend",
"def power_digits(n)\r\n sum = 2 ** n\r\n sum = sum.to_s.split(\"\").map{|x| x.to_i}.reduce(:+)\r\n return sum \r\nend",
"def add(num_1, num_2)\n\tnum_1.to_i + num_2.to_i\n# add(10, 5)\nend",
"def add_digits(number)\r\n total = 0\r\n number.to_s.split(\"\").each do |n|\r\n total += n.to_i\r\n end\r\n if total.to_s.length > 1\r\n div_by_3(@total)\r\n end\r\n total\r\nend",
"def super_digit(n)\n if n >= 0 && n < 10 \n return n\n end\n digits_of_n = n.digits\n sum_digits = digits_of_n.sum\n\n return super_digit(sum_digits)\nend",
"def double_digit_value(n)\n n *= 2\n # if a digit in the id sequence has to be doubled then\n # it may have 2 digits\n # if that is the case, we need to add the 2 digits separately\n if n >= 10\n # the first digit of n*2 is always one since 0 <= n <= 9\n # the second digit of n*2 is (n*2) % 10\n 1 + (n % 10)\n else\n n\n end\n end",
"def super_digit(n)\n sum = 0\n while n >= 10 do\n sum += n % 10\n n /= 10\n end\n sum += n\n return sum < 10 ? sum : super_digit(sum)\nend",
"def super_digit(n)\n return n if n/10 == 0\n \n sum = n % 10\n while n/10 != 0\n n = n/10\n sum += n % 10\n end\n return super_digit(sum)\nend",
"def two_digits_number(x)\n x < 10 ? \"0#{x}\" : x.to_s\n end",
"def sum_of_digits(number)\n\treturn (number/100)+((number/10)%10)+(number%10)\nend",
"def plus_one(digits)\n digits[-1] += 1 \n digits \nend",
"def super_digit(n)\n return n if n < 10\n count = add_digits(n)\n return super_digit(count)\n\nend",
"def super_digit(n)\n return n if n / 10 < 1\n \n string = n.to_s.split(\"\")\n sum = 0\n \n string.each do |num|\n sum += num.to_i\n end\n \n return super_digit(sum)\nend",
"def sum_of_digits(n)\n digits = n.to_s.split(//).map(&:to_i)\n digits.inject(0) { |sum, digit| sum + digit}\nend",
"def plus_one_short digits\n # int.next return the next int Ex: 2 -> 3\n # int.digits return an array of int digits\n # array.join return an string of array digits concatenation.\n # string.to_i return an int\n # array.reverse return an reversed array.\n digits.join.to_i.next.digits.reverse\nend",
"def two_digit_sum(nums)\n if nums.integer?\n string = nums.to_s.split(//)\n return string[0].to_i + string[1].to_i\n else\n print \"Please pass a valid two-digit argument\"\n end\n return\n\nend",
"def super_digit(n)\n if 10 > n\n return n\n end\n\n last_digit = n % 10\n sum = n / 10 + last_digit \n \n return super_digit(sum)\nend",
"def sum(number)\n sum = 0\n str_digits = number.to_s.chars\n\n str_digits.each do |str_digit|\n sum += str_digit.to_i\n end\n\n sum\nend",
"def to_2digit(number)\n if number < 9\n number=\"0\"+number.to_s\n else\n number=number.to_s\n end\n return number\nend",
"def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend",
"def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend",
"def number_adder(n)\n n += 10\nend",
"def sum_of_digits(n)\n sum = 0\n n.each_char {|digit| sum += digit.to_i}\n\n puts sum\nend",
"def super_digit(n)\n sum = 0;\n\n while n > 0 || sum > 9\n if n == 0\n n = sum\n sum = 0\n end\n sum += n % 10\n n /= 10\n end\n return sum\nend",
"def sum_base_2_number(pow = 1)\n (2**pow).to_s.split('').map(&:to_i).inject(:+)\nend",
"def add_nums(num_1,num_2)\n\treturn num_1.to_i + num_2.to_i\nend",
"def sumdig_r(num, result = 0)\n if num < 10\n result += num\n else\n result += num % 10\n result = sumdig_r(num / 10, result)\n end\n result\nend",
"def add_two_numbers(l1, l2)\n sum = l1.reverse.join('').to_i + l2.reverse.join('').to_i\n\n sum.to_s.split('').reverse.map(&:to_i)\nend",
"def add_nums number\n i = number.digits.count - 1\n j = 0\n sum = 0\n array = number.digits\n p i\n loop do\n p array[i]\n sum += array[i]\n i -= 1\n j += 1\n break if i < 0 || j == 2\n end\n sum\nend",
"def sum(n)\n n.digits.sum\nend",
"def sumDigits(number)\n number.to_s.chars.map(&:to_i).reduce\nend",
"def plus_one(digits)\n arr = digits.join.to_i + 1\n arr.to_s.split(\"\").map(&:to_i)\nend",
"def super_digit(n)\n return n if n < 10\n\n sum_digits = 0\n until n == 0\n sum_digits += n % 10\n n /= 10\n end\n\n super_digit(sum_digits)\nend",
"def sum_of_digits(number)\n sum = 0\n digits = number.to_s\n digits.each_char { |c| sum += c.to_i }\n sum\nend",
"def sumdig_r(n)\n\n # puts \"#{n} and n /10 is #{n/10} and n%10 is #{n%10}\"\n\n if (n<10) \n return n\n else\n return n%10 + sumdig_r(n/10)\n end\nend",
"def super_digit(n)\n while n >= 10\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend",
"def sum_digits\n self.to_s.split('').inject(0) { |memo, c| memo + c.to_i }\n end",
"def super_digit(n)\n\n return n if n < 10\n super_digit(n.digits.sum)\n\nend",
"def add ( num_1, num_2)\n num_1.to_i + num_2.to_i\nend",
"def plus_one(digits)\n sum, carry = [], 1\n\n digits.reverse_each do |digit|\n if carry.nonzero?\n value = digit + carry\n carry, value = value.divmod(10)\n else\n value = digit\n end\n\n sum.insert(0, value)\n end\n sum.insert(0, carry) if carry.nonzero?\n\n sum\nend",
"def sum_digits(n)\n remaining = n\n sum = 0\n while remaining > 0\n sum += remaining % 10\n remaining = remaining / 10\n end\n sum\nend",
"def super_digit(n)\n while n > 9\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend",
"def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend",
"def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend",
"def sumDigits(number)\n number.to_s.chars.map(&:to_i).reduce { |accum, n| accum.abs + n.abs }\nend",
"def square_digits_2 num\n num.to_s.chars.map{|x| x.to_i**2}.join.to_i\nend",
"def plus_one(digits)\n num = 0\n digits.each_with_index do |digit, index|\n num = num * 10 + digit\n end\n num += 1\n ans = []\n while num > 0 do \n ans.unshift(num % 10)\n num = num / 10\n end\n ans\nend",
"def sum_of_digit(n)\n sum = 0\n n.to_s.each_char {|i| sum = sum + i.to_i}\n puts sum\nend",
"def sum_of_digits(number)\n split_to_array(number).inject(:+)\n end",
"def sum(num)\n digits = num.to_s.chars.map(&:to_i) # Get an array of ints\n digits.reduce(:+) # Return sum of digits\nend",
"def sum(number)\n number.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(number)\n number.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(number)\n number.to_s.chars.map(&:to_i).reduce(:+)\n \nend",
"def super_digit(n)\n return n if n < 10\n return super_digit(n.digits.sum)\nend",
"def sum(integer)\n integer.digits.reduce(:+)\nend",
"def sum_digits(integer)\n arr = integer.to_s.chars.map { |num| num.to_i }\n arr.reduce(:+)\nend",
"def two_digits(number)\n (number * 100.0).to_i.to_f / 100.0\nend",
"def birth_path_number_again(digits)\n no1 = digits[0].to_i\n no2 = digits[1].to_i\n number = no1 + no2\n number = number.to_s\nend",
"def sum_func(n)\n if n / 10 == 0\n return n\n else\n return n % 10 + sum_func(n/10)\n end\nend",
"def sumDigits(number)\n sol = 0\n number.abs.to_s.each_char do |x|\n sol += x.to_i\n end\n print sol\n\nend",
"def sum(number)\r\n number.digits.sum\r\nend",
"def addition(num1, num2)\n num1.to_i + num2.to_i\nend",
"def add_twos(num1, num2)\n number = (num1 + num2)\n puts number\nend",
"def super_digit(n)\n return n if n < 10\n\n return super_digit(n.digits.sum)\nend",
"def super_digit(n)\n #has to be a single digit \n if n < 10 \n return n\n else \n return super_digit(n.digits.sum)\n end \n \n \nend",
"def super_digit(n)\n return n if n < 10\n sum = super_digit_helper(n, 0)\n super_digit(sum)\nend",
"def sum_of_digits(number)\n digits = number.to_s.split(\"\")\n sum = 0\n digits.each do |digit|\n sum += digit.to_i\n end\n return sum\nend",
"def add_two_numbers(l1, l2)\n (linked_list_to_array(l1).map(&:to_s).join.to_i + linked_list_to_array(l2).map(&:to_s).join.to_i).to_s.reverse.chars.map(&:to_i)\nend",
"def super_digit(n)\n num_array = n.to_s.chars.map(&:to_i)\n sum = num_array.sum\n if sum <9\n return sum\n else \n return super_digit(sum)\n end\n \nend",
"def sumdig_i(n)\n nums = n.to_s.chars.map(&:to_i).inject(:+)\nend",
"def add_two_number(l1, l2)\n m, n = l1, l2\n result = ListNode.new(0)\n curr = result\n carry = 0\n while(!m.nil? || !n.nil?)\n x = m.nil? ? 0 : m.val\n y = n.nil? ? 0 : n.val\n sum = x + y + carry\n curr.next = ListNode.new(sum % 10)\n carry = sum / 10\n curr = curr.next\n m = m.next if !m.nil?\n n = n.next if !n.nil?\n end\n curr.next = ListNode.new(carry) if (carry > 0)\n result.next\nend",
"def sum(number)\n number.digits.sum\nend",
"def sum(number)\n number.digits.sum\nend",
"def add_eight(number)\n number + 8\nend",
"def add_eight(number)\n number + 8\nend"
] | [
"0.7786175",
"0.76464266",
"0.7602193",
"0.7565762",
"0.74024767",
"0.72868913",
"0.721501",
"0.71777153",
"0.7091348",
"0.70408916",
"0.7022131",
"0.69648373",
"0.695648",
"0.6947659",
"0.6940182",
"0.6890425",
"0.68735445",
"0.6858815",
"0.68503183",
"0.6840207",
"0.68316364",
"0.6830217",
"0.68236494",
"0.68162906",
"0.6809666",
"0.68062747",
"0.6795374",
"0.67913926",
"0.6790354",
"0.67835265",
"0.6783347",
"0.67759925",
"0.6771031",
"0.67708653",
"0.67706686",
"0.6756832",
"0.67534214",
"0.6736518",
"0.67316",
"0.6725455",
"0.6714981",
"0.6704934",
"0.669438",
"0.66748655",
"0.6672611",
"0.6672611",
"0.66721284",
"0.66705793",
"0.6647895",
"0.6646762",
"0.6644095",
"0.6639441",
"0.6639222",
"0.66330653",
"0.6625473",
"0.66037416",
"0.6598349",
"0.6559148",
"0.6549208",
"0.65400684",
"0.65397084",
"0.653617",
"0.6535637",
"0.65346014",
"0.652358",
"0.6519048",
"0.6517532",
"0.6513273",
"0.6513273",
"0.6508054",
"0.65057874",
"0.65028083",
"0.6501668",
"0.65004426",
"0.6495798",
"0.6489797",
"0.6489797",
"0.648677",
"0.6480832",
"0.6480726",
"0.64805824",
"0.64720416",
"0.64718604",
"0.6467118",
"0.64586776",
"0.64480174",
"0.6447177",
"0.6446817",
"0.64464325",
"0.64454955",
"0.64309585",
"0.6409821",
"0.63970715",
"0.6394295",
"0.63893574",
"0.6386949",
"0.6380111",
"0.6380111",
"0.6375867",
"0.6375867"
] | 0.8303512 | 0 |
Just get the class methods defined in this module (or class) itself, omitting inherited ones. Equivalent to class_method_objects false | def own_class_method_objects sort: true
class_method_objects false, sort: sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_methods\n self.all_classes_and_modules.map do |klassmod|\n klassmod.own_methods.as_array\n end.flatten\n end",
"def class_methods\n all_methods().find_all{|m| m.singleton && (@options.show_all || m.visibility == :public || m.visibility == :protected)}.collect{|m| method_hash(m)}\n end",
"def all_rb_methods\n self.all_classes_and_modules.flat_map do |klassmod|\n klassmod.select_rb_methods\n end\n end",
"def all_c_methods\n self.all_classes_and_modules.flat_map do |klassmod|\n klassmod.select_c_methods\n end\n end",
"def unboring_methods\n if [::Class,::Module].include? self\n # Only those instance methods that we have not by virtue of being an instance of ourself\n self.methods - (self.instance_methods - self.singleton_methods)\n elsif self.is_a? ::Class\n # Only those instance methods that we have not by virtue of being a Class, unless we have overridden them\n self.methods - (::Class.instance_methods - self.singleton_methods)\n else\n # Only those instance methods that we have not by virtue of being a Module, unless we have overridden them\n self.methods - (::Module.instance_methods - self.singleton_methods)\n end\n end",
"def unboring_instance_methods\n if [::BasicObject,::Object,::Kernel].include? self\n self.instance_methods\n # elsif [Class,Module].include? self\n # self.instance_methods - Object.instance_methods\n else\n self.instance_methods - (::Object.instance_methods - self.local_instance_methods)\n end\n end",
"def interesting_methods\n (self.methods - Object.instance_methods).sort\n end",
"def interesting_methods\n em = extension_modules\n methods-[em.last ? em.last.methods : nil]-self.class.instance_methods\n end",
"def instance_methods\n all_methods().find_all{|m| (!m.singleton) && (@options.show_all || m.visibility == :public || m.visibility == :protected)}.collect{|m| method_hash(m)}\n end",
"def methods(all=true)\n __getobj__.methods(all) | super\n end",
"def class_methods\n @cache[:class_methods]\n end",
"def own_methods\n (self.methods - Object.methods)\n end",
"def inherited_instance_methods\n self.instance_methods.select{|m| self.instance_method(m).owner != self }\n end",
"def inherited_methods\n self.methods.select{|m| self.method(m).owner != self }\n end",
"def has_class_methods?\n m = all_methods().find{|m| m.singleton && (@options.show_all || m.visibility == :public || m.visibility == :protected)}\n m ? true : false\n end",
"def exposed_methods\n []\n end",
"def exposed_methods\n []\n end",
"def local_methods(obj = self)\n (obj.methods - obj.class.superclass.instance_methods).sort\n end",
"def api\n methods - Object.public_methods\n end",
"def local_methods(obj = self)\n (obj.methods - Object.instance_methods).sort\nend",
"def local_methods\n (methods - self.class.superclass.instance_methods).sort\n end",
"def get_methods(obj)\n meths = obj.methods.grep(/impl/)\n meths.map { |m| m.to_s.gsub('impl_', '') + '!' }\n end",
"def intersys_methods\n @methods ||= intersys_reflector._methods.to_a\n end",
"def local_methods(obj)\n (obj.methods - obj.class.superclass.instance_methods).sort\n end",
"def local_methods(obj)\n (obj.methods - obj.class.superclass.instance_methods).sort\n end",
"def local_instance_methods\n self.instance_methods.select{|m| self.instance_method(m).owner == self }\n end",
"def listing_methods\n (self.class.instance_methods & Node.all_methods)\n .sort.reverse!\n end",
"def included_methods\n included_modules.map(&:instance_methods).flatten\n end",
"def find_class_methods(klass)\n methods = []\n klass.instance_methods(false).each { |m| methods << m }\n end",
"def boring_classes\n return [::Class, *::Class.included_modules,\n ::Module, *::Module.included_modules,\n ::Kernel, *::Kernel.included_modules,\n ::Object, *::Object.included_modules,\n ::BasicObject, *::BasicObject.included_modules].uniq\n end",
"def dsl_methods\n (Chef::Node.public_instance_methods +\n Chef::Mixin::RecipeDefinitionDSLCore.included_modules.map{|mixin| mixin.public_instance_methods}).flatten.sort.uniq\n end",
"def methods\n return @methods if defined?(@methods)\n @methods = contents_of_type(Entities::InstanceMethod)\n @methods << contents_of_type(Entities::ClassMethod)\n @methods << contents_of_type(Entities::SingletonMethod)\n @methods.flatten!\n end",
"def methods(class_name)\n @methods[class_name] ||= []\n end",
"def mymethods\n (self.methods - self.class.superclass.methods).sort\n end",
"def exposed_methods\n @exposed_methods ||= from_superclass(:exposed_methods, {}).dup\n end",
"def all_methods(instance_methods = false)\n methods = if instance_methods || @instance_methods_switch\n Pry::Method.all_from_class(@interrogatee)\n else\n Pry::Method.all_from_obj(@interrogatee)\n end\n\n if Pry::Helpers::Platform.jruby? && !@jruby_switch\n methods = trim_jruby_aliases(methods)\n end\n\n methods.select { |method| @ppp_switch || method.visibility == :public }\n end",
"def local_methods\n self.methods.select{|m| self.method(m).owner == self }\n end",
"def remove_all_methods!\n instance_methods.each do |method_name|\n # Important -- we use Class#remove_method, not Class#undef_method, which does something that's different in\n # some important ways.\n remove_method(method_name) if @methods_defined[method_name.to_sym]\n end\n\n @class_methods_module.instance_methods.each do |method_name|\n @class_methods_module.send(:remove_method, method_name) if @class_methods_defined[method_name]\n end\n end",
"def options \n\t return self.methods - Object.instance_methods\n\t end",
"def public_methods(all=true)\n __getobj__.public_methods(all) | super\n end",
"def all_get_methods\n instance_methods.grep /^get_/\n end",
"def inspect_instance_methods\n return [] unless constant.respond_to?(:instance_methods)\n\n methods = get_methods(:instance_methods).map do |name|\n method_information(:instance_method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def inspect_instance_methods\n return [] unless constant.respond_to?(:instance_methods)\n\n methods = get_methods(:instance_methods).map do |name|\n method_information(:instance_method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def rest_class_methods\n @rest_class_methods ||= {}\n end",
"def api_methods\n self.class.instance_methods(false)\n end",
"def api_methods\n self.class.instance_methods(false)\n end",
"def overridden_instance_methods\n ancestors[1..-1].map(&:instance_methods).flatten.select{|m| self.instance_method_local? m }.uniq\n end",
"def instance_methods; end",
"def inspect_methods\n return [] unless constant.respond_to?(:methods)\n\n methods = get_methods.map do |name|\n method_information(:method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def inspect_methods\n return [] unless constant.respond_to?(:methods)\n\n methods = get_methods.map do |name|\n method_information(:method, name)\n end\n\n return methods.sort_by(&:name)\n end",
"def methods\n return if @methods.empty?\n @methods.uniq.sort\n end",
"def all_convenience_methods\n @mutex.synchronize do\n @methods.keys\n end\n end",
"def hooked_class_methods_for(klass)\n CLASS_METHOD_HOOKS[klass] || {}\n end",
"def member_classes\n self.class.member_classes\n end",
"def methods(*args)\n (super + analyser.delegatable_methods).uniq\n end",
"def methods\n return @methods\n end",
"def filtered_methods\n @filtered_methods ||= []\n end",
"def callable_methods\n methods.grep(/^_\\w+[^_]$/)\n end",
"def get_all_methods\n methods = []\n each_type do | type |\n type.each_method do |meth|\n methods << meth\n end\n end\n methods\n end",
"def public_methods(all=true) end",
"def instance_methods(include_super=true) end",
"def remove_all_methods!\n instance_methods.each do |method_name|\n # Important -- we use Class#remove_method, not Class#undef_method, which does something that's different in\n # some important ways.\n remove_method(method_name) if @methods_defined[method_name.to_sym]\n end\n end",
"def overridden_methods\n superclass.methods.select{|m| self.method_local? m }\n end",
"def __list_helper_methods\n # avoiding '__self__' and '__id__' symbols with last regex part\n methods.grep(/^#{@@helper_start_with}.*?[^__]$/) do |method|\n method.to_s\n end\n end",
"def all_methods\n collect_methods unless @methods\n @all_methods = sort_members(@methods) unless @all_methods\n @all_methods\n end",
"def statusable_methods\n # Include generated methods with a module, not right in class.\n @statusable_methods ||= Module.new.tap do |m|\n m.const_set :ClassMethods, Module.new\n include m\n extend m::ClassMethods\n end\n end",
"def dump_method_list(objectOrClass)\n puts \"[Debug] method list (#{objectOrClass.class}) #{objectOrClass.inspect} = #{(objectOrClass.methods - Object.methods - Class.methods).sort.to_s}\"\nend",
"def methods_to_try(obj)\n ret = obj.methods.map(&:intern)\n blacklist = obj.is_a?(Module) ? CLASS_METHOD_BLACKLIST : INSTANCE_METHOD_BLACKLIST\n klass = obj.is_a?(Module) ? obj : obj.class\n\n klass.ancestors.each { |ancestor| ret -= blacklist[ancestor.to_s.intern] }\n\n # 1.8.7 lacks Symbol#<=>\n ret.sort_by(&:to_s)\n end",
"def classes_and_modules\n classes + modules\n end",
"def classes_and_modules\n classes + modules\n end",
"def known_methods\n return self.operations.sort\n end",
"def static_methods\n return if @static_methods.empty?\n @static_methods.uniq.sort\n end",
"def internal_methods; end",
"def not_sandboxed_methods(include_superclasses = false, allowed_mixins=[], *disallowed_methods)\n\n __the_methods_to_check = public_instance_methods(false)\n puts \"#{self.name}: direct: #{__the_methods_to_check.inspect}\" if $DEBUG\n if include_superclasses\n clz = self.superclass\n while !clz.nil?\n unless clz == Object || (defined? BasicObject && clz == BasicObject)\n puts \"#{self.name}: #{clz.name}: #{clz.public_instance_methods(false).inspect}\" if $DEBUG\n __the_methods_to_check += clz.public_instance_methods(false)\n end\n clz = clz.superclass\n end\n \n if allowed_mixins.length > 0\n #we include any mixins\n for m in self.included_modules\n if allowed_mixins.include?(m)\n puts \"#{self.name}: #{m.name}: #{m.public_instance_methods(false).inspect}\" if $DEBUG\n __the_methods_to_check += m.public_instance_methods(false)\n end\n end\n end\n end\n \n __the_methods_to_check << \"nil?\".intern\n \n __the_methods_to_check.uniq!\n \n unless disallowed_methods.nil? || disallowed_methods.length == 0\n not_bang = false\n if disallowed_methods.include?(:bang_methods) #just remove all xxx! methods that modify in place\n __the_methods_to_check.reject! { |meth| meth.to_s[-1, 1] == \"!\"}\n not_bang = true\n end\n unless not_bang || disallowed_methods.length > 1\n __the_methods_to_check.reject! { |meth| disallowed_methods.include?(meth)}\n end\n end\n \n puts \"#{self.name}: #{__the_methods_to_check.inspect}\" if $DEBUG\n \n sandboxed_methods(*__the_methods_to_check)\n \n \n \n end",
"def instance_method_list\n warn '#instance_method_list is obsoleted, please use #instance_methods'\n @instance_methods ||= method_list.reject { |a| a.singleton }\n end",
"def all_signed_methods\n HasType.method_names_where(self) {|_| true }\n end",
"def all_classes_and_modules\n result = []\n ObjectSpace.each_object(Module) { |m| result << m }\n result.sort_by {|m| m.name}\nend",
"def child_methods\n literals.select {|lit| lit.kind_of? CompiledMethod }\n end",
"def safe_methods\n SafeClass.safe_methods_for(self)\n end",
"def internal_methods\n controller = self\n\n controller = controller.superclass until controller.abstract?\n controller.public_instance_methods(true)\n end",
"def methods(inherited_too=true)\n ensure_apply_object_class\n target_names = @attr_methods.keys + @attr_aliases.keys\n target_names -= ['objectClass', Inflector.underscore('objectClass')]\n super + target_names.uniq.collect do |x|\n [x, \"#{x}=\", \"#{x}?\", \"#{x}_before_type_cast\"]\n end.flatten\n end",
"def current_scoped_methods\n @reflection.klass.__send__(:current_scoped_methods)\n end",
"def methods(include_ancestors = true)\n super + @driver.methods(false)\n end",
"def methods\n main_service.methods.select(&:can_generate_rest?)\n end",
"def get_final_instance_methods(sorted=false)\n get_final_methods(@@final_instance_methods, sorted)\n end",
"def has_instance_methods?\n m = all_methods().find{|m| (!m.singleton) && (@options.show_all || m.visibility == :public || m.visibility == :protected)}\n m ? true : false\n end",
"def classes\n return @classes if @classes\n @classes = @context.classes.sort.find_all{|c| c.document_self}.collect{|c| R2Doc.all_references[c.full_name]}\n end",
"def methods\n @methods ||= {}\n end",
"def show_methods(klass)\n \t\tputs Object.const_get(klass).methods.inspect\n\tend",
"def filter_methods; end",
"def decorated_methods?\n !decorated_methods[:class_methods].empty? ||\n !decorated_methods[:instance_methods].empty?\n end",
"def all_giraffes\n methods.select { |m| m =~ /_giraffe$/ }\n end",
"def action_methods\n @action_methods ||= begin\n # All public instance methods of this class, including ancestors\n # except for public instance methods of Base and its ancestors.\n methods = public_instance_methods(true) - internal_methods\n # Be sure to include shadowed public instance methods of this class.\n methods.concat(public_instance_methods(false))\n methods.map!(&:to_s)\n methods.to_set\n end\n end",
"def detect_collection_methods; end",
"def instance_methods\n @cache[:instance_methods]\n end",
"def get_methods(mod)\n methods = []\n mod.constants.sort.each do |c|\n mod.const_get(c).singleton_methods.sort.each do |m|\n methods << \"#{c}::#{m}\"\n end\n end\n methods\nend",
"def private_methods(all=true) end",
"def __phi_extended_methods\n self.class.__phi_extend_methods.to_a\n end",
"def get_methods(getter = :methods)\n parent = inspect_superclass || Object\n diff = constant.__send__(getter, false) -\n parent.__send__(getter, false)\n\n methods = diff | constant.__send__(getter, false)\n\n # If the constant manually defines the initialize method (= private)\n # we'll also want to include it.\n if include_initialize?(getter)\n methods = methods | [:initialize]\n end\n\n return methods\n end",
"def simple_classes\n _simple_classes\n end"
] | [
"0.7824683",
"0.7650531",
"0.7537689",
"0.7418514",
"0.7371132",
"0.73499846",
"0.7103591",
"0.71016335",
"0.701458",
"0.6966601",
"0.69482386",
"0.6905873",
"0.6902744",
"0.68876094",
"0.6874491",
"0.6871948",
"0.6871948",
"0.68606853",
"0.686001",
"0.683219",
"0.6804061",
"0.6802942",
"0.6738045",
"0.67330265",
"0.67330265",
"0.6708563",
"0.66969895",
"0.6680674",
"0.6675637",
"0.66570467",
"0.6642075",
"0.6629031",
"0.661929",
"0.6579631",
"0.6556845",
"0.65499574",
"0.6531678",
"0.65072083",
"0.6506462",
"0.64994246",
"0.648774",
"0.6477094",
"0.6477094",
"0.64751655",
"0.6464641",
"0.6464641",
"0.6435198",
"0.6418518",
"0.6393713",
"0.6393713",
"0.6376374",
"0.63710964",
"0.636067",
"0.6358791",
"0.6354966",
"0.6339263",
"0.629716",
"0.62933403",
"0.62792826",
"0.62363106",
"0.62356526",
"0.62247545",
"0.62194616",
"0.62151515",
"0.6213863",
"0.6192277",
"0.61806226",
"0.6177767",
"0.61635053",
"0.61635053",
"0.61615545",
"0.6159263",
"0.6157457",
"0.61572975",
"0.6157107",
"0.6135364",
"0.6134723",
"0.6132155",
"0.6131327",
"0.6113847",
"0.6106465",
"0.61020666",
"0.6099319",
"0.6097038",
"0.60934305",
"0.60852885",
"0.60760635",
"0.60621184",
"0.6062056",
"0.6061532",
"0.6057768",
"0.60383964",
"0.6016509",
"0.6006958",
"0.60013425",
"0.60003304",
"0.5995789",
"0.59933454",
"0.59744775",
"0.5956481"
] | 0.6200593 | 65 |
Use callbacks to share common setup or constraints between actions. | def set_bank
@bank = Bank.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 set_actions\n actions :all\n end",
"def define_action_helpers?; 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 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 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 before_action \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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 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 my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; 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 duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def bank_params
params.require(:bank).permit(:name, :shortname, :image, :description, :website, :email, :facebook, :twitter, :linkedin, :youtube, :size, :geography, :industries, :products, :founded, :internship, :diversity, :underclass, :charity, :revenue, :stock, :employees, :ceo, :headquarters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; 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 safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
GET /session_replicas GET /session_replicas.json | def index
@session_replicas = SessionReplica.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end",
"def get_all_replicas(id, options = GetAllReplicasOptions.new) end",
"def replicas; 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 create\n @session_replica = SessionReplica.new(session_replica_params)\n\n respond_to do |format|\n if @session_replica.save\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :created, location: @session_replica }\n else\n format.html { render :new }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_replicas_by_shard(host, port, collection, shard)\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_status_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_status_resp in get_replicas_by_shard = #{cluster_status_resp.to_json}\")\n cluster_status_collections = cluster_status_resp[\"cluster\"][\"collections\"]\n shards = cluster_status_collections[collection][\"shards\"]\n replicas = shards[shard][\"replicas\"]\n return replicas\n end",
"def update\n respond_to do |format|\n if @session_replica.update(session_replica_params)\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :ok, location: @session_replica }\n else\n format.html { render :edit }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_any_replica(id, options = GetAnyReplicaOptions.new) end",
"def read_replica_identifiers\n data[:read_replica_identifiers]\n end",
"def read_replica_db_cluster_identifiers\n data[:read_replica_db_cluster_identifiers]\n end",
"def session_replica_params\n params.require(:session_replica).permit(:origin_id, :start_date)\n end",
"def increment_replica_count\n self.original['spec']['replicas'] += 1\n end",
"def read_replica_db_instance_identifiers\n data[:read_replica_db_instance_identifiers]\n end",
"def decrement_replica_count\n self.original['spec']['replicas'] -= 1\n end",
"def next_replica\n return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]]\n end",
"def replica_mode\n data[:replica_mode]\n end",
"def list_namespaced_replica_set_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_namespaced_replica_set ...\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.list_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets\".sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSetList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_namespaced_replica_set(namespace, opts = {})\n data, _status_code, _headers = list_namespaced_replica_set_with_http_info(namespace, opts)\n return data\n end",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def read_namespaced_replica_set_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.read_namespaced_replica_set ...\"\n end\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 AppsV1Api.read_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.read_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'exact'] = opts[:'exact'] if !opts[:'exact'].nil?\n query_params[:'export'] = opts[:'export'] if !opts[:'export'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#read_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fetch_replica_sets(release_docs)\n if release_docs.any? { |rd| rd.resource_template.any? { |r| r[:kind] == \"Deployment\" } }\n fetch_grouped(:replica_sets, 'apps/v1')\n else\n [] # save time\n end\n end",
"def update!(**args)\n @max_replicas = args[:max_replicas] if args.key?(:max_replicas)\n @min_replicas = args[:min_replicas] if args.key?(:min_replicas)\n end",
"def include_replicas_key\n ActiveRecord::VERSION::MAJOR >= 7 ? :include_hidden : :include_replicas\n end",
"def remove_excess_replicas_from_node( node, nb_partitions_to_remove )\n\n # First remove partitions which are not in ISR and already replicated enough times on other nodes of the cluster\n\n replicas_not_isr = @nodes_lists_replicas[node].keys - @nodes_lists_isr[node].keys\n\n replicas_not_isr_over_replicated = replicas_not_isr.keep_if { |tp| @partitions_lists[tp]['replicas'].keys.size > @replica_count }\n\n replicas_not_isr_over_replicated.each do |tp|\n break if (!nb_partitions_to_remove.nil? && nb_partitions_to_remove <= 0)\n\n remove_partition_from_node( tp, node )\n\n nb_partitions_to_remove -= 1 unless nb_partitions_to_remove.nil?\n end\n\n\n # Then remove partitions which regardless of ISR and already replicated enough times on other nodes of the cluster\n\n replicas_over_replicated = @nodes_lists_replicas[node].keys.keep_if { |tp| @partitions_lists[tp]['replicas'].keys.size > @replica_count }\n\n replicas_over_replicated.each do |tp|\n break if (!nb_partitions_to_remove.nil? && nb_partitions_to_remove <= 0)\n\n remove_partition_from_node( tp, node )\n\n nb_partitions_to_remove -= 1 unless nb_partitions_to_remove.nil?\n end\n\n end",
"def list_replica_set_for_all_namespaces_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_replica_set_for_all_namespaces ...\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/replicasets\"\n\n # query parameters\n query_params = {}\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSetList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_replica_set_for_all_namespaces\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def read_namespaced_replica_set(name, namespace, opts = {})\n data, _status_code, _headers = read_namespaced_replica_set_with_http_info(name, namespace, opts)\n return data\n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def read_replica_source_db_cluster_identifier\n data[:read_replica_source_db_cluster_identifier]\n end",
"def getReplicationPeers()\n replAdm = ReplicationAdmin.new(getConfiguration())\n\n repPeers = Array.new()\n repPeers = replAdm.listPeerConfigs\n existingPeerClusters = Array.new\n repPeers.entrySet().each do |e|\n state = replAdm.getPeerState(e.key)\n existingPeerClusters.push([ e.key, e.value.getClusterKey, state ])\n end\n \n replAdm.close()\n\n return existingPeerClusters\nend",
"def replica_set\n return nil if @machine.config.mongodb.nil?\n\n @machine.config.mongodb.replsets.find do |rs|\n rs.members.find do |member|\n member[:host] == @machine.name\n end\n end\n end",
"def list_all_shards(args = {}) \n get(\"/shards.json/\", args)\nend",
"def replication_state\n @grpc.replication_state\n end",
"def shards\n @data['shards']\n end",
"def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\n end",
"def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend",
"def session_revision_list\n @session_revision_list ||=\n begin\n x = session[:revision_list_id]\n x &&= RevisionList.find(x)\n x\n end\n end",
"def partitions(key, partitions)\n master = fnv_hash(key) % partitions.size\n selected = [master]\n nodes = [partitions[master]]\n current = (master + 1) % partitions.size\n\n # Walk clockwise around the ring of partitions, starting from the master partition.\n # The next few unique nodes in ring order are the replicas.\n while current != master && selected.size < @replicas\n if !nodes.include? partitions[current]\n nodes << partitions[current]\n selected << current\n end\n current = (current + 1) % partitions.size\n end\n\n selected\n end",
"def new_pg_info(session)\n result = nil\n save_result = postgres_exec(\"INSERT INTO session_replicas (start_date,created_at,updated_at,origin_id,info) VALUES ('#{session.start_date_time.utc.strftime('%Y-%m-%d %H:%M:%S')}',NOW(),NOW(),#{session.id},JSON('#{USERS_POSTGRES_CONNECTION.escape_string(session.to_lactic_json)}'))\")\n result = save_result && save_result.cmd_tuples()!=0\n\n result\n\n end",
"def snapshot_session\n Mongoid::Compatibility::Version.mongoid5? ? Mongoid.default_client : Mongoid.default_session\n end",
"def id\n replication_id\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 replica_set?; true; 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 @node = Fedora.rest('rest/')\n end",
"def nodes\n # Find the nodes that were down but are ready to be refreshed, or those\n # with stale connection information.\n needs_refresh, available = seeds.partition do |node|\n refreshable?(node)\n end\n\n # Refresh those nodes.\n available.concat(refresh(needs_refresh))\n\n # Now return all the nodes that are available and participating in the\n # replica set.\n available.reject{ |node| node.down? }\n end",
"def list_replication_executions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReplicationApi.list_replication_executions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ReplicationApi.list_replication_executions, must be smaller than or equal to 100.'\n end\n\n # resource path\n local_var_path = '/replication/executions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'policy_id'] = opts[:'policy_id'] if !opts[:'policy_id'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'trigger'] = opts[:'trigger'] if !opts[:'trigger'].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 = ['basic']\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<ReplicationExecution>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReplicationApi#list_replication_executions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def shards\n @obj['shards']\n end",
"def migrate_excess_replicas_from_node( node, nb_partitions_to_remove )\n\n # This method is not efficient, but that is not something you run often\n nb_partitions_to_remove.times do |i|\n\n # Find out the lowest balanced nodes\n nodes_sizes_replicas = @nodes_lists_replicas.hmap { |k,v| { k => v.size } }\n node_lowest = nodes_sizes_replicas.sort_by{|k,v| v}[0][0]\n\n # Find out which partitions the lowest balanced node does not have and which can be migrated from this node\n partition_to_migrate = (@nodes_lists_replicas[node].keys - @nodes_lists_replicas[node_lowest].keys)[0]\n\n remove_partition_from_node( partition_to_migrate, node )\n add_partition_to_node( partition_to_migrate, node_lowest )\n\n end\n\n # # Find out the lowest balanced nodes\n # nodes_sizes_replicas = @nodes_lists_replicas.hmap { |k,v| { k => v.size } }\n # nodes_lowest = nodes_sizes_replicas.sort_by{|k,v| v}.map { |a| a[0] }\n\n # nodes_lowest.each do |node_lowest|\n # break if nb_partitions_to_remove <= 0\n\n # # Find out which partitions the lowest balanced node does not have and which can be migrated from this node\n # partitions_to_migrate = @nodes_lists_replicas[node].keys - @nodes_lists_replicas[node_lowest].keys\n\n # partitions_to_migrate.each do |tp|\n # break if nb_partitions_to_remove <= 0\n\n # remove_partition_from_node( tp, node )\n # add_partition_to_node( tp, node_lowest )\n\n # nb_partitions_to_remove -= 1\n # end\n # end\n end",
"def sessions\n threads = servers.map { |server| Thread.new { server.session(true) } if server.session.nil? }\n threads.each { |thread| thread.join if thread }\n servers.map { |server| server.session }.compact\n end",
"def retain_replicas_on_node(old_node_ip)\n \n Chef::Log.info( \"***Old node IP : #{old_node_ip}\")\n new_ip = node['ipaddress']\n Chef::Log.info( \"***New node IP : #{new_ip}\")\n \n #get host ip other than the replaced node as old(replaced) ip has already gone from cluster\n computes = node.workorder.payLoad.has_key?(\"RequiresComputes\") ? node.workorder.payLoad.RequiresComputes : node.workorder.payLoad.computes\n other_computes = computes.select { |compute| compute['ciAttributes']['private_ip'] != old_node_ip}\n host = other_computes[0][\"ciAttributes\"][\"private_ip\"]\n port = (node[\"solr_version\"].start_with? \"4.\")?\"8080\":node['port_no']\n \n solrCollectionUrl = \"http://#{host}:#{port}/solr/admin/collections?\"\n \n #Get cluster state to fetch all collection & its details\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_state_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_state_resp = #{cluster_state_resp.to_json}\")\n cluster_status_collections = cluster_state_resp[\"cluster\"][\"collections\"]\n \n #Get list of all existing collection names\n collection_names = []\n if !cluster_status_collections.nil? && !cluster_status_collections.empty?\n collection_names = cluster_status_collections.keys\n end\n \n #For each collection->shard->replica, delete replica and add it back if it was hosted on replaced node\n collection_names.each do |collection_name|\n \n #Process next collection if no shards found\n next if cluster_status_collections[collection_name][\"shards\"].nil? || cluster_status_collections[collection_name][\"shards\"].empty?\n \n shard_names = cluster_status_collections[collection_name][\"shards\"].keys\n shards = cluster_status_collections[collection_name][\"shards\"]\n \n #Process each shard to delete and add replica if it was hosted on replaced(old_ip) then delete first and add it back again\n shard_names.each do |shard_name|\n Chef::Log.info( \"*** Processing shard '#{shard_name}' for collection '#{collection_name}'\")\n \n #Process next shard if no replica found\n next if shards[shard_name][\"replicas\"].nil? || shards[shard_name][\"replicas\"].empty?\n \n replica_names = shards[shard_name][\"replicas\"].keys\n replicas = shards[shard_name][\"replicas\"]\n Chef::Log.info( \"*** Replica names for shard #{shard_name} : #{replica_names}\")\n Chef::Log.info( \"*** Replicas for for shard #{shard_name} : #{replicas.to_json}\")\n new_ip_exist = 0\n old_ip_exist = 0\n \n #Process each replica to and if it was hosted on replaced(old_ip) then delete first and add it back again\n replica_names.each do |replica_name|\n Chef::Log.info( \"*** Replica is : #{replica_name}\")\n if (replicas.has_key?replica_name) && (replicas[replica_name][\"base_url\"].include? old_node_ip)\n old_ip_exist += 1\n Chef::Log.info(\"Deleting old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n delete_replica_url = \"#{solrCollectionUrl}action=DELETEREPLICA&collection=#{collection_name}&shard=#{shard_name}&replica=#{replica_name}\"\n Chef::Log.info(\"DELETEREPLICA : #{delete_replica_url}\")\n delete_replica_resp_obj = run_solr_action_api(delete_replica_url)\n Chef::Log.info(\"Deleted old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n \n #Refresh the collection/shard state to reflect the DELETEREPLICA change\n replicas = get_replicas_by_shard(host, port, collection_name, shard_name)\n Chef::Log.info(\"replicas for collection #{collection_name} & shard #{shard_name} after deleted replica=#{replica_name}\")\n \n else\n Chef::Log.info(\"Skipping Delete Replica for the replica #{replica_name} as no replica found on node #{old_node_ip}\")\n end\n \n # before adding the replica check if the new node ip is part of any collection in the cluster state, if so then don't do it\n # new-IP exists and old-IP too exists - Deletes the replica and sets old_ip_exist = 1, sets new_ip_exist = 1 => No add replica\n # new-IP exists and old-IP does not - doesn't delete replica, old_ip_exist = 0, sets new_ip_exist = 1 => No add replica\n # new-IP does not exist and old IP does - Deletes the replica and sets old_ip_exist = 1, new_ip_exist = 0 => Satisfies the condition for add replica\n Chef::Log.info(\"replicas before checking new_ip = #{replicas.to_json}\")\n Chef::Log.info(\"replicas[replica] before checking new_ip #{new_ip} = #{replicas[replica_name].to_json}\")\n #Check if for shard, any replica is using the new_ip\n if replica_exists_on_ip?(replicas, new_ip)\n Chef::Log.info(\"New IP #{new_ip} is found in the Replica for collection = #{collection_name} & shard = #{shard_name}\")\n new_ip_exist += 1\n else\n Chef::Log.info(\"New IP #{new_ip} is not found in replicas of collection = #{collection_name} & shard = #{shard_name}\")\n end\n end # next replica\n \n #Add replica on new ip if it was deleted from old ip. i.e. if old IP existed and new IP is not shown\n if (old_ip_exist > 0 && new_ip_exist == 0)\n add_replica_url = \"#{solrCollectionUrl}action=ADDREPLICA&collection=#{collection_name}&shard=#{shard_name}&node=#{new_ip}:#{port}_solr\"\n Chef::Log.info(\"ADDREPLICA: #{add_replica_url}\")\n add_replica_resp_obj = run_solr_action_api(add_replica_url)\n Chef::Log.info(\"Added new Replica : #{new_ip}, for collection = #{collection_name} & shard = #{shard_name}\")\n else\n Chef::Log.info(\"Skipping Add Replica for collection = #{collection_name} & shard = #{shard_name}, since value of old_ip_exist=#{old_ip_exist} and value of new_ip_exist=#{new_ip_exist}\")\n end\n end # next shard\n end # next collection\n end",
"def read_replica_source_db_instance_identifier\n data[:read_replica_source_db_instance_identifier]\n end",
"def replication_credentials\n {user: @config['mysql_repl_user'], pass: @config['mysql_repl_password']}\n end",
"def list_cluster_snapshots(rds_resource)\n cluster_snapshots = []\n rds_resource.db_clusters.each do |c|\n c.snapshots.each do |s|\n cluster_snapshots.append({\n \"cluster\": c.id,\n \"snapshot_id\": s.snapshot_id,\n \"snapshot_status\": s.status\n })\n end\n end\n cluster_snapshots\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list cluster snapshots:\\n #{e.message}\"\nend",
"def delete_collection_namespaced_replica_set_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.delete_collection_namespaced_replica_set ...\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.delete_collection_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets\".sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'V1Status')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#delete_collection_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @session_operations = SessionOperation.all\n end",
"def sessions\n @sessions\n end",
"def read_namespaced_replica_set_status_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.read_namespaced_replica_set_status ...\"\n end\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 AppsV1Api.read_namespaced_replica_set_status\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.read_namespaced_replica_set_status\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#read_namespaced_replica_set_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def replication_password\n find_password(\n @mysql_item, \"replication\", node_server[\"replication\"][\"password\"]\n )\n end",
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def show\n render json: @session_resource\n end",
"def sessions\n PokerSession.find(:all)\n end",
"def __get_nodes\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process\")))\n end",
"def deleteReplica(shard_name,collection_name,replica)\n params = {:action => \"DELETEREPLICA\",\n :collection => collection_name,:shard => shard_name,:replica => replica}\n\n jsonresponse = solr_collection_api(node['ipaddress'],node['port_no'],params)\n issuccess = jsonresponse.fetch('success', '')\n\n if issuccess.empty?\n iserror = jsonresponse.fetch('error', '')\n errormessage = iserror.fetch('msg','')\n raise errormessage\n else\n Chef::Log.info(issuccess)\n end\n end",
"def on_replica(&block)\n on_primary_or_replica(:replica, &block)\n end",
"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 index\n @shards = Shard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shards }\n end\n end",
"def replica_set_name; nil; end",
"def fetch_pods(release)\n release.clients.flat_map do |client, query|\n client.get_pods(query).map! do |p|\n Kubernetes::Api::Pod.new(p, client: client)\n end\n end\n end",
"def sessions=(value)\n @sessions = value\n end",
"def on_replica(&block)\n on_master_or_replica(:replica, &block)\n end",
"def list_remote_tmux_session(destination_host)\n # Note that the tmux variable substitution looks like Ruby string sub,\n # these must either be single quoted strings or Ruby-string escaped as well\n format_str = Shellwords.escape(['#{session_name}', '#{session_created}', '#{pane_pid}'].join(UNIT_SEPARATOR))\n keys = [:session_name, :session_created, :session_pid]\n cmd = ssh_cmd(destination_host, ['tmux', 'list-panes', '-aF', format_str])\n \n call(*cmd).split(\"\\n\").map do |line|\n Hash[keys.zip(line.split(UNIT_SEPARATOR))].tap do |session_hash|\n session_hash[:destination_host] = destination_host\n session_hash[:id] = \"#{session_hash[:session_name]}@#{destination_host}\"\n end\n end.select do |session_hash| \n session_hash.compact.length >= 5 && \n !session_hash[:session_name].nil? && \n session_hash[:session_name].start_with?(session_name_label)\n end\n rescue Error => e\n interpret_and_raise(e)\n []\n end",
"def read_namespaced_replica_set_status(name, namespace, opts = {})\n data, _status_code, _headers = read_namespaced_replica_set_status_with_http_info(name, namespace, opts)\n return data\n end",
"def index\n @sessions = Session.where(finalized: true).page(params[:page_id]).per(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def getNodeList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/nodes\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n node_data = temp2[\"resource_response\"][\"resources\"]\n return node_data\n \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 refresh\n session.cluster.refresh\n rescue => e\n raise ConnectionFailed, e\n end",
"def query_couchbase_servers\n\n couchbase_servers = Hash.new\n \n r=rightscale_server_collection 'couchbase_cluster_nodes' do\n tags [\"couchbase:cluster_ip=#{cluster_ip}\"]\n secondary_tags [\"server:uuid=*\", \"couchbase:listen_ip=*\"]\n action :nothing\n end\n r.run_action(:load)\n \n node[:server_collection]['couchbase_cluster_nodes'].to_hash.values.each do |tags|\n uuid = RightScale::Utils::Helper.get_tag_value('server:uuid', tags)\n ip = RightScale::Utils::Helper.get_tag_value('couchbase:listen_ip', tags)\n couchbase_servers[uuid] = {}\n couchbase_servers[uuid][:ip] = ip\n end\n \n couchbase_servers\n \n end",
"def shards\n perform_request(api_url('shards')).map do |shard_data|\n DynamicModel.new shard_data\n end\n end",
"def remove(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring.delete(key)\n @nodesort.delete(key)\n end\n end",
"def replica_set_name\n @replica_set_name ||= options[REPLICA_SET_NAME]\n end",
"def nodes\r\n params = {\r\n method: :get,\r\n url: '/project/nodes',\r\n params: { prjUUID: @uuid }\r\n }\r\n @session.request(**params).perform!['nodes']\r\n end",
"def show\n @shard = Shard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shard }\n end\n end",
"def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend",
"def replication_type\n settings[:replication_type]\n end",
"def index\n @admin_session = AdminSession.all\n end",
"def replica_set?; false; end",
"def flume_zookeeper_port\n node[:flume][:master][:zookeeper_port]\nend",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def list\n @session[:clustername]=nil\n @session[:clustername1]=nil\n @group_pages, @groups = paginate :groups, :per_page => 10\n end",
"def reconnect\n @read_replica.reconnect\n @primary.reconnect\n end",
"def clear_replicas(item_id, recovery_mode = false)\n# @logger.log_clear_replicas(item_id) unless recovery_mode\n nodes = find_nodes(item_id)\n nodes.each do |node|\n @nodes_to_data[node].delete(item_id)\n end\n @data_to_nodes.delete(item_id)\n end",
"def show\n @discovery_session = DiscoverySession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discovery_session }\n end\n end",
"def pods\n\nend"
] | [
"0.68597347",
"0.66880745",
"0.6502734",
"0.6378547",
"0.62445986",
"0.6064645",
"0.5996224",
"0.5950158",
"0.5847749",
"0.5792938",
"0.57326543",
"0.5591757",
"0.54726493",
"0.5337873",
"0.533406",
"0.53334785",
"0.5249959",
"0.5239103",
"0.51504034",
"0.51504034",
"0.5141558",
"0.5053479",
"0.50266784",
"0.49940288",
"0.49679258",
"0.4958004",
"0.495006",
"0.49493843",
"0.494528",
"0.4934323",
"0.48958573",
"0.48488238",
"0.4826326",
"0.48226798",
"0.47950318",
"0.4794406",
"0.47402024",
"0.47116888",
"0.4691736",
"0.46879616",
"0.46851724",
"0.4675905",
"0.46343517",
"0.46330446",
"0.46330446",
"0.46330446",
"0.46330446",
"0.45781067",
"0.4564505",
"0.4561897",
"0.45306623",
"0.4526188",
"0.45258418",
"0.45217925",
"0.45210272",
"0.45187166",
"0.45132133",
"0.4510088",
"0.45093754",
"0.44993514",
"0.4497829",
"0.4489911",
"0.4480755",
"0.44783667",
"0.4468367",
"0.44677538",
"0.44586268",
"0.44507074",
"0.444637",
"0.44449103",
"0.44357833",
"0.4428116",
"0.44232872",
"0.4418649",
"0.4418219",
"0.4416199",
"0.44160888",
"0.44100666",
"0.44074938",
"0.4407401",
"0.44063118",
"0.44029084",
"0.43928307",
"0.43898305",
"0.43775037",
"0.43729112",
"0.43608427",
"0.43577462",
"0.4352906",
"0.43464878",
"0.43244532",
"0.43230098",
"0.4316991",
"0.43153155",
"0.43153155",
"0.4308099",
"0.43080166",
"0.43021533",
"0.42992032",
"0.42914444"
] | 0.82171476 | 0 |
GET /session_replicas/1 GET /session_replicas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @session_replicas = SessionReplica.all\n end",
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\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 get_all_replicas(id, options = GetAllReplicasOptions.new) end",
"def replicas; end",
"def create\n @session_replica = SessionReplica.new(session_replica_params)\n\n respond_to do |format|\n if @session_replica.save\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :created, location: @session_replica }\n else\n format.html { render :new }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_replica.update(session_replica_params)\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :ok, location: @session_replica }\n else\n format.html { render :edit }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_any_replica(id, options = GetAnyReplicaOptions.new) end",
"def get_replicas_by_shard(host, port, collection, shard)\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_status_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_status_resp in get_replicas_by_shard = #{cluster_status_resp.to_json}\")\n cluster_status_collections = cluster_status_resp[\"cluster\"][\"collections\"]\n shards = cluster_status_collections[collection][\"shards\"]\n replicas = shards[shard][\"replicas\"]\n return replicas\n end",
"def read_replica_identifiers\n data[:read_replica_identifiers]\n end",
"def session_replica_params\n params.require(:session_replica).permit(:origin_id, :start_date)\n end",
"def read_replica_db_cluster_identifiers\n data[:read_replica_db_cluster_identifiers]\n end",
"def increment_replica_count\n self.original['spec']['replicas'] += 1\n end",
"def read_namespaced_replica_set_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.read_namespaced_replica_set ...\"\n end\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 AppsV1Api.read_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.read_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'exact'] = opts[:'exact'] if !opts[:'exact'].nil?\n query_params[:'export'] = opts[:'export'] if !opts[:'export'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#read_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_replica_db_instance_identifiers\n data[:read_replica_db_instance_identifiers]\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def next_replica\n return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]]\n end",
"def replica_mode\n data[:replica_mode]\n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def decrement_replica_count\n self.original['spec']['replicas'] -= 1\n end",
"def list_namespaced_replica_set_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_namespaced_replica_set ...\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.list_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets\".sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSetList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read_replica_source_db_cluster_identifier\n data[:read_replica_source_db_cluster_identifier]\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 read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def include_replicas_key\n ActiveRecord::VERSION::MAJOR >= 7 ? :include_hidden : :include_replicas\n end",
"def show\n render json: @session_resource\n end",
"def id\n replication_id\n end",
"def new_pg_info(session)\n result = nil\n save_result = postgres_exec(\"INSERT INTO session_replicas (start_date,created_at,updated_at,origin_id,info) VALUES ('#{session.start_date_time.utc.strftime('%Y-%m-%d %H:%M:%S')}',NOW(),NOW(),#{session.id},JSON('#{USERS_POSTGRES_CONNECTION.escape_string(session.to_lactic_json)}'))\")\n result = save_result && save_result.cmd_tuples()!=0\n\n result\n\n end",
"def list_all_shards(args = {}) \n get(\"/shards.json/\", args)\nend",
"def replication_state\n @grpc.replication_state\n end",
"def read_namespaced_replica_set(name, namespace, opts = {})\n data, _status_code, _headers = read_namespaced_replica_set_with_http_info(name, namespace, opts)\n return data\n end",
"def snapshot_session\n Mongoid::Compatibility::Version.mongoid5? ? Mongoid.default_client : Mongoid.default_session\n end",
"def index\n @node = Fedora.rest('rest/')\n end",
"def read_namespaced_replica_set_status_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.read_namespaced_replica_set_status ...\"\n end\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 AppsV1Api.read_namespaced_replica_set_status\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.read_namespaced_replica_set_status\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#read_namespaced_replica_set_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @discovery_session = DiscoverySession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discovery_session }\n end\n end",
"def list_replica_set_for_all_namespaces_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_replica_set_for_all_namespaces ...\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/replicasets\"\n\n # query parameters\n query_params = {}\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSetList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_replica_set_for_all_namespaces\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def replica_set?; true; end",
"def select_session\n @session = Session.find_by_session_id(@session_id)\n @session = @session.last rescue @session\n set_req_no\n end",
"def update!(**args)\n @max_replicas = args[:max_replicas] if args.key?(:max_replicas)\n @min_replicas = args[:min_replicas] if args.key?(:min_replicas)\n end",
"def refresh\n session.cluster.refresh\n rescue => e\n raise ConnectionFailed, e\n end",
"def replica_set_name; nil; end",
"def read_replica_source_db_instance_identifier\n data[:read_replica_source_db_instance_identifier]\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 replica_set\n return nil if @machine.config.mongodb.nil?\n\n @machine.config.mongodb.replsets.find do |rs|\n rs.members.find do |member|\n member[:host] == @machine.name\n end\n end\n end",
"def show\n @shard = Shard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shard }\n end\n end",
"def list_namespaced_replica_set(namespace, opts = {})\n data, _status_code, _headers = list_namespaced_replica_set_with_http_info(namespace, opts)\n return data\n end",
"def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend",
"def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\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 index\n @session_operations = SessionOperation.all\n end",
"def remove_excess_replicas_from_node( node, nb_partitions_to_remove )\n\n # First remove partitions which are not in ISR and already replicated enough times on other nodes of the cluster\n\n replicas_not_isr = @nodes_lists_replicas[node].keys - @nodes_lists_isr[node].keys\n\n replicas_not_isr_over_replicated = replicas_not_isr.keep_if { |tp| @partitions_lists[tp]['replicas'].keys.size > @replica_count }\n\n replicas_not_isr_over_replicated.each do |tp|\n break if (!nb_partitions_to_remove.nil? && nb_partitions_to_remove <= 0)\n\n remove_partition_from_node( tp, node )\n\n nb_partitions_to_remove -= 1 unless nb_partitions_to_remove.nil?\n end\n\n\n # Then remove partitions which regardless of ISR and already replicated enough times on other nodes of the cluster\n\n replicas_over_replicated = @nodes_lists_replicas[node].keys.keep_if { |tp| @partitions_lists[tp]['replicas'].keys.size > @replica_count }\n\n replicas_over_replicated.each do |tp|\n break if (!nb_partitions_to_remove.nil? && nb_partitions_to_remove <= 0)\n\n remove_partition_from_node( tp, node )\n\n nb_partitions_to_remove -= 1 unless nb_partitions_to_remove.nil?\n end\n\n end",
"def shards\n @data['shards']\n end",
"def show\n @current_session = CurrentSession.find(params[:id])\n\n render json: @current_session\n end",
"def show\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cluster }\n end\n end",
"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 set_session\n @session = BatchConnect::Session.find(params[:id])\n end",
"def session_from_redis\n redis_handler.get\n end",
"def session_revision_list\n @session_revision_list ||=\n begin\n x = session[:revision_list_id]\n x &&= RevisionList.find(x)\n x\n end\n end",
"def fetch_replica_sets(release_docs)\n if release_docs.any? { |rd| rd.resource_template.any? { |r| r[:kind] == \"Deployment\" } }\n fetch_grouped(:replica_sets, 'apps/v1')\n else\n [] # save time\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 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 flume_zookeeper_port\n node[:flume][:master][:zookeeper_port]\nend",
"def getReplicationPeers()\n replAdm = ReplicationAdmin.new(getConfiguration())\n\n repPeers = Array.new()\n repPeers = replAdm.listPeerConfigs\n existingPeerClusters = Array.new\n repPeers.entrySet().each do |e|\n state = replAdm.getPeerState(e.key)\n existingPeerClusters.push([ e.key, e.value.getClusterKey, state ])\n end\n \n replAdm.close()\n\n return existingPeerClusters\nend",
"def show\n @session = Session.where(unique_id: params[:id])\n # New round logic here\n\n end",
"def primary_status\n session.cluster.with_primary do |primary|\n primary.command(:admin, replSetGetStatus: 1)\n end\n rescue => e\n raise ConnectionFailed, e\n end",
"def retain_replicas_on_node(old_node_ip)\n \n Chef::Log.info( \"***Old node IP : #{old_node_ip}\")\n new_ip = node['ipaddress']\n Chef::Log.info( \"***New node IP : #{new_ip}\")\n \n #get host ip other than the replaced node as old(replaced) ip has already gone from cluster\n computes = node.workorder.payLoad.has_key?(\"RequiresComputes\") ? node.workorder.payLoad.RequiresComputes : node.workorder.payLoad.computes\n other_computes = computes.select { |compute| compute['ciAttributes']['private_ip'] != old_node_ip}\n host = other_computes[0][\"ciAttributes\"][\"private_ip\"]\n port = (node[\"solr_version\"].start_with? \"4.\")?\"8080\":node['port_no']\n \n solrCollectionUrl = \"http://#{host}:#{port}/solr/admin/collections?\"\n \n #Get cluster state to fetch all collection & its details\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_state_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_state_resp = #{cluster_state_resp.to_json}\")\n cluster_status_collections = cluster_state_resp[\"cluster\"][\"collections\"]\n \n #Get list of all existing collection names\n collection_names = []\n if !cluster_status_collections.nil? && !cluster_status_collections.empty?\n collection_names = cluster_status_collections.keys\n end\n \n #For each collection->shard->replica, delete replica and add it back if it was hosted on replaced node\n collection_names.each do |collection_name|\n \n #Process next collection if no shards found\n next if cluster_status_collections[collection_name][\"shards\"].nil? || cluster_status_collections[collection_name][\"shards\"].empty?\n \n shard_names = cluster_status_collections[collection_name][\"shards\"].keys\n shards = cluster_status_collections[collection_name][\"shards\"]\n \n #Process each shard to delete and add replica if it was hosted on replaced(old_ip) then delete first and add it back again\n shard_names.each do |shard_name|\n Chef::Log.info( \"*** Processing shard '#{shard_name}' for collection '#{collection_name}'\")\n \n #Process next shard if no replica found\n next if shards[shard_name][\"replicas\"].nil? || shards[shard_name][\"replicas\"].empty?\n \n replica_names = shards[shard_name][\"replicas\"].keys\n replicas = shards[shard_name][\"replicas\"]\n Chef::Log.info( \"*** Replica names for shard #{shard_name} : #{replica_names}\")\n Chef::Log.info( \"*** Replicas for for shard #{shard_name} : #{replicas.to_json}\")\n new_ip_exist = 0\n old_ip_exist = 0\n \n #Process each replica to and if it was hosted on replaced(old_ip) then delete first and add it back again\n replica_names.each do |replica_name|\n Chef::Log.info( \"*** Replica is : #{replica_name}\")\n if (replicas.has_key?replica_name) && (replicas[replica_name][\"base_url\"].include? old_node_ip)\n old_ip_exist += 1\n Chef::Log.info(\"Deleting old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n delete_replica_url = \"#{solrCollectionUrl}action=DELETEREPLICA&collection=#{collection_name}&shard=#{shard_name}&replica=#{replica_name}\"\n Chef::Log.info(\"DELETEREPLICA : #{delete_replica_url}\")\n delete_replica_resp_obj = run_solr_action_api(delete_replica_url)\n Chef::Log.info(\"Deleted old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n \n #Refresh the collection/shard state to reflect the DELETEREPLICA change\n replicas = get_replicas_by_shard(host, port, collection_name, shard_name)\n Chef::Log.info(\"replicas for collection #{collection_name} & shard #{shard_name} after deleted replica=#{replica_name}\")\n \n else\n Chef::Log.info(\"Skipping Delete Replica for the replica #{replica_name} as no replica found on node #{old_node_ip}\")\n end\n \n # before adding the replica check if the new node ip is part of any collection in the cluster state, if so then don't do it\n # new-IP exists and old-IP too exists - Deletes the replica and sets old_ip_exist = 1, sets new_ip_exist = 1 => No add replica\n # new-IP exists and old-IP does not - doesn't delete replica, old_ip_exist = 0, sets new_ip_exist = 1 => No add replica\n # new-IP does not exist and old IP does - Deletes the replica and sets old_ip_exist = 1, new_ip_exist = 0 => Satisfies the condition for add replica\n Chef::Log.info(\"replicas before checking new_ip = #{replicas.to_json}\")\n Chef::Log.info(\"replicas[replica] before checking new_ip #{new_ip} = #{replicas[replica_name].to_json}\")\n #Check if for shard, any replica is using the new_ip\n if replica_exists_on_ip?(replicas, new_ip)\n Chef::Log.info(\"New IP #{new_ip} is found in the Replica for collection = #{collection_name} & shard = #{shard_name}\")\n new_ip_exist += 1\n else\n Chef::Log.info(\"New IP #{new_ip} is not found in replicas of collection = #{collection_name} & shard = #{shard_name}\")\n end\n end # next replica\n \n #Add replica on new ip if it was deleted from old ip. i.e. if old IP existed and new IP is not shown\n if (old_ip_exist > 0 && new_ip_exist == 0)\n add_replica_url = \"#{solrCollectionUrl}action=ADDREPLICA&collection=#{collection_name}&shard=#{shard_name}&node=#{new_ip}:#{port}_solr\"\n Chef::Log.info(\"ADDREPLICA: #{add_replica_url}\")\n add_replica_resp_obj = run_solr_action_api(add_replica_url)\n Chef::Log.info(\"Added new Replica : #{new_ip}, for collection = #{collection_name} & shard = #{shard_name}\")\n else\n Chef::Log.info(\"Skipping Add Replica for collection = #{collection_name} & shard = #{shard_name}, since value of old_ip_exist=#{old_ip_exist} and value of new_ip_exist=#{new_ip_exist}\")\n end\n end # next shard\n end # next collection\n end",
"def sessions\n @sessions\n end",
"def replica_set?; false; end",
"def single_rs_member?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.replica_set_name\nend",
"def single_rs_member?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.replica_set_name\nend",
"def index\n params[:id] = session_user_id\n show\n end",
"def index\n @shards = Shard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shards }\n end\n end",
"def replication_credentials\n {user: @config['mysql_repl_user'], pass: @config['mysql_repl_password']}\n end",
"def show\n\n @training_session = TrainingSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_session }\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 pod\n @pod ||= lambda{\n host = lygneo_id.split('@')[1]\n ResourceServer.where(:host => host).first || ResourceServer.register(host)\n }.call\n end",
"def __get_nodes\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process\")))\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 deleteReplica(shard_name,collection_name,replica)\n params = {:action => \"DELETEREPLICA\",\n :collection => collection_name,:shard => shard_name,:replica => replica}\n\n jsonresponse = solr_collection_api(node['ipaddress'],node['port_no'],params)\n issuccess = jsonresponse.fetch('success', '')\n\n if issuccess.empty?\n iserror = jsonresponse.fetch('error', '')\n errormessage = iserror.fetch('msg','')\n raise errormessage\n else\n Chef::Log.info(issuccess)\n end\n end",
"def pods\n\nend",
"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 find_session(env, sid); end",
"def list_remote_tmux_session(destination_host)\n # Note that the tmux variable substitution looks like Ruby string sub,\n # these must either be single quoted strings or Ruby-string escaped as well\n format_str = Shellwords.escape(['#{session_name}', '#{session_created}', '#{pane_pid}'].join(UNIT_SEPARATOR))\n keys = [:session_name, :session_created, :session_pid]\n cmd = ssh_cmd(destination_host, ['tmux', 'list-panes', '-aF', format_str])\n \n call(*cmd).split(\"\\n\").map do |line|\n Hash[keys.zip(line.split(UNIT_SEPARATOR))].tap do |session_hash|\n session_hash[:destination_host] = destination_host\n session_hash[:id] = \"#{session_hash[:session_name]}@#{destination_host}\"\n end\n end.select do |session_hash| \n session_hash.compact.length >= 5 && \n !session_hash[:session_name].nil? && \n session_hash[:session_name].start_with?(session_name_label)\n end\n rescue Error => e\n interpret_and_raise(e)\n []\n end",
"def cluster name\n Cluster.receive connection.resource(:get, \"clusters/#{name}\")\n end",
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def show\n @study_session = StudySession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @study_session }\n end\n end",
"def get_pod_name(namespace, index)\n `kubectl get pods -n #{namespace} | awk 'FNR == #{index + 1} {print $1}'`.chomp\nend",
"def current_shard\n shard_data = perform_request(api_url('shards', region))\n DynamicModel.new shard_data\n end",
"def replica_set_name\n @replica_set_name ||= options[REPLICA_SET_NAME]\n end",
"def get_affinity_session(user_affinity_token, add_params = nil)\n params = {\n uid: uid,\n user_affinity_token: user_affinity_token,\n }\n api_call('/partner_proxies/:uid/affinities/:user_affinity_token/session(.:format)',:get,params,add_params)\n end",
"def views\n $redis.get(\"product:#{id}\")\n end",
"def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend",
"def replication_type\n settings[:replication_type]\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end",
"def session\n @req.session\n end"
] | [
"0.8026325",
"0.69743365",
"0.6514398",
"0.638829",
"0.6353358",
"0.6348696",
"0.6197808",
"0.6080882",
"0.5952667",
"0.57447505",
"0.5667694",
"0.5655303",
"0.5499601",
"0.5386497",
"0.53642917",
"0.5296435",
"0.52864754",
"0.52624065",
"0.52269536",
"0.5157514",
"0.51547253",
"0.51155907",
"0.5064053",
"0.50599605",
"0.50075203",
"0.50075203",
"0.4979279",
"0.49628413",
"0.4931235",
"0.4927544",
"0.4873619",
"0.48676106",
"0.48596135",
"0.48591545",
"0.48570126",
"0.4834653",
"0.48321536",
"0.48215583",
"0.48122254",
"0.4788415",
"0.47838077",
"0.47827443",
"0.47697595",
"0.47663292",
"0.4757116",
"0.4757116",
"0.4757116",
"0.4757116",
"0.47550642",
"0.4751407",
"0.47374046",
"0.4735668",
"0.47317988",
"0.4725471",
"0.4725471",
"0.47207543",
"0.4712693",
"0.47095326",
"0.4688504",
"0.4683107",
"0.4657818",
"0.46537182",
"0.46405306",
"0.4638098",
"0.46332306",
"0.46245956",
"0.46237025",
"0.4593396",
"0.45908257",
"0.4588055",
"0.4578096",
"0.4563036",
"0.45534194",
"0.45505053",
"0.45477018",
"0.45477018",
"0.45474386",
"0.45385528",
"0.45384136",
"0.45358706",
"0.45331004",
"0.4530865",
"0.45272693",
"0.4521251",
"0.4514293",
"0.45131972",
"0.45082793",
"0.4506783",
"0.450226",
"0.44997868",
"0.449528",
"0.4491311",
"0.44871",
"0.44841477",
"0.4481969",
"0.44790462",
"0.44715127",
"0.44660848",
"0.4464985",
"0.44635177",
"0.4463037"
] | 0.0 | -1 |
POST /session_replicas POST /session_replicas.json | def create
@session_replica = SessionReplica.new(session_replica_params)
respond_to do |format|
if @session_replica.save
format.html { redirect_to @session_replica}
format.json { render :show, status: :created, location: @session_replica }
else
format.html { render :new }
format.json { render json: @session_replica.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @session_replicas = SessionReplica.all\n end",
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\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 session_replica_params\n params.require(:session_replica).permit(:origin_id, :start_date)\n end",
"def increment_replica_count\n self.original['spec']['replicas'] += 1\n end",
"def replicas; end",
"def update\n respond_to do |format|\n if @session_replica.update(session_replica_params)\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :ok, location: @session_replica }\n else\n format.html { render :edit }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def decrement_replica_count\n self.original['spec']['replicas'] -= 1\n end",
"def get_all_replicas(id, options = GetAllReplicasOptions.new) end",
"def update!(**args)\n @max_replicas = args[:max_replicas] if args.key?(:max_replicas)\n @min_replicas = args[:min_replicas] if args.key?(:min_replicas)\n end",
"def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend",
"def add_tenant_to_specified_shard(args = {}) \n post(\"/tenants.json/shard/#{args[:shardId]}\", args)\nend",
"def create_replication(request, &block)\n post \"/replicate/\", request, &block\n end",
"def new_pg_info(session)\n result = nil\n save_result = postgres_exec(\"INSERT INTO session_replicas (start_date,created_at,updated_at,origin_id,info) VALUES ('#{session.start_date_time.utc.strftime('%Y-%m-%d %H:%M:%S')}',NOW(),NOW(),#{session.id},JSON('#{USERS_POSTGRES_CONNECTION.escape_string(session.to_lactic_json)}'))\")\n result = save_result && save_result.cmd_tuples()!=0\n\n result\n\n end",
"def add_replica(item_id, target_node, recovery_mode = false)\n# @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recovery_mode\n if @nodes_to_data[target_node].nil?\n @nodes_to_data[target_node] = [item_id]\n else\n @nodes_to_data[target_node] = @nodes_to_data[target_node] << item_id\n end\n \n if @data_to_nodes[item_id].nil?\n @data_to_nodes[item_id] = [target_node]\n else\n @data_to_nodes[item_id] = @data_to_nodes[item_id] << target_node\n end\n end",
"def post_params(path, params, session)\n post path, params, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def get_any_replica(id, options = GetAnyReplicaOptions.new) end",
"def next_replica\n return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]]\n end",
"def read_replica_identifiers\n data[:read_replica_identifiers]\n end",
"def remove_excess_replicas_from_node( node, nb_partitions_to_remove )\n\n # First remove partitions which are not in ISR and already replicated enough times on other nodes of the cluster\n\n replicas_not_isr = @nodes_lists_replicas[node].keys - @nodes_lists_isr[node].keys\n\n replicas_not_isr_over_replicated = replicas_not_isr.keep_if { |tp| @partitions_lists[tp]['replicas'].keys.size > @replica_count }\n\n replicas_not_isr_over_replicated.each do |tp|\n break if (!nb_partitions_to_remove.nil? && nb_partitions_to_remove <= 0)\n\n remove_partition_from_node( tp, node )\n\n nb_partitions_to_remove -= 1 unless nb_partitions_to_remove.nil?\n end\n\n\n # Then remove partitions which regardless of ISR and already replicated enough times on other nodes of the cluster\n\n replicas_over_replicated = @nodes_lists_replicas[node].keys.keep_if { |tp| @partitions_lists[tp]['replicas'].keys.size > @replica_count }\n\n replicas_over_replicated.each do |tp|\n break if (!nb_partitions_to_remove.nil? && nb_partitions_to_remove <= 0)\n\n remove_partition_from_node( tp, node )\n\n nb_partitions_to_remove -= 1 unless nb_partitions_to_remove.nil?\n end\n\n end",
"def migrate_excess_replicas_from_node( node, nb_partitions_to_remove )\n\n # This method is not efficient, but that is not something you run often\n nb_partitions_to_remove.times do |i|\n\n # Find out the lowest balanced nodes\n nodes_sizes_replicas = @nodes_lists_replicas.hmap { |k,v| { k => v.size } }\n node_lowest = nodes_sizes_replicas.sort_by{|k,v| v}[0][0]\n\n # Find out which partitions the lowest balanced node does not have and which can be migrated from this node\n partition_to_migrate = (@nodes_lists_replicas[node].keys - @nodes_lists_replicas[node_lowest].keys)[0]\n\n remove_partition_from_node( partition_to_migrate, node )\n add_partition_to_node( partition_to_migrate, node_lowest )\n\n end\n\n # # Find out the lowest balanced nodes\n # nodes_sizes_replicas = @nodes_lists_replicas.hmap { |k,v| { k => v.size } }\n # nodes_lowest = nodes_sizes_replicas.sort_by{|k,v| v}.map { |a| a[0] }\n\n # nodes_lowest.each do |node_lowest|\n # break if nb_partitions_to_remove <= 0\n\n # # Find out which partitions the lowest balanced node does not have and which can be migrated from this node\n # partitions_to_migrate = @nodes_lists_replicas[node].keys - @nodes_lists_replicas[node_lowest].keys\n\n # partitions_to_migrate.each do |tp|\n # break if nb_partitions_to_remove <= 0\n\n # remove_partition_from_node( tp, node )\n # add_partition_to_node( tp, node_lowest )\n\n # nb_partitions_to_remove -= 1\n # end\n # end\n end",
"def read_replica_db_cluster_identifiers\n data[:read_replica_db_cluster_identifiers]\n end",
"def add_partition_to_node( tp, node )\n\n @nodes_lists_replicas[node][tp] = ''\n @partitions_lists[tp]['replicas'] ||= {}\n @partitions_lists[tp]['replicas'][node] = ''\n end",
"def replica_mode\n data[:replica_mode]\n end",
"def get_replicas_by_shard(host, port, collection, shard)\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_status_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_status_resp in get_replicas_by_shard = #{cluster_status_resp.to_json}\")\n cluster_status_collections = cluster_status_resp[\"cluster\"][\"collections\"]\n shards = cluster_status_collections[collection][\"shards\"]\n replicas = shards[shard][\"replicas\"]\n return replicas\n end",
"def lsepoch_create_replica_record(params, record)\n _replica = Vob.new(params[:vob])\n _replica[:tag] = record[:tag]\n _replica[:host_id] = record[:host_id]\n _replica[:replica_name] = record[:row_replica] # \"fresh\" value from parsing\n _replica[:replica_uuid] = record[:oid]\n _replica[:description] = \"Orphaned from the epoch table...\"\n _replica.save\n record[:row_replica] = _replica[:id]\n end",
"def list_namespaced_replica_set_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_namespaced_replica_set ...\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.list_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets\".sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSetList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def addReplica(shard_name,collection_name)\n nodename = \"#{node['ipaddress']}:#{node['port_no']}_solr\"\n\n params = {:action => \"ADDREPLICA\",\n :collection => collection_name,:shard => shard_name,:node => nodename}\n\n jsonresponse = solr_collection_api(node['ipaddress'],node['port_no'],params)\n issuccess = jsonresponse.fetch('success', '')\n\n if issuccess.empty?\n iserror = jsonresponse.fetch('error', '')\n errormessage = iserror.fetch('msg','')\n raise errormessage\n else\n Chef::Log.info(issuccess)\n end\n end",
"def replica_set?; true; end",
"def read_replica_db_instance_identifiers\n data[:read_replica_db_instance_identifiers]\n end",
"def update_replication(request, &block)\n put \"/replicate/#{request[:replication_id]}/\", request, &block\n end",
"def delete_collection_namespaced_replica_set_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.delete_collection_namespaced_replica_set ...\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.delete_collection_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets\".sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'V1Status')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#delete_collection_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def replace_namespaced_replica_set_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.replace_namespaced_replica_set ...\"\n end\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 AppsV1Api.replace_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.replace_namespaced_replica_set\"\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 AppsV1Api.replace_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\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 = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#replace_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_namespaced_replica_set_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.patch_namespaced_replica_set ...\"\n end\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 AppsV1Api.patch_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.patch_namespaced_replica_set\"\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 AppsV1Api.patch_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/merge-patch+json', 'application/strategic-merge-patch+json'])\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 = ['BearerToken']\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 :return_type => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#patch_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def save\n @client.execute(\"CREATE KEYSPACE #{getKeyspaceName} WITH replication = {'class': 'SimpleStrategy','replication_factor': 3}\")\n end",
"def retain_replicas_on_node(old_node_ip)\n \n Chef::Log.info( \"***Old node IP : #{old_node_ip}\")\n new_ip = node['ipaddress']\n Chef::Log.info( \"***New node IP : #{new_ip}\")\n \n #get host ip other than the replaced node as old(replaced) ip has already gone from cluster\n computes = node.workorder.payLoad.has_key?(\"RequiresComputes\") ? node.workorder.payLoad.RequiresComputes : node.workorder.payLoad.computes\n other_computes = computes.select { |compute| compute['ciAttributes']['private_ip'] != old_node_ip}\n host = other_computes[0][\"ciAttributes\"][\"private_ip\"]\n port = (node[\"solr_version\"].start_with? \"4.\")?\"8080\":node['port_no']\n \n solrCollectionUrl = \"http://#{host}:#{port}/solr/admin/collections?\"\n \n #Get cluster state to fetch all collection & its details\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_state_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_state_resp = #{cluster_state_resp.to_json}\")\n cluster_status_collections = cluster_state_resp[\"cluster\"][\"collections\"]\n \n #Get list of all existing collection names\n collection_names = []\n if !cluster_status_collections.nil? && !cluster_status_collections.empty?\n collection_names = cluster_status_collections.keys\n end\n \n #For each collection->shard->replica, delete replica and add it back if it was hosted on replaced node\n collection_names.each do |collection_name|\n \n #Process next collection if no shards found\n next if cluster_status_collections[collection_name][\"shards\"].nil? || cluster_status_collections[collection_name][\"shards\"].empty?\n \n shard_names = cluster_status_collections[collection_name][\"shards\"].keys\n shards = cluster_status_collections[collection_name][\"shards\"]\n \n #Process each shard to delete and add replica if it was hosted on replaced(old_ip) then delete first and add it back again\n shard_names.each do |shard_name|\n Chef::Log.info( \"*** Processing shard '#{shard_name}' for collection '#{collection_name}'\")\n \n #Process next shard if no replica found\n next if shards[shard_name][\"replicas\"].nil? || shards[shard_name][\"replicas\"].empty?\n \n replica_names = shards[shard_name][\"replicas\"].keys\n replicas = shards[shard_name][\"replicas\"]\n Chef::Log.info( \"*** Replica names for shard #{shard_name} : #{replica_names}\")\n Chef::Log.info( \"*** Replicas for for shard #{shard_name} : #{replicas.to_json}\")\n new_ip_exist = 0\n old_ip_exist = 0\n \n #Process each replica to and if it was hosted on replaced(old_ip) then delete first and add it back again\n replica_names.each do |replica_name|\n Chef::Log.info( \"*** Replica is : #{replica_name}\")\n if (replicas.has_key?replica_name) && (replicas[replica_name][\"base_url\"].include? old_node_ip)\n old_ip_exist += 1\n Chef::Log.info(\"Deleting old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n delete_replica_url = \"#{solrCollectionUrl}action=DELETEREPLICA&collection=#{collection_name}&shard=#{shard_name}&replica=#{replica_name}\"\n Chef::Log.info(\"DELETEREPLICA : #{delete_replica_url}\")\n delete_replica_resp_obj = run_solr_action_api(delete_replica_url)\n Chef::Log.info(\"Deleted old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n \n #Refresh the collection/shard state to reflect the DELETEREPLICA change\n replicas = get_replicas_by_shard(host, port, collection_name, shard_name)\n Chef::Log.info(\"replicas for collection #{collection_name} & shard #{shard_name} after deleted replica=#{replica_name}\")\n \n else\n Chef::Log.info(\"Skipping Delete Replica for the replica #{replica_name} as no replica found on node #{old_node_ip}\")\n end\n \n # before adding the replica check if the new node ip is part of any collection in the cluster state, if so then don't do it\n # new-IP exists and old-IP too exists - Deletes the replica and sets old_ip_exist = 1, sets new_ip_exist = 1 => No add replica\n # new-IP exists and old-IP does not - doesn't delete replica, old_ip_exist = 0, sets new_ip_exist = 1 => No add replica\n # new-IP does not exist and old IP does - Deletes the replica and sets old_ip_exist = 1, new_ip_exist = 0 => Satisfies the condition for add replica\n Chef::Log.info(\"replicas before checking new_ip = #{replicas.to_json}\")\n Chef::Log.info(\"replicas[replica] before checking new_ip #{new_ip} = #{replicas[replica_name].to_json}\")\n #Check if for shard, any replica is using the new_ip\n if replica_exists_on_ip?(replicas, new_ip)\n Chef::Log.info(\"New IP #{new_ip} is found in the Replica for collection = #{collection_name} & shard = #{shard_name}\")\n new_ip_exist += 1\n else\n Chef::Log.info(\"New IP #{new_ip} is not found in replicas of collection = #{collection_name} & shard = #{shard_name}\")\n end\n end # next replica\n \n #Add replica on new ip if it was deleted from old ip. i.e. if old IP existed and new IP is not shown\n if (old_ip_exist > 0 && new_ip_exist == 0)\n add_replica_url = \"#{solrCollectionUrl}action=ADDREPLICA&collection=#{collection_name}&shard=#{shard_name}&node=#{new_ip}:#{port}_solr\"\n Chef::Log.info(\"ADDREPLICA: #{add_replica_url}\")\n add_replica_resp_obj = run_solr_action_api(add_replica_url)\n Chef::Log.info(\"Added new Replica : #{new_ip}, for collection = #{collection_name} & shard = #{shard_name}\")\n else\n Chef::Log.info(\"Skipping Add Replica for collection = #{collection_name} & shard = #{shard_name}, since value of old_ip_exist=#{old_ip_exist} and value of new_ip_exist=#{new_ip_exist}\")\n end\n end # next shard\n end # next collection\n end",
"def read_namespaced_replica_set_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.read_namespaced_replica_set ...\"\n end\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 AppsV1Api.read_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.read_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'exact'] = opts[:'exact'] if !opts[:'exact'].nil?\n query_params[:'export'] = opts[:'export'] if !opts[:'export'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#read_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end",
"def update!(**args)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end",
"def remove(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring.delete(key)\n @nodesort.delete(key)\n end\n end",
"def delete_failed_replica(collection:, shard:, replica:)\n Utils.solr_request(\n connection,\n 'DELETEREPLICA',\n extra_params: {\n 'collection' => collection,\n 'shard' => shard,\n 'replica' => replica\n }\n )\n rescue RSolr::Error::Http => _e\n false\n end",
"def deleteReplica(shard_name,collection_name,replica)\n params = {:action => \"DELETEREPLICA\",\n :collection => collection_name,:shard => shard_name,:replica => replica}\n\n jsonresponse = solr_collection_api(node['ipaddress'],node['port_no'],params)\n issuccess = jsonresponse.fetch('success', '')\n\n if issuccess.empty?\n iserror = jsonresponse.fetch('error', '')\n errormessage = iserror.fetch('msg','')\n raise errormessage\n else\n Chef::Log.info(issuccess)\n end\n end",
"def add(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring[key] = node\n @nodesort.push(key)\n end\n @nodesort.sort!\n end",
"def list_replica_set_for_all_namespaces_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_replica_set_for_all_namespaces ...\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/replicasets\"\n\n # query parameters\n query_params = {}\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ReplicaSetList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_replica_set_for_all_namespaces\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_namespaced_replica_set(name, namespace, body, opts = {})\n data, _status_code, _headers = patch_namespaced_replica_set_with_http_info(name, namespace, body, opts)\n return data\n end",
"def list_namespaced_replica_set(namespace, opts = {})\n data, _status_code, _headers = list_namespaced_replica_set_with_http_info(namespace, opts)\n return data\n end",
"def start_replication(execution, opts = {})\n start_replication_with_http_info(execution, opts)\n nil\n end",
"def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end",
"def clear_replicas(item_id, recovery_mode = false)\n# @logger.log_clear_replicas(item_id) unless recovery_mode\n nodes = find_nodes(item_id)\n nodes.each do |node|\n @nodes_to_data[node].delete(item_id)\n end\n @data_to_nodes.delete(item_id)\n end",
"def replica_set?; false; end",
"def redeploy(opts)\n client = opts.k8s.to_api\n patch = {\n spec: {\n template: {\n metadata: {\n annotations: {\n \"kubectl.kubernetes.io/restartedAt\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')\n }\n }\n }\n }\n }\n\n client\n .api('apps/v1')\n .resource('deployments', namespace: opts[:k8s][:k8s_namespace])\n .merge_patch(opts[:k8s][:k8s_deployment], patch)\nend",
"def replica_set_name; nil; end",
"def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end",
"def update!(**args)\n @label_selector_path = args[:label_selector_path] if args.key?(:label_selector_path)\n @spec_replicas_path = args[:spec_replicas_path] if args.key?(:spec_replicas_path)\n @status_replicas_path = args[:status_replicas_path] if args.key?(:status_replicas_path)\n end",
"def post_init\n # Build a JSON representation\n r = {:source => \"#{@conn_obj.remote_db}\",\n :target => \"#{@conn_obj.our_db}\"}\n #, :continuous => true }\n r_json = r.to_json\n\n # Create the HTTP request\n req = \"POST /_replicate HTTP/1.1\\r\\n\"\n req += \"Content-Length: #{r_json.length}\\r\\n\\r\\n\"\n req += \"#{r_json}\"\n\n # Push it to the network\n send_data req\n end",
"def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end",
"def create\n\n user = nil\n i = Identity.find_by_RID(params[:discovery_session][:RID])\n user = i.user unless i.nil?\n if user.nil?\n render :nothing => true, :status => 404\n else\n @discovery_session = DiscoverySession.new\n @discovery_session.user = user\n @discovery_session.discovery_session_id = DiscoverySession.unique_session_id\n\n # FIX MΕ \n respond_to do |format|\n if @discovery_session.save\n# format.json { render :json => @discovery_session.to_session_number.to_json, :status => :created }\n format.json { render :json => @discovery_session.to_json, :status => :created }\n else\n format.json { render :json => @discovery_session.errors, :status => :unprocessable_entity }\n end\n end\n end\n\n#remove scaffold code\n# @discovery_session = DiscoverySession.new(params[:discovery_session])\n#\n# respond_to do |format|\n# if @discovery_session.save\n# format.html { redirect_to @discovery_session, notice: 'Discovery session was successfully created.' }\n# format.json { render json: @discovery_session, status: :created, location: @discovery_session }\n# else\n# format.html { render action: \"new\" }\n# format.json { render json: @discovery_session.errors, status: :unprocessable_entity }\n# end\n# end \n#remove scaffold code\n\n end",
"def include_replicas_key\n ActiveRecord::VERSION::MAJOR >= 7 ? :include_hidden : :include_replicas\n end",
"def persist\n connection.resource(:post, 'persist', 'CLUSTER_CURRENT_STATUS' => { 'clusterState' => 'CLUSTER_STARTED_5' }.to_json)\n end",
"def write_session(env, sid, session, options); end",
"def on_replica(&block)\n on_master_or_replica(:replica, &block)\n end",
"def on_replica(&block)\n on_primary_or_replica(:replica, &block)\n end",
"def pods\n\nend",
"def id\n replication_id\n end",
"def fetch_replica_sets(release_docs)\n if release_docs.any? { |rd| rd.resource_template.any? { |r| r[:kind] == \"Deployment\" } }\n fetch_grouped(:replica_sets, 'apps/v1')\n else\n [] # save time\n end\n end",
"def create\n @shard = Shard.new(params[:shard])\n\n respond_to do |format|\n if @shard.save\n format.html { redirect_to @shard, notice: 'Shard was successfully created.' }\n format.json { render json: @shard, status: :created, location: @shard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform(scope, nodes_ids, session_auth_params)\n @context = Context.build(session_auth_params)\n nodes = Node.where(id: nodes_ids)\n copies = copy_service.copy(nodes, scope)\n notify_user(copies, scope)\n end",
"def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend",
"def update!(**args)\n @replication_state = args[:replication_state] if args.key?(:replication_state)\n end",
"def update_replication\n replication.stored = true\n replication.update_admin\n replication.update_local\n end",
"def patch_namespaced_replica_set_status(name, namespace, body, opts = {})\n data, _status_code, _headers = patch_namespaced_replica_set_status_with_http_info(name, namespace, body, opts)\n return data\n end",
"def create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend",
"def start_replication_with_http_info(execution, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReplicationApi.start_replication ...'\n end\n # verify the required parameter 'execution' is set\n if @api_client.config.client_side_validation && execution.nil?\n fail ArgumentError, \"Missing the required parameter 'execution' when calling ReplicationApi.start_replication\"\n end\n # resource path\n local_var_path = '/replication/executions'\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(execution)\n auth_names = ['basic']\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: ReplicationApi#start_replication\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @session_resource = SessionResource.new(session_resource_params)\n\n if @session_resource.save\n render json: @session_resource, status: :created, location: @session_resource\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end",
"def shard; end",
"def update!(**args)\n @replica_hours = args[:replica_hours] if args.key?(:replica_hours)\n end",
"def replication_state\n @grpc.replication_state\n end",
"def shards\n perform_request(api_url('shards')).map do |shard_data|\n DynamicModel.new shard_data\n end\n end",
"def replica_set_name\n @replica_set_name ||= options[REPLICA_SET_NAME]\n end",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def start\n @nodes.each(&:start)\n @worker = Thread.start do\n Thread.abort_on_exception = true\n catch(:shutdown) do\n loop do\n Moped.logger.debug \"replica_set: waiting for next client\"\n server, client = @manager.next_client\n\n if server\n Moped.logger.debug \"replica_set: proxying incoming request to mongo\"\n server.proxy(client, @mongo)\n else\n Moped.logger.debug \"replica_set: no requests; passing\"\n Thread.pass\n end\n end\n end\n end\n end",
"def shards\n @data['shards']\n end",
"def distribute(request)\n promote_replica_to_primary if primary_not_available?\n return \"Uh Oh, no primary\" if primary.nil?\n\n if write?(request)\n send(primary, request)\n else\n send(random_server, request)\n end\n end",
"def replication_type\n settings[:replication_type]\n 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 reserveNode(node_ids,account_name,valid_from,valid_until)\n cert_path = APP_CONFIG['cert_path']\n # resernation_name: we set a random name for every reservation constructing by the name of the slice and a random number ex user1/12341234 \n resernation_name =account_name+ \"/\" + (1000 + Random.rand(10000000)).to_s\n puts resernation_name\n \n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n\n node_ids.map!{|r| {uuid: r}}\n\n header = {\"Content-Type\" => \"application/json\"}\n options ={\n name: resernation_name,\n valid_from: valid_from,\n valid_until: valid_until,\n account: \n { \n name: account_name\n },\n components: node_ids\n }\n\n #puts options.to_json \n uri = URI.parse(broker_url+\"/resources/leases\")\n pem = File.read(cert_path)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.cert = OpenSSL::X509::Certificate.new(pem)\n http.key = OpenSSL::PKey::RSA.new(pem)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = options.to_json\n\n response = http.request(request)\n \n res = JSON.parse(response.body)\n \n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response \n puts res[\"exception\"][\"reason\"]\n return res[\"exception\"][\"reason\"]\n else\n return \"OK\"\n end\n \n end",
"def read_replica_source_db_cluster_identifier\n data[:read_replica_source_db_cluster_identifier]\n end",
"def create\n @server = Server.new(server_params)\n @neo = Neography::Rest.new\n\n respond_to do |format|\n if @server.save && n = Neography::Node.create(\"name\" => server_params[:name])\n n.add_to_index('servers', 'name', server_params[:name])\n n.id = n.neo_id # this construct should be improved..\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sessions=(value)\n @sessions = value\n end",
"def on_new_slice(params, req)\n debug \"on_new_slice: #{params}\"\n\n @topology_url = params[:topology]\n topo = OMF::Web::ContentRepository.read_content(@topology_url, params)\n @slice_name = params[:slice_name]\n\n SliceServiceProxy.instance.slice_memberships do |status, memberships|\n # not sure how to deliver errors\n unless status == :ok\n if status == :progress\n memberships.each {|msg| @progress_table << ['progress', msg]}\n else\n @progress_table << [status, memberships]\n end\n next\n end\n\n ssm = memberships.find do |sm|\n sm[:slice_name] == @slice_name\n end\n if ssm\n _request_sliver_for_existing_slice(ssm, topo, params)\n else\n _request_sliver_for_new_slice(@slice_name, topo, params)\n end\n end\n end",
"def create\n reading_id = Reading.next_sequence_id\n params.merge!(\"thermostat_id\" => @thermostat.id)\n $redis.set(reading_id, params)\n ::BackgroundWorker::CreateReading.perform(params, reading_id)\n render status: 200, :json=>{:sequence_id => reading_id} and return\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 increment(replica, increment_by=1)\n replicated_integer = @collection.get(replica)\n replicated_integer.increment(increment_by)\n self\n end",
"def create\n @client = current_client\n @session = @client.session\n debug { \"SessionsController#create - #{@session.inspect}\"}\n raise \"ResourceOwner from token != session.owner\" if doorkeeper_token.resource_owner_id != @session.owner.id\n\n @client.update_attributes!(client_params)\n render json: @client, status: :created, serializer: Sso::ClientSerializer\n end",
"def reconnect\n @read_replica.reconnect\n @primary.reconnect\n end",
"def partitions(key, partitions)\n master = fnv_hash(key) % partitions.size\n selected = [master]\n nodes = [partitions[master]]\n current = (master + 1) % partitions.size\n\n # Walk clockwise around the ring of partitions, starting from the master partition.\n # The next few unique nodes in ring order are the replicas.\n while current != master && selected.size < @replicas\n if !nodes.include? partitions[current]\n nodes << partitions[current]\n selected << current\n end\n current = (current + 1) % partitions.size\n end\n\n selected\n end",
"def replication_credentials\n {user: @config['mysql_repl_user'], pass: @config['mysql_repl_password']}\n end",
"def server_params\n params.permit(:uuid, :addr, :port, :status)\n end",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end"
] | [
"0.72132355",
"0.68021774",
"0.639382",
"0.638609",
"0.6376838",
"0.63217497",
"0.60546887",
"0.57516086",
"0.5648277",
"0.555512",
"0.53954935",
"0.53938895",
"0.51999646",
"0.5123359",
"0.5002693",
"0.49794427",
"0.49644673",
"0.4958506",
"0.49353305",
"0.49186015",
"0.4895357",
"0.48932034",
"0.48857304",
"0.48723936",
"0.4863217",
"0.47976208",
"0.4784519",
"0.4746587",
"0.47121853",
"0.47011533",
"0.47011495",
"0.4692993",
"0.4669074",
"0.46522164",
"0.46520418",
"0.4622459",
"0.46019724",
"0.4591502",
"0.4591502",
"0.45902157",
"0.4588956",
"0.45859545",
"0.45751527",
"0.45573333",
"0.45526776",
"0.45315236",
"0.45229802",
"0.45202535",
"0.451452",
"0.45126277",
"0.45083922",
"0.44810462",
"0.4468761",
"0.44667995",
"0.4465804",
"0.4464327",
"0.4448477",
"0.4440762",
"0.4436706",
"0.4402585",
"0.43790758",
"0.4360014",
"0.43551219",
"0.434489",
"0.43435895",
"0.43426776",
"0.43394062",
"0.43389636",
"0.43037224",
"0.42983276",
"0.428877",
"0.42851922",
"0.42748424",
"0.42685187",
"0.42577896",
"0.42550412",
"0.42544895",
"0.4238627",
"0.42358133",
"0.42339945",
"0.42339945",
"0.42238122",
"0.4214721",
"0.42023766",
"0.4200481",
"0.41899955",
"0.4151664",
"0.41496396",
"0.41383117",
"0.41361257",
"0.41243315",
"0.41196102",
"0.4118886",
"0.41144237",
"0.41140056",
"0.4107286",
"0.41059795",
"0.41046515",
"0.41038963",
"0.4103392"
] | 0.7139926 | 1 |
PATCH/PUT /session_replicas/1 PATCH/PUT /session_replicas/1.json | def update
respond_to do |format|
if @session_replica.update(session_replica_params)
format.html { redirect_to @session_replica}
format.json { render :show, status: :ok, location: @session_replica }
else
format.html { render :edit }
format.json { render json: @session_replica.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end",
"def update!(**args)\n @max_replicas = args[:max_replicas] if args.key?(:max_replicas)\n @min_replicas = args[:min_replicas] if args.key?(:min_replicas)\n end",
"def increment_replica_count\n self.original['spec']['replicas'] += 1\n end",
"def index\n @session_replicas = SessionReplica.all\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 update!(**args)\n @label_selector_path = args[:label_selector_path] if args.key?(:label_selector_path)\n @spec_replicas_path = args[:spec_replicas_path] if args.key?(:spec_replicas_path)\n @status_replicas_path = args[:status_replicas_path] if args.key?(:status_replicas_path)\n end",
"def update_replication(request, &block)\n put \"/replicate/#{request[:replication_id]}/\", request, &block\n end",
"def create\n @session_replica = SessionReplica.new(session_replica_params)\n\n respond_to do |format|\n if @session_replica.save\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :created, location: @session_replica }\n else\n format.html { render :new }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend",
"def update!(**args)\n @replication_state = args[:replication_state] if args.key?(:replication_state)\n end",
"def decrement_replica_count\n self.original['spec']['replicas'] -= 1\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 session_replica_params\n params.require(:session_replica).permit(:origin_id, :start_date)\n end",
"def redeploy(opts)\n client = opts.k8s.to_api\n patch = {\n spec: {\n template: {\n metadata: {\n annotations: {\n \"kubectl.kubernetes.io/restartedAt\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')\n }\n }\n }\n }\n }\n\n client\n .api('apps/v1')\n .resource('deployments', namespace: opts[:k8s][:k8s_namespace])\n .merge_patch(opts[:k8s][:k8s_deployment], patch)\nend",
"def replicas; end",
"def patch_namespaced_replica_set_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.patch_namespaced_replica_set ...\"\n end\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 AppsV1Api.patch_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.patch_namespaced_replica_set\"\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 AppsV1Api.patch_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/merge-patch+json', 'application/strategic-merge-patch+json'])\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 = ['BearerToken']\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 :return_type => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#patch_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_replication\n replication.stored = true\n replication.update_admin\n replication.update_local\n end",
"def modify_server(server_uuid, params)\n data = { \"server\" => params }\n json = JSON.generate data\n response = put \"server/#{server_uuid}\", json\n\n response\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!(**args)\n @autoscaling_spec = args[:autoscaling_spec] if args.key?(:autoscaling_spec)\n @disk_spec = args[:disk_spec] if args.key?(:disk_spec)\n @id = args[:id] if args.key?(:id)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @replica_count = args[:replica_count] if args.key?(:replica_count)\n @used_replica_count = args[:used_replica_count] if args.key?(:used_replica_count)\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update_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 replace_namespaced_replica_set_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.replace_namespaced_replica_set ...\"\n end\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 AppsV1Api.replace_namespaced_replica_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.replace_namespaced_replica_set\"\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 AppsV1Api.replace_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\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 = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#replace_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end",
"def update!(**args)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end",
"def update!(**args)\n @replica_hours = args[:replica_hours] if args.key?(:replica_hours)\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!(**args)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @starting_replica_count = args[:starting_replica_count] if args.key?(:starting_replica_count)\n end",
"def update!(**args)\n @device_index = args[:device_index] if args.key?(:device_index)\n @session = args[:session] if args.key?(:session)\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!(**args)\n @control_plane_node_port = args[:control_plane_node_port] if args.key?(:control_plane_node_port)\n @ingress_http_node_port = args[:ingress_http_node_port] if args.key?(:ingress_http_node_port)\n @ingress_https_node_port = args[:ingress_https_node_port] if args.key?(:ingress_https_node_port)\n @konnectivity_server_node_port = args[:konnectivity_server_node_port] if args.key?(:konnectivity_server_node_port)\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 restart!\n CouchRest.post \"#{@uri}/_restart\"\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 @discovery_session = DiscoverySession.find(params[:id])\n\n respond_to do |format|\n if @discovery_session.update_attributes(params[:discovery_session])\n format.html { redirect_to @discovery_session, notice: 'Discovery session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discovery_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!(**args)\n @allow_transactional_writes = args[:allow_transactional_writes] if args.key?(:allow_transactional_writes)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\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!(**args)\n @newscluster = args[:newscluster] if args.key?(:newscluster)\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 update!(**args)\n @cpus = args[:cpus] if args.key?(:cpus)\n @memory = args[:memory] if args.key?(:memory)\n @replicas = args[:replicas] if args.key?(:replicas)\n end",
"def update\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff.subcluster(sub_cluster) \n respond_to do |format|\n if @dtc_staff.update(params[:dtc_staff])\n format.html { redirect_to dtc_staffs_url, notice: 'Route Updated' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dtc_staff.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 respond_to do |format|\n if @cluster.update(cluster_params)\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { render :show, status: :ok, location: @cluster }\n else\n format.html { render :edit }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cluster.update(cluster_params)\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { render :show, status: :ok, location: @cluster }\n else\n format.html { render :edit }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\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 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 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 patch_namespaced_replica_set(name, namespace, body, opts = {})\n data, _status_code, _headers = patch_namespaced_replica_set_with_http_info(name, namespace, body, opts)\n return data\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 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 update!(**args)\n @autoscaling_metric_specs = args[:autoscaling_metric_specs] if args.key?(:autoscaling_metric_specs)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\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 @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @addons_node_port = args[:addons_node_port] if args.key?(:addons_node_port)\n @control_plane_node_port = args[:control_plane_node_port] if args.key?(:control_plane_node_port)\n @ingress_http_node_port = args[:ingress_http_node_port] if args.key?(:ingress_http_node_port)\n @ingress_https_node_port = args[:ingress_https_node_port] if args.key?(:ingress_https_node_port)\n @konnectivity_server_node_port = args[:konnectivity_server_node_port] if args.key?(:konnectivity_server_node_port)\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 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!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @partitions = args[:partitions] if args.key?(:partitions)\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 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!(**args)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n end",
"def get_all_replicas(id, options = GetAllReplicasOptions.new) end",
"def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n end",
"def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retain_replicas_on_node(old_node_ip)\n \n Chef::Log.info( \"***Old node IP : #{old_node_ip}\")\n new_ip = node['ipaddress']\n Chef::Log.info( \"***New node IP : #{new_ip}\")\n \n #get host ip other than the replaced node as old(replaced) ip has already gone from cluster\n computes = node.workorder.payLoad.has_key?(\"RequiresComputes\") ? node.workorder.payLoad.RequiresComputes : node.workorder.payLoad.computes\n other_computes = computes.select { |compute| compute['ciAttributes']['private_ip'] != old_node_ip}\n host = other_computes[0][\"ciAttributes\"][\"private_ip\"]\n port = (node[\"solr_version\"].start_with? \"4.\")?\"8080\":node['port_no']\n \n solrCollectionUrl = \"http://#{host}:#{port}/solr/admin/collections?\"\n \n #Get cluster state to fetch all collection & its details\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_state_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_state_resp = #{cluster_state_resp.to_json}\")\n cluster_status_collections = cluster_state_resp[\"cluster\"][\"collections\"]\n \n #Get list of all existing collection names\n collection_names = []\n if !cluster_status_collections.nil? && !cluster_status_collections.empty?\n collection_names = cluster_status_collections.keys\n end\n \n #For each collection->shard->replica, delete replica and add it back if it was hosted on replaced node\n collection_names.each do |collection_name|\n \n #Process next collection if no shards found\n next if cluster_status_collections[collection_name][\"shards\"].nil? || cluster_status_collections[collection_name][\"shards\"].empty?\n \n shard_names = cluster_status_collections[collection_name][\"shards\"].keys\n shards = cluster_status_collections[collection_name][\"shards\"]\n \n #Process each shard to delete and add replica if it was hosted on replaced(old_ip) then delete first and add it back again\n shard_names.each do |shard_name|\n Chef::Log.info( \"*** Processing shard '#{shard_name}' for collection '#{collection_name}'\")\n \n #Process next shard if no replica found\n next if shards[shard_name][\"replicas\"].nil? || shards[shard_name][\"replicas\"].empty?\n \n replica_names = shards[shard_name][\"replicas\"].keys\n replicas = shards[shard_name][\"replicas\"]\n Chef::Log.info( \"*** Replica names for shard #{shard_name} : #{replica_names}\")\n Chef::Log.info( \"*** Replicas for for shard #{shard_name} : #{replicas.to_json}\")\n new_ip_exist = 0\n old_ip_exist = 0\n \n #Process each replica to and if it was hosted on replaced(old_ip) then delete first and add it back again\n replica_names.each do |replica_name|\n Chef::Log.info( \"*** Replica is : #{replica_name}\")\n if (replicas.has_key?replica_name) && (replicas[replica_name][\"base_url\"].include? old_node_ip)\n old_ip_exist += 1\n Chef::Log.info(\"Deleting old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n delete_replica_url = \"#{solrCollectionUrl}action=DELETEREPLICA&collection=#{collection_name}&shard=#{shard_name}&replica=#{replica_name}\"\n Chef::Log.info(\"DELETEREPLICA : #{delete_replica_url}\")\n delete_replica_resp_obj = run_solr_action_api(delete_replica_url)\n Chef::Log.info(\"Deleted old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n \n #Refresh the collection/shard state to reflect the DELETEREPLICA change\n replicas = get_replicas_by_shard(host, port, collection_name, shard_name)\n Chef::Log.info(\"replicas for collection #{collection_name} & shard #{shard_name} after deleted replica=#{replica_name}\")\n \n else\n Chef::Log.info(\"Skipping Delete Replica for the replica #{replica_name} as no replica found on node #{old_node_ip}\")\n end\n \n # before adding the replica check if the new node ip is part of any collection in the cluster state, if so then don't do it\n # new-IP exists and old-IP too exists - Deletes the replica and sets old_ip_exist = 1, sets new_ip_exist = 1 => No add replica\n # new-IP exists and old-IP does not - doesn't delete replica, old_ip_exist = 0, sets new_ip_exist = 1 => No add replica\n # new-IP does not exist and old IP does - Deletes the replica and sets old_ip_exist = 1, new_ip_exist = 0 => Satisfies the condition for add replica\n Chef::Log.info(\"replicas before checking new_ip = #{replicas.to_json}\")\n Chef::Log.info(\"replicas[replica] before checking new_ip #{new_ip} = #{replicas[replica_name].to_json}\")\n #Check if for shard, any replica is using the new_ip\n if replica_exists_on_ip?(replicas, new_ip)\n Chef::Log.info(\"New IP #{new_ip} is found in the Replica for collection = #{collection_name} & shard = #{shard_name}\")\n new_ip_exist += 1\n else\n Chef::Log.info(\"New IP #{new_ip} is not found in replicas of collection = #{collection_name} & shard = #{shard_name}\")\n end\n end # next replica\n \n #Add replica on new ip if it was deleted from old ip. i.e. if old IP existed and new IP is not shown\n if (old_ip_exist > 0 && new_ip_exist == 0)\n add_replica_url = \"#{solrCollectionUrl}action=ADDREPLICA&collection=#{collection_name}&shard=#{shard_name}&node=#{new_ip}:#{port}_solr\"\n Chef::Log.info(\"ADDREPLICA: #{add_replica_url}\")\n add_replica_resp_obj = run_solr_action_api(add_replica_url)\n Chef::Log.info(\"Added new Replica : #{new_ip}, for collection = #{collection_name} & shard = #{shard_name}\")\n else\n Chef::Log.info(\"Skipping Add Replica for collection = #{collection_name} & shard = #{shard_name}, since value of old_ip_exist=#{old_ip_exist} and value of new_ip_exist=#{new_ip_exist}\")\n end\n end # next shard\n end # next collection\n end",
"def update!(**args)\n @zwieback_session_id = args[:zwieback_session_id] if args.key?(:zwieback_session_id)\n end",
"def update!(**args)\n @zwieback_session_id = args[:zwieback_session_id] if args.key?(:zwieback_session_id)\n end",
"def refresh\n session.cluster.refresh\n rescue => e\n raise ConnectionFailed, e\n end",
"def update\n respond_to do |format|\n if @mcluster.update(mcluster_params)\n format.html { redirect_to @mcluster, notice: 'Mcluster was successfully updated.' }\n format.json { render :show, status: :ok, location: @mcluster }\n else\n format.html { render :edit }\n format.json { render json: @mcluster.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 update\n @shard = Shard.find(params[:id])\n\n respond_to do |format|\n if @shard.update_attributes(params[:shard])\n format.html { redirect_to @shard, notice: 'Shard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @psc_uri = args[:psc_uri] if args.key?(:psc_uri)\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 update\n if @session\n @session.update_session(marshalize(@data))\n end\n end",
"def update!(**args)\n @all_namespaces = args[:all_namespaces] if args.key?(:all_namespaces)\n @cluster_metadata = args[:cluster_metadata] if args.key?(:cluster_metadata)\n @complete_time = args[:complete_time] if args.key?(:complete_time)\n @config_backup_size_bytes = args[:config_backup_size_bytes] if args.key?(:config_backup_size_bytes)\n @contains_secrets = args[:contains_secrets] if args.key?(:contains_secrets)\n @contains_volume_data = args[:contains_volume_data] if args.key?(:contains_volume_data)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_lock_days = args[:delete_lock_days] if args.key?(:delete_lock_days)\n @delete_lock_expire_time = args[:delete_lock_expire_time] if args.key?(:delete_lock_expire_time)\n @description = args[:description] if args.key?(:description)\n @encryption_key = args[:encryption_key] if args.key?(:encryption_key)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @manual = args[:manual] if args.key?(:manual)\n @name = args[:name] if args.key?(:name)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n @resource_count = args[:resource_count] if args.key?(:resource_count)\n @retain_days = args[:retain_days] if args.key?(:retain_days)\n @retain_expire_time = args[:retain_expire_time] if args.key?(:retain_expire_time)\n @selected_applications = args[:selected_applications] if args.key?(:selected_applications)\n @selected_namespaces = args[:selected_namespaces] if args.key?(:selected_namespaces)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n @state = args[:state] if args.key?(:state)\n @state_reason = args[:state_reason] if args.key?(:state_reason)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @volume_count = args[:volume_count] if args.key?(:volume_count)\n end",
"def update!(**args)\n @container_runtime = args[:container_runtime] if args.key?(:container_runtime)\n @max_pods_per_node = args[:max_pods_per_node] if args.key?(:max_pods_per_node)\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 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 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!(**args)\n @cluster = args[:cluster] if args.key?(:cluster)\n end",
"def update!(**args)\n @container_port = args[:container_port] if args.key?(:container_port)\n end",
"def update!(**args)\n @partition_key = args[:partition_key] if args.key?(:partition_key)\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\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 restart\n client.restart\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 @notebook = Notebook.find(params[:id])\n\n if @notebook.update_attributes(params[:notebook])\n head :no_content\n else\n render json: @notebook.errors, status: :unprocessable_entity\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update!(**args)\n @notebook_runtime = args[:notebook_runtime] if args.key?(:notebook_runtime)\n @notebook_runtime_id = args[:notebook_runtime_id] if args.key?(:notebook_runtime_id)\n @notebook_runtime_template = args[:notebook_runtime_template] if args.key?(:notebook_runtime_template)\n end",
"def patch_namespaced_replica_set_status_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.patch_namespaced_replica_set_status ...\"\n end\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 AppsV1Api.patch_namespaced_replica_set_status\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.patch_namespaced_replica_set_status\"\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 AppsV1Api.patch_namespaced_replica_set_status\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/merge-patch+json', 'application/strategic-merge-patch+json'])\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 = ['BearerToken']\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 :return_type => 'V1ReplicaSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#patch_namespaced_replica_set_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update\n @server_node = ServerNode.find(params[:id])\n\n respond_to do |format|\n if @server_node.update_attributes(params[:server_node])\n format.html { redirect_to @server_node, notice: 'Server node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = @job.nodes.find(params[:id])\n \n respond_to do |format|\n # When all nodes report ready, a nextstep action is triggered on the job.\n if @node.update_attributes(params[:node])\n \n if @job.state == \"waiting_for_nodes\"\n # check if all nodes have finished installs/configuration\n @ready_nodes = @job.nodes.find(:all, :conditions => {:is_configured => true })\n if @ready_nodes.size == @job.number_of_instances\n @job.nextstep! # waiting_for_nodes - > exporting_master_nfs\n puts \"All nodes have reported ready, configuring cluster host file and starting NFS export\"\n end \n elsif @job.state == \"exporting_master_nfs\"\n # trigger transition when nfs_mounted => true for master node...\n # find master node by checking if instance_id = master_instance_id, \n master_instance_id = @job.master_instance_id\n @master_node = @job.nodes.find(:first, :conditions => {:aws_instance_id => master_instance_id })\n # check if nfs_mounted is true for master node, if so - transition. \n if @master_node.nfs_mounted\n @job.nextstep! # exporting_master_nfs -> mounting_nfs\n puts \"Master node has exported NFS home, ready for worker nodes to begin mounting volume\" \n end \n elsif @job.state == \"mounting_nfs\" \n # check if all nodes have mounted NFS home directory\n @mounted_nodes = @job.nodes.find(:all, :conditions => {:nfs_mounted => true })\n if @mounted_nodes.size == @job.number_of_instances\n @job.nextstep! # mounting_nfs - > configuring_cluster\n puts \"All nodes mounted NFS volumes, cluster ready for MPI jobs\"\n end \n end \n \n flash[:notice] = 'Node was successfully updated.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update!(**args)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n @throttled = args[:throttled] if args.key?(:throttled)\n end",
"def update_cluster instance_id, cluster_id, location, serve_nodes\n instances.update_cluster name: cluster_path(instance_id, cluster_id),\n location: location,\n serve_nodes: serve_nodes\n end"
] | [
"0.65559",
"0.6220529",
"0.6152326",
"0.61337984",
"0.6014983",
"0.5835703",
"0.5744421",
"0.56974447",
"0.5681056",
"0.56587446",
"0.56110454",
"0.55506253",
"0.5516534",
"0.5504615",
"0.5400901",
"0.5381052",
"0.5347868",
"0.5278142",
"0.52709705",
"0.52651864",
"0.52610946",
"0.5234127",
"0.523332",
"0.52248025",
"0.52248025",
"0.5190108",
"0.51719075",
"0.5156422",
"0.51517797",
"0.5144639",
"0.5118555",
"0.5095465",
"0.5095465",
"0.50941944",
"0.509401",
"0.50935423",
"0.50745845",
"0.5073957",
"0.5071449",
"0.5068011",
"0.5058106",
"0.5057655",
"0.50521314",
"0.5031277",
"0.50231284",
"0.50231284",
"0.5021224",
"0.50119036",
"0.49954075",
"0.49925992",
"0.4991836",
"0.4989018",
"0.4987759",
"0.4985584",
"0.4983274",
"0.49595666",
"0.49552566",
"0.49514022",
"0.49514022",
"0.49514022",
"0.49514022",
"0.49474853",
"0.49408013",
"0.49252334",
"0.4922723",
"0.49170437",
"0.4911588",
"0.4911588",
"0.49091014",
"0.4894231",
"0.48830506",
"0.48830506",
"0.48757106",
"0.48667687",
"0.48575056",
"0.48572496",
"0.48477718",
"0.48451298",
"0.4843583",
"0.48367655",
"0.48171318",
"0.4812416",
"0.4801485",
"0.4797921",
"0.47900578",
"0.47877324",
"0.47869948",
"0.47844976",
"0.47818837",
"0.478068",
"0.4780516",
"0.4767883",
"0.4767051",
"0.47398013",
"0.47327954",
"0.47321078",
"0.4729736",
"0.47289872",
"0.47276092",
"0.47267732"
] | 0.6951087 | 0 |
DELETE /session_replicas/1 DELETE /session_replicas/1.json | def destroy
@session_replica.destroy
respond_to do |format|
format.html { redirect_to session_replicas_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 decrement_replica_count\n self.original['spec']['replicas'] -= 1\n end",
"def destroy\n @shard = Shard.find(params[:id])\n @shard.destroy\n\n respond_to do |format|\n format.html { redirect_to shards_url }\n format.json { head :no_content }\n end\n end",
"def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n rt = Scalaris::RoutingTable.new\n r = rt.get_replication_factor\n \n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(r, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def deleteReplica(shard_name,collection_name,replica)\n params = {:action => \"DELETEREPLICA\",\n :collection => collection_name,:shard => shard_name,:replica => replica}\n\n jsonresponse = solr_collection_api(node['ipaddress'],node['port_no'],params)\n issuccess = jsonresponse.fetch('success', '')\n\n if issuccess.empty?\n iserror = jsonresponse.fetch('error', '')\n errormessage = iserror.fetch('msg','')\n raise errormessage\n else\n Chef::Log.info(issuccess)\n end\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def remove(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring.delete(key)\n @nodesort.delete(key)\n end\n end",
"def delete_ingress(namespace, ingress_name)\n if namespace_exists?(namespace) && object_exists?(namespace, \"ingress\", ingress_name)\n execute(\"kubectl delete ingress #{ingress_name} -n #{namespace}\")\n end\nend",
"def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\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 @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to clusters_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def index\n @session_replicas = SessionReplica.all\n end",
"def testDelete2()\n key = \"_Delete2\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n rt = Scalaris::RoutingTable.new\n r = rt.get_replication_factor\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(r, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end",
"def test_delete1()\n key = \"_Delete1\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end",
"def delete(path, params={}) # :nodoc:\n handle_response(@session.delete(path, MultiJson.dump(params)))\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 delete_session(env, sid, options); 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\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 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 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 @server_node = ServerNode.find(params[:id])\n @server_node.destroy\n\n respond_to do |format|\n format.html { redirect_to server_nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node_index = NodeIndex.find(params[:id])\n @node_index.destroy\n\n respond_to do |format|\n format.html { redirect_to node_indices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session_resource.destroy\n\n head :no_content\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 delete\n execute_prlctl('delete', @uuid)\n end",
"def delete(path)\n RestClient.delete request_base+path\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_cluster\n lb_authenticate = authenticate()\n lb_url = \"\"\n headers = {\"x-auth-token\" => lb_authenticate['auth_token'], \"content-type\" => \"application/json\"}\n lb_authenticate['lb_urls'].each {|lb|\n if config[:lb_region].to_s.downcase == lb['region'].to_s.downcase\n lb_url = lb['publicURL']\n break\n end\n lb_url = lb['publicURL']\n }\n @name_args.each {|arg|\n server_uuids = []\n lb_url = lb_url + \"/loadbalancers/#{arg}\"\n get_uuids = make_web_call(\"get\", lb_url, headers )\n if get_uuids.code == '404'\n ui.msg \"Make sure you specify the -r flag to specify what region the LB is located\"\n exit(1)\n end\n lb_data = JSON.parse(get_uuids.body)\n lb_data['loadBalancer']['metadata'].each{|meta|\n server_uuids << {'uuid' => meta['value'], 'server_name' => meta['key'] }\n }\n server_uuids.each { |uuid|\n rs_delete = RackspaceServerDelete.new\n rs_delete.config[:yes] = 'yes'\n rs_delete.name_args = [ uuid['uuid'] ]\n rs_delete.config[:purge] = true\n rs_delete.config[:chef_node_name] = uuid['server_name']\n rs_delete.run\n }\n delete_lb_call = make_web_call(\"delete\", lb_url, headers)\n puts \"Deleted loadbalancer id #{arg}\"\n \n \n }\n end",
"def delete_server(server_uuid)\n response = delete \"server/#{server_uuid}\"\n\n response\n end",
"def clear_replicas(item_id, recovery_mode = false)\n# @logger.log_clear_replicas(item_id) unless recovery_mode\n nodes = find_nodes(item_id)\n nodes.each do |node|\n @nodes_to_data[node].delete(item_id)\n end\n @data_to_nodes.delete(item_id)\n end",
"def destroy\n authorize! :destroy, @db_repl_freq\n @db_repl_freq.destroy\n respond_to do |format|\n format.html { redirect_to db_repl_freqs_url, notice: 'Database replication frequency was successfully destroyed.' }\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 = 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 @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 delete(*rest) end",
"def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to(clusters_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n redis.eval(LUA_SCRIPT_DELETE, :keys => [build_key('*')])\n end",
"def delete!(uuid)\n return_value = delete(uuid)\n raise SessionNotFound if return_value.zero?\n\n true\n end",
"def destroy\n @mcluster.destroy\n respond_to do |format|\n format.html { redirect_to mclusters_url, notice: 'Mcluster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete_object(druid)\n storage_object = find_storage_object(druid)\n object_pathname = storage_object.object_pathname\n delete_storage(object_pathname)\n\n # TODO: remove any replicas from the replica-cache.\n\n end",
"def delete\n Iterable.request(conf, base_path).delete\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 delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end",
"def destroy\n @slice = Xen::Slice.find(params[:id])\n @slice.shutdown\n\n respond_to do |format|\n format.html { redirect_to(slices_url) }\n format.xml { head :ok }\n end\n end",
"def delete(url)\n setup_or_refresh_rest_session\n @session.delete(url: url)\n end",
"def delete(args)\n args = {:path => args} unless args.is_a?(Hash)\n assert_supported_keys(args, [:path, :version, :callback, :context])\n assert_required_keys(args, [:path])\n args[:version] ||= -1\n\n if args[:callback] ## asynchronous\n raise KeeperException::BadArguments unless args[:callback].kind_of?(VoidCallback)\n return zoo_adelete(@zk_handle, args[:path], args[:version], args[:callback].proc, YAML.dump(args[:context]))\n end\n\n ## synchronous\n rc = zoo_delete(@zk_handle, args[:path], args[:version])\n raise KeeperException.by_code(rc), ZooKeeperFFI::zerror(rc) unless rc == ZOK\n return rc\n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def destroy\n @topiccluster = Topiccluster.find(params[:id])\n @topiccluster.destroy\n\n respond_to do |format|\n format.html { redirect_to(topicclusters_url) }\n format.xml { head :ok }\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 @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 @cluster.clusterstatus = \"Destroying\"\n @cluster.save\n DeleteClusterJob.perform_later(@cluster)\n #@cluster.destroy\n respond_to do |format|\n format.html { redirect_to clusters_url, notice: 'Cluster is getting destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n head 200\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def running_delete\n base_delete(params, \"Running\")\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 delete\n \n end",
"def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end",
"def destroy\n @batch.destroy\n head :no_content\n end",
"def destroy\n n = Node.find_key(params[:id] || params[:name])\n render api_delete Node\n end",
"def test_delete2()\n key = \"_Delete2\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\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 delete_snapshot(snapshot_id)\n end",
"def destroy\n @terminal_master.destroy\n respond_to do |format|\n format.html { redirect_to terminal_masters_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete_failed_replica(collection:, shard:, replica:)\n Utils.solr_request(\n connection,\n 'DELETEREPLICA',\n extra_params: {\n 'collection' => collection,\n 'shard' => shard,\n 'replica' => replica\n }\n )\n rescue RSolr::Error::Http => _e\n false\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end",
"def delete_ns\n ns = cm_client.get_namespace(namespace)\n puts 'exists, deleting'\n ns = cm_client.delete_namespace(namespace)\n while true do\n ns = cm_client.get_namespace(namespace)\n ap ns\n sleep(1)\n end\nrescue Kubeclient::ResourceNotFoundError\n puts 'does not exists'\nend",
"def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_old_mgr(ceph_version)\n rs_client = kube_client.api('extensions/v1beta1').resource('replicasets', namespace: 'kontena-storage')\n old_replicasets = rs_client.list(labelSelector: 'app=rook-ceph-mgr').reject do |rs|\n rs.spec.template.spec.containers.first.image.include?(\"ceph/ceph:v#{ceph_version}\")\n end\n old_replicasets.each do |rs|\n rs_client.delete_resource(rs, propagationPolicy: 'Background')\n end\n end",
"def destroy\n @container = @container_row.container\n @container_row.destroy\n respond_to do |format|\n flash[:success] = 'Row was successfully deleted.' \n format.html { redirect_to admin_container_url(@container) }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def delete_collection_namespaced_replica_set_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.delete_collection_namespaced_replica_set ...\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.delete_collection_namespaced_replica_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/replicasets\".sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'V1Status')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#delete_collection_namespaced_replica_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_session(user_id:, session_id:)\n path = '/users/{userId}/sessions/{sessionId}'\n .gsub('{userId}', user_id)\n .gsub('{sessionId}', session_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if session_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"sessionId\"')\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 destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def delete(instance) # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + instance\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Node was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observation.wait_for_index_refresh = true\n @observation.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = t(:observation_was_deleted)\n redirect_to(observations_by_login_path(current_user.login))\n end\n format.xml { head :ok }\n format.json do\n head :ok\n end\n end\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 delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containerview.contents(@options[:container])\n container_contents = contents.body.split(/\\n/)\n container_contents.each do |content|\n containerview.delete_content(@options[:container], content)\n puts 'deleted ' + content\n end\n end\n containerview = containerview.delete(@options[:container])\n if containerview.code == '204'\n puts \"Container #{@options[:container]} deleted\"\n else\n @util.response_handler(containerview)\n end\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\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"
] | [
"0.630367",
"0.61659247",
"0.60246676",
"0.6015206",
"0.60112727",
"0.5996535",
"0.5980484",
"0.5930732",
"0.5909079",
"0.586176",
"0.5851236",
"0.58501256",
"0.5843635",
"0.5799133",
"0.57767534",
"0.57584006",
"0.57451165",
"0.5726068",
"0.5711957",
"0.56949353",
"0.5693736",
"0.56870884",
"0.5679643",
"0.56747204",
"0.56682026",
"0.5667519",
"0.5663684",
"0.56632143",
"0.5662794",
"0.5653342",
"0.5652608",
"0.56408155",
"0.56361896",
"0.56311506",
"0.5628403",
"0.56282246",
"0.561799",
"0.5605692",
"0.5600135",
"0.5598137",
"0.5591606",
"0.5590601",
"0.55860597",
"0.5576751",
"0.5565367",
"0.5565086",
"0.5561237",
"0.5557794",
"0.5557385",
"0.55448675",
"0.55448675",
"0.55429924",
"0.5537435",
"0.55296475",
"0.5529278",
"0.5525111",
"0.5524649",
"0.55222446",
"0.55186903",
"0.5515809",
"0.550555",
"0.54967713",
"0.54937375",
"0.54923934",
"0.54906106",
"0.5482373",
"0.5479272",
"0.5476489",
"0.5475",
"0.54723287",
"0.5469776",
"0.5469483",
"0.54673046",
"0.54660094",
"0.54655266",
"0.54623365",
"0.5461848",
"0.54574084",
"0.545586",
"0.54522735",
"0.5446257",
"0.5440944",
"0.5434539",
"0.5432977",
"0.54282266",
"0.5427895",
"0.5426073",
"0.5421783",
"0.5419728",
"0.5408936",
"0.54054457",
"0.5405162",
"0.5397246",
"0.53940874",
"0.5393959",
"0.53884816",
"0.5388431",
"0.53855294",
"0.537471",
"0.537471"
] | 0.80110145 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_session_replica
@session_replica = SessionReplica.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 session_replica_params
params.require(:session_replica).permit(:origin_id, :start_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; 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 safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
Method to sign out users | def destroy
session[:user_id] = nil
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_out\n logout\n end",
"def sign_out\n session.sign_out\n end",
"def sign_out\n @current_user = nil\n end",
"def sign_out\n reset_session\n @current_user = nil\n end",
"def sign_out\n reset_session\n end",
"def sign_out\n post \"api/logout\"\n @me = nil\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n session.delete(:user_id)\n end",
"def signout\n self.current_user = nil\n\n redirect_to root_path\n end",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n forget current_user\n session[:user_id] = nil\n end",
"def signout\n session.clear\n end",
"def sign_out\n session.delete :user_id\n @current_user = nil\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n @logout = true\n authenticate_api_user\n @logout = false\n revoke_access if @current_user\n head :no_content\n end",
"def logout\n sign_out(current_account)\n end",
"def sign_out\n arguments = { \"token\" => token }\n response = Services::Web.post user: self, service: 'User Data Service', endpoint: 'Authentication', method: 'signOut', arguments: arguments\n @token = nil if response.status == 200\n nil\n end",
"def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def sign_out\n if @current_user\n session.delete(:user_id)\n redirect_to action: \"index\"\n end\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def signoff\n delete_user\n redirect_to home_url\n end",
"def sign_out(*args)\n warden.logout(*args)\n end",
"def sign_out\n send_request('sign_out', :delete) do |req|\n req.body = { auth_token: @auth_token }\n end\n end",
"def signout\n\t\tself.current_user = false \n\t\tflash[:notice] = \"You have been logged out.\"\n\t\tredirect_to root_url\n\tend",
"def sign_out\n session[:user_id] = nil \n session.delete(:user)\n end",
"def signout\n self.oaw_signout\n redirect_to root_url\n end",
"def sign_out\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n current_user = nil\n end",
"def sign_out\n click_link 'Sign out'\n end",
"def sign_out(resource_or_scope); end",
"def sign_out(resource_or_scope); end",
"def sign_out\n @request.env[:clearance].sign_out\n end",
"def sign_out\n @username = nil\n @current_user = nil\n\n @modhash = nil\n @cookie = nil\n end",
"def destroy\n session[:user_id] = nil\n\n flash[:notice] = 'You have successfully signed out!'\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out\"\n end",
"def signout \n\t if current_user\n\t session[:identity] = nil\n\t session[:authentication_id] = nil\n\t session.delete :identity\n\t session.delete :authentication_id\n\t flash[:notice] = 'You have been signed out!'\n\t end \n\t redirect_to root_url\n\t end",
"def sign_out\n\t\tcookies.delete(:remember_token)\n\t\tcurrent_user = nil\n\tend",
"def verify_signed_out_user\n end",
"def sign_out\n cookies.delete(:remember_token)\n self.current_user = nil\n end",
"def destroy\n session[:user_id] = nil\n # alerts the user that the signout has been successful\n flash[:success] = \"You have successfully logged out!\"\n # redirects user to homepage\n redirect_to root_path\n end",
"def sign_out\n\n\t\t# Current user now is new.\n\t\tself.current_user = nil\n\n\t\t# The data cookies are deleted.\n\t\tcookies.delete(:remember_token)\n\tend",
"def destroy\n session[:user_id] = nil\n\n flash[:notice] = t(:successfully_logged_out)\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out\"\n end",
"def sign_out\n request.session.delete(:authorized)\n end",
"def destroy\n user_session.log_out\n redirect_to root_url\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:user_type)\n session.delete(:user_email)\n @current_user = nil\n end",
"def sign_out_user(user)\n visit root_path\n\n click_link 'Sign out'\n end",
"def signout\n #Made changes to show feedback form at certain intervals as per discussion & also signout auditors gracefully\n #Author: Ashish Wadekar\n #Date: 16th February 2017\n if @current_user.auditor?\n logout_user\n elsif @current_user.login_count < 6 || @current_user.login_count % 50 == 0\n redirect_to login_logout_feedback_path\n else\n logout_user\n end\n end",
"def destroy\n\tsign_out\n\tredirect_to root_path\n end",
"def destroy\n sign_out\n \n flash.now[:success] = \"User signed out.\"\n respond_with(flash)\n end",
"def destroy \r\n\t\tsign_out\r\n\t\tredirect_to root_path\r\n\tend",
"def signed_out_user\n redirect_to root_path unless !user_signed_in?\n end",
"def sign_out\n current_session.destroy if current_session\n @current_session = nil\n end",
"def destroy\n if @user && @user.reset_authentication_token\n render(success_response(message: \"User #{@user.username} successfully signed out.\"))\n else\n render(fail_response)\n end\n \n end",
"def destroy\n sign_out\n redirect_to root_path\n end",
"def destroy\n sign_out\n redirect_to root_path\n end",
"def destroy\n sign_out\n redirect_to root_path\n end",
"def destroy\n sign_out\n redirect_to root_path\n end",
"def destroy\n sign_out\n redirect_to root_path\n end",
"def log_out\n session.delete(:email)\n @current_user = nil\n end",
"def destroy\n sign_out_user\n redirect_to root_url\n end",
"def destroy\n session[:user_id] = nil\n\n redirect_to(URI(Rails.application.config.apslabs_federation_url).merge('/users/sign_out').to_s, :notice => 'You have successfully signed out!')\n end",
"def sign_out\n\tcookies.delete(:remember_token)\n\tcurrent_user = nil\n end",
"def verify_signed_out_user; end",
"def verify_signed_out_user; end",
"def verify_signed_out_user; end",
"def verify_signed_out_user\n end",
"def verify_signed_out_user\n end",
"def sign_out\n #Setting current user's remember_token to a\n #new hash that is in valid\n #The idea is to make every record in the\n #table to look identical in an attempt to\n #thwart evil\n current_user.update_attribute(:remember_token, User.hash(User.new_remember_token))\n #Deletes current user's remember_token from hash\n cookies.delete(:remember_token)\n #sets current use to empty\n self.current_user = nil\n end",
"def destroy\n logger.info \"Session :: End omniauth session request.\"\n sign_out\n redirect_to root_path, :notice => \"Signed out!\"\n end",
"def logout\n call :get, '/user/logout'\n end",
"def logout\n call('User.logout')\n end",
"def destroy\n\t\tsign_out\n\t\tredirect_to root_path\n\tend",
"def signout \n if current_user\n session[:user_id] = nil\n session[:service_id] = nil\n session.delete :user_id\n session.delete :service_id\n flash[:notice] = 'You have been signed out!'\n end \n redirect_to root_url\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end",
"def destroy\n sign_out\n redirect_to root_url\n end",
"def sign_out\n @token.destroy\n render json: { message: 'Sign-out successfully' }, status: :ok\n end",
"def signout\n orang = get_orang_from_jwt_token\n if orang\n reset_session\n render json: {\n status: 'success'\n }\n else\n render json: {\n status: 'fail'\n }\n end\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget current_user\n reset_session\n @current_user = nil\n end",
"def sign_out\n session[:user_name]=nil\n redirect_to action: 'sign_in'\n end",
"def logout\n HttpWrapper.post(\n url: \"#{::Coyodlee.base_url}/user/logout\"\n )\n end",
"def destroy\n sign_out\n redirect_to root_url\n end",
"def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def sign_out\r\n self.current_user = nil\r\n cookies.delete(:remember_token)\r\n end",
"def destroy\n sign_out\n redirect_to root_url\nend",
"def sign_out\n\t\tself.current_user = nil \n\t\tcookies.delete(:remember_token)\n\tend",
"def destroy\n user = User.find(params[:id])\n sign_out\n user.destroy \n redirect_to root_url\n end",
"def sign_out\n self.current_user = nil \n cookies.delete(:remember_token)\n end",
"def sign_out!\n self.current_account = AnonymousAccount.instance\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:danger] = 'Logoff realizado!'\n end",
"def destroy\n sign_out\n redirect_to root_url, alert: \"You have been signed out successfully.\"\n end",
"def destroy\n session[:user_id] = nil\n\n redirect_to \"#{SSOClient.provider_url}/users/sign_out?back=#{URI::encode(main_app.root_url)}\",\n notice: t(\"sso_client.messages.logged_out\")\n end",
"def destroy\n sign_out\n redirect_to root_url\n end",
"def destroy\n sign_out\n redirect_to '/'\n end",
"def logout\n if @signed_in_user\n session.delete(:signed_in_user_id)\n end\n redirect_to users_home_path\n end",
"def sign_out_user\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end"
] | [
"0.83403504",
"0.811225",
"0.800834",
"0.79289275",
"0.7926181",
"0.7911633",
"0.7906238",
"0.7902193",
"0.78967714",
"0.7841798",
"0.7834379",
"0.7832315",
"0.7823483",
"0.7814066",
"0.77722275",
"0.7761914",
"0.776026",
"0.7754297",
"0.7732997",
"0.77241147",
"0.77138615",
"0.77042663",
"0.7696327",
"0.76481247",
"0.7637434",
"0.76354617",
"0.7631663",
"0.76249135",
"0.75789803",
"0.7567077",
"0.75635254",
"0.75635254",
"0.75481296",
"0.7537056",
"0.7498703",
"0.7478313",
"0.74451077",
"0.7418403",
"0.74137264",
"0.74043965",
"0.73869765",
"0.73817664",
"0.7379683",
"0.73784596",
"0.7371533",
"0.736846",
"0.73665637",
"0.73645866",
"0.7363388",
"0.7362593",
"0.7361053",
"0.7353127",
"0.7352426",
"0.7341505",
"0.7341505",
"0.7341505",
"0.7341505",
"0.7341505",
"0.73344016",
"0.73314804",
"0.73292",
"0.73268044",
"0.73216474",
"0.73216474",
"0.73216474",
"0.732021",
"0.732021",
"0.73129433",
"0.7308873",
"0.7305923",
"0.7302094",
"0.7298821",
"0.72927886",
"0.7286174",
"0.72860605",
"0.7284759",
"0.7282258",
"0.7276726",
"0.72716147",
"0.72711444",
"0.7270387",
"0.72694737",
"0.7267885",
"0.7266165",
"0.7264274",
"0.7258188",
"0.72578365",
"0.72464395",
"0.7243863",
"0.7243178",
"0.7241567",
"0.7237207",
"0.7235959",
"0.7235002",
"0.7232728",
"0.72308993",
"0.7229954",
"0.7229568",
"0.7229568",
"0.7229568",
"0.7229568"
] | 0.0 | -1 |
Create a new participant under this account. Participants are idempotent, so relevant parameters must be set in this function if desired. | def create_participant(account_id,
body: nil)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/participants'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = config.http_client.post(
_query_url,
headers: _headers,
parameters: body.to_json
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 400
raise APIException.new(
'Bad Request',
_response
)
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_response.raw_body)
ApiResponse.new(
_response,
data: AccountsParticipantsResponse.from_hash(decoded)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_participant(safebox_guid, participant_params)\n handle_error { sendsecure_connection.post(\"api/v2/safeboxes/#{safebox_guid}/participants.json\", participant_params) }\n end",
"def create\n \n @participant = current_user.build_participant(participant_params)\n \n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n\n if @participant.save\n redirect_to participants_path\n flash[:success] = \"Participant was successfully created.\"\n else\n flash[:danger] = \"Participant was unsuccessfully created.\"\n render :new\n end\n end",
"def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end",
"def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end",
"def create\n\t\t@participant = Participant.new(participant_params)\n\n\t\tif @participant.save\n\t\t\trender json: @participant, status: :created, location: @participant\n\t\telse\n\t\t\trender json: @participant.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_url, notice: 'Participant was successfully created.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_user_and_participant\n @participant = Participant.new\n end",
"def create\n \n @participant = Participant.new(:remote_ip => params[:participant][:remote_ip],\n\t :user_id => params[:participant][:user_id], \n\t\t\t\t\t\t\t\t\t:contact_describe_id=> params[:participant][:contact_describe_id], \n\t\t\t\t\t\t\t\t\t:instructions => params[:participant][:instructions], \n\t\t\t\t\t\t\t\t\t:goodwill => params[:participant][:goodwill], \n\t\t\t\t\t\t\t\t\t:age_18_or_more => params[:participant][:age_18_or_more],\n\t\t\t\t\t\t\t\t\t:created_at => Time.current, \n\t\t\t\t\t\t\t\t\t:updated_at => Time.current,\n\t\t\t\t\t\t\t\t\t:date_deleted => Time.current) \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_path }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors }\n end\n end\n end",
"def create\n @activity_participant = Activity::Participant.new(activity_participant_params)\n @activity_participant.user = current_user\n @activity_participant.activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @activity_participant.save\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @activity_participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = @event.participants.new(participant_params)\n @participant.organization_id = @event.organization.id\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n @participant.competences = @competence\n respond_to do |format|\n if @participant.save\n TeamParticipant.create(participant: @participant, team: @team)\n format.html { redirect_to participants_url }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_participant request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_participant_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dialogflow::V2::Participant.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create\n @project_participant = ProjectParticipant.new(project_participant_params)\n\n respond_to do |format|\n if @project_participant.save\n format.html { redirect_to @project_participant, notice: 'Project participant was successfully created.' }\n format.json { render :show, status: :created, location: @project_participant }\n else\n format.html { render :new }\n format.json { render json: @project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transaction_participant = Transaction::Participant.new(params[:transaction_participant])\n\n respond_to do |format|\n if @transaction_participant.save\n format.html { redirect_to(@transaction_participant, :notice => 'Participant was successfully created.') }\n format.xml { render :xml => @transaction_participant, :status => :created, :location => @transaction_participant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.find(params[:participant][:family]) rescue nil\n params[:participant][:family] = @family\n @participants = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participants.save\n AuditTrail.audit(\"Participant #{@participants.fullname} created by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully created.'\n format.html { params[:commit] == 'Save' ? redirect_to(participants_path) : redirect_to(new_participant_path) }\n format.xml { render :xml => @participants, :status => :created, :location => @participants }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\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 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 add_participant(course_id, user)\n if CourseParticipant.find_by(parent_id: course_id, user_id: user.id).nil?\n CourseParticipant.create(parent_id: course_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end\n end",
"def create\n @participant = Participant.new(participant_params)\n\n respond_to do |format|\n if @participant.save\n # format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.html { redirect_to '/confirmation/thankyou'}\n # format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n # format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:participant] = convert_school_name_to_id params[:participant]\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @participant = Participant.new\n end",
"def new\n @participant = Participant.new\n end",
"def new\n @participant = Participant.new\n end",
"def create\n @participant = Participant.new(participant_params)\n if @participant.save\n log_in @participant\n flash[:success] = \"Welcome to the global(x) app!\"\n redirect_to @participant\n else\n render 'new'\n end\n end",
"def new\n @participant = Participant.new \n end",
"def new\n @participant = Participant.new \n end",
"def create_leader(user)\n participant = Participant.new(school_id: self.id, user_id: user.id)\n participant.role_id = 1\n participant.accepted = 2\n participant.prereq = true\n participant.save\n end",
"def ab_add_participant(experiment, alternative, identity)\n VanityParticipant.retrieve(experiment, identity, true, seen: alternative)\n end",
"def create\n @participant = Participant.new(participant_params)\n #@participant.password = Devise.friendly_token.first(8)\n respond_to do |format|\n if @participant.save\n #RegistrationMailer.welcome(user, generated_password).deliver\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_participant\n user = User.find(params[:user_id])\n\n unless user_is_initiator(current_user, @chat)\n return fail_response(['You are not an author of the conversation'], 403)\n end\n\n if user_related_to_chat(@chat, user)\n return fail_response(['User is already in chat'], 403)\n end\n\n @chat.add_participant(user)\n\n render json: { message: 'success' }, status: :ok\n end",
"def create\n @game = Game.find(params[:game_id])\n @participant = Participant.new(participant_params)\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to show_participant_path(@game, @participant) }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @annex1_project_participant = Annex1ProjectParticipant.new(params[:annex1_project_participant])\n\n respond_to do |format|\n if @annex1_project_participant.save\n format.html { redirect_to @annex1_project_participant, notice: 'Annex1 project participant was successfully created.' }\n format.json { render json: @annex1_project_participant, status: :created, location: @annex1_project_participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annex1_project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_participant(assignment_id, user)\n return if AssignmentParticipant.find_by(parent_id: assignment_id, user_id: user.id)\n\n AssignmentParticipant.create(parent_id: assignment_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end",
"def create\r\n respond_to do |format|\r\n if @participant.save\r\n format.html { redirect_to(@participant, :notice => 'Participant was successfully created.') }\r\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def add_participant_to_deal(id:, **args)\n params = parameters(args) do\n required_params :person_id\n optional_params :person_id\n end\n request(:post, \"deals/#{id}/participants\", params)\n end",
"def create\n @participant_type = ParticipantType.new(participant_type_params)\n\n respond_to do |format|\n if @participant_type.save\n format.html { redirect_to @participant_type, notice: 'Participant type was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def test_add_participant()\n\t\tparticipant = Participant.new\n assert participant.valid?\n\t\t#TODO Should an empty Participant be allowed?\n\t\t# assert !participant.valid?\n\t\t#TODO Define required fields in test and add those validations to the model so test passes.\n user = users(:student1)\n participant.user= user\n participant.assignment= assignments(:assignment1)\n\t\tassert participant.valid?\n assert \"student1\", participant.name\n assert \"student1_fullname\", participant.fullname\n assert \"assignment 1\", participant.assignment.name\n\tend",
"def ab_add_participant(_experiment, _alternative, _identity)\n raise \"Not implemented\"\n end",
"def create\n @host_project_participant = HostProjectParticipant.new(params[:host_project_participant])\n\n respond_to do |format|\n if @host_project_participant.save\n format.html { redirect_to @host_project_participant, notice: 'Host project participant was successfully created.' }\n format.json { render json: @host_project_participant, status: :created, location: @host_project_participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @host_project_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participate = Participate.new(participate_params)\n\n respond_to do |format|\n if @participate.save\n flash[:notice] = 'Participate was successfully created.'\n format.html { redirect_to(@participate) }\n format.json { render json: @participate, status: :created, location: @participate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end",
"def create\n @video_call = VideoCall.new(video_call_params)\n authorize @video_call\n @video_call.participants.build(user: current_user)\n respond_to do |format|\n if @video_call.save\n format.html { redirect_to @video_call, notice: \"Please wait here till the doctor joins.\" }\n format.json { render :show, status: :created, location: @video_call }\n else\n format.html { render :new }\n format.json { render json: @video_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_participant(user) # :nodoc:\n id = user.to_s.downcase\n if @participant_ids.include?(id)\n logger.warning(\"Attempted to add a participant who was already in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participant.\n user = if @context.users[id]\n @context.users[id]\n else\n @context.add_user(:id => id)\n end\n\n @context.add_operation(:type => Operation::WAVELET_ADD_PARTICIPANT,\n :wave_id => @wave_id, :wavelet_id => @id, :property => user)\n @participant_ids << id\n \n user\n end",
"def create\n @participant = Participant.new(participant_params)\n @participant.agent = request.user_agent\n @participant.ip = request.remote_ip\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participate!(given_event)\n participations.create!(participated_id: given_event.id)\n end",
"def create\n @participation = Participation.new(participation_params)\n @participation.user_id = current_user.id\n @participation.save\n end",
"def create\n @participant = Participant.new(participant_params)\n @participant.session_id = session[:session_id]\n @participant.ip_address = request.ip\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to directions_path }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_participant(participant)\n # Assume we are in a tournament, we'll want to look at the seeds and slot the higher seed as home\n self.logger.info(\"Adding #{participant.name} to match ##{self.id}\")\n self.logger.error(\"Cannot add participants when match has scores already\") and raise if self.home_score > 0 || self.away_score > 0\n self.logger.error(\"Cannot add participants; no free slots in match\") and raise if self.home_participant && self.away_participant\n\n current_participant = self.home_participant || self.away_participant\n current_seed = current_participant ? TeamSeason.where(participant: current_participant, season_id: self.season_id).first.division.to_i : nil\n participant_seed = TeamSeason.where(participant: participant, season_id: self.season_id).first.division.to_i\n if !current_seed || participant_seed < current_seed\n self.home_participant = participant\n self.away_participant = current_participant\n else\n self.home_participant = current_participant\n self.away_participant = participant\n end\n self.save!\n end",
"def create\n @participante = Participante.new(participante_params)\n\n respond_to do |format|\n if @participante.save\n format.html { redirect_to @participante, notice: 'Participante was successfully created.' }\n format.json { render :show, status: :created, location: @participante }\n else\n format.html { render :new }\n format.json { render json: @participante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_relationship_to_participant\n relationship_code = params[:relationship_code]\n if @participant && relationship_code\n ParticipantPersonLink.create(:participant => @participant, :person => @person,\n :relationship_code => params[:relationship_code])\n end\n end",
"def create\n logged_in_log_in_or_create_user\n @challenge_participant = @challenge.challenge_participants.build(user_id: @user.id)\n respond_to do |format|\n begin\n if @challenge_participant.save\n format.html { redirect_to :root, notice: \"You successfully joined #{@challenge.name}.\" }\n format.json { render :show, status: :created, location: @challenge_participant }\n else\n format.html { render :new }\n format.json { render json: @challenge_participant.errors, status: :unprocessable_entity }\n end\n rescue\n @challenge_participant = ChallengeParticipant.where(user_id: @user.id, challenge_id: @challenge.id).first\n format.html { redirect_to :root, notice: \"You have already joined this challenge.\" }\n format.json { render :show, status: :created, location: @challenge_participant }\n end\n end\n end",
"def create\n @meeting.add_new_participant(@participant)\n respond_to do |format|\n if @participant.save && @meeting.save\n flash[:notice] = 'Participant and meeting updates were successfully created.'\n format.html { redirect_to(meeting_path(@meeting)) }\n format.xml { render :xml => @participant, :status => :created, :location => @participant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def soft_create(rank_participant_params)\n\n @rank_participant = RankParticipant.new(rank_participant_params)\n\n @rank_participant.name = Participant.where(bib_number: rank_participant_params[:bib_number]).first.name || \"Cannot find name!\"\n\n #Check for rank participant as existent in the participants list, and make sure we don't enter a cancelled\n #rank chip number\n respond_to do |format|\n if Participant.find_by(bib_number: @rank_participant.bib_number) &&\n !(missing_numbers.include?(@rank_participant.rank)) &&\n @rank_participant.save\n\n format.html { redirect_to @rank_participant, notice: 'Rank participant was successfully created.' }\n format.json { render :show, status: :created, location: @rank_participant }\n else\n p @rank_participant.errors\n format.html { render :new }\n format.json { render json: @rank_participant.errors, status: :unprocessable_entity }\n format.js { render json: @rank_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participation = Participation.new(params[:participation])\n @participation.volunteer = current_user\n @participation.event = Event.find(params[:event_id])\n\n respond_to do |format|\n if @participation.save\n format.html { redirect_to volunteer_participation_url(current_user, @participation), notice: 'Participation was successfully created.' }\n format.json { render json: @participation, status: :created, location: @participation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return @tandem if @tandem\n\n @tandem = Tandem.create\n @tandem.participations.create(\n user: @creator,\n confirmed: true,\n language: @language_to_learn\n )\n\n TandemInviter.new(@tandem).invite(@invited)\n @tandem\n end",
"def createPlayer(params)\n \n # Create a hash\n doc = {:type => \"Person\"}\n \n # Set the name\n doc[:name] = params[\"name\"]\n \n # Set the email\n doc[:email] = params[\"email\"]\n \n # Set the username\n doc[:username] = params[\"username\"]\n \n # Set the guest flag\n doc[:guest] = params[\"guest\"] ? true : false\n \n # Set the current date\n doc[:date] = Time.now.to_i\n \n # Get a new id from the CouchDB server\n uuid = CouchDB.nextUUID @server\n doc[:_id] = uuid\n \n # Put it to the database\n response = CouchRest.put @server + \"/#{CouchDB::DB}/#{uuid}\", doc\n \n return response != false\n \n end",
"def create\n @activity_participant_assignment = ActivityParticipantAssignment.new(activity_participant_assignment_params)\n\n respond_to do |format|\n if @activity_participant_assignment.save\n format.html { redirect_to @activity_participant_assignment, notice: 'Activity participant assignment was successfully created.' }\n format.json { render :show, status: :created, location: @activity_participant_assignment }\n else\n format.html { render :new }\n format.json { render json: @activity_participant_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n tournament = Tournament.find(params[:tournament_id])\n s = Subscription.new\n s.tournament_id = tournament.id\n if tournament.is_individual?\n s.participant_id = params[:participant_id] || session[:user_id]\n \n flash[:valid] = I18n.t('subscription.ok') if s.save\n else\n if params[:membership_id]\n s.participant_id = params[:membership_id]\n\n flash[:valid] = I18n.t('subscription.ok') if s.save\n end\n end\n redirect_to :back\n end",
"def create\n @video_participant = VideoParticipant.new(params[:video_participant])\n\n respond_to do |format|\n if @video_participant.save\n format.html { \n\t\t\tredirect_to(\n\t\t\t\t@video_participant.video, \n\t\t\t\t:notice => \"#{@video_participant.bboy.bboyName} was tagged in #{@video_participant.video.title}.\"\n\t\t\t)\n\t\t}\n format.xml { render :xml => @video_participant, :status => :created, :location => @video_participant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video_participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:participant][:accepted] == \"1\" and params[:participant][:prereq] == \"1\"\n unless current_user.participants.exists?(:school_id => params[:school_id])\n @participant = @school.participants.new(params[:participant])\n @participant.user_id = current_user.id\n @participant.accepted = 0\n @participant.save\n end\n end\n \n respond_to do |format|\n if @participant\n Notifier.participant_user(@participant,@school).deliver\n Notifier.participant_admins(@participant,@school).deliver\n format.js { render \"register_success\" }\n else\n format.js { render \"register_failure\" }\n end\n end\n end",
"def create\n @partner = Partner.new(partner_params)\n @partner.user.skip_confirmation_notification!\n\n respond_to do |format|\n if @partner.save!\n format.html { redirect_to [:admin, @partner], notice: 'Partner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @partner }\n else\n format.html { render action: 'new' }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participante = Participante.new(params[:participante])\n\n respond_to do |format|\n if @participante.save\n format.html { redirect_to(@participante, :notice => 'Participante was successfully created.') }\n format.xml { render :xml => @participante, :status => :created, :location => @participante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def participant_params\n params.require(:participant).permit(:firstname, :familyname, :kyc_approved, :agreement, :privacy_agr, :eth_adress, :cont_amount, :eth_tx, :user_id)\n end",
"def set_participant\n @participant = Participant.find_by_id(params[:id])\n end",
"def participant\n ScriptoriaCore::Ruote.engine.participant(participant_name)\n end",
"def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end",
"def new_participant(user, testmail=nil)\n @user = user\n @study = user.study\n email_with_name = testmail || \"#{@user.name} <#{user.email}>\"\n mail(:to => email_with_name, :subject => I18n.t('users.participant.new.mail.subject', :study => @study.title))\n end",
"def create\n # Check the requester's permissions\n return forbidden unless current_account.admin?(current_organization) or\n (current_account.real?(current_organization) and params[:role] == Account::REVIEWER)\n\n # Find or create the appropriate account\n account_attributes = pick(params, :first_name, :last_name, :email, :language, :document_language).merge({\n language: current_organization.language,\n document_language: current_organization.document_language\n })\n account = Account.lookup(account_attributes[:email]) || Account.create(account_attributes)\n return json(account) unless account.valid?\n\n # Find role for account in organization if it exists.\n membership_attributes = pick(params, :role, :concealed)\n return bad_request(error: 'Role is required') unless Account::ROLES.include? membership_attributes[:role]\n\n membership = current_organization.role_of(account)\n # Create a membership if account has no existing role\n if membership.nil?\n membership_attributes[:default] = true unless account.memberships.exists?\n membership = current_organization.memberships.create(membership_attributes.merge(account_id: account.id))\n elsif membership.role == Account::REVIEWER # or if account is a reviewer in this organization\n account.upgrade_reviewer_to_real(current_organization, membership_attributes[:role])\n elsif membership.role == Account::DISABLED\n return bad_request(error: 'That email address belongs to an inactive account.')\n else\n return conflict(error: 'That email address is already part of this organization.')\n end\n\n if account.pending?\n account.send_login_instructions(current_organization, current_account)\n else\n LifecycleMailer.membership_notification(account, current_organization, current_account).deliver_now\n end\n json account.canonical(membership: membership)\n end",
"def attend\n user_id = current_user.id\n training_id = params[:id]\n TrainingRecord.create_new_record user_id, training_id\n redirect_to @training, notice: \"You have successfully registered for #{@training.title}\"\n end",
"def participant_params\n params.require(:participant).permit(:first_name, :last_name, :instructor, :email)\n end",
"def create\n @participant_quote = ParticipantQuote.new(params[:participant_quote])\n @participant_quote.user_id = current_user.id\n\n respond_to do |format|\n if @participant_quote.save\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully created.' }\n format.json { render json: @participant_quote, status: :created, location: @participant_quote }\n else\n format.html { render :new }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:event_id, :name, :title, :telephone_number, :email, :organization_name, :organization_type_id, :directorate_id, :responsibility, :place_of_work, :group_id, :field_visit_id, :stay_at, :participant_type_id, :checked_in)\n end",
"def create\n @movie_participant = MovieParticipant.new(movie_participant_params)\n\n respond_to do |format|\n if @movie_participant.save\n format.html { redirect_to @movie_participant, notice: 'Movie participant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @movie_participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @movie_participant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @participation = Participation.new(participation_params)\n @member = @participation.member_id\n @course = @participation.course_id\n respond_to do |format|\n if @participation.save\n #subscribe\n format.html { redirect_to edit_member_path(@member), notice: 'Deltaker ble opprettett.' }\n format.json { render :show, status: :created, location: @participation }\n else\n format.html { render :new }\n format.json { render json: @participation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def participant_params\n params.require(:participant).permit(:code, :first_name, :second_name, :third_name, :fourth_name, :gender_id, :birthdate, :email, :participant_type_id, :address, :website, :legal_representative, :phone, :mobile_phone, :param_matrix_id, :score, :created_by_id, :is_pep)\n end",
"def create\n if params[:commit] == \"Force Submit\"\n @rank_participant = RankParticipant.new(rank_participant_params)\n @rank_participant.name = \"HARD CREATED!\" if @rank_participant.name.blank?\n respond_to do |format|\n if @rank_participant.save\n format.html { redirect_to @rank_participant, notice: 'Rank participant was successfully created.' }\n format.json { render :show, status: :created, location: @rank_participant }\n else\n format.html { render :new }\n format.json { render json: @rank_participant.errors, status: :unprocessable_entity }\n format.js { render json: @rank_participant.errors, status: :unprocessable_entity }\n end\n end\n else\n self.soft_create(rank_participant_params)\n end\n\n end",
"def create_participation\n @participation = Participation.find(params[:participation_id])\n @signature_code = params[:signature_code]\n if PatientEncounter.add_participation(@participation, @signature_code)\n redirect_to_root_url\n else\n redirect_to @participation\n end\n end",
"def register_participant account_id, side\n\t\tif self.full?\n\t\t\traise \"Debate already full\"\n\t\telsif side == \"left\" or side == \"left_side\"\n\t\t\tproper_side = \"left_side\"\n\t\t\tif self.get_left_debater != nil\n\t\t\t\traise \"Side already taken\"\n\t\t elsif (self.get_debaters.count ==1 && self.get_right_debater.id == account_id)\n\t\t\t raise \"Account already registered\"\n\t\t\tend \n\t\telsif side == \"right\" or side == \"right_side\"\n\t\t\tproper_side = \"right_side\"\n\t\t\tif self.get_right_debater != nil\n\t\t\t\traise \"Side already taken\"\n\t\t\telsif (self.get_debaters.count ==1 && self.get_left_debater.id == account_id)\n\t\t\t\traise \"Account already registered\"\n\t\t\tend \n\t\t\t\n\t\tend\n\t\t\n\t\tdebate_participation = DebateParticipation.new\n\t\tdebate_participation.account_id = account_id\n\t\tdebate_participation.debate_id = self.id\n\t\tdebate_participation.side = proper_side\n\t\tdebate_participation.role = \"debater\"\n\t\tif debate_participation.save\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\t\t\n\tend",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def create\n @partner = Partner.new(params[:partner])\n @partner.build_user(params[:user])\n\n is_ok = true\n begin\n Partner.transaction do\n @partner.save!\n @partner.user.save!\n end\n rescue ActiveRecord::RecordInvalid => e\n logger.error e\n is_ok = false\n end\n\n if is_ok\n flash[:notice] = 'Partner was successfully created.'\n redirect_to partner_url(@partner) \n else\n render :action => \"new\" \n end\n end"
] | [
"0.8053179",
"0.76407427",
"0.7483264",
"0.74713874",
"0.74713874",
"0.74632746",
"0.7445831",
"0.7445831",
"0.7269123",
"0.7234513",
"0.71342874",
"0.71215737",
"0.7111744",
"0.698187",
"0.69366145",
"0.68862873",
"0.6873858",
"0.68725973",
"0.6863236",
"0.6842878",
"0.681197",
"0.6804703",
"0.6791839",
"0.6712766",
"0.6670779",
"0.6670779",
"0.6670779",
"0.65901726",
"0.65422237",
"0.65422237",
"0.65304977",
"0.6525745",
"0.6511924",
"0.646943",
"0.64506906",
"0.64415103",
"0.6426761",
"0.6423652",
"0.6423582",
"0.6415058",
"0.63524246",
"0.6335505",
"0.6328063",
"0.63205314",
"0.6269714",
"0.62553006",
"0.62517655",
"0.6225889",
"0.6206713",
"0.6205696",
"0.61797106",
"0.6168076",
"0.6157401",
"0.61498374",
"0.61297214",
"0.61257714",
"0.61075157",
"0.60980284",
"0.6089308",
"0.6068296",
"0.6057965",
"0.60523003",
"0.60483587",
"0.6045936",
"0.60406506",
"0.6006046",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5984196",
"0.5974987",
"0.5959803",
"0.59527767",
"0.5947661",
"0.5946454",
"0.59268403",
"0.59215057",
"0.59183925",
"0.5911193",
"0.5897418",
"0.58936256",
"0.58913356",
"0.588984",
"0.5880449",
"0.58772755",
"0.58709705",
"0.58705306",
"0.58705306",
"0.58643216"
] | 0.70873135 | 13 |
Get participant by ID. | def get_participant(account_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/participants/{participantId}'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'participantId' => { 'value' => participant_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json'
}
# Prepare and execute HttpRequest.
_request = config.http_client.get(
_query_url,
headers: _headers
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_response.raw_body)
ApiResponse.new(
_response, data: Participant.from_hash(decoded)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_participants(id, params = {})\n get \"/api/v2/projects/#{id}/participants\", params\n end",
"def show\n @participant = Participant.find(params[:id])\n end",
"def participant_id\n return @participant_id\n end",
"def participant_id\n return @participant_id\n end",
"def player_by_id id\n @players.select {|p| p.id == id}.first\n end",
"def get_member(_user_id)\n user_participants.where(id: _user_id).take\n end",
"def set_participant\n @participant = Participant.find_by_id(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def get_player(id)\n\t\treturn @players[id]\n\tend",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def get_conversation_participants(id)\n @client.raw('get', \"/content/conversations/#{id}/participants\")\n end",
"def set_participant\n @participant = Participant.find_by_login(params[:id])\n end",
"def current_project_participant(project_id)\n # if self.has_accepted?(project_id)\n Participant.where(project_id: project_id, user_id: self.id).first\n # end\n end",
"def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end",
"def participant\n ScriptoriaCore::Ruote.engine.participant(participant_name)\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def find_by_id(id)\n find(id)\n end",
"def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end",
"def get_conversation_participants(id)\r\n #TODO: Test if this method needs data in options.\r\n @client.raw('get', \"/content/conversations/#{id}/participants\", nil, nil, @contact_v1_url)\r\n end",
"def find(id)\n self.detect{|x| x.id == id.to_i}\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_group_peers.get(\n id,\n deadline: deadline,\n )\n end",
"def get_by_id(id)\n raise(ArgumentError, \"Argument 'id' must be a Fixnum\") unless id.is_a?(Fixnum)\n @data.find{ |entry| entry[:id] == id }\n end",
"def my_participant_id\n return @my_participant_id\n end",
"def find(id)\n where({'id' => \"#{id}\"}).first\n end",
"def participant_id=(value)\n @participant_id = value\n end",
"def participant_id=(value)\n @participant_id = value\n end",
"def find_member_by_id(id)\n @board.members.find { |m| m.id == id }\n end",
"def get_user(id)\n @users[id]\n end",
"def find_participant_id(station_id:, css_id:)\n response = request(:find_ptcpnt_id, \"stationNumber\": station_id, \"userId\": css_id)\n response.body[:find_ptcpnt_id_response][:return]\n end",
"def find(id)\n find_by_index(id: id)\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_groups.get(\n id,\n deadline: deadline,\n )\n end",
"def get(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n account = @accounts.select{|a| a.id == id}\n account = account.nil? || account.empty? ? nil : account[0]\n return account\n end",
"def participants_on_issue(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}/participants\")\n end",
"def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def find_by_id(id)\n court_slots[id]\n end",
"def player_by_id(id)\n response = Faraday.get(\"#{URL}/#{id}\")\n data = JSON.parse(response.body)\n new(data[KEY][0]) if data[KEY]\n end",
"def get(conference_sid, call_sid)\n Conference.participant(conference_sid, call_sid)\n end",
"def get_patient(id)\n if has_role?(:enroller)\n enrolled_patients.find_by_id(id)\n elsif has_role?(:public_health)\n viewable_patients.find_by_id(id)\n elsif has_role?(:public_health_enroller)\n viewable_patients.find_by_id(id)\n elsif has_role?(:admin)\n nil\n end\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def get(id=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('partner', 'get', 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 get_assessments(id, params = {})\n get \"/api/v1/projects/#{id}/participants\", params\n end",
"def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end",
"def get(\n id,\n deadline: nil\n )\n return @remote_identities.get(\n id,\n deadline: deadline,\n )\n end",
"def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self.class.name}#find with ID #{id.inspect} was not found\"\n end\n }\n end",
"def find(id:)\n request.get(\"#{teamsites_url}/#{id}\")\n end",
"def get_participant_event(event)\n unless event.nil?\n return participant_event_class.find_by_event_id_and_schedule_id(event.id, self.id)\n end\n end",
"def find(id)\n end",
"def find_passenger(id)\n return find_by_id(@passengers, id)\n end",
"def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end",
"def get(\n id,\n deadline: nil\n )\n return @peering_group_resources.get(\n id,\n deadline: deadline,\n )\n end",
"def participant\n market.participants[env['REMOTE_USER'].to_i]\n end",
"def user(id)\n self.users[id] ||= User.supervise id, workflow_name: name\n user = self.users[id].actors.first\n user.load_data\n user\n end",
"def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def find id\n model.find id\n end",
"def find_by_id(id)\n @court_slots.find_by_id(id)\n end",
"def retrieve(id)\n sender = Client.get(\"#{path}/#{id}\")\n initialize_from_hash(sender['user'])\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def find(id)\n id = id.to_i\n contacts = Contact.all\n contact = nil\n contact = contacts[id-1] unless contacts[id-1].nil?\n end",
"def findById(peerId)\n @peersById[peerId]\n end",
"def show\n @participant = Participant.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end",
"def set_project_participant\n @project_participant = ProjectParticipant.find(params[:id])\n end",
"def id(id)\n #::Hero.find_by_id(id)\n ::Hero.where(id: id)\n end",
"def locate(id)\n return self if are_you(id)\n \n i = @inv.fetch(id)\n return i if !i.nil?\n \n return nil\n end",
"def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end",
"def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end",
"def find(id)\n @data[id]\n end",
"def find(id, optional = {})\n find_all([id], optional).first\n end",
"def find_by_id(id)\n videos.where(id: id).as(Video).one\n end",
"def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end",
"def retrieve(id)\n @client.make_request(:get, \"parcels/#{id}\", MODEL_CLASS)\n end",
"def get(id)\n Conversation.from_id(@client, id)\n end",
"def find(id)\n @collection[id.to_s]\n end",
"def get_patient(id)\n current_resource_owner.viewable_patients.find_by(id: id)\n end",
"def instance_by_id(id)\n instances.detect { |x| x.id == id } # ID should always be unique\n end",
"def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end",
"def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end",
"def participant\n self_link.try(:participant)\n end",
"def find_user_by_id(id)\n User.find(id)\n end"
] | [
"0.6766038",
"0.6747537",
"0.67231965",
"0.67231965",
"0.6620221",
"0.66014564",
"0.65296113",
"0.6413168",
"0.6413168",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.64080566",
"0.63784367",
"0.63683546",
"0.63683546",
"0.634744",
"0.6329165",
"0.6305108",
"0.6304412",
"0.6241069",
"0.6215951",
"0.6156115",
"0.61516863",
"0.61495274",
"0.61480004",
"0.6125891",
"0.6121592",
"0.6119785",
"0.6095675",
"0.60927373",
"0.60927373",
"0.6058833",
"0.604871",
"0.596597",
"0.59460723",
"0.59035397",
"0.59027547",
"0.58891845",
"0.58826107",
"0.58782345",
"0.5859038",
"0.5850753",
"0.58478725",
"0.5845725",
"0.5845673",
"0.58430165",
"0.58425707",
"0.5840855",
"0.5815662",
"0.5814342",
"0.5800749",
"0.57832265",
"0.57825315",
"0.575814",
"0.5753058",
"0.575016",
"0.5744687",
"0.57444596",
"0.5744405",
"0.5742917",
"0.5740773",
"0.5721122",
"0.5720168",
"0.5710952",
"0.5710952",
"0.5710952",
"0.5710952",
"0.5706265",
"0.5704844",
"0.56996655",
"0.5693609",
"0.5691032",
"0.5673097",
"0.56694824",
"0.56549615",
"0.5646416",
"0.5645358",
"0.5639185",
"0.5637827",
"0.56337976",
"0.56165045",
"0.5613499",
"0.56045103",
"0.5600863",
"0.5597372",
"0.5588189",
"0.55846614",
"0.5584341"
] | 0.6646042 | 4 |
Delete participant by ID. | def delete_participant(account_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/participants/{participantId}'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'participantId' => { 'value' => participant_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare and execute HttpRequest.
_request = config.http_client.delete(
_query_url
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
ApiResponse.new(_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n\t\tif @participant.ganador_flag\n\t\t\t@ganador = Ganador.find_by_id_participante(@participant.id)\n\t\t\t@ganador.destroy\n\t\tend\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participants = Participant.find(params[:id])\n success = @participants.destroy\n\n if success and @participants.errors.empty?\n AuditTrail.audit(\"Participant #{@participants.fullname} destroyed by #{current_user.login}\")\n flash[:success] = \"Participant #{@participants.fullname} destroyed\"\n else\n flash[:error] = @participants.errors.full_messages\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@participant.destroy\n\n\t\thead :no_content\n\tend",
"def destroy\n @participant.destroy\n flash[:success] = 'Participant was successfully destroyed.'\n redirect_to participants_url\n end",
"def delete\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n participants = meeting.participants\n meeting.participants.delete(participants)\n meeting.delete\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def destroy\n @participant.destroy\n flash[:notice] = 'Participant was successfully removed.'\n respond_to do |format|\n format.html { redirect_to(meeting_participants_path(@meeting)) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n self.find(id).delete_\n end",
"def delete(id)\n call(:delete, path(id))\n end",
"def destroy\n @participante = Participante.find(params[:id])\n @participante.destroy\n\n respond_to do |format|\n format.html { redirect_to(participantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participante = Participante.find(params[:id])\n @participante.destroy\n\n respond_to do |format|\n format.html { redirect_to(participantes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_deal_participants(id:, deal_participant_id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"deals/#{id}/participants/#{deal_participant_id}\", params)\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Participant was successfully destroyed.' }\n end\n end",
"def destroy\n email = @participant.email\n @participant.rankings\n @participant.destroy\n flash[:success] = \"Successfully deleted participant #{email}.\"\n redirect_to display_project_participants_path(@participant.project_id)\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: '' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @annex1_project_participant = Annex1ProjectParticipant.find(params[:id])\n @annex1_project_participant.destroy\n\n respond_to do |format|\n format.html { redirect_to annex1_project_participants_url }\n format.json { head :no_content }\n end\n end",
"def leave_participant(resource_id)\n http.delete(participants_endpoint(resource_id)) do |response|\n true\n end\n end",
"def really_delete\n RankParticipant.only_deleted.find(params[:id]).really_destroy!\n\n respond_to do |format|\n format.html { redirect_to rank_participants_url, notice: 'RankParticipant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n if meeting.participants.exists?(participant_id)\n # remove all the participant's votes from each suggestion\n meeting.suggestions.each do |suggestion|\n vote = Vote.where(:voter_id => participant_id, :suggestion_id => suggestion.id)\n if vote != nil\n suggestion.votes.delete(vote)\n end\n end\n meeting.participants.delete(User.find(participant_id))\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to admin_participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # The call uses a begin/rescue block so any errors can be handled properly\n begin\n Account.filter(:id => id).destroy\n flash[:success] = 'The specified Account has been removed'\n rescue => e\n Ramaze::Log.error(e.message)\n flash[:error] = 'The specified Account could not be removed'\n end\n Action.add_record(@account.id, session[:email], 'deleted', 'account', @account.name)\n redirect(Accounts.r(:index))\n end",
"def destroy\n @participant.destroy\n respond_with(@participant)\n end",
"def destroy\n @participant.destroy\n respond_with(@participant)\n end",
"def destroy\n @transaction_participant = Transaction::Participant.find(params[:id])\n @transaction_participant.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_participants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to event_participants_url(@event), notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.admin?\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: \"Participant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end \n end",
"def delete(id)\n collection.remove(id)\n end",
"def destroy(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :delete)\n end",
"def destroy\n @trainee = Trainee.find(params[:id])\n @trainee.destroy\n respond_to do |format|\n format.html { redirect_to training_calendar_trainees_path(params[:training_calendar_id]), :notice => 'The participant was successfully removed.' }\n format.json { head :ok }\n end\n end",
"def delete(id)\n collection.remove({ _id: id })\n end",
"def destroy\r\n @participant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(participants_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @activity_participant.destroy\n respond_to do |format|\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n assert_exists(id)\n\n persister.delete(id)\n end",
"def destroy\n\t@video_participant = VideoParticipant.find(params[:id])\n\t@video = @video_participant.video\n if @video_participant.destroy\n\t\trespond_to do |format|\n\t\t format.html { redirect_to video_path(@video) }\n\t\t format.xml { head :ok }\n\t\tend\n\telse\n\t\tredirect_to video_path(@video)\n\tend\n end",
"def destroy\n @challenge_participant.destroy\n respond_to do |format|\n format.html { redirect_to action: \"index\", id: @challenge.token, notice: 'Challenge participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # The call uses a begin/rescue block so any errors can be handled properly\n begin\n Contact.filter(:id => id).destroy\n flash[:success] = 'The specified Contact has been removed'\n rescue => e\n Ramaze::Log.error(e.message)\n flash[:error] = 'The specified Contact could not be removed'\n end\n Action.add_record(@contact.id, session[:email], 'deleted', 'contact', @contact.last_name)\n redirect(Contacts.r(:index))\n end",
"def delete(id)\n path(id).delete\n clean(id) if clean?\n end",
"def delete(id)\n begin\n User.filter(:id => id).destroy\n flash[:success] = 'The specified user has been removed'\n rescue => e\n Ramaze::Log.error(e)\n flash[:error] = 'The specified user could not be removed'\n end\n\n redirect_referrer\n end",
"def destroy\n @project_participant.destroy\n respond_to do |format|\n format.html { redirect_to project_participants_url, notice: 'Project participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @participant.destroy\n # respond_to do |format|\n # format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n Partextra.where(participant_id: @participant.id).destroy_all\n Badge.where(participant_id: @participant.id).destroy_all\n end",
"def delete(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n\n # remove the account\n @accounts.delete_if{|a| a.id == id}\n end",
"def delete(params)\n _params = params.clone\n id = _params.delete(:id)\n return unless id\n send_request({method: :delete, subject: subject, id: id}.merge(_params))\n end",
"def delete(params)\n _params = params.clone\n id = _params.delete(:id)\n return unless id\n send_request({method: :delete, subject: subject, id: id}.merge(_params))\n end",
"def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end",
"def destroy\n @participante.destroy\n respond_to do |format|\n format.html { redirect_to participantes_url, notice: 'Participante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_patient_by_id(patient_id)\n patient = Patient.find(patient_id)\n patient.destroy\nend",
"def delete(id)\n lock.synchronize do\n @deleted_ids << id.to_s\n end\n end",
"def delete_team_with(id)\n visit teams_path\n click_button 'Delete'\n click_button 'OK'\n end",
"def remove_participant_from_session(account_id,\r\n session_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def delete(id)\n read_or_die(id)\n\n sql, vals = sql_delete(id_fld => id)\n execute sql_subst(sql, *vals.map{|v| quote v})\n\n self\n\n rescue => e\n handle_error(e)\n end",
"def destroy\n @partnership = Partnership.find(params[:id])\n @partnership.destroy\n head :no_content\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @participant.studysite.destroy_all\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = @school.participants.find(params[:id])\n @participant.remove_school_teams(current_user.id, @school)\n @participant.destroy\n\n respond_to do |format|\n Notifier.participant_deleted(@participant,@school).deliver\n format.html { redirect_to admin_tools_personnel_url }\n end\n end",
"def destroy\n @host_project_participant = HostProjectParticipant.find(params[:id])\n @host_project_participant.destroy\n\n respond_to do |format|\n format.html { redirect_to host_project_participants_url }\n format.json { head :no_content }\n end\n end",
"def deleteAttendee(name)\n RSVP.delete(@id,name)\n end",
"def destroy\n @auditor_participation = @site.auditor_participations.find(params[:id])\n @auditor_participation.destroy\n \n respond_to do |format|\n format.html { redirect_to @site, notice: 'AuditorParticipation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n resource = RESOURCE % { account_id: account.id, id: id }\n response = Request.new(account.client, :delete, resource).perform\n from_response(response.body[:data])\n end",
"def destroy\n @corporacion_policiaca = CorporacionPoliciaca.find(params[:id])\n if @corporacion_policiaca.participantes.empty?\n @corporacion_policiaca.destroy\n flash[:notice] = \"Registro eliminado correctamente\"\n else\n flash[:error] = \"Registro no se pudo eliminar\"\n end\n\n respond_to do |format|\n format.html { redirect_to(corporacion_policiacas_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n polls = read_polls_data\n polls.delete(id)\n save_polls_data(polls)\n end",
"def destroy\n @sport_entry = SportEntry.find(params[:sport_entry_id])\n @participant = Participant.find(params[:id])\n \n @sport_entry.participants.destroy(@participant)\n \n if @sport_entry.captaincy == @participant\n @sport_entry.captaincy = nil\n @sport_entry.save\n end\n flash[:notice] = \"Participant removed from sport entry\"\n \n respond_to do |format|\n format.html do \n if params[:return] && params[:return] == 'edit_sports'\n redirect_to(edit_sports_gc_participant_path(@participant)) \n else\n redirect_to(edit_gc_sport_entry_url(@sport_entry)) \n end\n end\n end\n end",
"def delete_conversation(id)\n delete(\"conversations/#{id}\")\n end",
"def delete(id)\n results = connection.exec_params('DELETE FROM contacts WHERE id=$1;', [id]) \n end",
"def delete(project_id, id)\n @_client.delete(\"#{resource_root(project_id)}/#{id}\")\n end",
"def delete(id)\n file = get_file(id)\n delete_file(file) unless file.nil?\n end",
"def delete!\n resource = self.class::RESOURCE % { account_id: account.id, id: id }\n response = Request.new(account.client, :delete, resource).perform\n from_response(response.body[:data])\n end",
"def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end",
"def delete(id)\n Net::SFTP.start(@host, @user, @password) do |sftp|\n sftp.remove!(url(id))\n end\n end",
"def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end",
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def delete\n id = params[:format]\n @choice = Choice.where(\"id = #{id}\").first\n if @choice.destroy\n logger.debug \"choice successfully destroyed\"\n else\n logger.debug \"Choice NOT successfully destroyed\"\n end\n redirect_to home_index_url\n end",
"def delete(id)\n record = find(id)\n return unless record\n\n delete_from_file(@file, record)\n @records = read_file(@file)\n end",
"def delete id=nil\n id ||= self.id\n @nimble.delete \"contact/#{id}\"\n end",
"def delete(id)\n @conn.execute(*@builder.delete(id))\n end",
"def delete(id)\n @service.delete(id)\n end",
"def destroy\n begin\n @participant_to_delete = Participant.find(params[:id])\n @family_to_delete = @participant_to_delete.family if @participant_to_delete.only_member_of_associated_family?\n\n # TODO look into whether this can be done in a validation, given that we only delete family if participant is only member.\n Participant.transaction do\n errors = []\n participant_deleted = @participant_to_delete.destroy\n family_deleted = nil\n if participant_deleted\n AuditTrail.audit(\"Participant #{@participant_to_delete.fullname} removed by #{current_user.login}\")\n flash[:notice] = \"Participant #{@participant_to_delete.fullname} deleted\"\n if @family_to_delete\n family_name = @family_to_delete.familyname\n family_deleted = @family_to_delete.destroy\n if family_deleted\n AuditTrail.audit(\n \"Family #{family_name} removed by #{current_user.login} while deleting last family member #{@participant_to_delete.fullname}\")\n flash[:success] << \", and family #{family_name} also deleted\"\n else\n errors << @family_to_delete.errors.full_messages if @family_to_delete.errors\n end\n end\n else\n errors << @participant_to_delete.errors.full_messages if @participant_to_delete.errors\n end\n if not errors.blank?\n flash[:error] = errors\n logger.error errors.join(\"\\n\\t\")\n end\n end\n rescue Exception => e\n flash[:error] = \"Error deleting #{@participant_to_delete.fullname}: #{e.to_s}\"\n logger.error \"Error deleting #{@participant_to_delete.fullname}\"\n logger.error e.backtrace.join(\"\\n\\t\")\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @patient = Patient.find(params[:id])\n end",
"def delete_id(id)\n redis.srem(key, id)\n end",
"def delete(id)\n _params = {:id => id}\n return @master.call 'subaccounts/delete', _params\n end",
"def destroy\n begin\n @participant_to_delete = Participant.find(params[:id])\n @family_to_delete = @participant_to_delete.family if @participant_to_delete.only_member_of_associated_family?\n\n # TODO look into whether this can be done in a validation, given that we only delete family if participant is only member.\n Participant.transaction do\n errors = []\n participant_deleted = @participant_to_delete.destroy\n family_deleted = nil\n if participant_deleted\n AuditTrail.audit(\"Participant #{@participant_to_delete.fullname} removed by #{current_user.login}\")\n flash[:notice] = \"Participant #{@participant_to_delete.fullname} deleted\"\n if @family_to_delete\n family_name = @family_to_delete.familyname\n family_deleted = @family_to_delete.destroy\n if family_deleted\n AuditTrail.audit(\n \"Family #{family_name} removed by #{current_user.login} while deleting last family member #{@participant_to_delete.fullname}\")\n flash[:success] = \", and family #{family_name} also deleted\"\n else\n errors << @family_to_delete.errors.full_messages if @family_to_delete.errors\n end\n end\n else\n errors << @participant_to_delete.errors.full_messages if @participant_to_delete.errors\n end\n if not errors.blank?\n flash[:error] = errors\n logger.error errors.join(\"\\n\\t\")\n end\n end\n rescue Exception => e\n flash[:error] = \"Error deleting #{@participant_to_delete.fullname}: #{e.to_s}\"\n logger.error \"Error deleting #{@participant_to_delete.fullname}\"\n logger.error e.backtrace.join(\"\\n\\t\")\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end",
"def delete!(id:)\n client.delete_list(id: id)\n end",
"def delete_user(id)\n # accept an id input parameter\n # use the User Model class to remove the User associated with the `id` primary key from the database\n # (no return is required)\n (User.find_by(id: id)).destroy\n end",
"def delete(id)\n post('deleteSubAccount', userId: id)\n end",
"def destroy\n\t\t@person = Person.find_by(id: params[:id])\n\t\t@person.destroy\n\t\tredirect_to persons_url\n\tend",
"def destroy\n @movie_participant.destroy\n respond_to do |format|\n format.html { redirect_to movie_participants_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n FileUtils.rm_r File.join(DOTDIR, id)\n end",
"def destroy\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\tperson.destroy\n\t\t\trender body: 'Person Destroyed', status: 204\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend",
"def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.72154033",
"0.7198045",
"0.7198045",
"0.71091694",
"0.7099698",
"0.70190936",
"0.70072484",
"0.69691104",
"0.6938913",
"0.69336134",
"0.6904828",
"0.6866794",
"0.6866794",
"0.68004376",
"0.6768609",
"0.67427915",
"0.6705309",
"0.66963917",
"0.66963917",
"0.66963917",
"0.66882527",
"0.66852605",
"0.66852605",
"0.66763854",
"0.66480416",
"0.66401255",
"0.6639555",
"0.66322285",
"0.66308177",
"0.66029286",
"0.6587032",
"0.6587032",
"0.65861684",
"0.6578013",
"0.65707034",
"0.6568711",
"0.6552217",
"0.65388554",
"0.65374494",
"0.6524386",
"0.6517613",
"0.64919823",
"0.64710677",
"0.64145595",
"0.6403042",
"0.63976747",
"0.6387989",
"0.6384354",
"0.6368641",
"0.63549376",
"0.6350147",
"0.63433105",
"0.63433105",
"0.63428",
"0.63306266",
"0.6316875",
"0.6312593",
"0.6306762",
"0.63059276",
"0.6295629",
"0.6294328",
"0.6291519",
"0.62872475",
"0.62742674",
"0.62706614",
"0.62673384",
"0.6258843",
"0.6257946",
"0.6242897",
"0.623594",
"0.6221756",
"0.62185025",
"0.620422",
"0.6196212",
"0.61949384",
"0.61939335",
"0.61900896",
"0.61853343",
"0.61782306",
"0.6172132",
"0.6172055",
"0.616725",
"0.6159869",
"0.6148178",
"0.6136518",
"0.6124825",
"0.61102927",
"0.610907",
"0.61090225",
"0.6107618",
"0.6102826",
"0.609462",
"0.6091134",
"0.6088291",
"0.6084359",
"0.6067719",
"0.6066278",
"0.6064495",
"0.60595196",
"0.6051137"
] | 0.74030274 | 0 |
Create a new session. Sessions are idempotent, so relevant parameters must be set in this function if desired. | def create_session(account_id,
body: nil)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = config.http_client.post(
_query_url,
headers: _headers,
parameters: body.to_json
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 400
raise APIException.new(
'Bad Request',
_response
)
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_response.raw_body)
ApiResponse.new(
_response, data: Session.from_hash(decoded)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_session\n @connection.create_session(@config || {})\n end",
"def create!(*args)\n session = new(*args)\n session.save!\n session\n end",
"def create!(*args)\n session = new(*args)\n session.save!\n end",
"def create!(*args)\n session = new(*args)\n session.save!\n end",
"def create_session\n raise NotImplementedError\n end",
"def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end",
"def create_session(session_id, data)\n session_id = escape(session_id)\n new_session = new(session_id, data)\n new_session\n end",
"def create_session(config)\n options = (config[:options] || {}).dup\n session = Moped::Session.new(config[:hosts], options)\n session.use(config[:database])\n if authenticated?(config)\n session.login(config[:username], config[:password])\n end\n session\n end",
"def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end",
"def create(*args, &block)\n session = new(*args)\n session.save(&block)\n end",
"def new\n @session = Session.new('')\n end",
"def create_session(params={})\n raise \"HornetQ::Client::Connection Already Closed\" unless @connection\n params ||= {}\n session = @connection.create_session(\n params[:username],\n params[:password],\n params[:xa] || false,\n params[:auto_commit_sends].nil? ? true : params[:auto_commit_sends],\n params[:auto_commit_acks].nil? ? true : params[:auto_commit_acks],\n params[:pre_acknowledge] || false,\n params[:ack_batch_size] || 1)\n (@sessions << session) if params.fetch(:managed, false)\n session\n end",
"def new\n @session = Session.new\n end",
"def create_session(body, opts = {})\n data, _status_code, _headers = create_session_with_http_info(body, opts)\n data\n end",
"def new_session(options)\n options[:source_profile] = options[:source_profile].to_sym\n options[:profile] = options[:profile].to_sym\n\n user_prof = user_profile(options[:source_profile], options[:config_file])\n options = user_prof.to_h.deep_merge(options).deep_symbolize_keys\n\n sb = SessionBuilder.new(\n mfa_device: mfa_device(options),\n session_duration_seconds: options[:duration],\n source_profile: user_prof\n )\n set_user_session_profile(options[:profile], sb.session_profile)\n end",
"def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end",
"def new\n @session = Session.new\n end",
"def create_session(params)\n driver.createSession(\n self.account_data,\n self.transaction_data(params),\n params[:transaction_type],\n params[:payment_type],\n params[:options] || {},\n { 'redirectUrl' => params[:success_url], 'silentErrorUrl' => params[:error_url] }\n )[0]\n end",
"def create_session(conn, opts={})\n # If there is a parent payload, then use that in preference.\n return parent_payload.create_session(conn, opts) if (parent_payload)\n\n # If the payload we merged in with has an associated session factory,\n # allocate a new session.\n if (self.session)\n begin\n # if there's a create_session method then use it, as this\n # can form a factory for arb session types based on the\n # payload.\n if self.session.respond_to?('create_session')\n s = self.session.create_session(conn, opts)\n else\n s = self.session.new(conn, opts)\n end\n rescue ::Exception => e\n # We just wanna show and log the error, not trying to swallow it.\n print_error(\"#{e.class} #{e.message}\")\n elog('Could not allocate a new Session.', error: e)\n raise e\n end\n\n # Pass along the framework context\n s.framework = framework\n\n # Associate this system with the original exploit\n # and any relevant information\n s.set_from_exploit(assoc_exploit)\n\n # set injected workspace value if db is active\n if framework.db.active && wspace = framework.db.find_workspace(s.workspace)\n framework.db.workspace = wspace\n end\n\n # Pass along any associated payload uuid if specified\n if opts[:payload_uuid]\n s.payload_uuid = opts[:payload_uuid]\n s.payload_uuid.registered = false\n\n if framework.db.active\n payload_info = {\n uuid: s.payload_uuid.puid_hex,\n workspace: framework.db.workspace\n }\n if s.payload_uuid.respond_to?(:puid_hex) && (uuid_info = framework.db.payloads(payload_info).first)\n s.payload_uuid.registered = true\n s.payload_uuid.name = uuid_info['name']\n s.payload_uuid.timestamp = uuid_info['timestamp']\n else\n s.payload_uuid.registered = false\n end\n end\n end\n\n # If the session is valid, register it with the framework and\n # notify any waiters we may have.\n if (s)\n register_session(s)\n end\n\n return s\n end\n nil\n end",
"def create_session(parms)\n @session = Session.new(parms)\n pp @session\n returnValue = false\n if people = People.auth(@session)\n session[:people] = people.id\n cookies[:people] = people.id\n unless people.id.nil?\n returnValue = true\n end\n end\n returnValue\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 create_session(location='', opts={})\n opts.merge!({:location => location})\n doc = do_request '/session/create', opts\n\n unless doc.get_elements('Errors').empty?\n raise OpenTokException.new doc.get_elements('Errors')[0].get_elements('error')[0].children.to_s\n end\n Session.new doc.root.get_elements('Session')[0].get_elements('session_id')[0].children[0].to_s\n end",
"def new(api_key = nil, secret_key = nil, session_key = nil)\n Session.create(api_key, secret_key, session_key)\n end",
"def new_session\n session = IntegrationSession.new\n session.test_case = self\n return session\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 initialize_session(params_hash)\n raise_error_unless_params_is_a_hash(params_hash)\n raise_error_if_params_are_empty(params_hash)\n request.method = :post\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def create_session\n raw_token, enc_token = account.create_session(ip, meta_info)\n set_account_cache(account, raw_token)\n set_auth_token_cache(enc_token, raw_token)\n return raw_token\n end",
"def create_session_pool(params={})\n require 'hornetq/client/session_pool'\n SessionPool.new(self, params)\n end",
"def create_session(start, opts = {})\n data, _status_code, _headers = create_session_with_http_info(start, opts)\n return data\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 create_consumer_session\n connection.create_session(@config || {})\n end",
"def create_session(timeout=nil)\n if timeout.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class]).call(timeout),::VertxWeb::Session)\n end\n raise ArgumentError, \"Invalid arguments when calling create_session(timeout)\"\n end",
"def new(*)\n # return new mock session\n BunnyMock::Session.new\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 init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end",
"def create_session(account_id, opts = {})\n data, _status_code, _headers = create_session_with_http_info(account_id, opts)\n data\n end",
"def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end",
"def create_user_session\n password = '12345678'\n user = User.make!(\n password: password,\n password_confirmation: password\n )\n UserSession.create!(\n email: user.email,\n password: password\n )\n end",
"def createSession(groupID, authorID, validUntil)\n call :createSession, :groupID => groupID, :authorID => authorID, :validUntil => validUntil\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 new_session\n IntegrationSession.new\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 create\n @session = Session.new(params[:session])\n\n respond_to do |format|\n if @session.save\n flash[:notice] = t 'flash.notice.successfully.created', :object => Session.human_name\n format.html { redirect_to(@session) }\n format.xml { render :xml => @session, :status => :created, :location => @session }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @session = User::Session.new\n end",
"def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end",
"def set_session(env, sid, new_session, options)\n# if options[:drop]\n# @sessions[sid] = nil\n# return false\n# end\n @sessions[sid] = new_session\n\n # Commit the repository, including session data.\n Maglev.commit_transaction\n return sid\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 open_session\n @current_session = new_session\n @current_session.test_case = self\n yield @current_session if block_given?\n @current_session\n end",
"def create_write_and_return_new_session!\n require 'timeout'\n\n session = DropboxSession.new(api_key, api_secret)\n\n # grab the request token for session\n session.get_request_token\n\n template = Backup::Template.new(\n {:session => session, :cached_file => cached_file}\n )\n template.render(\"storage/dropbox/authorization_url.erb\")\n\n # wait for user to hit 'return' to continue\n Timeout::timeout(180) { STDIN.gets }\n\n # this will raise an error if the user did not\n # visit the authorization_url and grant access\n #\n # get the access token from the server\n # this will be stored with the session in the cache file\n session.get_access_token\n\n template.render(\"storage/dropbox/authorized.erb\")\n write_cache!(session)\n template.render(\"storage/dropbox/cache_file_written.erb\")\n\n session\n\n rescue => err\n raise Errors::Storage::Dropbox::AuthenticationError.wrap(\n err, 'Could not create or authenticate a new session'\n )\n end",
"def create_session\n session[:who_is_this] = \"admin\"\n end",
"def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end",
"def create\n unathenticated_error if ! @api_consumer.is_a? Service\n service = @api_consumer\n\n @session = Session.create(service_id: service.id)\n\n invalid_request_error_check\n end",
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def create\n @session = Session.new(session_params)\n authorize @session\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 :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 create_new_session\n session = reviewer_access_sessions.build\n session.save!\n session\n end",
"def new(options = {})\n session = with(options)\n session.instance_variable_set(:@cluster, cluster.dup)\n\n if block_given?\n yield session\n else\n session\n end\n end",
"def open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\n end",
"def new_session\r\n session = ActionController::Integration::Session.new\r\n yield session if block_given?\r\n session\r\nend",
"def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\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 open_session; 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 start_session\n session_tracker.start_session\n end",
"def start_session\n return unless Bugsnag.configuration.enable_sessions && Bugsnag.configuration.should_notify_release_stage?\n\n start_delivery_thread\n start_time = Time.now().utc().strftime('%Y-%m-%dT%H:%M:00')\n new_session = {\n id: SecureRandom.uuid,\n startedAt: start_time,\n paused?: false,\n events: {\n handled: 0,\n unhandled: 0\n }\n }\n SessionTracker.set_current_session(new_session)\n add_session(start_time)\n end",
"def create_session(ip, meta_info={})\n raw, enc = Authentication::TokenGenerator.generate(Authentication::Session, 'authentication_token')\n Authentication::Session.create({\n 'authentication_token' => enc,\n 'meta_info' => meta_info,\n 'ip' => ip,\n 'account_id' => self.id\n })\n return raw, enc\n end",
"def session(params={}, &proc)\n raise \"HornetQ::Client::session mandatory block missing\" unless proc\n session = nil\n begin\n session = create_session(params)\n proc.call(session)\n ensure\n session.close if session\n end\n end",
"def create(description, permitted_ips: nil)\n fail ArgumentError, 'description is required' unless description\n fail 'Cannot create session, please add the api_key to your configuration' unless @client.configuration.api_key\n\n params = {description: description, secret: @client.configuration.api_key}\n params[:permitted_ips] = permitted_ips if permitted_ips\n\n @resource.post(params)['Response']\n end",
"def new_session\n # Register PhantomJS (aka poltergeist) as the driver to use\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(app, timeout: 60, js_errors: false)\n end\n\n # Use CSS as the default selector for the find method\n Capybara.default_selector = :css\n\n # Start up a new thread\n @session = Capybara::Session.new(:poltergeist)\n\n # Report using a particular user agent\n @session.driver.headers = { 'User-Agent' =>\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X)\" }\n\n # Return the driver's session\n @session\n end",
"def ensure_session(sess_label)\n die \"Unknown session: '#{sess_label}'.\" unless Config.session? sess_label\n\n Session.new label: sess_label\n end",
"def new_session\n @logger.info(\"Attempting to connect to WinRM (patched)...\")\n @logger.info(\" - Host: #{@host}\")\n @logger.info(\" - Port: #{@port}\")\n @logger.info(\" - Username: #{@username}\")\n\n client = ::WinRM::WinRMWebService.new(endpoint, :ssl, endpoint_options)\n client.set_timeout(@timeout_in_seconds)\n client.toggle_nori_type_casting(:off) #we don't want coersion of types\n client\n end",
"def session # :nodoc:\n sess = Mack::SessionStore.get($current_session_id, nil, nil, nil)\n if sess.nil?\n id = String.randomize(40).downcase\n set_cookie(configatron.mack.session_id, id)\n sess = Mack::Session.new(id)\n Mack::SessionStore.store.direct_set(id, sess)\n $current_session_id = id\n sess \n end\n sess\n end",
"def set_session\n \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 create\n\t \t\tmodule_grand_access = permission_control(\"session\",\"create\")\n\t \t\tif module_grand_access\n\t \t\t\tsession = Session.new(session_params)\n\t \t\t\tsession.created_by = current_user.id\n\t \t\t\tif session.save!\n\t \t\t\t\trender json: session, status: :created\n\t \t\t\telse\n\t \t\t\t\trender json: session.errors,status: :bad_request\n\t \t\t\tend\n\t \t\telse\n \t \t\t\trender json: { error: \"You dont have permission to perform this action,Please contact Site admin\" }, status: :unauthorized\t \t\t\t\n\t\t\tend\n\t \tend",
"def build_session\n # If it's empty assume user doesn't need session attributes.\n @session_attributes = Hash.new if @session_attributes.nil?\n @session = { :sessionAttributes => @session_attributes }\n @session\n end",
"def create_session_with_http_info(start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.create_session ...\"\n end\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.create_session\" if start.nil?\n # resource path\n local_var_path = \"/session/add\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_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 => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#create_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_session user_id\n @state.user_id = user_id\n end",
"def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end",
"def create_session(channel_id, options={})\n match = post_json(\"sessions\", options.merge(\n :channel_id => channel_id.to_s\n ))[:body].match(%r{/sessions/([^/]+)})\n match[1] if match\n end",
"def establish_new_session(header_and_content_hash)\n @session = header_and_content_hash\n @step = 0\n @state = [:uninitiated]\n session_initiated \n @state << :initiated\n header_and_content_hash\n end",
"def new\n @taster_session = TasterSession.new\n end",
"def session_begin(cred, mode)\n #This is a stub, used for indexing\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session(options={}, &block)\n self.class.session self, &block\n end",
"def session\n @session ||= Session.new( req )\n end",
"def open_session\n old_session = @current_session\n @current_session = new_session\n result = yield @current_session\n @current_session = old_session\n return result\n end",
"def create_new_id\n @new_session = true\n self.class.generate_unique_id\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 with_name(name)\n Threaded.sessions[name.to_sym] ||= Sessions::Factory.create(name)\n end",
"def create_session_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.create_session ...'\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 SessionsApi.create_session\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions'.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 # 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[:'session'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Session'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.create_session\",\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: SessionsApi#create_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end",
"def start_session(params={}, &proc)\n raise \"HornetQ::Client::session mandatory block missing\" unless proc\n session = nil\n begin\n session = create_session(params)\n session.start\n proc.call(session)\n ensure\n session.close if session\n end\n end",
"def create value=nil\n # TODO: only certain keys are recognised in a session create request,\n # should raise an error on others.\n raw = @conn.put do |req|\n req.url \"/v1/session/create\"\n req.body = (if value.kind_of?(String) then value else JSON.generate(value) end) unless value.nil?\n end\n body = JSON.parse(raw.body)\n return body[\"ID\"]\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def initialize(session_id, options = nil)\r\n RAGI.LOGGER.debug(\"creating ragi session with id=#{session_id}\")\r\n\r\n standard_options = {\r\n # This tells the base class where to look in the request_hash\r\n \"session_key\" => \"session_id\",\r\n\r\n # Disable output\r\n \"no_hidden\" => true,\r\n \"no_cookies\" => true,\r\n \r\n # Create a new session iff there is not an existing session id\r\n \"new_session\" => (session_id == nil)\r\n }\r\n\r\n full_options = DEFAULT_OPTIONS.merge(standard_options)\r\n full_options.merge!(options) if options\r\n\r\n # Convert all keys to strings\r\n full_options.keys.each do |key|\r\n full_options[key.to_s] = full_options.delete(key) if key.class != String\r\n end\r\n\r\n request_hash = { \"session_id\" => session_id }\r\n super(request_hash, full_options)\r\n end",
"def initialize(session_id = nil, map_state = nil)\n if session_id.blank?\n create_session\n else\n @session_id = session_id\n end\n \n if map_state\n @map_state = map_state\n end\n end"
] | [
"0.84279007",
"0.79473907",
"0.782255",
"0.782255",
"0.7791551",
"0.7677732",
"0.7632679",
"0.7626174",
"0.7523134",
"0.73476195",
"0.73223513",
"0.729912",
"0.7256545",
"0.72282434",
"0.72026724",
"0.7196217",
"0.7166488",
"0.71363103",
"0.7125027",
"0.7000495",
"0.69899964",
"0.689817",
"0.6829181",
"0.6811399",
"0.6727761",
"0.6651243",
"0.6643766",
"0.66347337",
"0.65978384",
"0.6588687",
"0.6588105",
"0.6562189",
"0.65365964",
"0.65276796",
"0.6509071",
"0.6508658",
"0.650665",
"0.64890254",
"0.64863193",
"0.6473635",
"0.64396524",
"0.6431707",
"0.64211005",
"0.64119077",
"0.6407728",
"0.64066994",
"0.6395096",
"0.639101",
"0.6383964",
"0.63788664",
"0.6376974",
"0.63642746",
"0.6359463",
"0.6330075",
"0.63217497",
"0.6292114",
"0.6283231",
"0.62686044",
"0.62347555",
"0.62341577",
"0.62213784",
"0.6212699",
"0.62036806",
"0.6190831",
"0.6173186",
"0.61617863",
"0.6159425",
"0.6156271",
"0.6153936",
"0.61490196",
"0.61383075",
"0.6134015",
"0.612605",
"0.6124469",
"0.6120255",
"0.61084265",
"0.6106954",
"0.60878587",
"0.60594463",
"0.60542786",
"0.6045381",
"0.60447085",
"0.60447085",
"0.60447085",
"0.60447085",
"0.60447085",
"0.60402155",
"0.6030902",
"0.6024777",
"0.6020605",
"0.60141885",
"0.6009727",
"0.6009584",
"0.6007493",
"0.60035545",
"0.59995526",
"0.59934473",
"0.59934473",
"0.59934473",
"0.59919596",
"0.599118"
] | 0.0 | -1 |
Get session by ID. | def get_session(account_id,
session_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json'
}
# Prepare and execute HttpRequest.
_request = config.http_client.get(
_query_url,
headers: _headers
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_response.raw_body)
ApiResponse.new(
_response, data: Session.from_hash(decoded)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def session(id)\n search_sessions(xml_doc, id).first\n end",
"def get_session(session_id)\n session = Session.find(:first, :conditions => ['session_id=?', session_id])\n return session\n end",
"def session!(id)\n search_sessions(xml_doc!, id).first\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 retrieve_session(session_id)\n @mutex.synchronize {\n @timestamps[session_id] = Time.now\n @sessions[session_id]\n }\n end",
"def session\n return nil unless session_id\n QuoVadis::Session.find_by id: session_id\n end",
"def get_session(env, sid)\n raise '#get_session not implemented.'\n end",
"def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end",
"def retrieve(session_id)\n unless session_id.blank?\n begin\n session_data = store.retrieve_session(session_id)\n rescue => err\n Merb.logger.warn!(\"Could not retrieve session from #{self.name}: #{err.message}\")\n end\n # Not in container, but assume that cookie exists\n session_data = new(session_id) if session_data.nil?\n else\n # No cookie...make a new session_id\n session_data = generate\n end\n if session_data.is_a?(self)\n session_data\n else\n # Recreate using the existing session as the data, when switching \n # from another session type for example, eg. cookie to memcached\n # or when the data is just a hash\n new(session_id).update(session_data)\n end\n end",
"def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def sessionGet(options={})\n assert_valid_keys(options, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def get_session( env, sid )\n return _get_session( env, sid ) unless env['rack.multithread']\n mutex.synchronize do\n return _get_session( env, sid )\n end \n end",
"def find_by_session_id(session_id)\n SEMAPHORE.synchronize { setup_sessid_compatibility! }\n find_by_session_id(session_id)\n end",
"def find_by_session_id(session_id)\n SEMAPHORE.synchronize { setup_sessid_compatibility! }\n find_by_session_id(session_id)\n end",
"def find_session(env, sid); end",
"def find(id = nil)\n args = [id].compact\n session = new(*args)\n return session if session.find_record\n nil\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\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 find_session(env, sid)\n unless sid && (session = get_session_with_fallback(sid))\n sid, session = generate_sid, {}\n end\n [sid, session]\n end",
"def set_session\r\n @session = Session.find(params[:id])\r\n end",
"def sessionGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :sessionId)\n assert_keys_exists(options, :sessionId)\n execute(:sessionGet, options)\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[: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 set_session\n @session = Session.find(params[:id])\n end",
"def find_user_by_session(sess_id)\n return unless sess_id\n session_options = ActionController::Base.session_options\n sess = CGI::Session.new(request.cgi,{\n 'session_id' => sess_id,\n 'new_session' => false,\n 'secret' => session_options[:secret],\n 'database_manager' => session_options[:database_manager],\n 'session_key' => session_options[:session_key],\n 'prefix' => session_options[:prefix],\n 'tmpdir' => session_options[:tmpdir],\n 'cache' => session_options[:cache],\n 'no_cookies' => true #undocumented ruby feature, critical for us.\n })\n if(sess[:user_id])\n User.find(sess[:user_id])\n else\n nil\n end\n end",
"def find_session(session_id, lock = false)\n find(\"`session_id`=#{quote_escape session_id} LIMIT 1\" + (lock ? ' FOR UPDATE' : ''))\n end",
"def class_session_get(id, opts = {})\n data, _status_code, _headers = class_session_get_with_http_info(id, opts)\n return data\n end",
"def get_app_session(session_id = nil)\n if session_id.nil?\n session_id = params[:id]\n end\n\n app_session = nil\n if current_user.administrator?\n app_session ||= model_class.administered_by(current_user).find_by_id(session_id)\n end\n app_session ||= model_class.viewable_by(current_user).find_by_id(session_id)\n end",
"def get_session(options = {})\n get_session!(options)\n rescue Error::SessionsNotSupported\n nil\n end",
"def id\n @id ||= scgi.session_id\n end",
"def set_session\n @session = current_user.sessions.find(params[:id])\n end",
"def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end",
"def get_session\n @session = Session.find(@blocker.session_id)\n end",
"def set_session\n @session = BatchConnect::Session.find(params[:id])\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 get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end",
"def get_session\n return Seasar::Rack::Session.get_session(@env)\n end",
"def current_user(id, session_type = :user)\n session_type.to_s.camelize.constantize.find id\n end",
"def session_id\n request.session_options[:id]\n end",
"def get_session_id(name)\n sessions = parse_body get(\"#{admin_url}/sessions/summary\")\n current = sessions.find do |session|\n session[:name] == name\n end\n current&.dig(:id)\n end",
"def find_session(request, sid)\n record = get_session_record(request, sid)\n record.session_id = generate_sid if record.new_record?\n [record.session_id, record.data]\n end",
"def set_session\n @session = Session.find(params[:session_id])\n end",
"def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def session_from_redis\n redis_handler.get\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def id\n response_hash[:session_id]\n end",
"def get_session_record(request, sid)\n model = @@session_class.find_by_session_id(sid) ||\n @@session_class.new(session_id: sid || generate_sid)\n\n if request.env[SESSION_OPTIONS_KEY][:id].nil?\n request.env[SESSION_RECORD_KEY] = model\n else\n request.env[SESSION_RECORD_KEY] ||= model\n end\n\n model\n end",
"def session_id\n @options[:session_id]\n end",
"def session(session_id)\n @session_id = session_id\n end",
"def find_bgp_session_by_id(id, opts = {})\n data, _status_code, _headers = find_bgp_session_by_id_with_http_info(id, opts)\n data\n end",
"def session_fromid(ip, idhash, meta)\n ip = \"bot\" if idhash == \"bot\"\n \n if !@sessions.key?(idhash)\n session = @ob.get_by(:Session, \"idhash\" => idhash)\n if !session\n session = @ob.add(:Session, {\n :idhash => idhash,\n :user_agent => meta[\"HTTP_USER_AGENT\"],\n :ip => ip,\n :date_lastused => Time.now\n })\n else\n session[:date_lastused] = Time.now\n end\n \n hash = {}\n @sessions[idhash] = {\n :dbobj => session,\n :hash => hash\n }\n else\n session = @sessions[idhash][:dbobj]\n hash = @sessions[idhash][:hash]\n end\n \n raise ArgumentError, \"Invalid IP.\" if ip != \"bot\" and !session.remember? and ip.to_s != session[:ip].to_s\n return [session, hash]\n end",
"def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_privileged = true\n end\n begin\n if not @@session_id.nil?\n return @@session_id\n else\n @@session_id = get_new_session2\n end\n rescue\n @@session_id = get_new_session2\n end\n return @@session_id\n end",
"def login_by_session(sessid)\n return if @logged_in\n @logged_in = true\n @session = sessid\n end",
"def setSession(id)\n\tif id.class == Integer \n\t\tsession[:id] = id\n\telse \n\t\treturn false \n\tend\nend",
"def set_session\n @session = FitnessSession.find(params[:id])\n end",
"def select_session\n @session = Session.find_by_session_id(@session_id)\n @session = @session.last rescue @session\n set_req_no\n end",
"def get_session\n @authenticator.get_session\n end",
"def getSessionInfo(sessionID)\n call :getSessionInfo, :sessionID => sessionID\n end",
"def session_id_key\n @session_id_key\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def session # :nodoc:\n sess = Mack::SessionStore.get($current_session_id, nil, nil, nil)\n if sess.nil?\n id = String.randomize(40).downcase\n set_cookie(configatron.mack.session_id, id)\n sess = Mack::Session.new(id)\n Mack::SessionStore.store.direct_set(id, sess)\n $current_session_id = id\n sess \n end\n sess\n end",
"def get_user_from_session\r\n return User.find(session[:user_id]) if session[:user_id]\r\nend",
"def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end",
"def session_user\n return @session_user if defined? @session_user\n if session.has_key? :user_id\n @session_user ||= User.find_by_id(session[:user_id])\n end\n end",
"def get_session\n env = get_session_tagged\n req_headers = env.request_headers\n res_headers = env.response_headers\n @session.class.new(user_id: req_headers['mhvCorrelationId'],\n expires_at: res_headers['expires'],\n token: res_headers['token'])\n end",
"def retrieve\n session = session_from_redis\n return session if session.present?\n\n establish_chip_session\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def session\n Session.instance\n end",
"def show\n @session = Session.where(unique_id: params[:id])\n # New round logic here\n\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def get(context = Context.current)\n if digest = context.cookies[Session.cookie_name]\n session = @cache[digest]\n end\n\n ensure\n unless session\n digest = generate_digest()\n session = Session.new\n session.instance_variable_set(\"@digest\", digest)\n @cache[digest] = session\n end\n\n return session\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 set_session_info\n @session_info = SessionInfo.find(params[:id])\n end",
"def load_session(env)\n sid = current_session_id(env)\n sid, session = get_session(env, sid)\n [sid, session || {}]\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end",
"def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end",
"def set_sessao\n @sessao = Sessao.where(\"id = ?\", params[:id]).first\n end",
"def get_document(id)\n @session.getDocument id\n end",
"def session\n object.session\n end"
] | [
"0.85440904",
"0.82807875",
"0.79861295",
"0.78630334",
"0.7602142",
"0.7514217",
"0.7400442",
"0.7292203",
"0.71992344",
"0.71649617",
"0.7164787",
"0.7164787",
"0.71492904",
"0.7062619",
"0.7062619",
"0.7026547",
"0.6966625",
"0.6848968",
"0.6848968",
"0.6848968",
"0.6848968",
"0.6842938",
"0.68373483",
"0.6832829",
"0.6785084",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.67847246",
"0.677979",
"0.6775742",
"0.6766747",
"0.6712672",
"0.66794974",
"0.6675937",
"0.66723603",
"0.6618329",
"0.6592573",
"0.658063",
"0.6525959",
"0.65252256",
"0.6515941",
"0.65110797",
"0.647529",
"0.6471545",
"0.646737",
"0.645349",
"0.64503616",
"0.64457065",
"0.64408576",
"0.64325863",
"0.64031094",
"0.6394264",
"0.6376283",
"0.63674676",
"0.63632286",
"0.63571876",
"0.63382536",
"0.6312992",
"0.6312342",
"0.6223779",
"0.62158114",
"0.620945",
"0.61942345",
"0.61765015",
"0.6169656",
"0.61680776",
"0.6160724",
"0.61580247",
"0.61402524",
"0.61384887",
"0.6137534",
"0.61283505",
"0.61208457",
"0.6112419",
"0.6108135",
"0.6104011",
"0.6093088",
"0.6091794",
"0.6078263",
"0.6061141",
"0.6051954",
"0.60335636",
"0.60286856",
"0.6007884",
"0.59912264",
"0.5986799"
] | 0.6230211 | 73 |
Delete session by ID. | def delete_session(account_id,
session_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare and execute HttpRequest.
_request = config.http_client.delete(
_query_url
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
ApiResponse.new(_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def delete_session(env, sid, options); end",
"def delete_session(session_id)\n @mutex.synchronize {\n @timestamps.delete(session_id)\n @sessions.delete(session_id)\n }\n end",
"def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end",
"def delete\n return unless @session\n @session.destroy\n @session = nil\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 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 destroy\n @current_session = CurrentSession.find(params[:id])\n @current_session.destroy\n\n head :no_content\n end",
"def delete_session(jid)\n @sessions.delete(jid)\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 self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\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 = 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 delete_session(user_id:, session_id:)\n path = '/users/{userId}/sessions/{sessionId}'\n .gsub('{userId}', user_id)\n .gsub('{sessionId}', session_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if session_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"sessionId\"')\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 destroy\n session.delete(:user_id) if session[:user_id]\n redirect_to new_session_path\n end",
"def delete_session(id, opts = {})\n data, _status_code, _headers = delete_session_with_http_info(id, opts)\n return data\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 delete\n GLOBAL_HASH_TABLE.delete(@session_id)\n end",
"def delete_session(session)\n return Seasar::Rack::Session.delete_session(@env, session)\n end",
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def delete_session(request, _sid, options)\n old_record = destroy_session(request)\n return if options[:drop]\n\n generate_sid.tap do |new_sid|\n if options[:renew]\n request.env[SESSION_RECORD_KEY] =\n @@session_class.create(session_id: new_sid, data: old_record&.data)\n end\n end\n end",
"def delete(id)\n call(:delete, path(id))\n end",
"def destroy\n\t\tsession.delete(:user_id)\n\t\tredirect_to login_path\n\tend",
"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 destroy\n\n session.delete(:user_id)\n redirect_to root_path, notice: \"logged out successfully \"\n\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 delete_session_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.delete_session ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling SessionApi.delete_session\" if id.nil?\n # resource path\n local_var_path = \"/session/delete\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\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(:DELETE, 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 => 'InlineResponse2003')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#delete_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n session[:user_id] = nil\n redirect_to sessions_path\n end",
"def delete(id)\n self.find(id).delete_\n end",
"def destroy\n session.delete(:user_id)\n flash[:success] = t('.successfully_logged_out')\n redirect_to login_path\n end",
"def destroy\n session.delete :user_id\n redirect_to root_path\n end",
"def destroy\n session.delete :user_id\n redirect_to '/'\n end",
"def delete(id)\n Net::SFTP.start(@host, @user, @password) do |sftp|\n sftp.remove!(url(id))\n end\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 destroy\n session[:user_id] = nil\n redirect_to sessions_path, flash: { info: 'Logged Out' }\n end",
"def destroy\n @user_session = UserSession.find\n @user_session.destroy\n if params[:id] == 'intruder'\n flash[:error] = \"You're not allowed in here!\"\n else\n flash[:notice] = \"Successfully logged out.\"\n end\n redirect_to :action => 'new'\n end",
"def destroy_session(env, sid, options)\n raise '#destroy_session not implemented'\n end",
"def destroy\n @session.clear\n end",
"def kill_session(id=\"new\")\n session[\"cart_new\"] = nil\n session[\"cart_#{id}\".to_sym] = nil\n end",
"def delete!(uuid)\n return_value = delete(uuid)\n raise SessionNotFound if return_value.zero?\n\n true\n end",
"def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end",
"def remove!\n @session.delete(SESSION_KEY) if empty?\n end",
"def delete_by_id(id)\n delete_payment_token_by_id(id)\n end",
"def destroy\n session.delete(:user)\n end",
"def logout\n session.delete(:user_id)\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path, notice: I18n.t(:session_logged_out)\n end",
"def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def delete_id(id)\n redis.srem(key, id)\n end",
"def destroy\n session[:user_id] = nil\n redirect_to login_path, notice: \"Logged out\"\n end",
"def close_session(s)\n @sessions.delete(s)\n end",
"def delete_classsession(id, opts = {})\n data, _status_code, _headers = delete_classsession_with_http_info(id, opts)\n return data\n end",
"def delete_session session_key\n init_redis\n begin\n @redis.del(session_key)\n return true\n rescue\n end\n return false\n end",
"def destroy\n # Remove the user id from the session\n session.clear\n redirect_to root_url\n end",
"def destroy\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.destroy\n session.destroy\n \tredirect_to root_url\n\tend",
"def destroy\n session[:user_id] = nil\n redirect_to '/login'\n end",
"def destroy\n session[:user_id] = nil\n redirect_to '/login'\n end",
"def destroy\n session[:user_id] = nil\n redirect_to '/login'\n end",
"def destroy(id)\n http.delete(\"/nfse/#{id}\") do |response|\n response.code == 204\n end\n end",
"def delete\n session[:cart].delete(params[:id])\n flash[:success] = 'Delete done'\n redirect_to cart_index_path\n end",
"def destroy\n\n # deletes user session\n session[:user_id] = nil\n redirect_to root_path, notice: 'Logged out.'\n end",
"def delete(url)\n setup_or_refresh_rest_session\n @session.delete(url: url)\n end",
"def destroy_session_cookie\n cookies.delete(_session_id_key)\n end",
"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 @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\t\tsession.delete(:user_id)\n\t\tredirect_to root_url, notice: 'Logged out!'\n\tend",
"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 delete(id, type)\n check_login\n response = @client.request :delete do\n soap.header = { \"SessionHeader\" => { \"session\" => \"#{self.session}\" }}\n soap.body = {\n \"ins0:type\" => type,\n \"ins0:ids\" => id\n }\n end\n if response.success?\n return response.to_hash\n else \n return false\n end\n end",
"def remove\n id = params[:id]\n cart = session[:cart]\n cart.delete id\n \n redirect_to :action => :index\n end",
"def logout\n session.delete :user_id\n end",
"def delete(id)\n @conn.execute(*@builder.delete(id))\n end",
"def delete\n client.delete(\"/#{id}\")\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_session(user)\n session[:user_id] = nil\n end",
"def destroy_session(user)\n session[:user_id] = nil\n end",
"def destroy_session(user)\n session[:user_id] = nil\n end",
"def delete\n connection.delete_user id\n nil\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy_session(user)\n session[:user_id] = nil\n end",
"def destroy \n session.delete :user_id \n head :no_content \n end",
"def destroy\n session[:user_id] = nil\n redirect_to(root_path)\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 delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def destroy\n session[:user_id] = nil\n redirect_to login_path, :notice => \"Successfully logged out\"\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out\"\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path\n end",
"def delete_sessions(node)\n @sessions.delete_all(node)\n end",
"def destroy(id)\n Ribs.with_handle(self.database) do |h|\n h.delete(get(id))\n end\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_path()\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_url, notice: 'Logged out!'\n end",
"def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out!\"\n end"
] | [
"0.82746494",
"0.8213924",
"0.78407186",
"0.77177083",
"0.77132183",
"0.7480458",
"0.74661034",
"0.7442562",
"0.7431306",
"0.73627746",
"0.72922283",
"0.72196",
"0.72133327",
"0.72098905",
"0.72053957",
"0.7161604",
"0.71371156",
"0.7125123",
"0.7071327",
"0.70678574",
"0.70669407",
"0.7022474",
"0.7016978",
"0.70038366",
"0.6954483",
"0.6920366",
"0.69053686",
"0.6882397",
"0.68704414",
"0.68624264",
"0.6861727",
"0.68550926",
"0.68503296",
"0.68457514",
"0.6838531",
"0.68327844",
"0.6813654",
"0.68120503",
"0.6802319",
"0.67712307",
"0.6760708",
"0.6755288",
"0.6752826",
"0.6736807",
"0.67274857",
"0.6725219",
"0.6717856",
"0.6687427",
"0.6685031",
"0.6680452",
"0.66677105",
"0.6666933",
"0.6656739",
"0.6652213",
"0.6648337",
"0.66479325",
"0.664653",
"0.6639448",
"0.66352",
"0.66352",
"0.66352",
"0.6622527",
"0.6610918",
"0.66027546",
"0.65945005",
"0.65933955",
"0.658776",
"0.6580527",
"0.6575763",
"0.65747726",
"0.65666884",
"0.65632224",
"0.65536344",
"0.6548555",
"0.6536088",
"0.65322894",
"0.6530785",
"0.6530785",
"0.6530785",
"0.6525758",
"0.65211123",
"0.65211123",
"0.65189993",
"0.65165234",
"0.65088594",
"0.6505297",
"0.6504946",
"0.6501157",
"0.64980173",
"0.64917946",
"0.64917946",
"0.64917946",
"0.64917946",
"0.64917946",
"0.64917946",
"0.64898074",
"0.64884746",
"0.6486277",
"0.64838105",
"0.648289"
] | 0.68834496 | 27 |
List participants in a session. | def list_session_participants(account_id,
session_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json'
}
# Prepare and execute HttpRequest.
_request = config.http_client.get(
_query_url,
headers: _headers
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_response.raw_body)
ApiResponse.new(
_response,
data: decoded.map { |element| Participant.from_hash(element) }
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_session_participants(account_id, session_id, opts = {})\n data, _status_code, _headers = list_session_participants_with_http_info(account_id, session_id, opts)\n data\n end",
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n users = meeting.participants\n send_json(users)\n else\n send_error 401\n end\n end",
"def participants\n expose Challenge.participants(@oauth_token, params[:challenge_id].strip)\n end",
"def listerParticipants\n puts \"\"\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n @participants.each do |participant|\n puts \" #{participant.nom.upcase}[#{participant.initiative}] - PV(#{participant.pv} / #{participant.pv_max}) >> #{participant.etat}\"\n end\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n puts \"\"\n end",
"def getParticipants\r\n\t\t\t\t\treturn @participants\r\n\t\t\t\tend",
"def index\n @participants = @current_event.participants rescue nil || []\n end",
"def participants\n return @participants\n end",
"def participants\n return @participants\n end",
"def list\n\n get_list['list'].collect { |e| ParticipantEntry.new(e) }\n end",
"def conference_list_members(params)\n path = @version + '/Conference/Member/List/'\n method = 'POST'\n return request(path, method, params)\n end",
"def members\n participants\n end",
"def members\n participants\n end",
"def index\n @participants = @event.participants\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def index\n @participants = Participant.all\n end",
"def get_conversation_participants(id)\n @client.raw('get', \"/content/conversations/#{id}/participants\")\n end",
"def participants # :nodoc:\n @participant_ids.map { |p| @context.users[p] }\n end",
"def get_all_participants(params = {})\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}/participant\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end",
"def participants\n participant_ids.blank? ? User.none : User.where(id: participant_ids)\n end",
"def participants( params={} )\n participants = get_connections(\"participants\", params)\n return map_connections participants, :to => Facebook::Graph::Generic\n end",
"def participants=(value)\n @participants = value\n end",
"def participants=(value)\n @participants = value\n end",
"def index\n @game = Game.find(params[:game_id])\n @participants = @game.joinable_participants_for_user(current_user)\n end",
"def list_session_participants_with_http_info(account_id, session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.list_session_participants ...'\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 SessionsApi.list_session_participants\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.list_session_participants\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Participant>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.list_session_participants\",\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: SessionsApi#list_session_participants\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def participants\n users.where(parent_id: parent_id || current_user_id).flat_map(&:participants)\n end",
"def participants\n recipients\n end",
"def participants\n return recipients\n end",
"def get_participants(id, params = {})\n get \"/api/v2/projects/#{id}/participants\", params\n end",
"def participants\n # NOTE: You have to sort by sequence id yourself\n # ZooKeeper won't do that\n @zk.children(@election_path).sort.map do |c|\n \"#{@election_path}/#{c}\" \n end\n end",
"def list_participants request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_participants_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Dialogflow::V2::ListParticipantsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def participants\n attributes['participants'] ||= []\n attributes['participants']\n end",
"def participants\n @participants ||= ParticipantSet.new\n end",
"def to_s\n '#<Twilio.Api.V2010.ParticipantList>'\n end",
"def participants\n users = self.users\n participants = []\n users.each do |user|\n participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: parent_id)\n participants << participant unless participant.nil?\n end\n participants\n end",
"def participants\n @participants ||= AssignmentParticipant.find(:all, :conditions => ['parent_id = ? and user_id IN (?)', parent_id, users])\n end",
"def participants\n @participants ||= AssignmentParticipant.find(:all, :conditions => ['parent_id = ? and user_id IN (?)', parent_id, users])\n end",
"def participants\n @participants ||= AssignmentParticipant.find(:all, :conditions => ['parent_id = ? and user_id IN (?)', parent_id, users])\n end",
"def get_conversation_participants(id)\r\n #TODO: Test if this method needs data in options.\r\n @client.raw('get', \"/content/conversations/#{id}/participants\", nil, nil, @contact_v1_url)\r\n end",
"def participants\n User.find([self.thought.user_id,*thought.comments.map(&:user_id)].compact-[self.user_id])\n end",
"def to_s\n '#<Twilio.Api.V2010.ParticipantList>'\n end",
"def get_safebox_participants(safebox_guid)\n handle_error { sendsecure_connection.get(\"api/v2/safeboxes/#{safebox_guid}/participants.json\") }\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_list\n\n @context.storage.get_configuration('participant_list') ||\n { 'type' => 'configurations',\n '_id' => 'participant_list',\n 'list' => [] }\n end",
"def index\n unless ( params[:organization_id].blank? )\n @organization = Organization.find(params[:organization_id])\n @participants = @organization.participants\n else\n @participants = Participant.all\n end\n\n @participants = @participants.paginate(:page => params[:page]).per_page(20)\n end",
"def participants\n User.find Participation.select(\"distinct user_id\").where(:occasion_id => id).all.map(&:user_id)\n # participations.map(&:user).uniq\n end",
"def index\n @participantes = Participante.all\n end",
"def index\n @participants = Participant.all\n redirect_to display_project_participants_path(params[:project_id])\n end",
"def list(conference_sid: :unset, friendly_name: :unset, status: :unset, created_after: :unset, created_before: :unset, mixer_region: :unset, tags: :unset, subaccount: :unset, detected_issues: :unset, end_reason: :unset, limit: nil, page_size: nil)\n self.stream(\n conference_sid: conference_sid,\n friendly_name: friendly_name,\n status: status,\n created_after: created_after,\n created_before: created_before,\n mixer_region: mixer_region,\n tags: tags,\n subaccount: subaccount,\n detected_issues: detected_issues,\n end_reason: end_reason,\n limit: limit,\n page_size: page_size\n ).entries\n end",
"def index\n if params[:organization_id].blank?\n @participants = Participant.all\n else\n @organization = Organization.find(params[:organization_id])\n @participants = @organization.participants\n end\n\n # @participants = @participants.paginate(:page => params[:page]).per_page(20)\n end",
"def index\n @activity_participants = Activity::Participant.all\n \n end",
"def session_list\n @admin_customer_emails = Admin::Customer::Email.by_session(MyStudio::Session.find(params[:id]))\n @record_count = @admin_customer_emails.count\n @admin_customer_emails = @admin_customer_emails.page(params[:page])\n render :index\n end",
"def user_list\n @room = current_user.room\n @user_list = @room.users\n render partial: \"user_list\"\n end",
"def index\n @all_confirmed_participants = current_user.confirmed_participants_of_all_sessions\n # If sessions must be filtered, use the passed params for filtering\n # display all running sessions otherwise, upcoming, past or unconfirmed, respectively.\n if params.count > 0\n @soccers_upcoming = current_user.sport_sessions_filtered(params, true, 'Soccer').select { |s| s.is_upcoming }\n @soccers_past = current_user.sport_sessions_filtered(params, true, 'Soccer').select { |s| s.is_past }\n @invitations = current_user.sport_sessions_filtered(params, false, 'Soccer')\n else\n soccers = current_user.sport_sessions_confirmed('Soccer')\n @soccers_upcoming = soccers.select { |s| s.is_upcoming }\n @soccers_past = soccers.select { |s| s.is_past }\n @invitations = current_user.sport_sessions_unconfirmed('Soccer')\n end\n end",
"def get_safebox_participants(safebox)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid == nil\n @json_client.get_safebox_participants(safebox.guid)[\"participants\"].map {|p| Participant.new(p) }\n end",
"def sessions\n PokerSession.find(:all)\n end",
"def conversation_participant_ids\n self.conversation ?\n self.conversation.participant_ids + [self.conversation.user_id] : []\n end",
"def show\n @memberships = @participant.memberships.all\n end",
"def index\n #@partnerships = Partnership.all\n @participant = Participant.find_by(user_id: current_user.id)\n @partnerships = @participant.partnerships.distinct\n end",
"def participant_ids\n participants.pluck(:id)\n end",
"def list_student_group_participants(id,opts={})\n query_param_keys = [\n :registration_status\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/appointment_groups/{id}/groups\",\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 participants(*vals)\n\t\t\t@sprint.participants = Array(vals).map{|v| v.to_sym}\n\t\tend",
"def peers\n if sessions.count > 0\n puts\n puts \"Currently Managing\"\n puts \"------------------\"\n puts\n sessions.each_with_index do |session, i|\n puts \"[#{i}] #{session.peername}\"\n end\n puts\n else\n puts \"No active sessions\"\n end\n nil\n end",
"def current_room_sessionids \n result = []\n peeps = simperson.simplace.simpeople\n peeps.each do |aperson|\n result << aperson.simcharacter.simplayer.sessionid if aperson.simcharacter.simplayer.online == true\n end\n result\n end",
"def get_members()\n @client.make_request(:get, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"))[0].map do |i|\n member = ConferenceMember.new(i, @client)\n member.conference_id = id\n member\n end\n end",
"def listSessionsOfGroup(groupID)\n call :listSessionsOfGroup, :groupID => groupID\n end",
"def arr_participants\n participants.split(',').map{|id|\n User.find(id) rescue nil\n }\n end",
"def list_friend\n ActionCable.server.broadcast(\n \"conversations-#{connect_user.id}\",\n message: 'list_user',\n data: User.where.not(id: connect_user).select('id, email')\n )\n end",
"def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end",
"def selected_participants #:nodoc:\n return self.bids_dataset.list_subjects if self.implicit_all_participants?\n select_hash = params[:_cb_participants] || {}\n select_hash.keys.select { |sub| select_hash[sub] == '1' }.sort\n end",
"def show\n @user = User.find_by_name(params[:name])\n @participants = Participant.find_all_by_user_id(@user.id).paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend",
"def index\n @competitions = Competition.where(:user_id => session[:user_id]).all\n end",
"def show\n @participants = @event.admins\n end",
"def challenge_participants\n search_param = params[params[:fieldname]]\n collection_id = params[:collection_id]\n render_output(Pseud.limit(10).order(:name).joins(:challenge_signups)\n .where([\"pseuds.name LIKE ? AND challenge_signups.collection_id = ?\", \n '%' + search_param + '%', collection_id]).map(&:byline))\n end",
"def index\n if current_user.admin?\n @participants = Participant.all \n else\n redirect_to new_participant_url\n end\n \n \n end",
"def conference_list(params)\n path = @version + '/Conference/List/'\n method = 'POST'\n return request(path, method, params)\n end",
"def index\n @project_participants = ProjectParticipant.all\n @roles = ProjectParticipant.roles\n end",
"def index\n @participants = Participant.includes(:responses, :participant_test_cases).order(created_at: :desc)\n .paginate(:page => params[:page])\n end",
"def parties(session_id)\n fetch \"eksport/partier/?sesjonid=#{session_id}\"\n end",
"def list\n get('users')['users']\n end",
"def userinfo\n @participant = Participant.find(session[:user])\n end",
"def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end",
"def participants\n @contest_registered_contracts = BookContestParticipant.where(:book_contest_id => @book_contest.id).includes(:contract, :book_language)\n end",
"def participants_on_issue(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}/participants\")\n end",
"def curator_list\n users.map(&:email)\n end",
"def index\n @guest_session_associations = GuestSessionAssociation.where(user_id:[session[:user_id]])\n end",
"def students\n students = self.users.where(\"participants.role_id = 4 and accepted = 2\").order('lastname').all\n return students\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 past_meeting_participants(*args)\n options = Zoom::Params.new(Utils.extract_options!(args))\n options.require(%i[meeting_uuid])\n Utils.parse_response self.class.get(\"/past_meetings/#{options[:meeting_uuid]}/participants\", headers: request_headers)\n end",
"def getInvited\n rsvpInvited = []\n Invitation.where(\"study_session_id = '#{self.id}' AND status = 'invited'\").each do |invitation|\n rsvpInvited.push(User.where(\"id = '#{invitation.user_id}'\").first)\n end\n return rsvpInvited\n end",
"def index\n @chat_rooms = current_user.chat_rooms\n end",
"def all_members(**params)\n client.api.get_room_members(id, **params)[:chunk].map { |ch| client.get_user(ch[:state_key]) }\n end",
"def get_all_participants\n\t\tparticipants_array = []\n\t\tmatch.teams.each do |t|\n\t\t\tparticipants_array << get_team_participants(t)\n\t\tend\n\t\tparticipants_array\n\tend",
"def get_participant_subscriptions(account_id,\r\n session_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: Subscriptions.from_hash(decoded)\r\n )\r\n end",
"def getMembersList()\n\t\tbegin\n\t \t@members=[];\n\t \tuserMembers = TwitterClient.list_members(@selectedList)\n\t \tuserMembers.each do |memberInList|\n\t \t\t@members << memberInList.id\n\t \tend\n\t \t@members\n\t rescue\n\t \t-1\n\t end\n\tend",
"def index\n @match_participants = MatchParticipant.select(:participant).distinct.map(&:participant)\n end"
] | [
"0.6977873",
"0.67511976",
"0.67085135",
"0.6699871",
"0.6695217",
"0.6586641",
"0.65847737",
"0.65847737",
"0.6551789",
"0.6521923",
"0.6515579",
"0.6515579",
"0.6501313",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6477563",
"0.6468465",
"0.64411354",
"0.6417176",
"0.6401648",
"0.63752544",
"0.63752544",
"0.6364155",
"0.63493234",
"0.63460165",
"0.63242424",
"0.6305875",
"0.6276654",
"0.62088674",
"0.61814517",
"0.61137825",
"0.6076512",
"0.6067477",
"0.6067023",
"0.60456985",
"0.60456985",
"0.60456985",
"0.6037299",
"0.6032861",
"0.6031016",
"0.60252035",
"0.59941304",
"0.5986412",
"0.5952783",
"0.59506077",
"0.5931743",
"0.5908217",
"0.5907533",
"0.59060997",
"0.5904257",
"0.5901925",
"0.5896343",
"0.58962643",
"0.5878602",
"0.58757704",
"0.5865222",
"0.58514583",
"0.5841594",
"0.58381355",
"0.57938117",
"0.57753783",
"0.5773834",
"0.5769834",
"0.5767958",
"0.5767614",
"0.57592165",
"0.5741962",
"0.5737858",
"0.5712103",
"0.57097614",
"0.5705608",
"0.5699541",
"0.5699401",
"0.56899506",
"0.567805",
"0.5677938",
"0.56745046",
"0.5668427",
"0.56591237",
"0.5657123",
"0.5636305",
"0.5635021",
"0.56336486",
"0.56316704",
"0.5625026",
"0.56246907",
"0.56246084",
"0.56231433",
"0.56211686",
"0.5598016",
"0.5584205",
"0.55748475",
"0.55707866",
"0.5570214",
"0.55665785",
"0.55477446"
] | 0.7196438 | 0 |
Add a participant to a session. Subscriptions can optionally be provided as part of this call. | def add_participant_to_session(account_id,
session_id,
participant_id,
body: nil)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false },
'participantId' => { 'value' => participant_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = config.http_client.put(
_query_url,
headers: _headers,
parameters: body.to_json
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
ApiResponse.new(_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_participant_to_session(account_id, session_id, participant_id, opts = {})\n add_participant_to_session_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"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 ab_add_participant(experiment, alternative, identity)\n VanityParticipant.retrieve(experiment, identity, true, seen: alternative)\n end",
"def add_participant\n user = User.find(params[:user_id])\n\n unless user_is_initiator(current_user, @chat)\n return fail_response(['You are not an author of the conversation'], 403)\n end\n\n if user_related_to_chat(@chat, user)\n return fail_response(['User is already in chat'], 403)\n end\n\n @chat.add_participant(user)\n\n render json: { message: 'success' }, status: :ok\n end",
"def add_participant_to_session_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.add_participant_to_session ...'\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 SessionsApi.add_participant_to_session\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.add_participant_to_session\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.add_participant_to_session\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:'subscriptions'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.add_participant_to_session\",\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: SessionsApi#add_participant_to_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def ab_add_participant(_experiment, _alternative, _identity)\n raise \"Not implemented\"\n end",
"def add_participant(user) # :nodoc:\n id = user.to_s.downcase\n if @participant_ids.include?(id)\n logger.warning(\"Attempted to add a participant who was already in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participant.\n user = if @context.users[id]\n @context.users[id]\n else\n @context.add_user(:id => id)\n end\n\n @context.add_operation(:type => Operation::WAVELET_ADD_PARTICIPANT,\n :wave_id => @wave_id, :wavelet_id => @id, :property => user)\n @participant_ids << id\n \n user\n end",
"def add(participant)\n participants.add(participant)\n participant.order = self\n\n participant\n end",
"def update_participant_subscriptions(account_id,\r\n session_id,\r\n participant_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 400\r\n raise APIException.new(\r\n 'Bad Request',\r\n _response\r\n )\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def addSubscription(subscr)\n subscriptions = Hash.new\n if @subscriptionLists.hasKey(\"subscriptions\")\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n subscriptions[subscr] = Subscription.new(subscr)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n end",
"def add_participant(course_id, user)\n if CourseParticipant.find_by(parent_id: course_id, user_id: user.id).nil?\n CourseParticipant.create(parent_id: course_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end\n end",
"def add_participant_to_deal(id:, **args)\n params = parameters(args) do\n required_params :person_id\n optional_params :person_id\n end\n request(:post, \"deals/#{id}/participants\", params)\n end",
"def update_participant_subscriptions(account_id, session_id, participant_id, opts = {})\n update_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def add_subscription(entity)\r\n subscriptions << entity\r\n end",
"def add_participant(assignment_id, user)\n return if AssignmentParticipant.find_by(parent_id: assignment_id, user_id: user.id)\n\n AssignmentParticipant.create(parent_id: assignment_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end",
"def register(name, participant, options, block)\n\n entry = to_entry(name, participant, options, block)\n\n key = entry.first\n options = entry.last.last\n\n list = get_list\n\n position = options['position'] || options['pos'] || 'last'\n\n if position == 'before'\n\n position = list['list'].index { |e| e.first == key } || -1\n\n elsif position == 'after'\n\n position = (list['list'].rindex { |e| e.first == key } || -2) + 1\n\n elsif position == 'over'\n\n position = list['list'].index { |e| e.first == key } || -1\n list['list'].delete_at(position) unless position == -1\n\n elsif options.delete('override') != false\n\n list['list'].delete_if { |e| e.first == key }\n # enforces only one instance of a participant per key/regex\n end\n\n case position\n when 'last' then list['list'] << entry\n when 'first' then list['list'].unshift(entry)\n when Fixnum then list['list'].insert(position, entry)\n else raise \"cannot insert participant at position '#{position}'\"\n end\n\n if r = @context.storage.put(list)\n #\n # if put returns something it means the put failed, have to redo the\n # work...\n #\n return register(name, participant, options, block)\n end\n\n if entry.last.first == 'Ruote::StorageParticipant'\n Ruote::StorageParticipant.new(@context)\n else\n nil\n end\n end",
"def update_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.update_participant_subscriptions ...'\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 SessionsApi.update_participant_subscriptions\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.update_participant_subscriptions\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.update_participant_subscriptions\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:'subscriptions'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.update_participant_subscriptions\",\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: SessionsApi#update_participant_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n 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 addUser\n\tconference = Conference.find(params[:id])\n\tuserTest = conference.users.find_by_email(params[:email])\n\tif userTest.nil?\n\t\tconference.users << User.find_by_email(params[:email])\n\t\tredirect_to conferences_url, notice: 'User Added'\n\telse\n\t\tredirect_to conferences_url, notice: 'Cant add the same User twice'\n\tend\n end",
"def add_session(session, options = {})\n session.each{|s| add_session(s, options)} and return if session.is_a?(Array)\n options = { :include_heading => true }.merge(options)\n puts \"\\n\\nAdding session #{session.id}\"\n session_heading(session) if options[:include_heading] == true\n apps = session.presenters.sort{|x,y| x.offering_session_order.nil? ? x.fullname <=> y.fullname : x.offering_session_order.to_i <=> y.offering_session_order.to_i }\n add_abstracts(apps)\n end",
"def subscribe(subscriber, **args)\n caffeinate_campaign_subscriptions.find_or_create_by(subscriber: subscriber, **args)\n end",
"def subscribe(event)\n has_subscriptions.create(subscribed_id: event.id)\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 add_participant(_user_ids, _current_user = nil)\n update(new_members: _user_ids.is_a?(Array) ? _user_ids : [_user_ids], updated_by: _current_user)\n end",
"def subscribe!(subscriber, **args)\n caffeinate_campaign_subscriptions.find_or_create_by!(subscriber: subscriber, **args)\n end",
"def add_participant(participant)\n # Assume we are in a tournament, we'll want to look at the seeds and slot the higher seed as home\n self.logger.info(\"Adding #{participant.name} to match ##{self.id}\")\n self.logger.error(\"Cannot add participants when match has scores already\") and raise if self.home_score > 0 || self.away_score > 0\n self.logger.error(\"Cannot add participants; no free slots in match\") and raise if self.home_participant && self.away_participant\n\n current_participant = self.home_participant || self.away_participant\n current_seed = current_participant ? TeamSeason.where(participant: current_participant, season_id: self.season_id).first.division.to_i : nil\n participant_seed = TeamSeason.where(participant: participant, season_id: self.season_id).first.division.to_i\n if !current_seed || participant_seed < current_seed\n self.home_participant = participant\n self.away_participant = current_participant\n else\n self.home_participant = current_participant\n self.away_participant = participant\n end\n self.save!\n end",
"def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end",
"def create\n tournament = Tournament.find(params[:tournament_id])\n s = Subscription.new\n s.tournament_id = tournament.id\n if tournament.is_individual?\n s.participant_id = params[:participant_id] || session[:user_id]\n \n flash[:valid] = I18n.t('subscription.ok') if s.save\n else\n if params[:membership_id]\n s.participant_id = params[:membership_id]\n\n flash[:valid] = I18n.t('subscription.ok') if s.save\n end\n end\n redirect_to :back\n end",
"def subscribe(recipient)\n subscription = subscriptions.find_or_initialize_by(recipient: recipient)\n return unless subscription.new_record?\n subscription.save\n subscription\n end",
"def register(participant, ppi=nil)\n CollectionProtocolRegistration.new(:participant => participant, :protocol => self, :protocol_participant_identifier => ppi)\n end",
"def ajoutParticipants(participant)\n @participants.push(participant)\n end",
"def get_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.get_participant_subscriptions ...'\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 SessionsApi.get_participant_subscriptions\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.get_participant_subscriptions\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.get_participant_subscriptions\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Subscriptions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.get_participant_subscriptions\",\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: SessionsApi#get_participant_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def participate!(given_event)\n participations.create!(participated_id: given_event.id)\n end",
"def participant=(part)\n @participant = part\n end",
"def set_participant\n @participant = Participant.find_by_login(params[:id])\n end",
"def get_participant_subscriptions(account_id,\r\n session_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: Subscriptions.from_hash(decoded)\r\n )\r\n end",
"def subscribe(options, &block)\n subscriptions.create(options, &block)\n end",
"def subscribe\n \n @conversation.subscriptions << @user unless @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n\n end",
"def register_session(session)\n # Register the session with the framework\n framework.sessions.register(session)\n\n # Call the handler's on_session() method\n if session.respond_to?(:bootstrap)\n session.bootstrap(datastore, self)\n else\n # Process the auto-run scripts for this session\n if session.respond_to?(:process_autoruns)\n session.process_autoruns(datastore)\n end\n on_session(session)\n end\n\n # If there is an exploit associated with this payload, then let's notify\n # anyone who is interested that this exploit succeeded\n if assoc_exploit\n framework.events.on_exploit_success(assoc_exploit, session)\n end\n\n # Notify waiters that they should be ready to rock\n session_waiter_event.notify(session)\n\n # Decrement the pending connections counter now that we've processed\n # one session.\n self.pending_connections -= 1\n\n # Count the number of sessions we have registered\n self.sessions += 1\n end",
"def add_player(player, tier = nil)\n # See if this player is already in this round\n return if participants.where(player_id: player.id).exists?\n\n Round.transaction do\n p1 = Participant.create!(round_id: id,\n tier_id: (tier || smallest_tier).id,\n player_id: player.id)\n\n create_games_for(p1)\n return p1\n end\n end",
"def add_instructor(instructor)\n @instructors << instructor\n end",
"def subscribe(course)\n subscribeds << course\n end",
"def adduser(email, password, first_name, last_name, slug)\n @user = User.invite!(:email => email, :slug => slug) do |u|\n u.skip_invitation = true\n end\n token = @user.instance_variable_get(:@raw_invitation_token)\n User.accept_invitation!(:invitation_token => token,\n :password => password,\n :password_confirmation => password,\n :first_name => first_name,\n :last_name => last_name,\n :slug => slug)\n\n puts \"Created User #{email} with password #{password}\"\n @user\n end",
"def fAddSubscribedEventTo(email, eventID)\n @users.addSubscribedEventTo(email, eventID)\n end",
"def set_participant\n @participant = Participant.find_by_id(params[:id])\n end",
"def add_player(player, password)\n @storage.save_player(player, password)\n self.add_object(player)\n end",
"def add_account\n # make sure a second confirmation email is not sent\n skip_reconfirmation!\n\n # update before setting the account_id\n update_profile_email\n\n update_attribute(:account_id, Account.current.id)\n ensure_site_profile_exists\n end",
"def append_task(task)\n @session_tasks << task\n end",
"def create\n @subscription = current_user.subscriptions.create(subscription_params)\n redirect_to @playlist\n end",
"def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end",
"def add_recipient(data)\n channel_id = data['channel_id'].to_i\n channel = self.channel(channel_id)\n\n recipient_user = ensure_user(data['user'])\n recipient = Recipient.new(recipient_user, channel, self)\n channel.add_recipient(recipient)\n end",
"def add_subscriber!(product, account, role)\n subscription = product_subscription(product)\n if !subscription.nil?\n subscriber = subscription.subscribers.select { |s| s.account.id.to_s == account.id.to_s }.first\n if subscriber.nil?\n subscription.subscribers << Subscriber.new(:account=>account, :role=>role)\n self.save!\n else\n # update role in case it was upgraded or downgraded\n subscriber.role = role\n subscriber.save!\n end\n else\n raise \"Product not found: #{product}\"\n end\n end",
"def create_participant(safebox_guid, participant_params)\n handle_error { sendsecure_connection.post(\"api/v2/safeboxes/#{safebox_guid}/participants.json\", participant_params) }\n end",
"def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end",
"def add_to_spotify\n if self.spotify_id.nil?\n playlist = self.group.owner.rspotify_user.create_playlist!(self.name)\n self.spotify_id = playlist.id\n self.save\n self\n else\n nil\n end\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def set_participant\n @participant = Participant.find(params[:id])\n end",
"def add_event_subscriber\n\t\tevent = Event.find(params[:id])\n\t\tuser = User.find(params[:user_id])\n\t\tif !event.users.exists?(user.id)\n\t\t\tevent.users << user\n\t\t\t@del = true\n\t\telse\n\t\t\tevent.users.delete(user)\n\t\t\t@del = false\n\t\tend\n\tend",
"def insert(opts={})\n mirror_api_method = opts[:mirror_api_method] || :subscriptions \n subscription = mirror_api.subscriptions.insert.request_schema.new(\n collection: opts[:collection] || DEFAULT_COLLECTION,\n userToken: user_token,\n verifyToken: verification_secret,\n callbackUrl: opts[:callback_url] || client.callback_url,\n operation: opts[:operations] || DEFAULT_OPERATIONS)\n result = google_client.execute(api_method: mirror_api.send(mirror_api_method).insert,\n body_object: subscription)\n result\n end",
"def add\n request('add').auth_required!\n end",
"def add(id, name=nil, notes=nil, custom_quota=nil)\n _params = {:id => id, :name => name, :notes => notes, :custom_quota => custom_quota}\n return @master.call 'subaccounts/add', _params\n end",
"def register_session_message(kind, phone, location = nil, dlr_message_id = nil)\n @registration_account.session_messages.create!(:kind => kind, :phone => phone, :location => location, :dlr_message_id => dlr_message_id)\n end",
"def subscribe(aSubscriber)\n subscribers << aSubscriber\n end",
"def create\n event = Event.find(params[:event_id])\n current_user.subscribe(event)\n redirect_to event\n end",
"def subscribe(email)\n return false if subscriber?(email)\n\n store[name].create(email)\n\n true\n end",
"def register(subscriber)\n subscribers << subscriber\n end",
"def add_track(opts)\n # Create the track\n track_id = Track.create(opts)\n\n # Add it to the playlist\n REDIS.sadd tracks_key, track_id\n\n # Return the track\n return Track.get(self, track_id)\n end",
"def new_user_and_participant\n @participant = Participant.new\n end",
"def create\n \n @participant = current_user.build_participant(participant_params)\n \n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\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 participant\n ScriptoriaCore::Ruote.engine.participant(participant_name)\n end",
"def register_session_email(kind, email, location = nil)\n @registration_account.session_emails.create!(:kind => kind, :email => email, :location => location)\n end",
"def enter_room\n session = Session.find(params[:id])\n user_id = params[:user_id]\n # get the session user (this exists if the user is registered for the session)\n session_user = SessionUser.where(\"session_id = ? and user_id = ?\", session.id, user_id)[0]\n if session_user\n # this user is now present\n session_user.update(present: true);\n end\n redirect_to :action => \"show\", :id => session.id \n end",
"def register_with_et\r\n App.et[\"accounts\"].each_pair do |account_name, account_config|\r\n next unless account_config[:rsvp_guest_list]\r\n ETSubscriberAdd.create!(\r\n :account => account_name,\r\n :target => self,\r\n :properties => {\r\n :list_id => account_config[:rsvp_guest_list],\r\n :values => {\r\n :email_address => self.email,\r\n :cobrand => cobrand.short_name\r\n }\r\n }\r\n )\r\n end\r\n end",
"def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end",
"def add_participants_to_global_competition\n\t\tusers = User.where({:in_grand_competition=>true})\n\t\t\n\t\tinvitation_count = 0\n\t\tusers.each do |user|\n\t\t\tCompetitionParticipant.add_participant(user.id, self.id)\n\t\t\tinvitation_count += 1\n\t\tend\n\t\tAppMailer.global_race_admin_notify(self.id, users.length, invitation_count).deliver\n\t\t\n\t\treturn \"#{self.name} created. #{invitation_count}/#{users.length} users invited.\"\n\tend",
"def subscribe\n begin\n gibbon.lists(mc_list_id).members.create(\n body: {\n email_address: params[:email][:address],\n status: \"subscribed\",\n marketing_permissions: [{\n marketing_permission_id: mc_mp_id_one,\n enabled: true\n }]\n }\n )\n flash[:success] = @settings.newsletter_success\n rescue Gibbon::MailChimpError => event\n message = \"Houston, we have a problem: #{event.message} - #{event.raw_body}\"\n Rails.logger.debug message\n flash[:failure] = @settings.newsletter_failure\n end\n redirect_to newsletter_path\n end",
"def add(subwindow, options = {})\n execute_only(:add, subwindow, options.to_tcl_options)\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 append(opts)\n playlist_control :add, opts\n end",
"def create_participant(account_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/participants'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 400\r\n raise APIException.new(\r\n 'Bad Request',\r\n _response\r\n )\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: AccountsParticipantsResponse.from_hash(decoded)\r\n )\r\n end",
"def addAttendee(name)\n RSVP.add(@id,name)\n end",
"def extend_trial(date)\n raise ArgumentError, \"Extending a subscription's trial requires a date in the future.\" unless date.future?\n\n subscription = as_stripe_subscription\n subscription.trial_end = date.to_i\n subscription.save\n\n update(trial_ends_at: date)\n\n self\n end",
"def subscribe\n @board.subscribers << current_user\n redirect_to board_path(@board), notice: \"Boarda abone oldunuz.\"\n end",
"def add_exhibitor_to_event\n session_event = SessionRelationship.find_by_session_id(self.event_id)\n EventExhibitor.find_or_create_by_event_id_and_exhibitor_id(session_event.event_id, self.exhibitor_id) unless session_event.blank?\n end",
"def add_a_room(opts = {})\n data, _status_code, _headers = add_a_room_with_http_info(opts)\n data\n end",
"def create\n @session = Session.new(params[:session].merge(conference: active_conference))\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 json: @session, 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"
] | [
"0.69242907",
"0.6579323",
"0.64100623",
"0.6259223",
"0.6197239",
"0.61822116",
"0.6081688",
"0.60389733",
"0.60210556",
"0.599112",
"0.5919563",
"0.58165616",
"0.57802224",
"0.5687276",
"0.55658764",
"0.5538888",
"0.55289817",
"0.54701144",
"0.5463343",
"0.5450351",
"0.543932",
"0.5437263",
"0.5387935",
"0.5375099",
"0.5372967",
"0.5323068",
"0.53181434",
"0.53077656",
"0.52935845",
"0.52703404",
"0.5264775",
"0.5222018",
"0.5199225",
"0.5163714",
"0.5157955",
"0.51354337",
"0.51328397",
"0.51322454",
"0.5122048",
"0.50654393",
"0.50351036",
"0.503357",
"0.50331056",
"0.50290483",
"0.50247407",
"0.5014231",
"0.5009877",
"0.50025886",
"0.4999096",
"0.49983418",
"0.49971342",
"0.49956498",
"0.49837413",
"0.49742347",
"0.49736854",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49708062",
"0.49682072",
"0.4967746",
"0.49500406",
"0.4949889",
"0.49490902",
"0.4948999",
"0.49340284",
"0.49277815",
"0.49269032",
"0.49222687",
"0.4912365",
"0.49104175",
"0.49086246",
"0.49074173",
"0.48926586",
"0.48790875",
"0.48750794",
"0.4874593",
"0.48731834",
"0.48657882",
"0.48606086",
"0.48577297",
"0.48411044",
"0.4837366",
"0.48361027",
"0.48271847",
"0.4827058",
"0.48173156",
"0.48020172",
"0.47862408"
] | 0.6828904 | 1 |
Remove a participant from a session. This will automatically remove any subscriptions the participant has associated with this session. | def remove_participant_from_session(account_id,
session_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false },
'participantId' => { 'value' => participant_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare and execute HttpRequest.
_request = config.http_client.delete(
_query_url
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
ApiResponse.new(_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_participant_from_session(account_id, session_id, participant_id, opts = {})\n remove_participant_from_session_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def remove_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n if meeting.participants.exists?(participant_id)\n # remove all the participant's votes from each suggestion\n meeting.suggestions.each do |suggestion|\n vote = Vote.where(:voter_id => participant_id, :suggestion_id => suggestion.id)\n if vote != nil\n suggestion.votes.delete(vote)\n end\n end\n meeting.participants.delete(User.find(participant_id))\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end",
"def remove\n @conference_session = ConferenceSession.find(params[:conference_session_id])\n (@presentation.update_attribute(:conference_session_id, nil)) if user_in_organizer_committee?\n redirect_to manage_presentations_conference_session_path(@conference_session)\n end",
"def remove_session(session)\n found = nil\n @model.each do |model,path,iter|\n if (iter[ID_SESSION] == session.sid.to_s)\n found = iter\n break\n end\n end\n\n @model.remove(found) if found\n end",
"def delete_subscription subscription\n subscriber.delete_subscription subscription: subscription_path(subscription)\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def unsubscribe(ident)\n @subscribers.delete(ident)\n end",
"def remove!\n @session.delete(SESSION_KEY) if empty?\n end",
"def delete_participant(account_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/participants/{participantId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def remove_event(event)\n participant_event = get_participant_event(event)\n\n if not participant_event.nil? and participant_event.role == \"creator\"\n event.route.destroy unless event.route.nil?\n event.destroy\n end\n end",
"def remove_participant_from_session_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.remove_participant_from_session ...'\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 SessionsApi.remove_participant_from_session\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.remove_participant_from_session\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.remove_participant_from_session\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.remove_participant_from_session\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionsApi#remove_participant_from_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def remove_participant(user) # :nodoc:\n id = user.to_s.downcase\n unless @participant_ids.include?(id)\n logger.warning(\"Attempted to remove a participant who was not in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participant.\n user = @context.users[id]\n\n unless user.robot?\n logger.warning(\"Attempted to remove a non-robot from wavelet(#{@id}): #{id}\")\n return nil\n end\n\n if user == @context.robot\n return remove_robot\n end\n\n @context.add_operation(:type => Operation::WAVELET_REMOVE_PARTICIPANT,\n :wave_id => @wave_id, :wavelet_id => @id, :property => user)\n @participant_ids.delete id\n \n user\n end",
"def unsubscribe(course)\n subscribeds.delete(course)\n end",
"def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end",
"def remove_subscriber!(product, account)\n subscription = product_subscription(product)\n if !subscription.nil?\n matches = subscription.subscribers.select { |s| s.account.id.to_s == account.id.to_s }\n matches.each { |s| s.delete }\n subscription.save!\n else\n raise \"Product not found: #{product}\"\n end\n end",
"def destroy\n\t\t@participant.destroy\n\n\t\thead :no_content\n\tend",
"def destroy\n event = Subscription.find(params[:id]).event\n current_user.unsubscribe(event)\n redirect_to event\n end",
"def unsubscribe(subscriber)\n name_or_subscriber = subscriber.is_a?(String) ? name_with_suffix(subscriber) : subscriber\n adapter.unsubscribe(name_or_subscriber)\n end",
"def supprimeParticipant(participant_nom)\n participant = self.recupNom(participant_nom)\n @participants.delete(participant)\n end",
"def update_participant_subscriptions(account_id, session_id, participant_id, opts = {})\n update_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def detach_subscription subscription\n publisher.detach_subscription subscription: subscription_path(subscription)\n end",
"def unsubscribe(subscriber_name = DEFAULT_SUBSCRIBER_NAME, options = { })\n wait_for_destination(options[:startup_timeout]) do\n with_session do |session|\n session.unsubscribe( subscriber_name )\n end\n end\n end",
"def unregister(subscription)\n synchronize do\n @membership_subscriptions.delete(subscription)\n end\n nil\n end",
"def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end",
"def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end",
"def unsubscribe\n if @subscriber\n @subscriber.stream.close\n @subscriber = nil\n end\n end",
"def destroy\n @participant.destroy\n flash[:success] = 'Participant was successfully destroyed.'\n redirect_to participants_url\n end",
"def leave_participant(resource_id)\n http.delete(participants_endpoint(resource_id)) do |response|\n true\n end\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def delete_session(account_id,\r\n session_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def unsubscribe(id_or_email, options = {})\n url = \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/remove\"\n url += options[:campaign_id] ? \"?campaign_id=#{options[:campaign_id]}\" : \"\"\n make_json_api_request :post, url\n end",
"def unmute\n response = Network.post(['Conferences', self.conference_sid, 'Participant', self.call_sid], { :Muted => false })\n Participant.new(response)\n end",
"def unparticipate!(given_event)\n participations.find_by_participated_id(given_event.id).destroy\n end",
"def destroy\n email = @participant.email\n @participant.rankings\n @participant.destroy\n flash[:success] = \"Successfully deleted participant #{email}.\"\n redirect_to display_project_participants_path(@participant.project_id)\n end",
"def unsubscribeTo (event)\r\n @subscribedEvents.delete?(event)\r\n end",
"def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n #TODO move to model Subscription\n if not current_user.fitbit.nil?\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n current_user.fitbit.client.delete(path.join('/') + '.json')\n flash[:success] = 'Subscription successfully removed from Fitbit.'\n else\n flash[:error] = 'Can not remove subscription from Fitbit, because you are not connected.'\n end\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :ok }\n end\n end",
"def delete\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n participants = meeting.participants\n meeting.participants.delete(participants)\n meeting.delete\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def unsubscribe\n unless unsubscribe = pubsub.find_first('ns:unsubscribe', :ns => self.class.registered_ns)\n self.pubsub << (unsubscribe = XMPPNode.new('unsubscribe', self.document))\n unsubscribe.namespace = self.pubsub.namespace\n end\n unsubscribe\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def delete_subscription(account_id, subscription_id)\n delete(url_(\"subscription\", subscription_id))\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe(listener)\n listeners.delete(listener)\n end",
"def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end",
"def destroy\n subscribers.each do |name, subscriber|\n subscriber.destroy\n end\n end",
"def destroy\n @participants = Participant.find(params[:id])\n success = @participants.destroy\n\n if success and @participants.errors.empty?\n AuditTrail.audit(\"Participant #{@participants.fullname} destroyed by #{current_user.login}\")\n flash[:success] = \"Participant #{@participants.fullname} destroyed\"\n else\n flash[:error] = @participants.errors.full_messages\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end",
"def unsubscribe\n redis.unsubscribe\n end",
"def delete_subscription(subscription_id)\n query = @subscriptions.delete(subscription_id)\n # In case this came from the server, tell the client to unsubscribe:\n @action_cable.server.broadcast(stream_subscription_name(subscription_id), { more: false })\n # This can be `nil` when `.trigger` happens inside an unsubscribed ActionCable channel,\n # see https://github.com/rmosolgo/graphql-ruby/issues/2478\n if query\n events = query.context.namespace(:subscriptions)[:events]\n events.each do |event|\n ev_by_fingerprint = @events[event.topic]\n ev_for_fingerprint = ev_by_fingerprint[event.fingerprint]\n ev_for_fingerprint.delete(event)\n if ev_for_fingerprint.empty?\n ev_by_fingerprint.delete(event.fingerprint)\n end\n end\n end\n end",
"def update_participant_subscriptions(account_id,\r\n session_id,\r\n participant_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 400\r\n raise APIException.new(\r\n 'Bad Request',\r\n _response\r\n )\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def unsubscribe(subscriber)\n handler.unsubscribe(self, subscriber)\n end",
"def remove_subscription\n buyer = @current_user\n customer_id = buyer.stripe_customer_id\n customer = Stripe::Customer.retrieve(customer_id)\n subscription.delete\n render json: { message: 'Unsubscribed succesfully' }, status: 200\n end",
"def delete_session(jid)\n @sessions.delete(jid)\n end",
"def unsubscribe(event, listener)\n ensure_valid event\n if @subscriptions && @subscriptions[event]\n @subscriptions[event].delete_if do |block_or_target|\n if block_or_target.is_a? Proc\n eval('self',block_or_target.binding).equal?(listener)\n else\n block_or_target[0] == listener\n end\n end\n end\n end",
"def remove_sub sub\n @subs.delete sub\n nil\n end",
"def delete_subscription(entity)\r\n subscriptions.delete(entity)\r\n end",
"def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end",
"def delete_subscriber(id_or_email)\n make_json_api_request :delete, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def destroy\n @participant.destroy\n respond_with(@participant)\n end",
"def destroy\n @participant.destroy\n respond_with(@participant)\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\n end",
"def deleteSubscription(subscr)\n subscriptions = Hash.new\n if @subscriptionLists.hasKey(\"subscriptions\")\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n #subscriptions[subscr] = Array.new\n #@subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n subscriptions.delete(subscr)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n end",
"def unsubscribe\n unregister\n end",
"def delete_session(env, sid, options); end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def destroy\n @participant.destroy\n flash[:notice] = 'Participant was successfully removed.'\n respond_to do |format|\n format.html { redirect_to(meeting_participants_path(@meeting)) }\n format.xml { head :ok }\n end\n end",
"def unsubscribe(subscriber, **args)\n reason = args.delete(:reason)\n subscription = subscriber(subscriber, **args)\n return false if subscription.nil?\n\n subscription.unsubscribe(reason)\n end",
"def delete_subscription\n puts \"\\nWhich subscription would you like to delete?\"\n sport_given = gets.chomp\n\n sport = Sport.find_by(name: sport_given)\n subs = @user.subscriptions.find_by(user_id: @user.id, sport_id: sport.id)\n\n subs.destroy\n\n puts \"\\nYou just deleted your #{sport.name} subscription.\"\n end",
"def delete_session(session)\n return Seasar::Rack::Session.delete_session(@env, session)\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def remove\n if empty?\n @session.delete(SESSION_KEY)\n @session.delete(KEPT_KEY)\n end\n end",
"def unsubscribe(subscribable)\n subscribable.unsubscribe(self)\n end",
"def remove_robot\n robot = @context.robot\n @context.add_operation(:type => Operation::WAVELET_REMOVE_SELF,\n :wave_id => @wave_id, :wavelet_id => @id)\n @participant_ids.delete robot.id\n\n robot\n end",
"def destroy\n session.delete(:user)\n end",
"def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end",
"def deletesubscriber\n\n\tparams[\"phone\"] = params[\"phone\"].gsub(\"\\s\",\"\").gsub(/^0044/, \"\").gsub(/^\\+44/, \"\")\n\tif params[\"phone\"].length == 10\n\t\tparams[\"phone\"] = '0' + params[\"phone\"]\n\tend\n\n\tif (Subscriber.exists?(:phone => params[:phone]))\n\t\tsubscriber = Subscriber.where(:phone => params[:phone]).first\n\t\tsubscriber.destroy\n\n\t\trespond_to do |format|\n\t\t format.html # deletesubscriber.html.erb\n\t\tend\n\telse\n\t\tredirect_to :action => \"unsubscribe\", phone: params[:phone]\n end\n end",
"def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end",
"def unsubscribe\n return if self.hub.nil?\n\n change_subscription(:unsubscribe)\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to event_participants_url(@event), notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n if @count == 0\n subscription = @subscription\n @subscription = nil\n end\n end\n end\n end\n\n subscription.unsubscribe if subscription\n end",
"def destroy_as_receiver(participant=nil)\n memberships= Membership.receiver(participant.id, self.id)\n if memberships.empty?\n raise Ecs::NoReceiverOfMessageException,\n \"you are not a receiver of \" +\n \"\\\"#{self.ressource.namespace}/#{self.ressource.ressource}/#{self.id.to_s}\\\"\"\n end\n if participant\n MembershipMessage.delete_relations(self, memberships)\n end\n destroy_or_tag_as_removed if membership_messages.blank? and !ressource.postroute\n end",
"def remove_role(role)\n self.roles.destroy(role)\n end",
"def remove_role(role)\n self.roles.destroy(role)\n end",
"def remove_actor(actor)\n active_actors.delete(actor.actor_id)\n end",
"def remove_exhibitor_from_event\n session_event = SessionRelationship.find_by_session_id(self.event_id)\n if session_event.blank?\n Event.find(self.event_id).sessions.each do |s| \n pstr = EventExhibitor.find_by_event_id_and_exhibitor_id(s.id, self.exhibitor_id)\n\tpstr.destroy if pstr\n end\n end\n end",
"def opt_in(participant)\n opt_outs.unsubscriber(participant).destroy_all\n end",
"def destroy\n @chatroom_user.destroy\n end",
"def delete\n return unless @session\n @session.destroy\n @session = nil\n end",
"def unsubscribe(channel, connection)\n if sid = subscriptions.delete(channel => connection.signature)\n Channel[app_id => channel].unsubscribe(sid)\n end\n end",
"def remove(push_channel_subscription)\n push_channel_subscription_object = PushChannelSubscription(push_channel_subscription)\n raise ArgumentError, \"Channel is required yet is empty\" if push_channel_subscription_object.channel.to_s.empty?\n if push_channel_subscription_object.client_id.to_s.empty? && push_channel_subscription_object.device_id.to_s.empty?\n raise ArgumentError, \"Either client_id or device_id must be present\"\n end\n\n client.delete(\"/push/channelSubscriptions\", push_channel_subscription_object.as_json)\n end",
"def delete_session(session_id)\n @mutex.synchronize {\n @timestamps.delete(session_id)\n @sessions.delete(session_id)\n }\n end"
] | [
"0.75884026",
"0.6380433",
"0.624602",
"0.60856694",
"0.6079354",
"0.60488826",
"0.60285354",
"0.59954965",
"0.59787464",
"0.5914275",
"0.5896921",
"0.5887634",
"0.58749133",
"0.586737",
"0.5838793",
"0.57602346",
"0.5759116",
"0.57585454",
"0.57508636",
"0.57487637",
"0.5723534",
"0.56957304",
"0.5694471",
"0.56885386",
"0.5679537",
"0.56604743",
"0.56589216",
"0.56453305",
"0.5617689",
"0.5609597",
"0.56017995",
"0.5594186",
"0.5585104",
"0.5584821",
"0.5581621",
"0.5543154",
"0.5541479",
"0.55276036",
"0.5526981",
"0.5519322",
"0.5518428",
"0.55039114",
"0.55021876",
"0.54945695",
"0.5489905",
"0.5488521",
"0.5481359",
"0.5481359",
"0.5478639",
"0.54734606",
"0.5466342",
"0.5439739",
"0.54374707",
"0.54318714",
"0.54203755",
"0.54169625",
"0.54115283",
"0.5396945",
"0.53820896",
"0.5381491",
"0.5371826",
"0.5371193",
"0.5368827",
"0.5349693",
"0.5349693",
"0.5349151",
"0.53474796",
"0.53474796",
"0.53367823",
"0.5336696",
"0.5333671",
"0.5332741",
"0.5325",
"0.5323703",
"0.53136575",
"0.5299816",
"0.5292231",
"0.5277444",
"0.5272815",
"0.5271645",
"0.5271467",
"0.5269616",
"0.526787",
"0.52676904",
"0.52591527",
"0.5254917",
"0.5239728",
"0.52383375",
"0.52367127",
"0.5234827",
"0.5231425",
"0.5231425",
"0.52262837",
"0.5224135",
"0.5222442",
"0.5217644",
"0.5214615",
"0.5214451",
"0.5208256",
"0.520119"
] | 0.7534986 | 1 |
Get a participant's subscriptions. | def get_participant_subscriptions(account_id,
session_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false },
'participantId' => { 'value' => participant_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json'
}
# Prepare and execute HttpRequest.
_request = config.http_client.get(
_query_url,
headers: _headers
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_response.raw_body)
ApiResponse.new(
_response, data: Subscriptions.from_hash(decoded)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscriptions\n get_subscriptions_from(@nodename)\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def get_participant_subscriptions(account_id, session_id, participant_id, opts = {})\n data, _status_code, _headers = get_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts)\n data\n end",
"def get_subscribers\n @subscriptions = subscribers(@nodename)\n end",
"def get_subscriptions(opts = {})\n data, _status_code, _headers = get_subscriptions_with_http_info(opts)\n return data\n end",
"def subscriptions\n @subscriptions ||= begin\n resp = @client.access_token.get('/reader/api/0/subscription/list?output=json')\n raise \"unable to retrieve the list of subscription for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['subscriptions'].collect do |hash|\n Google::Reader::Subscription.new(hash.merge({:client => @client}))\n end\n end\n end",
"def subscriptions\n @channels\n end",
"def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end",
"def list_subscriptions(options = {})\n api.graph_call(subscription_path, {}, \"get\", options)\n end",
"def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end",
"def subscriptions\n @subscriptions ||= get_roster || {}\n end",
"def list_subs\n \t@subs = instagram_client.subscriptions\n end",
"def subscriptions\n # subscriber entries are embedded in subscriptions inside of an\n # org. We'll flip this, so that we only return subscriber entries\n # for the account\n orgs = Org.all(:conditions=>{ \"subscriptions.subscribers.account_id\"=> self.id})\n subscribers = []\n orgs.each do |org|\n org.subscriptions.each do |subscription|\n subscribers += subscription.subscribers.select { |subscriber| subscriber.account_id.to_s == self.id.to_s }\n end\n end\n subscribers.flatten!\n subs = []\n subscribers.each do |subscriber|\n subscript = subscriber.subscription\n org = subscript.org\n subs << AccountSubscription.new(org.id.to_s, org.name, subscript.product, subscript.billing_level, subscriber.role)\n end\n subs\n end",
"def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end",
"def subscribers\n subscriptions = Joyce::StreamSubscriber\n .joins(\"JOIN joyce_activities_streams AS jas ON joyce_streams_subscribers.stream_id = jas.stream_id\")\n .includes(:subscriber)\n .where(\"jas.activity_id = ?\", self.id)\n .where(\"joyce_streams_subscribers.ended_at IS NULL OR joyce_streams_subscribers.ended_at >= ?\", self.created_at)\n .where(\"joyce_streams_subscribers.started_at <= ?\", self.created_at)\n subscriptions.collect{ |s| s.subscriber }.uniq\n end",
"def subscriptions\n\t\t@subscriptions = current_user.customer.subjects\n\tend",
"def subscriptions\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Subscription)\n end",
"def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end",
"def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end",
"def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end",
"def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end",
"def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end",
"def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end",
"def subscriptions\n @subscriptions ||= {}\n end",
"def subscribers\n @subscribers ||= ActsAsIcontact::Subscription.contacts(:listId => id)\n end",
"def subscriptions(page = 1)\n Dropio::Resource.client.subscriptions(self, page)\n end",
"def get_subscribers\n subscriber_data = RunrWatcherServer.runr_session_get(\"subscribers\")\n return [] unless subscriber_data.present?\n list = subscriber_data[:subscribers][\"list\"]\n return [] unless list.present?\n JSON.parse list\n end",
"def subscribers\n AdminNotifier.subscribers(Subscriber.first)\n end",
"def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end",
"def all_subscriptions(&block)\n subscriptions.list(&block)\n end",
"def get_transcriptions()\n @client.make_request(:get, @client.concat_user_path(\"#{RECORDING_PATH}/#{id}/transcriptions\"))[0]\n end",
"def get_subscriptions\n subscriptions = []\n\n # Load the checks\n file = File.read(CHECKS)\n checks = JSON.parse(file)\n\n for check in checks\n subscriptions |= check[\"subscribers\"]\n end\n\n return subscriptions\nend",
"def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end",
"def subscriber_activities(identifier)\n connection.get(\"subscribers/#{identifier}/activity\")\n end",
"def subscriptions()\n return MicrosoftGraph::Subscriptions::SubscriptionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def service_subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscriptions')\n )\n )\n send_iq_stanza_fibered iq\n end",
"def get_subscribed_channels\n @channels\n end",
"def recipients(subscriber)\n subscribers\n end",
"def subscribers(domain, node)\n @cluster.query(:smembers, \"pubsub:#{domain}:subscribers_#{node}\")\n end",
"def subscriber_names\n @client.smembers @name\n end",
"def subscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Subscribed\", params: params)\n end",
"def getParticipants\r\n\t\t\t\t\treturn @participants\r\n\t\t\t\tend",
"def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end",
"def agencies_get_subscriptions(id, opts = {})\n data, _status_code, _headers = agencies_get_subscriptions_with_http_info(id, opts)\n data\n end",
"def get_conversation_participants(id)\n @client.raw('get', \"/content/conversations/#{id}/participants\")\n end",
"def index\n @subscriptions = current_user.subscriptions.all\n end",
"def index\n @my_subscriptions = current_user.active_subscriptions\n end",
"def get_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.get_participant_subscriptions ...'\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 SessionsApi.get_participant_subscriptions\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.get_participant_subscriptions\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.get_participant_subscriptions\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Subscriptions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.get_participant_subscriptions\",\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: SessionsApi#get_participant_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def users\n user_arr = []\n subscriptions.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end",
"def get_subscriptions(*args)\n raise_unsupported\n end",
"def participants\n return recipients\n end",
"def available_subscribers\n subscribed = @user.subscribed_from_contacts.map {|c| c.jid }\n router.available_resources(subscribed)\n end",
"def subscribed_channels\n @channels\n end",
"def list_topics_subscriptions topic, options = {}\n publisher.list_topic_subscriptions topic: topic_path(topic, options),\n page_size: options[:max],\n page_token: options[:token]\n end",
"def subscription\n ensure_connection\n @consumers.find(&:subscription)\n end",
"def participants\n return @participants\n end",
"def participants\n return @participants\n end",
"def subscriptions\n @subscriptions ||= Hash.new do |subscriptions, channel|\n # Setup the hash to generate subscriptions that can delete themselves from\n # their own collection on an unsubscription event.\n subscription = Subscription.new(self, channel)\n subscription.on_unsubscribe do\n # Remove the subscription from the consumer.subscriptions \n # list when unsubscribe.\n subscriptions.delete channel\n end\n subscriptions[channel] = subscription\n end\n end",
"def subscriptions(dbname = nil)\n subscriptions = typed_exec(<<-SQL).to_a\n SELECT\n sub.subname::TEXT AS subscription_name,\n pg_database.datname::TEXT AS database_name,\n pg_user.usename::TEXT AS owner,\n COUNT(sub_stat.pid) AS worker_count,\n sub.subenabled AS enabled,\n sub.subconninfo AS subscription_dsn,\n sub.subslotname::TEXT AS slot_name,\n sub.subpublications AS publications,\n stat.remote_lsn::TEXT AS remote_replication_lsn,\n stat.local_lsn::TEXT AS local_replication_lsn\n FROM\n pg_subscription AS sub\n JOIN pg_user\n ON sub.subowner = usesysid\n JOIN pg_database\n ON sub.subdbid = pg_database.oid\n LEFT JOIN pg_replication_origin_status stat\n ON concat('pg_', sub.oid) = stat.external_id\n LEFT JOIN pg_stat_subscription sub_stat\n ON sub_stat.subid = sub.oid AND sub_stat.pid IS NOT NULL\n GROUP BY\n sub.subname,\n pg_database.datname,\n pg_user.usename,\n sub.subenabled,\n sub.subconninfo,\n sub.subslotname,\n sub.subpublications,\n stat.remote_lsn,\n stat.local_lsn\n SQL\n\n dbname ? subscriptions.select { |s| s[\"database_name\"] == dbname } : subscriptions\n end",
"def list_subscribed(&block)\n @driver.list_subscribed(&block)\n end",
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def list(filter)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('subscription', 'list', 'KalturaSubscriptionListResponse', 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 participants\n recipients\n end",
"def subscribers\r\n @subscribers.clone\r\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def subscribers\n store[name].map { |r| r.contents } \n end",
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n users = meeting.participants\n send_json(users)\n else\n send_error 401\n end\n end",
"def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end",
"def get_all_subscriptions(opts = {})\n data, _status_code, _headers = get_all_subscriptions_with_http_info(opts)\n return data\n end",
"def index\n @api_subscriptions = Api::Subscription.all\n end",
"def index\n @user_to_channel_subscriptions = UserToChannelSubscription.all\n end",
"def get_conversation_participants(id)\r\n #TODO: Test if this method needs data in options.\r\n @client.raw('get', \"/content/conversations/#{id}/participants\", nil, nil, @contact_v1_url)\r\n end",
"def index\n if params[:client_id].blank?\n @subscriptions = Subscription.all\n else\n @subscriptions = Client.find(params[:client_id]).subscriptions\n end\n end",
"def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end",
"def get_participants(id, params = {})\n get \"/api/v2/projects/#{id}/participants\", params\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def get_all_participants(params = {})\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}/participant\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end",
"def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end",
"def active_subscriptions\n subscriptions.select { |s| s.active? }.sort{|x,y| y.created_at <=> x.created_at} || []\n end",
"def get_subscribers who_uuid\n who_uuid = who_uuid.uuid if who_uuid.is_a?(Group)\n @groups.find_all{|group|group.member_uuids.find{|uuid|uuid == who_uuid}}\n end",
"def subscribers\n Hey::Subscriber.new api_token: api_token\n end",
"def index\n @subscribers = Subscriber.all\n end",
"def subscribed_subreddits(options = {})\n options = options.clone\n\n category = options[:category] or 'subscriber'\n path = \"subreddits/mine/#{category}.json\"\n options.delete :category\n\n objects_from_response(:get, path, options)\n end",
"def subscribers_for(event)\n @subscribers.select { |subscriber| subscriber.subscribed_to?(event) }\n end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def index\n @q = ::Pushar::Core::Subscription.unscoped.search(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @subscriptions = @q.result(distinct: true).page(params[:page]).per(50)\n end",
"def available_subscribed_to_resources\n subscribed = @user.subscribed_to_contacts.map {|c| c.jid }\n router.available_resources(subscribed)\n end",
"def subscriber(id_or_email)\n make_json_api_request :get, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def index\n @subscriptions = Subscription.all\n end",
"def index\n @subscriptions = Subscription.all\n end",
"def index\n @subscriptions = Subscription.all\n end",
"def user_subscriptions(user_id, options={})\n response = connection.get do |req|\n req.url \"/user/#{user_id}/subscriptions\", simple_params(options)\n end\n response.body\n end",
"def list_session_participants(account_id,\r\n session_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: decoded.map { |element| Participant.from_hash(element) }\r\n )\r\n end",
"def index\n @subscriptions = @user.subscriptions.order(updated_at: :desc)\n end",
"def subscriptions!\n @subscriptions = nil\n subscriptions\n end"
] | [
"0.73605067",
"0.7262282",
"0.7177072",
"0.71370053",
"0.70708144",
"0.7036096",
"0.7030234",
"0.6889275",
"0.687437",
"0.6863825",
"0.68365085",
"0.6836278",
"0.6778858",
"0.67383724",
"0.67221636",
"0.6709729",
"0.66607046",
"0.6650482",
"0.6644378",
"0.66291213",
"0.66198504",
"0.6591852",
"0.6587763",
"0.6587763",
"0.64337295",
"0.6433074",
"0.6425045",
"0.6373498",
"0.6356054",
"0.635487",
"0.6335644",
"0.6316331",
"0.6310277",
"0.6305862",
"0.6295685",
"0.6285922",
"0.6268558",
"0.6267936",
"0.6252172",
"0.6250857",
"0.6237011",
"0.619646",
"0.6177623",
"0.6168857",
"0.61675626",
"0.6165966",
"0.6151874",
"0.61315954",
"0.61246747",
"0.61112446",
"0.6092053",
"0.6089483",
"0.607826",
"0.60705936",
"0.6050514",
"0.60328954",
"0.60297054",
"0.60297054",
"0.602784",
"0.60242856",
"0.5994386",
"0.5983479",
"0.59696794",
"0.59672385",
"0.59540397",
"0.5922109",
"0.5902212",
"0.5897577",
"0.58945143",
"0.5893288",
"0.5884154",
"0.5873341",
"0.5853714",
"0.58424854",
"0.5838538",
"0.5802772",
"0.57931626",
"0.5777209",
"0.5777209",
"0.5764747",
"0.5753918",
"0.5750601",
"0.57485133",
"0.5714951",
"0.57118547",
"0.5705986",
"0.5700011",
"0.569708",
"0.569708",
"0.569708",
"0.5695635",
"0.56894183",
"0.56841964",
"0.56747735",
"0.56747735",
"0.56747735",
"0.5669955",
"0.5669649",
"0.5662497",
"0.56596506"
] | 0.73398226 | 1 |
Update a participant's subscriptions. This is a full update that will replace the participant's subscriptions. First call `getParticipantSubscriptions` if you need the current subscriptions. Call this function with no `Subscriptions` object to remove all subscriptions. | def update_participant_subscriptions(account_id,
session_id,
participant_id,
body: nil)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'
_query_builder = APIHelper.append_url_with_template_parameters(
_query_builder,
'accountId' => { 'value' => account_id, 'encode' => false },
'sessionId' => { 'value' => session_id, 'encode' => false },
'participantId' => { 'value' => participant_id, 'encode' => false }
)
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = config.http_client.put(
_query_url,
headers: _headers,
parameters: body.to_json
)
WebRtcBasicAuth.apply(config, _request)
_response = execute_request(_request)
# Validate response against endpoint and global error codes.
case _response.status_code
when 400
raise APIException.new(
'Bad Request',
_response
)
when 401
raise APIException.new(
'Unauthorized',
_response
)
when 403
raise APIException.new(
'Access Denied',
_response
)
when 404
raise APIException.new(
'Not Found',
_response
)
end
unless _response.status_code.between?(200, 208)
raise ErrorException.new(
'Unexpected Error',
_response
)
end
validate_response(_response)
# Return appropriate response type.
ApiResponse.new(_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_participant_subscriptions(account_id, session_id, participant_id, opts = {})\n update_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def update_subscriptions(opts = {})\n data, _status_code, _headers = update_subscriptions_with_http_info(opts)\n data\n end",
"def update_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.update_participant_subscriptions ...'\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 SessionsApi.update_participant_subscriptions\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.update_participant_subscriptions\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.update_participant_subscriptions\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:'subscriptions'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.update_participant_subscriptions\",\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: SessionsApi#update_participant_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def bulk_update_subscriptions(subscriptions = [])\n attrs = { updateSubscriptionsRequests: subscriptions }\n Iterable.request(conf, '/users/bulkUpdateSubscriptions').post(attrs)\n end",
"def get_participant_subscriptions(account_id,\r\n session_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: Subscriptions.from_hash(decoded)\r\n )\r\n end",
"def update_subscriptions(email, attrs = {})\n attrs['email'] = email\n Iterable.request(conf, '/users/updateSubscriptions').post(attrs)\n end",
"def update_contact_account_subscriptions\n accounts = params[:accounts]\n accounts_subscribing = params[:account_subscriptions].is_a?(Hash) ? params[:account_subscriptions].keys : []\n accounts_unsubscribing = accounts - accounts_subscribing\n accounts_unsubscribing.each do |a_id|\n Case_Watcher.remove_subscription!(current_contact.synced_record, \n :account => Sfaccount.find(a_id).synced_record )\n end\n redirect_to :controller => 'contact', :action => 'settings', \n :notice => \"Account subscriptions updated.\"\n end",
"def get_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SessionsApi.get_participant_subscriptions ...'\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 SessionsApi.get_participant_subscriptions\"\n end\n # verify the required parameter 'session_id' is set\n if @api_client.config.client_side_validation && session_id.nil?\n fail ArgumentError, \"Missing the required parameter 'session_id' when calling SessionsApi.get_participant_subscriptions\"\n end\n # verify the required parameter 'participant_id' is set\n if @api_client.config.client_side_validation && participant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'participant_id' when calling SessionsApi.get_participant_subscriptions\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(session_id.to_s)).sub('{' + 'participantId' + '}', CGI.escape(participant_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Subscriptions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"SessionsApi.get_participant_subscriptions\",\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: SessionsApi#get_participant_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def modify_subscriptions(subs)\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',{:node => node_id},\n subs.map do |s|\n x('subscription',:jid => s.jid, :subscription => s.subscription, :subid => s.sub_id)\n end\n )\n )\n )\n send_iq_stanza_fibered iq\n end",
"def destroy\n @subscriptions = []\n\n # query parameter with the ids of all the necessarily deleted subscriptions\n subscription_id_string = params[:subscription][:subscriptions]\n\n # converts the query parameter string into an array. Query parameter gets sent like this \"[1,2,3]\"\n all_ids = subscription_id_string[subscription_id_string.index(\"[\") + 1, subscription_id_string.index(\"]\") - 1].split(\",\")\n\n # for each id in the array of ids, find the Subscription with that id, add it to the array of deleted subscriptions\n # for the view, and then destroy the subscription\n all_ids.each do |id|\n this_subscription = Subscription.find(id)\n @subscriptions << this_subscription\n\n # decrement subscription count of corresponding dept/club/team\n if this_subscription.category == \"department\"\n dept = Department.find(this_subscription.subscribed_to)\n dept.subscriber_count -= 1\n dept.save\n elsif this_subscription.category == \"club\"\n club = Club.find(this_subscription.subscribed_to)\n club.subscriber_count -= 1\n club.save\n else\n team = AthleticTeam.find(this_subscription.subscribed_to)\n team.subscriber_count -= 1\n team.save\n end\n\n this_subscription.destroy\n end\n end",
"def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end",
"def subscriptions!\n @subscriptions = nil\n subscriptions\n end",
"def get_participant_subscriptions(account_id, session_id, participant_id, opts = {})\n data, _status_code, _headers = get_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts)\n data\n end",
"def update_subscriptions_from_account \n contacts = params[:contacts]\n contacts_subscribing = params[:subscribers].is_a?(Hash) ? params[:subscribers].keys : []\n contacts_unsubscribing = params[:contacts] - contacts_subscribing\n \n # subscribe these contacts\n contacts_subscribing.each do |c_id|\n begin\n Case_Watcher.create_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't create subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n\n # unsubscribe these contacts\n contacts_unsubscribing.each do |c_id|\n begin\n Case_Watcher.remove_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't remove subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n \n redirect_to :action => 'account', :id => @account, :notice => \"Account subscriptions updated.\"\n end",
"def update_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StreamsApi.update_subscriptions ...'\n end\n # resource path\n local_var_path = '/users/me/subscriptions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'delete'] = @api_client.build_collection_param(opts[:'delete'], :multi) if !opts[:'delete'].nil?\n query_params[:'add'] = @api_client.build_collection_param(opts[:'add'], :multi) if !opts[:'add'].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] || 'JsonSuccessBase'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"StreamsApi.update_subscriptions\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StreamsApi#update_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_subscription\n # Only change the subscription if the models email\n # address has been changed.\n self.class.list_manager.update_subscription(self.email_was, self.email, campaignable_additional_fields) if self.email_changed?\n end",
"def update\n @subscription = Subscription.get(params[:id])\n @subscription.update(params[:subscription])\n respond_with(@subscription.reload)\n end",
"def update\n\t\t@subscription = Subscription.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tif @subscription.update_attributes(params[:subscription])\n\t\t\t\tflash[:notice] = 'Subscription was successfully updated.'\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def service_subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscriptions')\n )\n )\n send_iq_stanza_fibered iq\n end",
"def subscriptions\n # subscriber entries are embedded in subscriptions inside of an\n # org. We'll flip this, so that we only return subscriber entries\n # for the account\n orgs = Org.all(:conditions=>{ \"subscriptions.subscribers.account_id\"=> self.id})\n subscribers = []\n orgs.each do |org|\n org.subscriptions.each do |subscription|\n subscribers += subscription.subscribers.select { |subscriber| subscriber.account_id.to_s == self.id.to_s }\n end\n end\n subscribers.flatten!\n subs = []\n subscribers.each do |subscriber|\n subscript = subscriber.subscription\n org = subscript.org\n subs << AccountSubscription.new(org.id.to_s, org.name, subscript.product, subscript.billing_level, subscriber.role)\n end\n subs\n end",
"def subscriptions\n @subscriptions ||= get_roster || {}\n end",
"def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end",
"def show_subscriptions\n puts \"\\nYour current subscriptions are:\"\n @user.subscriptions.reload.each do |sub|\n puts sub.name\n end\n end",
"def set_active_subscriptions_paid!\r\n self.subscriptions.all { |sub| sub.pay! }\r\n end",
"def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def update\n \n # TODO: Modify subscription (refund remainder of current, prorate new)\n \n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to subscriptions_url, success: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n format.js { redirect_to subscriptions_url, :format => :html, success: 'Subscription was successfully updated.' }\n else\n format.html { render action: 'edit' }\n format.js { render action: 'edit' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sync_subscriptions(**options)\n subscriptions = ::Stripe::Subscription.list(options.merge(customer: customer), stripe_options)\n subscriptions.map do |subscription|\n Pay::Stripe::Subscription.sync(subscription.id)\n end\n rescue ::Stripe::StripeError => e\n raise Pay::Stripe::Error, e\n end",
"def delete_subscriptions\n end",
"def subscriptions\n @subscriptions ||= {}\n end",
"def subscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Subscribed\", params: params)\n end",
"def perform(subscription_ids)\n return if subscription_ids.empty?\n\n subscriptions = SolidusSubscriptions::Subscription.where(id: subscription_ids)\n subscriptions.each do |subscription|\n subscription.remind!\n end\n\n subscriptions\n end",
"def create / update_subscriptions\n end",
"def subscriptions\n @subscriptions ||= Hash.new do |subscriptions, channel|\n # Setup the hash to generate subscriptions that can delete themselves from\n # their own collection on an unsubscription event.\n subscription = Subscription.new(self, channel)\n subscription.on_unsubscribe do\n # Remove the subscription from the consumer.subscriptions \n # list when unsubscribe.\n subscriptions.delete channel\n end\n subscriptions[channel] = subscription\n end\n end",
"def subscriptions\n @subscriptions ||= begin\n resp = @client.access_token.get('/reader/api/0/subscription/list?output=json')\n raise \"unable to retrieve the list of subscription for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['subscriptions'].collect do |hash|\n Google::Reader::Subscription.new(hash.merge({:client => @client}))\n end\n end\n end",
"def subscriptions()\n return MicrosoftGraph::Subscriptions::SubscriptionsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end",
"def update!(**args)\n @subscriptions = args[:subscriptions] unless args[:subscriptions].nil?\n @next_page_token = args[:next_page_token] unless args[:next_page_token].nil?\n end",
"def update!(**args)\n @subscriptions = args[:subscriptions] unless args[:subscriptions].nil?\n @next_page_token = args[:next_page_token] unless args[:next_page_token].nil?\n end",
"def update_subscriptions_from_case\n contacts = params[:contacts]\n contacts_subscribing = params[:subscribers].is_a?(Hash) ? params[:subscribers].keys : []\n contacts_unsubscribing = params[:contacts] - contacts_subscribing\n \n logger.info \"Found #{contacts_subscribing.size} subscribing\"\n logger.info \"Found #{contacts_unsubscribing.size} unsubscribing\"\n \n # subscribe these contacts\n contacts_subscribing.each do |c_id|\n begin\n Case_Watcher.create_subscription!(Contact.find(c_id), \n :support_case => Sfcase.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't remove subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n if contacts_unsubscribing.any?\n logger.info(\"[CASE WATCHER] Removing subscription for: #{contacts_unsubscribing.join(',')}\")\n end\n # unsubscribe these contacts\n contacts_unsubscribing.each do |c_id|\n begin\n Case_Watcher.remove_subscription!(Contact.find(c_id), \n :support_case => Sfcase.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't remove subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n redirect_to :action => 'case', :id => @case, :notice => \"CR subscriptions updated.\"\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end",
"def update\n response = begin\n CoachClient::Request.get(url, username: @user1.username,\n password: @user1.password)\n rescue CoachClient::Exception\n CoachClient::Request.get(url, username: @user2.username,\n password: @user2.password)\n end\n response = response.to_h\n @id = response[:id]\n @datecreated = response[:datecreated]\n @publicvisible = response[:publicvisible]\n set_user_confirmed(response)\n @subscriptions = []\n unless response[:subscriptions].nil?\n response[:subscriptions].each do |s|\n sport = s[:uri].match(/\\/(\\w+)\\/\\z/).captures.first\n @subscriptions << CoachClient::PartnershipSubscription.new(client, self,\n sport)\n end\n end\n self\n end",
"def update_newsletter_subscription!\n return unless self.user.present?\n\n if self.receives_newsletter?\n NewsletterSubscriptionsWorker.perform_async(:subscribe, self.user.email)\n else\n NewsletterSubscriptionsWorker.perform_async(:unsubscribe, self.user.email)\n end\n end",
"def update_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:put, path, query_params, form_params, headers)\n response\n \n\n end",
"def update_subscription(old_email, new_email, merge_vars={})\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def update_contact_case_subscriptions\n cases = params[:cases]\n cases_subscribing = params[:case_subscriptions].is_a?(Hash) ? params[:case_subscriptions].keys : []\n cases_unsubscribing = cases - cases_subscribing\n\n cases_unsubscribing.each do |c_id|\n Case_Watcher.remove_subscription!(current_contact.synced_record, \n :support_case => Sfcase.find(c_id).synced_record )\n end\n redirect_to :controller => 'contact', :action => 'settings', \n :notice => \"Cases subscriptions updated.\"\n end",
"def update!(**args)\n @pubsub_subscription = args[:pubsub_subscription] if args.key?(:pubsub_subscription)\n end",
"def subscriptions\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Subscription)\n end",
"def update_recurring(options = {})\n requires!(options, :subscription_id)\n request = build_recurring_request(:update, options)\n recurring_commit(:update, request)\n end",
"def update_subscription(old_email, new_email, merge_vars={})\n # Update the existing member details.\n api.lists(@campaignable_list_id).members(subscriber_hash(old_email)).update(body: {\n :email_address => new_email,\n :status => \"subscribed\",\n :merge_fields => prep_merge_fields(merge_vars) # Include additional variables to be stored.\n })\n end",
"def update_stripe_subscription(options = {})\n Stripe::Subscription.update(\n stripe_id, options, owner.stripe_options\n )\n end",
"def get_subscriptions(opts = {})\n data, _status_code, _headers = get_subscriptions_with_http_info(opts)\n return data\n end",
"def update\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remove_subscriptions(subscriptions)\n lightstreamer_subscriptions = Array(subscriptions).compact.map(&:lightstreamer_subscription)\n\n return if lightstreamer_subscriptions.empty?\n\n @lightstreamer.remove_subscriptions lightstreamer_subscriptions\n end",
"def subscribe_to_updates\n if @subscription = @requestor.find_or_create_subscriptions(@target.id)\n @subscription.update_attributes(blocked: false) if @subscription.blocked?\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to subscriber updates, please try again'}, status: 202\n end\n end",
"def subscriptions(page = 1)\n Dropio::Resource.client.subscriptions(self, page)\n end",
"def update\n @subscription = Subscription.find(params[:id])\n\n if @subscription.update(subscription_params)\n head :no_content\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end",
"def subscribe_teachers\n self.indicated_teachers.each do |teacher|\n self.subscriptions.create user_id: teacher.id\n end\n end",
"def update\n bundle_subscriptions = create_bundle_subs\n if BundleSubscription.import(bundle_subscriptions)\n @bundle.bundle_subscriptions.where.not(id: bundle_subscriptions).destroy_all\n redirect_to @bundle, notice: 'Bundle was successfully updated.'\n else\n edit\n flash[:alert] = 'Something went wrong while updating your bundle. Please try again.'\n render :edit and return\n end\n end",
"def list_subscriptions(options = {})\n api.graph_call(subscription_path, {}, \"get\", options)\n end",
"def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end",
"def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end",
"def get_subscribers\n @subscriptions = subscribers(@nodename)\n end",
"def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end",
"def subscriptions\n\t\t@subscriptions = current_user.customer.subjects\n\tend",
"def subscriptions_reset\n self.subscriptions = Subscription.defaults\n end",
"def update\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(manage_screen_field_subscriptions_path(@screen, @field), :notice => t(:subscription_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def update\n content = get_content('email_notifications.yml')\n user = User.where(unsubscription_token: params[:unsubscription_token]).first\n\n unless user\n flash[:error] = \"Could not find user\"\n redirect_to root_path and return\n end\n\n user.subscriptions.update_all(unsubscribe_reason: reason_param)\n\n render 'email_notifications/update', layout: 'notification', status: :accepted, locals: {\n content: content['update'],\n }\n end",
"def update_subscription(subscription_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def unsubscribe_subscribers(subscribers)\n url = \"v2/#{account_id}/unsubscribes/batches\"\n make_json_api_request :post, url, private_generate_resource(\"batches\", { \"subscribers\" => subscribers })\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def refresh\n puts \" -- refresh subscriptions(#{@subscriptions.size}):\"\n\n run_callback_server # call it once to make sure it runs\n \n @subscriptions.each do |sub| \n puts \" - #{sub.name}\"\n params = { \"attributes[accept]\" => 'application/json' }\n\n query = \"/gnp;#{sub.name};#{sub.entry_uri}\"\n params[\"attributes[callback_url]\"] = \"#{callback_server.base_url}#{query}\"\n\n [:operations, :uri_regexp, :condition_script].each do |key|\n (v = sub.send key) and params[\"attributes[#{key}]\"] = v\n end\n\n url = \"#{@target_url}#{sub.uri}.xml\"\n http_put(url, params) # {|req| req.content_type = 'application/xml'}\n end\n end",
"def unsubscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Unsubscribed\", params: params)\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @subscriptions = args[:subscriptions] if args.key?(:subscriptions)\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @subscriptions = args[:subscriptions] if args.key?(:subscriptions)\n end",
"def subscribers\n @subscribers ||= ActsAsIcontact::Subscription.contacts(:listId => id)\n end",
"def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end",
"def update\n @panel_subscription = Panel::Subscription.find(params[:id])\n respond_to do |format|\n if @panel_subscription.update_attributes(params[:panel_subscription])\n format.html { redirect_to(@panel_subscription, :notice => 'Subscription was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end",
"def subscribe(email, campaign_id, options = {})\n data = options.merge(\"email\" => email)\n url = \"v2/#{account_id}/campaigns/#{campaign_id}/subscribers\"\n make_json_api_request :post, url, private_generate_resource(\"subscribers\", data)\n end",
"def update_subscription(subscription_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/subscriptions/{subscription_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'subscription_id' => { 'value' => subscription_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def upsert_subscription(entity, subscription_params)\n raise \"'#{entity.name}' has no Stripe Account\" if entity.stripe_customer_id.blank?\n\n customer = get_stripe_customer(entity.try(:stripe_customer_id))\n raise \"'#{entity.name}' has no Stripe Account\" if customer.nil?\n raise \"Stripe account for '#{entity.name}' is deleted\" if customer.try(:deleted) == true\n raise \"'#{entity.name}' has no default payment method in Stripe\" if customer.try(:default_source).blank? && subscription_params[:source].blank?\n\n # Initialize 'subscription not found' state\n subscription = nil\n\n # Gather data\n submission_data = {\n plan: subscription_params[:plan],\n metadata: {\n \"lo_entity_id\" => entity.id,\n \"lo_entity_type\" => entity.class.name.underscore,\n \"lo_entity_name\" => entity.name\n }\n }\n # Stripe uses the default card if one exists, making this value optional\n submission_data[:source] = subscription_params[:source] if subscription_params[:source].present?\n\n # Stripe complains if you pass an empty coupon. Only add it if it exists\n submission_data[:coupon] = subscription_params[:coupon] if subscription_params[:coupon].present?\n\n customer.subscriptions.data.each do |sub|\n # If an existing subscription matches the current data...\n if sub.plan.id == subscription_params[:plan]\n # ...then update the subscription:\n subscription = customer.subscriptions.retrieve(sub.id)\n subscription.plan = submission_data[:plan]\n subscription.source = submission_data[:source] if submission_data[:source].present?\n subscription.coupon = submission_data[:coupon] if submission_data[:coupon].present?\n subscription.save\n\n else\n # Otherwise delete it:\n customer.subscriptions.retrieve(sub.id).delete\n end\n end\n\n # If no matching subscription was found...\n if subscription.nil?\n # ...just create one\n subscription = customer.subscriptions.create(submission_data)\n end\n\n subscription\n end",
"def destroy\n subscribers.each do |name, subscriber|\n subscriber.destroy\n end\n end",
"def subscribers\r\n @subscribers.clone\r\n end",
"def update\n @subscription = Subscription.by_user_channel_ids(current_user.id, params[:channel_id])\n\n respond_to do |format|\n if @subscription and @subscription.update_attributes(params[:subscription])\n @channel = Channel.find(params[:channel_id])\n format.html { redirect_to @subscription, notice: I18n.t('subscription_updated') }\n format.json { render json: { name: @channel.subscription_name(current_user) }, status: :ok}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionApi.get_subscriptions ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 10000000.'\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 SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/subscription\"\n\n # query parameters\n 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[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] 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/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 => 'SubscriptionSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionApi#get_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_subscriber_list\n @mandrill = Mandrill::API.new 'nDSi_tYPhOy6QpG8Kn_lqg'\n @subscriber_list = User.where(isSubscribed: true)\n end",
"def update_recurrent_subscriptions\n notification_type_subscriptions.recurrent.each do |recurrent_subscription| \n recurrent_subscription.recurrence.update_attributes(:starts_at => ActiveSupport::TimeZone[timezone].parse(\"#{Date.today.to_s} #{recurrent_subscription.notification_type.constantize.time}\"))\n end\n end",
"def pay_active_subscriptions!\n\t\t# puts \"PAY_ACITVE_SUBSCRIPTIONS 1, center: #{@center.inspect} subs: #{@center.subscriptions.size} #{@center.subscriptions.inspect}\"\n result = @center.subscriptions.map { |sub|\n\t\t\t# puts \"SUB_SERVICE: pay #{sub.inspect}\"\n\t \t\tsub.pay! }\n\t\t# puts \"PAY_ACTIVE_SUBSCRIPTIONS result: #{result.inspect}\"\n end",
"def subscribe\n\t if !self_owned? && !subscribed?\n\t\towners.each do |peer|\n\t\t peer.subscribe(self) unless peer.subcribed?(self)\n\t\tend\n\t end\n\tend",
"def add_subscription(entity)\r\n subscriptions << entity\r\n end",
"def update\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end",
"def subscribe(recipient)\n subscription = subscriptions.find_or_initialize_by(recipient: recipient)\n return unless subscription.new_record?\n subscription.save\n subscription\n end",
"def list_session_participants(account_id,\r\n session_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: decoded.map { |element| Participant.from_hash(element) }\r\n )\r\n end",
"def delete_subscriptions(jids,subids=nil)\n jids = [jids].flatten\n subids = [subids].flatten\n subs = jids.zip(subids).map{|jid,subid| EM::Xmpp::Context::Contexts::PubsubMain::Subscription.new(jid, nil, 'none', subid, nil)}\n modify_subscriptions subs\n end",
"def subscribe_to_topic_courses(course_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/discussion_topics/{topic_id}/subscribed\",\n :course_id => course_id,\n :topic_id => topic_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"
] | [
"0.7673749",
"0.7155982",
"0.67502654",
"0.6652334",
"0.6607356",
"0.6371448",
"0.624291",
"0.62138253",
"0.6094653",
"0.6083461",
"0.60051227",
"0.60031813",
"0.5951139",
"0.58575505",
"0.5813624",
"0.5774981",
"0.57129824",
"0.56561977",
"0.5618912",
"0.5617216",
"0.55555254",
"0.5548084",
"0.55430686",
"0.5511632",
"0.55035377",
"0.54878044",
"0.5478938",
"0.5450823",
"0.54398125",
"0.5428711",
"0.540613",
"0.5398119",
"0.5389526",
"0.5386976",
"0.53757423",
"0.5372196",
"0.53717136",
"0.53717136",
"0.53669137",
"0.53669137",
"0.5354921",
"0.53475",
"0.5326798",
"0.5313263",
"0.5312256",
"0.530356",
"0.52649146",
"0.5259894",
"0.525527",
"0.5254428",
"0.52513903",
"0.52500784",
"0.5186653",
"0.5179323",
"0.5152619",
"0.5125431",
"0.5101353",
"0.509557",
"0.5079989",
"0.5069407",
"0.5063887",
"0.5062355",
"0.5062302",
"0.503641",
"0.50354713",
"0.5031235",
"0.5023151",
"0.5011494",
"0.4979932",
"0.49700004",
"0.49580285",
"0.49437484",
"0.49338332",
"0.49310207",
"0.49298865",
"0.4928751",
"0.49286523",
"0.49286523",
"0.49099293",
"0.49093825",
"0.48990062",
"0.4894029",
"0.48917773",
"0.489099",
"0.4880294",
"0.48795334",
"0.48753986",
"0.48745656",
"0.48742977",
"0.4872203",
"0.4864723",
"0.48630458",
"0.4859056",
"0.48517907",
"0.48484886",
"0.48340303",
"0.48326838",
"0.4831129",
"0.4826389",
"0.48191488"
] | 0.731687 | 1 |
GET /computers GET /computers.json | def index
if signed_in?
@computers = current_user.computers.all.decorate
@computer = current_user.computers.new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n \t\tuser = User.find(current_user.id)\n \t @computers = user.computer.all\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def index\n @computers = Computer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @computers }\n end\n end",
"def index\r\n @product_machines = ProductMachine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_machines }\r\n end\r\n end",
"def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end",
"def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end",
"def machines\n api_execute(version_prefix + '/machines', :get).body.split(',').map(&:strip)\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n @devices = Device.all.includes(:browsers)\n json_response(@devices, :ok, [:browsers])\n end",
"def index\n @computadors = Computador.all\n end",
"def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end",
"def machines\n connect unless connected?\n client.list_machines['node']['nodes'].map { |machine|\n machine['nodes'].map { |machine_node|\n JSON.parse(machine_node['value'])\n }\n }.flatten\n end",
"def machines\n response = request(:get, @machines_uri)\n response.body.split(MACHINES_SEPARATOR_RE)\n end",
"def get_computer(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/computers/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n @computers_chipsets = ComputersChipset.all\n end",
"def index\n @computers = Computer.all.where(operational: true).order(:name).paginate(page: params[:page], per_page: 10 )\n #@computers = Computer.all.order(:name).paginate(page: params[:page], per_page: 10 ) ORIGINAL\n end",
"def index\n json_response(@device.browsers)\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def index\n @computers_activities = ComputersActivity.all\n end",
"def get_domain_computers()\n\t\tcomputer_list = []\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net view\").split(devisor)[1]\n\t\tif raw_list =~ /The command completed successfully/\n\t\t\traw_list.sub!(/The command completed successfully\\./,'')\n\t\t\traw_list.gsub!(/\\\\\\\\/,'')\n\t\t\traw_list.split(\" \").each do |m|\n\t\t\t\tcomputer_list << m\n\t\t\tend\n\t\tend\n\n\t\treturn computer_list\n\tend",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def index\n @computers_keyboards = ComputersKeyboard.all\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"def index\n @hostel_rooms = HostelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hostel_rooms }\n end\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n if params[:printer_type].present?\n @printers = Printer.where(printer_type: params[:printer_type])\n else\n @printers = Printer.all\n end\n\n render json: @printers\n end",
"def physicians\n physicians = User.physicians\n render json: { status: 200, data: physicians }\n end",
"def show\n @algorithm = Algorithm.find(params[:id])\n @available_computers = Computer.all.reject {|computer| @algorithm.computers.include?(computer)}\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @algorithm }\n end\n end",
"def index\n @devices = Device.all\n render json: @devices\n end",
"def index\n @macs = Mac.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @macs }\n end\n end",
"def index\n @computers_quests = ComputersQuest.all\n end",
"def index\n @computer_geometries = ComputerGeometry.all\n end",
"def index\n @phones = Phone.all\n json_response(@phones)\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def index\n\t\t@people = People.all\n\t\t#render json: \"test\"\n\t\tresponse = @people\n\t\trender json: response\n\t\treturn response\n\tend",
"def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def index\n @cpus = Cpu.all\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @computer }\n end\n end",
"def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end",
"def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend",
"def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end",
"def index\n @papers = Paper.all\n\n render json: @papers\n end",
"def index\n @clients = Client.all\n render json: @clients\n end",
"def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end",
"def index\n @programmes = Programme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programmes }\n end\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def show\r\n @machine = Machine.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end",
"def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index\n @tailors = Tailor.all\n respond_to do |format|\n format.html\n format.json { render json: @tailors}\n end\n end",
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def index\n @computer_allocations = ComputerAllocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @computer_allocations }\n end\n end",
"def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end",
"def index\n respond_to do |format|\n format.html { @chefs = Chef.all }\n format.json { @chefs = Chef.order(:name) }\n end\n end",
"def show\n @compute_node = ComputeNode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compute_node }\n end\n end",
"def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end",
"def index\n respond_with Celeb.all\n end",
"def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\r\n @product_machine = ProductMachine.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @product_machine }\r\n end\r\n end",
"def list_machines\n machines = Machine.all\n machines.each do |machine|\n puts \"#{machine.serial_number}, #{machine.description} (#{machine.building.name})\"\n end\nend",
"def index\n @cpu_miners = CpuMiner.page(params[:page]).per(CpuMiner::PER_PAGE)\n end",
"def show\n render json: @elector\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\n end",
"def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end",
"def index\n @machine_infos = MachineInfo.all\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end",
"def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end",
"def index\n @page = params[:page].nil? ? 1 : params[:page].to_i\n @page_max = Host.count / PAGE_SIZE\n @all_hosts = Host.order('name ASC')\n @count = @all_hosts.count\n @hosts = @all_hosts.offset((@page - 1) * PAGE_SIZE).limit(PAGE_SIZE)\n\n respond_to do |format|\n format.html\n format.json { render json: @all_hosts.to_json }\n end\n end",
"def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end",
"def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end",
"def index\n @customers = @user.customers.all\n render json: @customers\n end"
] | [
"0.67311513",
"0.66616935",
"0.66616935",
"0.64807296",
"0.6431978",
"0.64173335",
"0.62085265",
"0.61089754",
"0.6072001",
"0.5942813",
"0.5939837",
"0.58973014",
"0.58893174",
"0.58778757",
"0.5870756",
"0.58282804",
"0.58281624",
"0.581224",
"0.581224",
"0.58016986",
"0.58016986",
"0.57852226",
"0.57762426",
"0.5773061",
"0.5751319",
"0.5669443",
"0.5643443",
"0.5636159",
"0.55737585",
"0.5566606",
"0.55470777",
"0.5500971",
"0.55006695",
"0.54951495",
"0.5494247",
"0.5488849",
"0.5486088",
"0.54629385",
"0.54561317",
"0.5449573",
"0.5441071",
"0.5431252",
"0.5415226",
"0.5415226",
"0.5415226",
"0.5415226",
"0.54107827",
"0.539548",
"0.5393878",
"0.5387858",
"0.53806734",
"0.53791",
"0.5378778",
"0.537479",
"0.536816",
"0.53546715",
"0.53509176",
"0.5346717",
"0.5346717",
"0.5346541",
"0.53410625",
"0.533763",
"0.5329445",
"0.5327927",
"0.5326503",
"0.5325945",
"0.5324068",
"0.53215027",
"0.53128",
"0.53078127",
"0.530462",
"0.52883226",
"0.5286619",
"0.52839357",
"0.5282976",
"0.5280943",
"0.52806836",
"0.5279581",
"0.5277118",
"0.52759314",
"0.52749634",
"0.5270176",
"0.52694196",
"0.5261133",
"0.52602065",
"0.52595407",
"0.5259391",
"0.5250689",
"0.52493715",
"0.5246382",
"0.52430916",
"0.52325547",
"0.5229677",
"0.52254504",
"0.5225025",
"0.52249223",
"0.5221289",
"0.5219819",
"0.52188003",
"0.5215762"
] | 0.62725574 | 6 |
GET /computers/1 GET /computers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def get_computer(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/computers/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end",
"def list\n \t\tuser = User.find(current_user.id)\n \t @computers = user.computer.all\n end",
"def index\n @computers = Computer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @computers }\n end\n end",
"def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end",
"def index\r\n @product_machines = ProductMachine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_machines }\r\n end\r\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def index\n if signed_in?\n @computers = current_user.computers.all.decorate\n @computer = current_user.computers.new\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\r\n @machine = Machine.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end",
"def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end",
"def show\r\n @product_machine = ProductMachine.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @product_machine }\r\n end\r\n end",
"def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end",
"def show\n @compute_node = ComputeNode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compute_node }\n end\n end",
"def show\n @core_machine = Core::Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_machine }\n end\n end",
"def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end",
"def show\n @m_machine_number = MMachineNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_machine_number }\n end\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @computer }\n end\n end",
"def show\n @host = Host.find(params[:id])\n\n render json: @host\n end",
"def index\n json_response(@device.browsers)\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def index\n @devices = Device.all.includes(:browsers)\n json_response(@devices, :ok, [:browsers])\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def index\n @computadors = Computador.all\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end",
"def machines\n api_execute(version_prefix + '/machines', :get).body.split(',').map(&:strip)\n end",
"def index\n @computers = Computer.all.where(operational: true).order(:name).paginate(page: params[:page], per_page: 10 )\n #@computers = Computer.all.order(:name).paginate(page: params[:page], per_page: 10 ) ORIGINAL\n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_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 my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end",
"def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end",
"def index\n @computers_chipsets = ComputersChipset.all\n end",
"def index\n @cpus = Cpu.all\n end",
"def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def show\n @comp = Comp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comp }\n end\n end",
"def show\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def show\n @host = Host.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @host }\n end\n end",
"def index\n @macs = Mac.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @macs }\n end\n end",
"def show\n @user = User.find(params[:id])\n @machine = @user.current_machine\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 @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def show\n @algorithm = Algorithm.find(params[:id])\n @available_computers = Computer.all.reject {|computer| @algorithm.computers.include?(computer)}\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @algorithm }\n end\n end",
"def show\n @comp_info = CompInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comp_info }\n end\n end",
"def show\n @mac = Mac.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mac }\n end\n end",
"def show\n @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @precious_metal }\n end\n end",
"def show\n @hostela = Hostela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hostela }\n end\n end",
"def show\n @communication = Communication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @communication }\n end\n end",
"def show\n @local_cpu_summary = LocalCpuSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @local_cpu_summary }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint }\n end\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def show\n @physical_disk = PhysicalDisk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @physical_disk }\n end\n end",
"def machines\n response = request(:get, @machines_uri)\n response.body.split(MACHINES_SEPARATOR_RE)\n end",
"def index\n @devices = Device.all\n render json: @devices\n end",
"def index\n @computers_activities = ComputersActivity.all\n end",
"def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end",
"def index\n @machine_infos = MachineInfo.all\n end",
"def show\n @compra = Compra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compra }\n end\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end",
"def new\r\n @machine = Machine.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end",
"def list_machines\n machines = Machine.all\n machines.each do |machine|\n puts \"#{machine.serial_number}, #{machine.description} (#{machine.building.name})\"\n end\nend",
"def machines\n connect unless connected?\n client.list_machines['node']['nodes'].map { |machine|\n machine['nodes'].map { |machine_node|\n JSON.parse(machine_node['value'])\n }\n }.flatten\n end",
"def show\n @ip = Ip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end",
"def info\n CouchRest.get \"#{@uri}/\"\n end",
"def find_available_node\n node_name=nil\n nodes = JSON.parse http_get(@node_list_endpoint)\n nodes[\"computer\"].each do |i|\n if i[\"offline\"]\n node_name=i[\"displayName\"]\n break\n end\n end\n\n return node_name\nend",
"def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end",
"def set_computer\n @computer = Computer.find(params[:id])\n end",
"def set_computer\n @computer = Computer.find(params[:id])\n end",
"def set_computer\n @computer = Computer.find(params[:id])\n end",
"def find_available_node\n node_name=nil\n nodes = JSON.parse http_get(@node_list_end_point)\n nodes[\"computer\"].each do |i|\n if i[\"offline\"]\n node_name=i[\"displayName\"]\n break\n end\n end\n\n return node_name\nend",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\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 show\r\n\r\n\r\n @account = Account.find(params[:id])\r\n @workers = @account.workers\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @account }\r\n end\r\n end",
"def show\n @intern = Intern.find(params[:id])\n @internships = Internship.where(intern_id: @intern.id)\n respond_to do |format|\n format.html #show.html.erb\n format.json { render json: @intern }\n end\n end",
"def index\n if params[:printer_type].present?\n @printers = Printer.where(printer_type: params[:printer_type])\n else\n @printers = Printer.all\n end\n\n render json: @printers\n end",
"def show\n @ip = @customer.ips.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end",
"def show\n @equipment = Equipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end",
"def show\n @meteor = Meteor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meteor }\n end\n end",
"def show\n @virtualmachines = Virtualmachine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @virtualmachines }\n end\n end",
"def index\n\n @virtualmachines = Virtualmachine.all\n\n end",
"def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end",
"def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end",
"def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end",
"def show\n @compliment = Compliment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compliment }\n end\n end",
"def show\n @system = System.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system }\n end\n end",
"def show\n @termin = Termin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @termin }\n end\n end",
"def index\n @computer_geometries = ComputerGeometry.all\n end",
"def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end"
] | [
"0.6924024",
"0.6924024",
"0.6357132",
"0.63052154",
"0.61541355",
"0.6121647",
"0.6106257",
"0.61024415",
"0.60811013",
"0.6075338",
"0.6075338",
"0.5999612",
"0.59883416",
"0.59883416",
"0.59883416",
"0.59883416",
"0.5907304",
"0.58208865",
"0.5792714",
"0.576821",
"0.5749698",
"0.57398164",
"0.5708659",
"0.5706503",
"0.5685901",
"0.56850564",
"0.56850564",
"0.55836165",
"0.55777395",
"0.55721897",
"0.55664355",
"0.55626965",
"0.55578315",
"0.55578315",
"0.55472577",
"0.5506059",
"0.5498838",
"0.54888576",
"0.5459403",
"0.54586685",
"0.5458233",
"0.54544216",
"0.54464674",
"0.54355943",
"0.5434598",
"0.5427682",
"0.54177535",
"0.53905517",
"0.53783804",
"0.5368908",
"0.53566647",
"0.53432274",
"0.5333568",
"0.5333104",
"0.5319224",
"0.53180015",
"0.5303252",
"0.52969956",
"0.52944165",
"0.52829736",
"0.5280062",
"0.5275254",
"0.5269663",
"0.52579135",
"0.52477944",
"0.52468926",
"0.5246813",
"0.5246809",
"0.52437824",
"0.522552",
"0.5214246",
"0.5213215",
"0.52088046",
"0.52031666",
"0.5197662",
"0.51918656",
"0.5191218",
"0.5189065",
"0.5189065",
"0.5189065",
"0.5181915",
"0.5173882",
"0.5170388",
"0.5164586",
"0.5157045",
"0.5154709",
"0.51512",
"0.5148939",
"0.5143994",
"0.51431143",
"0.51396036",
"0.5139304",
"0.5133163",
"0.5131818",
"0.5126533",
"0.5125451",
"0.5122112",
"0.5121472",
"0.5120854",
"0.5120827",
"0.5116055"
] | 0.0 | -1 |
POST /computers POST /computers.json | def create
@computer = current_user.computers.new(computer_params)
respond_to do |format|
if @computer.save
current_user.add_role :owner, @computer
format.html { redirect_to computers_path, notice: t('computer.created') }
format.json { render action: 'show', status: :created, location: @computer }
else
format.html { render action: 'new' }
format.json { render json: @computer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @computer = Computer.new(params[:computer])\n\n respond_to do |format|\n if @computer.save\n format.html { redirect_to @computer, notice: 'Computer was successfully created.' }\n format.json { render json: @computer, status: :created, location: @computer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @computer = Computer.new(params[:computer])\n\n respond_to do |format|\n if @computer.save\n format.html { redirect_to @computer, notice: 'Computer was successfully created.' }\n format.json { render json: @computer, status: :created, location: @computer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @computer = Computer.new(computer_params)\n upsme\n respond_to do |format|\n if @computer.save\n set_me\n format.html { redirect_to @computer, notice: 'Computadora fue creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @computer }\n else\n format.html { render :new }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def create\n @computador = Computador.new(computador_params)\n\n respond_to do |format|\n if @computador.save\n format.html { redirect_to @computador, notice: 'Computador was successfully created.' }\n format.json { render :show, status: :created, location: @computador }\n else\n format.html { render :new }\n format.json { render json: @computador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def computer_params\n params.require(:computer).permit(:name)\n end",
"def create\n @computers_quest = ComputersQuest.new(computers_quest_params)\n\n respond_to do |format|\n if @computers_quest.save\n format.html { redirect_to @computers_quest, notice: 'Computers quest was successfully created.' }\n format.json { render :show, status: :created, location: @computers_quest }\n else\n format.html { render :new }\n format.json { render json: @computers_quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def computer_params\n params.require(:computer).permit(:city, :warranty, :vendor, :serial_number)\n end",
"def create\n @computers_chipset = ComputersChipset.new(computers_chipset_params)\n\n respond_to do |format|\n if @computers_chipset.save\n format.html { redirect_to @computers_chipset, notice: 'Computers chipset was successfully created.' }\n format.json { render :show, status: :created, location: @computers_chipset }\n else\n format.html { render :new }\n format.json { render json: @computers_chipset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @computers_keyboard = ComputersKeyboard.new(computers_keyboard_params)\n\n respond_to do |format|\n if @computers_keyboard.save\n format.html { redirect_to @computers_keyboard, notice: 'Computers keyboard was successfully created.' }\n format.json { render :show, status: :created, location: @computers_keyboard }\n else\n format.html { render :new }\n format.json { render json: @computers_keyboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @computer = Computer.new(params[:computer])\n\n respond_to do |format|\n if @computer.save\n flash[:notice] = 'Computer was successfully created.'\n format.html { redirect_to(root_url) }\n format.xml { render :xml => @computer, :status => :created, :location => @computer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @computer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @computers_activity = ComputersActivity.new(computers_activity_params)\n\n respond_to do |format|\n if @computers_activity.save\n format.html { redirect_to @computers_activity, notice: 'Computers activity was successfully created.' }\n format.json { render :show, status: :created, location: @computers_activity }\n else\n format.html { render :new }\n format.json { render json: @computers_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @computer = Computer.new(computer_params)\n\t\t# logger.debug params[:computer].to_yaml\n\t\t\n respond_to do |format|\n if @computer.save\n flash[:notice] = 'Computer was successfully created.'\n format.html { redirect_to(@computer) }\n format.xml { render :xml => @computer, :status => :created, :location => @computer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @computer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n concat_phone_numbers params[:guest]\n @tablet_guest = Tablet::Guest.new(params[:guest])\n\n respond_to do |format|\n if @tablet_guest.save\n format.json { render :json => @tablet_guest, :status => :created}\n else\n format.json { render :json => @tablet_guest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def computer_params\n params.require(:computer).permit(:ninventary, :nserie, :brand, :model, :nfactura, :buy_date, :genus, :processor, :hd, :memory, \n :bluetooth, :macbluetooth ,:os, :voffice, :users, :name, :workgroup, :wifi, :maclan, :iplan, :masklan, :macwifi, :ipwifi, \n :maskwifi, :operational, :reazon, :notes, :Network_id, :Delegation_id, :Dependency_id, :Worker_id,\n :picture1, :picture2, :picture3 )\n end",
"def create\n @compute_node = ComputeNode.new(params[:compute_node])\n\n respond_to do |format|\n if @compute_node.save\n format.html { redirect_to @compute_node, notice: 'Compute node was successfully created.' }\n format.json { render json: @compute_node, status: :created, location: @compute_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @compute_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @machine = Machine.new(machine_params)\n\n respond_to do |format|\n if @machine.save\n format.html { redirect_to @machine, notice: 'Machine was successfully created.' }\n format.json { render :show, status: :created, location: @machine }\n else\n format.html { render :new }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab = Lab.find(params[:lab_id])\n @machine = @lab.machines.create(machine_params)\n\n respond_to do |format|\n if @machine.save\n format.html { redirect_to lab_path(@lab), notice: 'Machine was successfully created.' }\n format.json { render json: @machine, status: :created, location: @machine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if signed_in?\n @computers = current_user.computers.all.decorate\n @computer = current_user.computers.new\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end",
"def create\n @machine = Machine.new(params[:machine])\n\n respond_to do |format|\n if @machine.save\n format.html { redirect_to @machine, notice: t('controller.successfully_created', :model => t('activerecord.models.machine')) }\n format.json { render json: @machine, status: :created, location: @machine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cpu = Cpu.new(cpu_params)\n\n respond_to do |format|\n if @cpu.save\n format.html { redirect_to cpus_url }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @machine_info = MachineInfo.new(machine_info_params)\n\n respond_to do |format|\n if @machine_info.save\n format.html { redirect_to @machine_info, notice: 'Machine info was successfully created.' }\n format.json { render :show, status: :created, location: @machine_info }\n else\n format.html { render :new }\n format.json { render json: @machine_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @host = Host.new(params[:host])\n\n if @host.save\n render json: @host, status: :created, location: @host\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end",
"def create\n @machine = Machine.new(machine_params)\n # authorize(@machine)\n respond_to do |format|\n if @machine.save\n format.html { redirect_to @machine, notice: 'Machine was successfully created.' }\n format.json { render :show, status: :created, location: @machine }\n else\n format.html { render :new }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end",
"def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end",
"def create\n @cpu_miner = CpuMiner.new(cpu_miner_params)\n\n respond_to do |format|\n if @cpu_miner.save\n format.html { redirect_to @cpu_miner, notice: 'Cpu miner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cpu_miner }\n else\n format.html { render action: 'new' }\n format.json { render json: @cpu_miner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @precious_metal = PreciousMetal.new(params[:precious_metal])\n\n respond_to do |format|\n if @precious_metal.save\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully created.' }\n format.json { render :json => @precious_metal, :status => :created, :location => @precious_metal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @precious_metal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def create\n @microport = Microport.new(microport_params)\n\n respond_to do |format|\n if @microport.save\n format.html { redirect_to @microport, notice: 'Microport was successfully created.' }\n format.json { render :show, status: :created, location: @microport }\n else\n format.html { render :new }\n format.json { render json: @microport.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def create\n @host = Host.new(host_params)\n\n if @host.save\n render json: @host, status: :created, location: @host\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end",
"def create\n @physician = Physician.new(physician_params)\n\n if @physician.save\n render json: @physician, status: :created\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def create\n @hardware = Hardware.new(params[:hardware])\n\n respond_to do |format|\n if @hardware.save\n format.html { redirect_to @hardware, :notice => 'Hardware was successfully created.' }\n format.json { render :json => @hardware, :status => :created, :location => @hardware }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @hardware.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end",
"def create\n @virtualmachines = Virtualmachine.new(params[:virtualmachines])\n\n respond_to do |format|\n if @virtualmachines.save\n flash[:notice] = 'Virtualmachines was successfully created.'\n format.html { redirect_to(@virtualmachines) }\n format.xml { render :xml => @virtualmachines, :status => :created, :location => @virtualmachines }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @virtualmachines.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def create\n @networking = Networking.new(networking_params)\n\n respond_to do |format|\n if @networking.save\n format.html { redirect_to @networking, notice: 'Networking was successfully created.' }\n format.json { render :show, status: :created, location: @networking }\n else\n format.html { render :new }\n format.json { render json: @networking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @porter = Porter.new(params[:porter])\n\n respond_to do |format|\n if @porter.save\n format.html { redirect_to @porter, notice: 'Porter was successfully created.' }\n format.json { render json: @porter, status: :created, location: @porter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @porter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @computer_geometry = ComputerGeometry.new(computer_geometry_params)\n\n respond_to do |format|\n if @computer_geometry.save\n format.html { redirect_to @computer_geometry, notice: 'Computer geometry was successfully created.' }\n format.json { render :show, status: :created, location: @computer_geometry }\n else\n format.html { render :new }\n format.json { render json: @computer_geometry.errors, status: :unprocessable_entity }\n end\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 destroy\n @computer.destroy\n respond_to do |format|\n format.html { redirect_to computers_url }\n format.json { head :no_content }\n end\n end",
"def upload_facts(host_json, host = '')\n curl = setup_curl(\"#{@foreman_url}/api/hosts/facts\")\n curl.headers['Accept'] = 'application/json,version=2'\n curl.headers['Content-Type'] = 'application/json'\n curl.http_post(host_json)\n result = JSON.parse(curl.body_str)\n raise result['message'] if result['message'] =~ /^ERF51/\n result\n rescue => e\n warn \"Could not push #{host}: #{e}\"\n false\n end",
"def create\n @computer_case = ComputerCase.new(computer_case_params)\n\n respond_to do |format|\n if @computer_case.save\n format.html { redirect_to @computer_case, notice: 'Computer case was successfully created.' }\n format.json { render :show, status: :created, location: @computer_case }\n else\n format.html { render :new }\n format.json { render json: @computer_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cerc = Cerc.new(params[:cerc])\n\n if @cerc.save\n render json: @cerc, status: :created, location: @cerc\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end",
"def create\n name = params[:machine][:name]\n nickname = params[:machine][:nickname]\n\n @machine = Machine.new(params[:machine])\n \n respond_to do |format|\n if @machine.save\n flash[:notice] = 'Machine was successfully created.'\n format.html { redirect_to machines_path }\n format.xml { render :xml => @machine, :status => :created, :location => @machine }\n format.atom { \n headers[\"Location\"] = formatted_machine_url(@machine, :atom )\n render :action => 'show',\n :status => :created\n }\n else\n format.html { \n @machines = Machine.all\n render :action => :index }\n format.xml { render :xml => @machine.errors, :status => :unprocessable_entity }\n format.atom { render :xml => @machine.errors.to_xml, :status => :bad_request }\n end\n end\n end",
"def create\n @cloud = Cloud.new(params[:cloud])\n\n respond_to do |format|\n if @cloud.save\n format.html { redirect_to @cloud, :notice => 'Cloud was successfully created.' }\n format.json { render :json => @cloud, :status => :created, :location => @cloud }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cloud.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend",
"def create\n @device.browsers.create!(browser_params)\n json_response(@device, :created)\n end",
"def create\n @hostela = Hostela.new(params[:hostela])\n\n respond_to do |format|\n if @hostela.save\n format.html { redirect_to @hostela, notice: 'Hostela was successfully created.' }\n format.json { render json: @hostela, status: :created, location: @hostela }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hostela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end",
"def create\n @hardware = Hardware.new(hardware_params)\n\n respond_to do |format|\n if @hardware.save\n format.html { redirect_to @hardware, notice: 'Hardware was successfully created.' }\n format.json { render :show, status: :created, location: @hardware }\n else\n format.html { render :new }\n format.json { render json: @hardware.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\r\n @product_machine = ProductMachine.new(params[:product_machine])\r\n\r\n respond_to do |format|\r\n if @product_machine.save\r\n format.html { redirect_to @product_machine, notice: 'Produkt wurde erfolgreich angelegt!' }\r\n format.json { render json: @product_machine, status: :created, location: @product_machine }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @product_machine.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def index\n @computers = Computer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @computers }\n end\n end",
"def create\n @eleccion_interna = EleccionInterna.new(eleccion_interna_params)\n\n respond_to do |format|\n if @eleccion_interna.save\n format.html { redirect_to @eleccion_interna, notice: 'Eleccion interna was successfully created.' }\n format.json { render :show, status: :created, location: @eleccion_interna }\n else\n format.html { render :new }\n format.json { render json: @eleccion_interna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @waiter = Waiter.new(waiter_params)\n\n respond_to do |format|\n if @waiter.save\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('created',@waiter) }\n format.json { render action: 'show', status: :created, location: @waiter }\n else\n @workstations = current_user.workstations.select(:id, :name).map {|w| [w.name, w.id] }\n format.html { render action: 'new' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @kontum = Kontum.new(kontum_params)\n\n respond_to do |format|\n if @kontum.save\n format.html { redirect_to @kontum, notice: 'Kontum was successfully created.' }\n format.json { render :show, status: :created, location: @kontum }\n else\n format.html { render :new }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @careers = Career.create!(career_params)\n json_response(@careers, :created)\n end",
"def computers_keyboard_params\n params.require(:computers_keyboard).permit(:name, :description)\n end",
"def create\n @complaint = Complaint.new(params[:complaint])\n\n if @complaint.save\n render json: @complaint, status: :created, location: @complaint\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def create\n @electronic = Electronic.new(electronic_params)\n\n respond_to do |format|\n if @electronic.save\n format.html { redirect_to @electronic, notice: 'Electronic was successfully created.' }\n format.json { render :show, status: :created, location: @electronic }\n else\n format.html { render :new }\n format.json { render json: @electronic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @printer = Printer.new(printer_params)\n\n respond_to do |format|\n if @printer.save\n format.html { redirect_to root_path }\n format.json { render :show, status: :created, location: @printer }\n else\n format.html { render :new }\n format.json { render json: @printer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end",
"def create\n @physician = Physician.new(params[:physician])\n\n respond_to do |format|\n if @physician.save\n format.html { redirect_to @physician, :notice => 'Physician was successfully created.' }\n format.json { render :json => @physician, :status => :created, :location => @physician }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @physician.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vending_machine = VendingMachine.new(vending_machine_params)\n\n respond_to do |format|\n if @vending_machine.save\n format.html { redirect_to @vending_machine, notice: 'Vending machine was successfully created.' }\n format.json { render :show, status: :created, location: @vending_machine }\n else\n format.html { render :new }\n format.json { render json: @vending_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vending_machine = VendingMachine.new(vending_machine_params)\n\n respond_to do |format|\n if @vending_machine.save\n format.html { redirect_to @vending_machine, notice: 'Vending machine was successfully created.' }\n format.json { render :show, status: :created, location: @vending_machine }\n else\n format.html { render :new }\n format.json { render json: @vending_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people = People.new(people_params)\n\n respond_to do |format|\n if @people.save\n format.html { redirect_to root_path, notice: 'Um VIP ' + @people.name.to_s + ' foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @people }\n else\n format.html { render :new }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hardware = Hardware.new(permitted_params[:hardware])\n params[:hardware]\n\n respond_to do |format|\n if @hardware.save\n format.html { redirect_to @hardware, notice: 'Hardware was successfully created.' }\n format.json { render :show, status: :created, location: @hardware }\n else\n format.html { render :new }\n format.json { render json: @hardware.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @physician = Physician.new(params[:physician])\n\n respond_to do |format|\n if @physician.save\n format.html { redirect_to @physician, :notice => 'Physician was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @physician.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @laboratory = Laboratory.new(params[:laboratory])\n @municipalities = Municipality.all\n respond_to do |format|\n if @laboratory.save\n format.html { redirect_to @laboratory, notice: 'Laboratory was successfully created.' }\n format.json { render json: @laboratory, status: :created, location: @laboratory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @laboratory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n if !params[:name].nil? && !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n pet = user.pets.create(name:params[:name], observations: params[:observations])\n if pet\n render json: pet, status: :created\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'Pet name not provided'}, status: :bad_request\n end\n end",
"def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end",
"def create\n @pokemon = Pokemon.new(pokemon_info)\n \n #check if the pokemon was saved\n #everything went fine\n if @pokemon.save\n render json:{\n status: \"success\",\n message: \"Pokemon was saved, and sent to the PC Storage\",\n data: @pokemon \n }\n else\n render json:{\n status: \"error\",\n message: \"Pokemon ran away...\",\n data: @pokemon.errors\n } \n\n \n end \n end",
"def new\r\n @machine = Machine.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end",
"def create_division\n \t@division = @company.divisions.create(name: params[:division][:name])\n respond_to do |format|\n format.json { render json: @division }\n end\n end",
"def create\n @m_machine_number = MMachineNumber.new(params[:m_machine_number])\n\n respond_to do |format|\n if @m_machine_number.save\n format.html { redirect_to :controller => \"m_machine_numbers\", :action => \"index\" }\n #format.html { redirect_to @m_machine_number, notice: 'M machine number was successfully created.' }\n format.json { render json: @m_machine_number, status: :created, location: @m_machine_number }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_machine_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def computers_activity_params\n params.require(:computers_activity).permit(:name, :description)\n end",
"def create\n @slot_machine = SlotMachine.new(slot_machine_params)\n\n respond_to do |format|\n if @slot_machine.save\n format.html { redirect_to @slot_machine, notice: 'Slot machine was successfully created.' }\n format.json { render :show, status: :created, location: @slot_machine }\n else\n format.html { render :new }\n format.json { render json: @slot_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def set_computer\n @computer = Computer.find(params[:id])\n end",
"def set_computer\n @computer = Computer.find(params[:id])\n end",
"def set_computer\n @computer = Computer.find(params[:id])\n end",
"def create\n @monit = Monit.new(params[:monit])\n\n respond_to do |format|\n if @monit.save\n format.html { redirect_to @monit, notice: 'Monit was successfully created.' }\n format.json { render json: @monit, status: :created, location: @monit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def machine_params\n params.require(:machine).permit(:api_key, :name, :url, :code)\n end",
"def create\n @component_in_machine = ComponentInMachine.new(component_in_machine_params)\n\n respond_to do |format|\n if @component_in_machine.save\n format.html { redirect_to @component_in_machine, notice: 'Component in machine was successfully created.' }\n format.json { render :show, status: :created, location: @component_in_machine }\n else\n format.html { render :new }\n format.json { render json: @component_in_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @core_machine = Core::Machine.new(params[:core_machine])\n\n respond_to do |format|\n if @core_machine.save\n format.html do\n flash[:success] = 'Machine was successfully created.'\n redirect_to @core_machine\n end\n format.json { render json: @core_machine, status: :created, location: @core_machine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @core_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def computador_params\n params.require(:computador).permit(:marca, :procesador, :gigas_de_ram, :gigas_de_capacidad)\n end",
"def create\n @port = Port.new(port_params)\n\n respond_to do |format|\n if @port.save\n format.html { redirect_to @port, notice: \"Port was successfully created.\" }\n format.json { render :show, status: :created, location: @port }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @port.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end",
"def list\n \t\tuser = User.find(current_user.id)\n \t @computers = user.computer.all\n end",
"def index\r\n @product_machines = ProductMachine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_machines }\r\n end\r\n end",
"def create\n @printer = Printer.new(printer_params)\n\n respond_to do |format|\n if @printer.save\n format.html { redirect_to @printer, notice: 'Printer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @printer }\n else\n format.html { render action: 'new' }\n format.json { render json: @printer.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.64897925",
"0.64897925",
"0.6039501",
"0.5775147",
"0.5775147",
"0.5757551",
"0.5744683",
"0.5735534",
"0.57079923",
"0.5691522",
"0.5655635",
"0.559592",
"0.5590071",
"0.5556231",
"0.5546339",
"0.5534325",
"0.54972136",
"0.5479081",
"0.5447243",
"0.53298336",
"0.5300725",
"0.52998704",
"0.52968115",
"0.5289673",
"0.5210465",
"0.5180667",
"0.51749533",
"0.51415455",
"0.5139881",
"0.5139836",
"0.51126164",
"0.51060677",
"0.5101456",
"0.5096137",
"0.50808746",
"0.50804836",
"0.50794953",
"0.5053992",
"0.505015",
"0.5043227",
"0.5027669",
"0.5023135",
"0.49946758",
"0.49939957",
"0.4988495",
"0.4987081",
"0.49829444",
"0.4975556",
"0.49719036",
"0.49657688",
"0.4961902",
"0.49565792",
"0.49398223",
"0.49362442",
"0.49354333",
"0.4931559",
"0.4917216",
"0.49159214",
"0.49159214",
"0.4910397",
"0.49099487",
"0.49082392",
"0.48987567",
"0.48934987",
"0.4887636",
"0.48841515",
"0.48840216",
"0.48789212",
"0.48766202",
"0.48723882",
"0.48694253",
"0.48612174",
"0.48612174",
"0.48593974",
"0.48545176",
"0.48496965",
"0.48474646",
"0.4845248",
"0.48440632",
"0.4840747",
"0.4836781",
"0.48339388",
"0.48338753",
"0.4833738",
"0.48317286",
"0.48310873",
"0.48299375",
"0.48299375",
"0.48299375",
"0.48296314",
"0.48274624",
"0.48266312",
"0.482036",
"0.48199737",
"0.48154214",
"0.48102066",
"0.4808864",
"0.47982964",
"0.47982103",
"0.47949857"
] | 0.6087589 | 2 |
PATCH/PUT /computers/1 PATCH/PUT /computers/1.json | def update
respond_to do |format|
@computer.versionless do |doc|
if doc.update(computer_params)
format.html { redirect_to computers_path, notice: t('computer.updated') }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @computer.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n if @computer.update_attributes(params[:computer])\n format.html { redirect_to @computer, notice: 'Computer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n if @computer.update_attributes(params[:computer])\n format.html { redirect_to @computer, notice: 'Computer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n upsme\n respond_to do |format|\n if @computer.update(computer_params)\n set_me\n format.html { redirect_to @computer, notice: 'Computadora fue actualizada satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @computer }\n else\n format.html { render :edit }\n format.json { render json: @computer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @computers_chipset.update(computers_chipset_params)\n format.html { redirect_to @computers_chipset, notice: 'Computers chipset was successfully updated.' }\n format.json { render :show, status: :ok, location: @computers_chipset }\n else\n format.html { render :edit }\n format.json { render json: @computers_chipset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @computador.update(computador_params)\n format.html { redirect_to @computador, notice: 'Computador was successfully updated.' }\n format.json { render :show, status: :ok, location: @computador }\n else\n format.html { render :edit }\n format.json { render json: @computador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n if @computer.update_attributes(params[:computer])\n flash[:notice] = 'Comuter was successfully updated.'\n format.html { redirect_to(@computer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @computer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:lab_id])\n @machine = @lab.machines.find(params[:id])\n\n respond_to do |format|\n if @machine.update_attributes(machine_params)\n format.html { redirect_to lab_path(@lab), notice: 'Machine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n if @computer.update_attributes(params[:computer])\n flash[:notice] = 'Computer was successfully updated.'\n format.html { redirect_to(@computer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @computer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n concat_phone_numbers params[:guest]\n @tablet_guest = Tablet::Guest.find(params[:id])\n\n respond_to do |format|\n if @tablet_guest.update_attributes(params[:guest])\n format.json { render :json => @tablet_guest }\n else\n format.json { render :json => @tablet_guest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @cpu.update(cpu_params)\n format.html { redirect_to cpus_url }\n else\n format.html { render :edit }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @computers_quest.update(computers_quest_params)\n format.html { redirect_to @computers_quest, notice: 'Computers quest was successfully updated.' }\n format.json { render :show, status: :ok, location: @computers_quest }\n else\n format.html { render :edit }\n format.json { render json: @computers_quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n raise \"Not implemented\"\n @machine = Machine.find(params[:id])\n# valid_keys = %w{name}\n# params[:machine].delete_if{|k,v|!valid_keys.include?(k)}\n#\n# respond_to do |format|\n# if @machine.update_attributes(params[:machine])\n# format.html { redirect_to @machine, notice: 'Machine was successfully updated.' }\n# format.json { head :ok }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @machine.errors, status: :unprocessable_entity }\n# end\n# end\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 @compute_node = ComputeNode.find(params[:id])\n\n respond_to do |format|\n if @compute_node.update_attributes(params[:compute_node])\n format.html { redirect_to @compute_node, notice: 'Compute node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compute_node.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 @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n if @precious_metal.update_attributes(params[:precious_metal])\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @precious_metal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @computers_activity.update(computers_activity_params)\n format.html { redirect_to @computers_activity, notice: 'Computers activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @computers_activity }\n else\n format.html { render :edit }\n format.json { render json: @computers_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @laptop.update(laptop_params)\n format.html { redirect_to laptops_path, notice: 'Laptop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @laptop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put!\n request! :put\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @machine.update(machine_params)\n format.html { redirect_to @machine, notice: 'Machine was successfully updated.' }\n format.json { render :show, status: :ok, location: @machine }\n else\n format.html { render :edit }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @machine.update(machine_params)\n format.html { redirect_to @machine, notice: 'Machine was successfully updated.' }\n format.json { render :show, status: :ok, location: @machine }\n else\n format.html { render :edit }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n if @cloud.update_attributes(params[:cloud])\n format.html { redirect_to @cloud, :notice => 'Cloud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cloud.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloud.update(cloud_params)\n format.html { redirect_to @cloud, notice: 'Cloud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meteor = Meteor.find(params[:id])\n\n respond_to do |format|\n if @meteor.update_attributes(params[:meteor])\n format.html { redirect_to @meteor, notice: 'Meteor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meteor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @intern = Intern.find(params[:id])\n\n respond_to do |format|\n if @intern.update_attributes(params[:intern])\n format.html { redirect_to @intern, notice: 'Intern was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intern.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comp.update(comp_params)\n format.html { redirect_to @comp, notice: 'Comp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couch was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.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 @comp_info = CompInfo.find(params[:id])\n\n respond_to do |format|\n if @comp_info.update_attributes(params[:comp_info])\n format.html { redirect_to @comp_info, notice: 'Comp info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comp_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @microport.update(microport_params)\n format.html { redirect_to @microport, notice: 'Microport was successfully updated.' }\n format.json { render :show, status: :ok, location: @microport }\n else\n format.html { render :edit }\n format.json { render json: @microport.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n if @machine.update_attributes(params[:machine])\n format.html { redirect_to @machine, notice: t('controller.successfully_updated', :model => t('activerecord.models.machine')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @machine_info.update(machine_info_params)\n format.html { redirect_to @machine_info, notice: 'Machine info was successfully updated.' }\n format.json { render :show, status: :ok, location: @machine_info }\n else\n format.html { render :edit }\n format.json { render json: @machine_info.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_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @computers_keyboard.update(computers_keyboard_params)\n format.html { redirect_to @computers_keyboard, notice: 'Computers keyboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @computers_keyboard }\n else\n format.html { render :edit }\n format.json { render json: @computers_keyboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\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 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 official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n respond_to do |format|\n if @waiter.update(waiter_params.slice(:name, :email, :mobile))\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('updated',@waiter) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloud_resource.update(cloud_resource_params)\n format.html { redirect_to @cloud_resource, notice: 'Cloud resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @cloud_resource }\n else\n format.html { render :edit }\n format.json { render json: @cloud_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.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\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @kontum.update(kontum_params)\n format.html { redirect_to @kontum, notice: 'Kontum was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontum }\n else\n format.html { render :edit }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n if @microplst.update_attributes(params[:microplst])\n format.html { redirect_to @microplst, notice: 'Microplst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microplst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @laptop.update(laptop_params)\n format.html { redirect_to admin_laptop_url(@laptop.id), notice: 'Laptop was successfully updated.' }\n format.json { render :show, status: :ok, location: @laptop }\n else\n format.html { render :edit }\n format.json { render json: @laptop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n @virtualmachines = Virtualmachine.find(params[:id])\n\n respond_to do |format|\n if @virtualmachines.update_attributes(params[:virtualmachines])\n flash[:notice] = 'Virtualmachines was successfully updated.'\n format.html { redirect_to(@virtualmachines) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @virtualmachines.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource.host, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource.host }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n if @kitten.update_attributes(params[:kitten])\n format.html { redirect_to @kitten, notice: 'Kitten was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @component_in_machine.update(component_in_machine_params)\n format.html { redirect_to @component_in_machine, notice: 'Component in machine was successfully updated.' }\n format.json { render :show, status: :ok, location: @component_in_machine }\n else\n format.html { render :edit }\n format.json { render json: @component_in_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pc.update(pc_params)\n format.html { redirect_to @pc, notice: 'Pc was successfully updated.' }\n format.json { render :show, status: :ok, location: @pc }\n else\n format.html { render :edit }\n format.json { render json: @pc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def update\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n if @hardware.update_attributes(params[:hardware])\n format.html { redirect_to @hardware, :notice => 'Hardware was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hardware.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @it_system.update(it_system_params)\n format.html { redirect_to @it_system, notice: 'It system was successfully updated.' }\n format.json { render :show, status: :ok, location: @it_system }\n else\n format.html { render :edit }\n format.json { render json: @it_system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @complaint.update(complaint_params)\n format.html { redirect_to @complaint, notice: 'Complaint was successfully updated.' }\n format.json { render :show, status: :ok, location: @complaint }\n else\n format.html { render :edit }\n format.json { render json: @complaint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @complaint.update(complaint_params)\n format.html { redirect_to @complaint, notice: 'Complaint was successfully updated.' }\n format.json { render :show, status: :ok, location: @complaint }\n else\n format.html { render :edit }\n format.json { render json: @complaint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n if @fleet.update_attributes(params[:fleet])\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloud.update(cloud_params)\n format.html { redirect_to @cloud, notice: 'Cloud was successfully updated.' }\n format.json { render :show, status: :ok, location: @cloud }\n else\n format.html { render :edit }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compliment = Compliment.find(params[:id])\n\n respond_to do |format|\n if @compliment.update_attributes(params[:compliment])\n format.html { redirect_to @compliment, notice: 'Compliment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compliment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @machine = Machine.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @machine.update_attributes(params[:machine])\r\n format.html { redirect_to @machine, notice: 'Produkt wurde erfolgreich aktualisiert.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @machine.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @alumni = Alumni.find(params[:id])\n\n respond_to do |format|\n if @alumni.update_attributes(params[:alumni])\n format.html { redirect_to @alumni, notice: 'Alumni was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alumni.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cpu_miner.update(cpu_miner_params)\n format.html { redirect_to @cpu_miner, notice: 'Cpu miner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cpu_miner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @electronic.update(electronic_params)\n format.html { redirect_to @electronic, notice: 'Electronic was successfully updated.' }\n format.json { render :show, status: :ok, location: @electronic }\n else\n format.html { render :edit }\n format.json { render json: @electronic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n respond_to do |format|\n if @catched.update(catched_params)\n format.html { redirect_to @catched, notice: 'Catched was successfully updated.' }\n format.json { render :show, status: :ok, location: @catched }\n else\n format.html { render :edit }\n format.json { render json: @catched.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n flash.now[:success] = \"System was successfully updated.\"\n format.html { redirect_to @system }\n #proper response to http PUT is also no_content\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cluster.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 @core_machine = Core::Machine.find(params[:id])\n\n respond_to do |format|\n if @core_machine.update_attributes(params[:core_machine])\n format.html do\n flash[:success] = 'Machine was successfully updated.'\n redirect_to @core_machine\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @core_machine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hostela = Hostela.find(params[:id])\n\n respond_to do |format|\n if @hostela.update_attributes(params[:hostela])\n format.html { redirect_to @hostela, notice: 'Hostela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hostela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @technical.update(technical_params)\n format.html { redirect_to @technical, notice: 'Alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @technical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @compte.update(compte_params)\n format.html { redirect_to @compte, notice: 'Compte was successfully updated.' }\n format.json { render :show, status: :ok, location: @compte }\n else\n format.html { render :edit }\n format.json { render json: @compte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(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_patch(@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 @serv = Serv.find(params[:id])\n olddomain=@serv.domain\n oldname=@serv.name\n oldip=@serv.conn.ip\n oldport=@serv.conn.port\n @serv2 = Serv.new(params[:serv])\n if @serv2.mother\n params[:serv][:domain]= @serv2.mother.name\n params[:serv][:mother]=@serv2.mother\n params[:serv][:conn][:ip]=@serv2.mother.conn.ip\n else\n params[:serv][:domain]=nil\n params[:serv][:mother]=nil\n params[:serv][:conn][:ip]=''\n end\n pass=@serv.update_attributes(params[:serv])\n\n if pass\n if @serv.mngbl\n #Si se modifico algo se reinicia el MR a través de los llamados a webservices registrar y remover del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => oldip, 'port' => oldport}\n request = Net::HTTP::Delete.new(\"/mbs/#{olddomain}/#{oldname}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port, 'domain' => @serv.domain, 'type' => @serv.name}\n request = Net::HTTP::Post.new(\"/mbs/register\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n end\n respond_to do |format|\n if pass\n newname=@serv.name\n modify_links(oldname,newname)\n format.html { redirect_to servs_url, notice: t('servs.update.notice') }\n format.json { head :no_content }\n else\n @net_eles = NetEle.all\n format.html { render action: \"edit\" }\n format.json { render json: @serv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = @client.patients.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @computer_geometry.update(computer_geometry_params)\n format.html { redirect_to @computer_geometry, notice: 'Computer geometry was successfully updated.' }\n format.json { render :show, status: :ok, location: @computer_geometry }\n else\n format.html { render :edit }\n format.json { render json: @computer_geometry.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.65186167",
"0.6512862",
"0.6054839",
"0.60220796",
"0.59716916",
"0.5971474",
"0.59525293",
"0.5926014",
"0.59202605",
"0.58949536",
"0.58347315",
"0.58220094",
"0.5798602",
"0.5782536",
"0.57804316",
"0.57764715",
"0.57568485",
"0.5729036",
"0.5724011",
"0.5712803",
"0.5711303",
"0.5704619",
"0.5675185",
"0.5673632",
"0.5668645",
"0.5639975",
"0.5612353",
"0.5612353",
"0.56043684",
"0.55998254",
"0.55966705",
"0.5590582",
"0.5589937",
"0.5582934",
"0.5563609",
"0.55590945",
"0.5555793",
"0.55552",
"0.5554202",
"0.55524856",
"0.5542475",
"0.5541629",
"0.55406815",
"0.5535559",
"0.553461",
"0.55326194",
"0.55221874",
"0.5521437",
"0.550982",
"0.55052906",
"0.54945934",
"0.5484227",
"0.5473356",
"0.5472509",
"0.54711324",
"0.5467445",
"0.54667157",
"0.54582924",
"0.54574025",
"0.5453164",
"0.5453077",
"0.54451436",
"0.54428536",
"0.54393715",
"0.54377884",
"0.54295224",
"0.5425585",
"0.54213446",
"0.54188",
"0.54186314",
"0.54046214",
"0.54040694",
"0.5403423",
"0.5399034",
"0.53989106",
"0.53989106",
"0.5394092",
"0.5391491",
"0.5386336",
"0.5385752",
"0.5384078",
"0.53818816",
"0.5381785",
"0.53673863",
"0.53673005",
"0.5366256",
"0.53661835",
"0.53632635",
"0.5361297",
"0.53594905",
"0.5358889",
"0.53545785",
"0.53517103",
"0.53483546",
"0.53480226",
"0.5347471",
"0.53430545",
"0.5342293",
"0.5342259",
"0.5337578"
] | 0.647093 | 2 |
DELETE /computers/1 DELETE /computers/1.json | def destroy
@computer.destroy
respond_to do |format|
format.html { redirect_to computers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @computer = Computer.find(params[:id])\n @computer.destroy\n\n respond_to do |format|\n format.html { redirect_to computers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @computer = Computer.find(params[:id])\n @computer.destroy\n\n respond_to do |format|\n format.html { redirect_to computers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @computer = Computer.find(params[:id])\n @computer.destroy\n\n respond_to do |format|\n format.html { redirect_to(computers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @computador.destroy\n respond_to do |format|\n format.html { redirect_to computadors_url, notice: 'Computador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @computer = Computer.find(params[:id])\n @computer.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lab = Lab.find(params[:lab_id])\n @machine = @lab.machines.find(params[:id])\n @machine.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_path(@lab) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\r\n @machine = Machine.find(params[:id])\r\n @machine.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to machines_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def host_delete(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.http_delete\n end",
"def destroy\n @client.delete(@name)\n end",
"def destroy\n @compute_node = ComputeNode.find(params[:id])\n @compute_node.destroy\n\n respond_to do |format|\n format.html { redirect_to compute_nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @core_machine = Core::Machine.find(params[:id])\n @core_machine.destroy\n\n respond_to do |format|\n format.html { redirect_to core_machines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @computers_chipset.destroy\n respond_to do |format|\n format.html { redirect_to computers_chipsets_url, notice: 'Computers chipset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud = Cloud.find(params[:id])\n @cloud.destroy\n\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @computers_activity.destroy\n respond_to do |format|\n format.html { redirect_to computers_activities_url, notice: 'Computers activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @host = Host.find_by(hostname: params[:id])\n @host.destroy\n\n head :no_content\n end",
"def destroy\n @machine.destroy\n respond_to do |format|\n format.html { redirect_to machines_url, notice: 'Machine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @machine.destroy\n respond_to do |format|\n format.html { redirect_to machines_url, notice: 'Machine was successfully destroyed.' }\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 @machine = Machine.find(params[:id])\n @machine.destroy\n\n respond_to do |format|\n format.html { redirect_to machines_url, notice: t('controller.successfully_deleted', :model => t('activerecord.models.machine')) }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete!\n server.delete(name)\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cpu.destroy\n respond_to do |format|\n format.html { redirect_to cpus_url }\n end\n end",
"def destroy\n @hostela = Hostela.find(params[:id])\n @hostela.destroy\n\n respond_to do |format|\n format.html { redirect_to hostelas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n return if @name.nil?\n delete_rest \"vservers/#{@name}\"\n end",
"def destroy\n @virtualmachines = Virtualmachine.find(params[:id])\n @virtualmachines.destroy\n\n respond_to do |format|\n format.html { redirect_to(virtualmachines_url) }\n format.xml { head :ok }\n end\n end",
"def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end",
"def destroy\n @computers_quest.destroy\n respond_to do |format|\n format.html { redirect_to computers_quests_url, notice: 'Computers quest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @machine = Machine.find(params[:id])\n @machine.deleted_by = current_user\n @machine.save!\n @machine.destroy\n\n respond_to do |format|\n format.html { redirect_to location_machines_path(@machine.location), notice: 'Machine was deleted.' }\n format.json { head :ok }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\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 @eleccion_interna.destroy\n respond_to do |format|\n format.html { redirect_to eleccion_internas_url, notice: 'Eleccion interna was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud.destroy\n respond_to do |format|\n format.html { redirect_to clouds_url, notice: 'Cloud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @intern = Intern.find(params[:id])\n @intern.destroy\n\n respond_to do |format|\n format.html { redirect_to interns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @host = Host.find(params[:id])\n @host.destroy\n\n head :no_content\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 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 @host = Host.find(params[:id])\n @host.deleted = true\n @host.save\n\n respond_to do |format|\n format.html { redirect_to hosts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n if params[:id]\n result = backend_instance.compute_delete(params[:id])\n else\n result = backend_instance.compute_delete_all\n end\n\n if result\n respond_with(Occi::Collection.new)\n else\n respond_with(Occi::Collection.new, status: 304)\n end\n end",
"def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @machine = Machine.find(params[:id])\n @machine.destroy\n\n respond_to do |format|\n format.html { redirect_to(machines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ip_name.destroy\n respond_to do |format|\n format.html { redirect_to ip_names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @egreso_interno.destroy\n respond_to do |format|\n format.html { redirect_to egreso_internos_url, notice: 'Egreso interno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @machine = Machine.find(params[:id])\n @machine.destroy\n\n respond_to do |format|\n format.html { redirect_to machines_url }\n end\n end",
"def destroy\n @machine_info.destroy\n respond_to do |format|\n format.html { redirect_to machine_infos_url, notice: 'Machine info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @electronic.destroy\n respond_to do |format|\n format.html { redirect_to electronics_url, notice: 'Electronic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @networking.destroy\n respond_to do |format|\n format.html { redirect_to networkings_url, notice: 'Networking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @laptop.destroy\n respond_to do |format|\n format.html { redirect_to laptops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @host.destroy\n respond_to do |format|\n format.html { redirect_to hosts_url, notice: 'Host was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kontum.destroy\n respond_to do |format|\n format.html { redirect_to konta_url, notice: 'Kontum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @component_in_machine.destroy\n respond_to do |format|\n format.html { redirect_to component_in_machines_url, notice: 'Component in machine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete\n delete_from_server single_url\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 @cpu_miner.destroy\n respond_to do |format|\n format.html { redirect_to cpu_miners_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @cervejarium = Cervejarium.find(params[:id])\n @cervejarium.destroy\n\n respond_to do |format|\n format.html { redirect_to cervejaria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@computer.destroy ----> ORIGINAL\n @computer.operational = false if @computer.operational\n @computer.save!\n respond_to do |format|\n format.html { redirect_to computers_url, notice: 'Computadora fue eliminada satisfactoriament.' }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @teleoperation = Teleoperation.find(params[:id])\n @teleoperation.destroy\n\n respond_to do |format|\n format.html { redirect_to teleoperations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n deleteVm = Virtualmachine.new\n @response_del = deleteVm.deleteVMcall(@virtualmachine.RemoteID)\n @virtualmachine.destroy\n respond_to do |format|\n format.html { redirect_to virtualmachines_url,notice: 'Virtual server will be delete shortly.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @graphium_city.destroy\n respond_to do |format|\n format.html { redirect_to graphium_cities_url, notice: 'City was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interno.destroy\n respond_to do |format|\n format.html { redirect_to internos_url, notice: 'Interno fue borrado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @physical_disk = PhysicalDisk.find(params[:id])\n @physical_disk.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_disks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end"
] | [
"0.7075332",
"0.7073891",
"0.6769502",
"0.6759127",
"0.6672537",
"0.6650148",
"0.66151136",
"0.6583461",
"0.65668356",
"0.65420014",
"0.65370816",
"0.6536434",
"0.6529319",
"0.6506546",
"0.64749974",
"0.6459115",
"0.64537036",
"0.6432832",
"0.6425489",
"0.6417039",
"0.641132",
"0.6408688",
"0.6408353",
"0.6397359",
"0.63957375",
"0.63941485",
"0.63941485",
"0.6385844",
"0.6382362",
"0.63598496",
"0.63553756",
"0.63525915",
"0.63503313",
"0.6343163",
"0.6337324",
"0.6330297",
"0.63294625",
"0.63294333",
"0.6325633",
"0.63248485",
"0.6320514",
"0.6315816",
"0.63049996",
"0.6300388",
"0.6280788",
"0.6279221",
"0.62725055",
"0.6269586",
"0.6269347",
"0.62618774",
"0.62618774",
"0.62618774",
"0.62618774",
"0.62611836",
"0.6259363",
"0.6247749",
"0.62412095",
"0.6240392",
"0.6239366",
"0.62360585",
"0.62326884",
"0.62179375",
"0.6211144",
"0.62066966",
"0.6206032",
"0.62059385",
"0.62013894",
"0.6200388",
"0.61942625",
"0.6194218",
"0.6190505",
"0.6187309",
"0.6185812",
"0.6185452",
"0.61853087",
"0.61821085",
"0.61739653",
"0.61714625",
"0.61566",
"0.6156279",
"0.61559343",
"0.61553735",
"0.6154647",
"0.6153923",
"0.6152574",
"0.6147987",
"0.6147056",
"0.61451066",
"0.6141815",
"0.6140217",
"0.61399543",
"0.61379987",
"0.6135137",
"0.613503",
"0.6134781",
"0.61338997",
"0.61338603",
"0.61331654",
"0.6132549",
"0.612069"
] | 0.7023989 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_computer
@computer = Computer.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 computer_params
params.require(:computer).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Helper method for error_classes | def status_to_error(status)
case status
when 1
'InvalidRequest'
when 2
'InvalidCredentials'
when 3
'NonExistentOrder'
when 4
'NonExistentOrderItem'
when 5
'InvalidStateChange'
when 6
'InvalidStorno'
when 7
'AnotherError'
when 8
'OrderNotExported'
when 9
'AutomaticDeliveryError'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_error; end",
"def original_error; end",
"def error_message; end",
"def error_class_constant(error_code); end",
"def error(ex) [:error, ex]; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def errors=(_); end",
"def errors_for(_object); end",
"def error\n end",
"def errors=(_arg0); end",
"def errors=(_arg0); end",
"def errors=(_arg0); end",
"def errors=(_arg0); end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def bold_error(*args); end",
"def error_string\n # This method should be overridden\n end",
"def error(*args); end",
"def error_msg\n ERROR_MSG[upcase_class_sym]\n end",
"def error(description, result)\n raise \"Implement this in a sub-class\"\n end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def error?; end",
"def error?; end",
"def error?; end",
"def error(string); end",
"def error(string); end",
"def error(exception) nil ; end",
"def error_messages; end",
"def error_messages=(_arg0); end",
"def errors( klass )\n @errors[klass] || @errors[:default]\n end",
"def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end",
"def error_message\n self[:error_message]\n end",
"def error\n end",
"def error_name\n self.class.error_name\n end",
"def error_name\n self.class.error_name\n end",
"def error_msg\n name\n end",
"def error_number; end",
"def error_description\n end",
"def errorhandling\n end",
"def errors_class\n Errors\n end",
"def errors_class\n Errors\n end",
"def errors\n raise 'Method should implemented in inherit class'\n end",
"def error\r\n @error\r\n end",
"def error_name(klass)\n underscore(klass.class.name).split(/\\//).last \n end",
"def recover_from(_error); end",
"def serialize_error\n case error\n when Common::Exceptions::BaseError\n base_error\n when Common::Client::Errors::ClientError\n client_error\n when EMISRedis::VeteranStatus::NotAuthorized\n emis_error(:not_authorized)\n when EMISRedis::VeteranStatus::RecordNotFound\n emis_error(:not_found)\n when MPI::Errors::RecordNotFound\n mpi_error(404)\n when MPI::Errors::FailedRequestError\n mpi_error(503)\n when MPI::Errors::DuplicateRecords\n mpi_error(404)\n else\n standard_error\n end\n end",
"def errmsg(message); end",
"def error\n\t\t{ \n\t\t\terror: { \n\t\t\t\tmessage: self.object[:message],\n\t\t\t\tfield: self.object[:field]\n\t\t\t} \n\t\t}\n\tend",
"def get_errors_for_class(klass)\n if klass.errors.any?\n klass.errors.full_messages.each do |msg|\n msg\n end\n end\n end",
"def error msg\n puts \"#{self.class} error: #{msg}\"\n end",
"def error_key\n self.class.error_key\n end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def error\n nil\n end",
"def error\n nil\n end",
"def error(nvae)\n end",
"def full_error(attribute_name, options = T.unsafe(nil)); end",
"def error\n @error\n end",
"def exception_class; end",
"def error\n return {error: \"\"}\n end",
"def error_object\n {:success => false, :error => \"Error encountered\"}\n end",
"def invalid_field_error_class\n (\"Invalid\" + self.field_name.split(\"_\").map(&:capitalize).join + \\\n \"FieldError\").classify.safe_constantize\n end",
"def error_messages_for(clazz)\n if clazz.present? && clazz.errors.present? && clazz.errors.count > 0\n return \"Errors: #{clazz.errors.full_messages}\"\n end\n end",
"def error\n []\n end",
"def error(method)\n errors = @object.errors[method] if @object\n errors.to_sentence if errors.present?\n end",
"def check_errors;\n end",
"def wrap_error obj, errors\n if errors.kind_of? Array\n errors.collect do |error| \"#{obj.class.name} #{error}\" end if @manufacturer.try(:errors).present?\n elsif errors.kind_of? String\n \"#{obj.class.name} #{errors}\"\n end\n end",
"def error_style(error)\n red_style(error)\nend",
"def error_message\n error.message\n end",
"def validates_type_error_message(m, klass)\n # SEQUEL6: Make this the default behavior in validation_helpers\n if OVERRIDE_PROC.equal?(m)\n TYPE_ERROR_STRINGS[klass]\n else\n super\n end\n end",
"def _error_name(error)\n case error\n when Errors::RequestError\n error.error\n else\n Utils.underscore(error.class.name.split('::').last.sub('Error', ''))\n end\n end",
"def error msg\n @error = msg\n end",
"def parse_error(error, req); end",
"def error_with(data, clazz = Bolt::Error)\n data = Bolt::Util.walk_keys(data, &:to_s)\n if data['msg'] && data['kind'] && (data.keys - %w[msg kind details issue_code]).empty?\n @data[:default] = clazz.new(data['msg'], data['kind'], data['details'], data['issue_code'])\n else\n $stderr.puts \"In the future 'error_with()' might require msg and kind, and \" \\\n \"optionally accept only details and issue_code.\"\n @data[:default] = data\n end\n @data_set = true\n self\n end",
"def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n end",
"def check_errors;\n end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def error\n @error_response\n end",
"def wrap_error(message)\n { error: message }\nend",
"def getError\n return @error\n end"
] | [
"0.757518",
"0.757518",
"0.7567129",
"0.7501133",
"0.7383669",
"0.73776627",
"0.73776627",
"0.73776627",
"0.73776627",
"0.73776627",
"0.73776627",
"0.73776627",
"0.73201376",
"0.73012877",
"0.71660274",
"0.7143055",
"0.7143055",
"0.7143055",
"0.7143055",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7127042",
"0.7120041",
"0.709222",
"0.70559436",
"0.70368654",
"0.6992444",
"0.69637734",
"0.69637734",
"0.69637734",
"0.6949856",
"0.6949856",
"0.6949856",
"0.6946318",
"0.6946318",
"0.6923704",
"0.691885",
"0.6888941",
"0.6879762",
"0.68341166",
"0.6833304",
"0.6827171",
"0.6822078",
"0.6822078",
"0.6781434",
"0.6773277",
"0.67605555",
"0.6720478",
"0.67151845",
"0.67151845",
"0.6709218",
"0.66914296",
"0.66500014",
"0.66497",
"0.6648704",
"0.66169447",
"0.6612473",
"0.6610379",
"0.66070855",
"0.65800375",
"0.65757775",
"0.65757775",
"0.65616757",
"0.6559237",
"0.6553588",
"0.6548024",
"0.65389663",
"0.653815",
"0.6537451",
"0.65364194",
"0.65338963",
"0.6532844",
"0.6524838",
"0.65026885",
"0.6494471",
"0.64941007",
"0.6482932",
"0.6475579",
"0.64678806",
"0.6455895",
"0.6452685",
"0.6450259",
"0.6437054",
"0.64317787",
"0.6403791",
"0.6395808",
"0.6395808",
"0.6395808",
"0.6395808",
"0.6395808",
"0.6395808",
"0.6395808",
"0.63922286",
"0.63899714",
"0.63711905"
] | 0.0 | -1 |
separate action, as this one makes a stripe API call | def payment_transfers
authorize :report
@transfers = company.transfers(start_param, end_param)
# @transfers = company.transfers(300.days.ago.to_s, Date.current.to_s)
respond_to do |format|
format.json
format.pdf { render '/companies/report' }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 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 create\n\n @charge = Charge.new(charge_params)\n \n customer = StripeTool.create_customer(email: params[:stripeEmail], \n stripe_token: params[:stripeToken])\n\n charge = StripeTool.create_charge(customer_id: customer.id, \n amount: (@charge.amount*100).to_i,\n description: @charge.topic)\n\n @charge.stripe_id = customer.id\n \n\n respond_to do |format|\n if @charge.save\n if @charge.owner_type == \"User\"\n format.html { redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: (I18n.t :thxpayment) }\n end\n if @charge.owner_type == \"Company\"\n format.html { redirect_to company_path(:id => @charge.owner_id, :topic => \"institutionen_charges\"), notice: 'Charge was successfully created.' }\n end\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: (:I18n.t :nopayment)\n \n end",
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\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 purchase_sub_existing_choose\n @plan = params[:sec][:plan] #now this is an integer, my_plan_id\n @planobject = Plan.find_by_my_plan_id(@plan)\n @events_number = @planobject.events_number \n # if user is a stripe customer (even though no acticve sub), want to allow him to use existing card\n if !current_user.customer_id.blank? \n c = Stripe::Customer.retrieve(current_user.customer_id)\n @last4 = c.cards.data.first.last4\n @cardtype = c.cards.data.first.type\n end \n\nend",
"def payment\n # Get the current user's last order (i.e. the current order)\n @order = @current_user.orders.last\n\n # Token automatically created by Checkout and sent through params\n token = params[:stripeToken]\n\n # Invoke action in cart.rb that calculates the total price of all items in the cart\n total_amount = (@cart.get_total_price * 100).to_i\n\n Stripe.api_key = Rails.application.secrets.stripe_api_secret\n\n # Make an API request to create a one-time charge containing the token,\n # currency, total amount (as an integer not a float) and description\n charge = Stripe::Charge.create({\n amount: total_amount,\n currency: 'aud',\n description: 'Purchase from Eight by Eight',\n source: token,\n })\n\n # Update the current order with the Stripe charge response data\n @order.update stripe_token: token, stripe_charge_response: charge\n\n # Checks whether the payment was successful\n unless @order.stripe_charge_response[\"outcome\"][\"network_status\"] == \"approved_by_network\"\n # If the payment was unsuccessful, set a flash error and redirect to orders#confirm_order\n flash[:order_error] = \"Transaction unsuccessful. Please contact your card issuer for more details.\"\n redirect_to confirm_order_path\n return\n end\n\n # Redirect to orders#complete_order\n redirect_to complete_order_path\n end",
"def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n :description => 'Prlayvous Ticket',\n :currency => 'usd'\n )\n\n #After paying with Stripe, consumers are prompt to confirm their shipping address.\n redirect_to edit_consumer_order_path(current_consumer, @order)\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to charges_path\n end",
"def post_billing(req)\n with_stripe_error_handlers do\n dealership = update_dealership(req)\n live_domain = Lynr.config('app').fetch(:live_domain, 'www.lynr.co')\n req.session.destroy\n Lynr::Events.emit(type: 'dealership.upgraded', dealership_id: dealership.id.to_s)\n redirect \"https://#{live_domain}/signin/#{token(req).id}\", 302\n end\n end",
"def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def 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 post_billing(req)\n with_stripe_error_handlers do\n customer = Stripe::Customer.retrieve(@dealership.customer_id)\n customer.card = posted['stripeToken']\n customer.save\n req.session['billing_flash_msg'] = \"Card updated successfully.\"\n redirect \"/admin/#{@dealership.slug}/billing\"\n end\n end",
"def pay\n # Find the user to pay.\n captain = User.find( params[:id] )\n\n # Charge amount owed over .971 to account for Stripe fee. This needs to be done here because the fee is being charged to the captain, so he needs to charge his players extra to account for the money being taken out of his take.\n amount = session[:amount_owed]/0.971\n # Calculate the fee amount that goes to the application.\n fee = (amount * Rails.application.secrets.fee_percentage).to_i\n\n begin\n charge_attrs = {\n amount: amount,\n currency: user.currency,\n source: params[:token],\n description: \"Test Charge via Stripe Connect\",\n application_fee: fee,\n destination: captain.stripe_user_id\n }\n\n # case params[:charge_on]\n # when 'connected'\n # p charge_attrs\n # # Use the user-to-be-paid's access token\n # # to make the charge directly on their account\n # charge = Stripe::Charge.create( charge_attrs, user.secret_key )\n # when 'platform'\n # # Use the platform's access token, and specify the\n # # connected account's user id as the destination so that\n # # the charge is transferred to their account.\n # charge_attrs[:destination] = user.stripe_user_id\n charge = Stripe::Charge.create( charge_attrs )\n # end\n\n flash[:notice] = \"Charged successfully! <a target='_blank' rel='#{params[:charge_on]}-account' href='https://dashboard.stripe.com/test/payments/#{charge.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 session[:saved_url]\n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end",
"def purchase_sub_not_stripe_customer\n token = params[:stripeToken]\n @plan = params[:plan] #integer corresponding to my_plan_id\n @events_number = params[:events_number] #not being used right now because create_customer helper finds the events_number form the plan object via @plan argument\n @code = params[:code] \n @new_price = params[:new_price]\n event_type = \"voicegems\"\n\n if create_customer(token, @plan, @code, @new_price, event_type) #using the same helper as when a new user signs up as a customer\n #record stripe's (?) customer_id for this user\n # this helper is in users helper\n \n redirect_to current_user\n else\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\n #These above are required to properly render purchase_sub_existing. Not changing below to redirect because the create_customer helper is creating Flash.nows, not Flashs, and this helper also being used in for totally new customers/users\n render 'purchase_sub_existing'\n end \n\n\nend",
"def create\n @payment = Payment.new(payment_params)\n\n @amount = @payment.amount * 100\n\n Stripe.api_key = 'sk_test_CfSPVwqeJbuCxJSnCDcXuKRG';\n\n begin\n if current_user.stripe_customer_id.present?\n @customer = Stripe::Customer.retrieve(current_user.stripe_customer_id) \n else\n card_details = {}\n card_details[:name] = payment_params[:first_name]\n card_details[:number] = payment_params[:credit_card_number]\n card_details[:cvc] = payment_params[:card_security_code]\n card_details[:exp_month] = payment_params[:expiration_month]\n card_details[:exp_year] = payment_params[:expiration_year]\n\n @card = Stripe::Token.create(card: card_details)\n \n @customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => @card.id\n )\n\n if @customer.present?\n current_user.stripe_customer_id = @customer.id\n current_user.save!\n end\n end\n\n\n @charge = Stripe::Charge.create(\n :customer => @customer.id,\n :amount => @amount,\n :description => 'Autopass payment',\n :currency => 'usd'\n )\n\n if @payment.save\n redirect_to success_payment_path(@payment), notice: 'Payment was successfully created. Vender will be notified.'\n end\n rescue Stripe::CardError => e\n redirect_to \"/siteparking/sitepayments/#{@payment.parking.token}\"\n flash[:error] = e.message\n end \n\n\n end",
"def purchase_events_new_card_couple\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if update_card_and_purchase(token, @number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n flash[:success] = \"Thank you! You have purchased #{@number} VoiceGems Pages.\"\n redirect_to current_user\n else\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \nend",
"def create\n customer = StripeTool.create_customer(email: params[:stripeEmail], stripe_token: params[:stripeToken])\n\n\tcharge = StripeTool.create_charge(customer_id: customer.id, amount: @amount, description: @description)\n\n current_user.stripe_id = customer.id\n\n\treceipt = Charge.new charge_stripe_token: charge.id, price: @amount, description: @description)\n\n\tif Charge.save\n\n\telse\n\n\tend",
"def purchase_events_new_stripe_couple\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \n\nend",
"def index\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to user_path(:id => $stripe_customer.id), notice: 'Payment was succesfull.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def purchase_events_new_stripe_customer\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_user_purchase_path\n end \n\nend",
"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_events_new_card\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost] #in cents\n\n if update_card_and_purchase(token, @number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n flash[:success] = \"Thank you! You have purchased an additional #{@number} event pages.\"\n redirect_to current_user\n else\n redirect_to existing_user_purchase_path\n end \nend",
"def charge_credit_invoice\n @invoice = Invoice.find(params[:id])\n Stripe.api_key = \"\"\n total_invoice_stripe = Money.new(@invoice.total_due, \"USD\")\n \n charge = Stripe::Charge.create(\n :amount => total_invoice_stripe.cents,\n :currency => \"usd\",\n :card => params[:invoice][:stripe_card_token],\n :description => @invoice.invoice_number\n )\n \n @invoice.stripe_card_token = charge.id\n if(@invoice.save!)\n @invoice.payment_received = true\n @invoice.save!\n redirect_to invoice_path(@invoice.id)\n else\n redirect_to root_path\n end\n end",
"def billing\n authorize current_user.organization\n if request.get?\n load_receipts\n if current_user.organization.stripe_customer.present?\n @default_card = current_user.organization.default_card\n\n if @default_card.present?\n @masked_card_number = \"**** **** **** #{@default_card.last4}\"\n @button_label = \"Update Credit Card\"\n else\n @button_label = \"Add Credit Card\"\n end\n else\n @button_label = \"Add Credit Card\"\n end\n else\n #{\"stripeToken\"=>\"tok_1DMMCKBtjjIyBvbaLqcBqsD4\", \"stripeTokenType\"=>\"card\", \"stripeEmail\"=>\"user@gmail.com\", \"controller\"=>\"home\", \"action\"=>\"stripe\"}\n if current_user.organization.stripe_customer_id.blank?\n #You do not have to assign a source to create a customer.\n # However, if you set the customer up on a subscription, they will require a source to be available, and the charges will be made to the customer's default_source.\n # If a customer has only one source, it is automatically the default_source.\n customer = Stripe::Customer.create(\n source: params.fetch(:stripeToken),\n email: params.fetch(:stripeEmail)\n )\n organization = current_user.organization\n organization.stripe_customer_id = customer.id\n organization.save!\n else\n #you can also add a new card to an existing customer, using a token:\n customer = Stripe::Customer.retrieve(current_user.organization.stripe_customer_id)\n stripe_card = customer.sources.create(source: params.fetch(:stripeToken))\n\n #Once you have a card assigned to the customer, you can make it the default_source, using this:\n customer.default_source = customer.sources.retrieve(stripe_card.id)\n customer.save\n end\n\n # so that you can't simulate same POST request multiple times(stripeToken must be unique)\n redirect_to profile_billing_path\n end\n end",
"def create\n @Payment = Payment.new\n @Payment.user_id = current_user\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => (25 * 100).floor,\n :currency => \"usd\",\n :card => token\n )\n flash[:notice] = \"Thanks for purchasing!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n\n @Payment.stripe_id = charge.id\n @Payment.amount = charge.amount\n\n if current_user.subscribed != true\n current_user.subscribed = true\n current_user.credit = 25.00\n else\n current_user.credit = current_user.credit + 25.00\n end\n\n current_user.save\n redirect_to caves_path\n end",
"def confirm\n @model = User::BillingLog.find params[:id]\n @billable = @model.billable\n\n authorize @model\n\n if request.post?\n case @billable.pay_type.to_sym\n when *Billing::PaymentTypeList::BALANCE\n case @billable.class.name\n when 'Billing::Delocoin::Buy'\n run Billing::Delocoin::Buy::Operation::Finish, id: @billable.id do |result|\n roistat.push_async(:delocoin_buy_finish, cost: result['model'].cost)\n end\n\n return redirect_to status_my_billing_path(@model.billing_log.id)\n end\n end\n\n not_found\n end\n\n case @billable.pay_type.to_sym\n when *Billing::PaymentTypeList::YANDEX_KASSA\n @fields = Billing::YandexKassa::RequestFieldsService.new(@billable).perform\n\n render 'my/billing/confirm/yandex_kassa'\n when *Billing::PaymentTypeList::BALANCE\n render 'my/billing/confirm/balance'\n else\n not_found\n end\n end",
"def update_card\n host_url = request.protocol + request.host_with_port \n begin\n result = ChargeBee::HostedPage.update_payment_method(\n { :customer => { :id => @customer_id },\n :redirect_url => host_url + \"/ssp/redirect_handler\",\n :cancel_url => host_url + \"/ssp/subscription\",\n :embed => \"false\" })\n redirect_to result.hosted_page.url\n rescue Exception => e\n redirect_to \"/500\"\n end\n end",
"def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\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 create\n @user = current_user\n @product = @event.title\n @amount = @event.price\n @stripe_amount = (@amount * 100).to_i\n begin\n customer = Stripe::Customer.create({\n email: params[:stripeEmail],\n source: params[:stripeToken],\n })\n charge = Stripe::Charge.create({\n customer: customer.id,\n amount: @stripe_amount,\n description: \"Achat d'un produit\",\n currency: 'eur',\n })\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_order_path\n end\n end",
"def stripe_charge\n donation = Donation.create(user_id: current_user.id, disaster_id: params[:disaster_id], charity_id: params[:id], amount: params[:donation_amount])\n\n Stripe.api_key = ENV['STRIPE_SECRET']\n token = params[:stripeToken]\n\n customer = Stripe::Customer.create(\n :source => token,\n :description => \"Example customer\"\n )\n # current_user.token = customer //save user token\n begin\n charge = Stripe::Charge.create(\n :amount => donation.amount, # in cents\n :currency => \"usd\",\n :customer => customer.id\n )\n flash[:good] = \"Thanks for donating!\"\n rescue Stripe::CardError => e\n flash[:problem] = e.message\n end\n redirect_to root_path\n\n end",
"def checkout\n create_adapter!\n booking = StripeBooking.new(paymentplan: Paymentplan.find(params[:plan_id]))\n booking.succeed_booking!(Booking.current)\n redirect_to ordersuccess_path\n end",
"def callback\n if params[:error] == \"access_denied\"\n return redirect_to payment_url(subdomain: @account.subdomain),\n alert: %(Der Vorgang wurde abgebrochen. Fehlermeldung von Stripe: \"#{params[:error_description]}\")\n end\n @account.update!(oauth_service.fetch_access_token(params[:code]))\n Accountpaymentmethod.joins(:paymentmethod).find_or_create_by!(paymentmethod: Paymentmethod.find_by(key: \"cc\"))\n redirect_to payment_url(subdomain: @account.subdomain), notice: \"Stripe wurde erfolgreich integriert!\"\n end",
"def purchase\n # number of checks to see if coming out of context\n # no order_id\n unless params[:order_id]\n go_home()\n return\n end\n @order = Order.find_by_id(params[:order_id])\n # order doesn't exist\n unless @order\n go_home()\n return\n end\n # order is already authorized or paid\n if @order.state != Order::CREATED\n go_home()\n return\n end\n # order has zero quantity or zero amount\n if @order.quantity == 0 or @order.amount == 0\n go_home()\n return\n end\n # deal doesn't exist\n deal = @order.deal\n unless deal\n go_home()\n return\n end\n \n # check if deal has ended\n if deal.is_ended\n flash[:error] = \"This deal has ended. Checkout out some of our other deals!\"\n go_home()\n return\n end\n \n # check if deal hasn't started\n if !deal.is_started\n go_home()\n return\n end\n \n # check if order is timed out\n if @order.is_timed_out\n flash[:error] = \"Your order has timed out. Please restart your transaction.\"\n redirect_to :controller => self.controller_name, :action => 'order', :deal_id => @order.deal.id\n return\n end\n \n if params[:failure]\n flash.now[:error] = \"There was a problem approving your transaction. Please try again.\"\n end\n \n @sim_transaction = \n AuthorizeNet::SIM::Transaction.new(\n AUTHORIZE_NET_CONFIG['api_login_id'], \n AUTHORIZE_NET_CONFIG['api_transaction_key'], \n @order.amount.to_f,\n :transaction_type => AuthorizeNet::SIM::Transaction::Type::AUTHORIZE_ONLY,\n :relay_url => url_for(:controller => self.controller_name, :action => 'relay_response', :only_path => false))\n @timeout = OPTIONS[:order_timeout]\n @gateway_url = Rails.env.production? ? AuthorizeNet::SIM::Transaction::Gateway::LIVE : AuthorizeNet::SIM::Transaction::Gateway::TEST\n render \"payment/#{self.action_name}\"\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 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 create\n # Stripe customer creation\n customer = Stripe::Customer.create(\n source: params[:stripeToken],\n email: params[:stripeEmail]\n )\n # Stripe payment\n charge = Stripe::Charge.create(\n customer: customer.id, # You should store this customer id and re-use it.\n amount: @reservation.amount_cents,\n description: \"Paiement pour le pack #{@reservation.pack_sku} de la réservation #{@reservation.id}\",\n currency: @reservation.amount.currency\n )\n # Update the reservation statuses after payment is confirmed\n @reservation.update(payment: charge.to_json, payment_status: 'paid', tracking_status: 'paid')\n @reservation.save\n\n # Save paid amount in user profile (in case of pack modification, it will give ability to calculate amount to be paid)\n update_paid_amount(@reservation)\n\n # Redirect to user's dashboard\n redirect_to tracking_path\n\n # Send receipt E-mail\n send_receipt_mail\n\n # Redirect to payment page in case of error\n rescue Stripe::CardError => e\n flash[:alert] = e.message\n redirect_to new_reservation_payment_path(@reservation)\n end",
"def transfer_money\n\n @recipient_details = BankDetail.where(\"user_id =?\", params[:poster_id]).first\n\n @booking = Booking.find(params[:booking_id])\n\n if @recipient_details\n\n @price = @booking.price.to_i\n data = PaymentTransfer.transfer_money_to_poster(@booking,@recipient_details)\n if data.class == Stripe::InvalidRequestError\n redirect_to :back, :notice => \"Stripe error while creating customer: #{data.message}\"\n else\n redirect_to payement_transfers_path\n flash[:notice] = \"Payement was successfully transfered to #{@recipient_details.stripe_card_id_token}. Amount transfer to poster $#{data[0]} and commision is $#{data[1]}\"\n end\n else\n transfer_payment = @booking.update_columns(comment: \"Waiting for poster bank account.\")\n flash[:error] = \"No bank detail added for payment\"\n redirect_to payement_transfers_path\n\n end\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 receive_token\n publically do\n if req.post?\n res.header['Content-Type'] = \"text/plain\"\n\n # set your secret key: remember to change this to your live secret key in production\n # see your keys here https://manage.stripe.com/account\n Stripe.api_key = \"sk_0Jr3LdfdbLofD4rCiGVOQMWe14SKx\"\n\n # get the credit card details submitted by the form\n token = req.params[:stripeToken]\n\n #\n # ONE TIME CHARGE\n #\n\n # create the charge on Stripe's servers - this will charge the user's card\n #charge = Stripe::Charge.create(\n # :amount => 1000, # amount in cents, again\n # :currency => \"cad\",\n # :card => token,\n # :description => \"payinguser@example.com\"\n #)\n\n #\n # CREATE A RECURRING CUSTOMER\n #\n\n # create a Customer\n customer = Stripe::Customer.create(\n :card => token,\n :description => req.to_yaml.gibbler.shorten\n )\n customer_id = customer.id\n\n # charge the Customer instead of the card\n Stripe::Charge.create(\n :amount => 1000, # in cents\n :currency => \"cad\",\n :customer => customer.id\n )\n\n # save the customer ID in your database so you can use it later\n #save_stripe_customer_id(user, customer.id)\n\n # later\n #customer_id = get_stripe_customer_id(user)\n\n charge = Stripe::Charge.create(\n :amount => 1500, # $15.00 this time\n :currency => \"cad\",\n :customer => customer_id\n )\n\n\n res.body = req.to_yaml\n\n puts charge.to_yaml\n end\n end\n end",
"def create \n\t\t# amoutn in cents \n\t\t#@amount = 500 \n\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => 'example@stripe.com',\n\t\t\t:card => params[:stripeToken]\n\t\t\t)\t\n\n\t\tcharge = Stripe::Charge.create(\n\t\t\t:customer => customer.id,\n\t\t\t:amount => @amount,\n\t\t\t:description => 'Rails Stripe customer',\n\t\t\t:currency => 'usd'\n\t\t\t)\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to charges_path \n\tend",
"def another_action\n @discogs = Discogs::Wrapper.new(\"Test OAuth\", access_token: session[:access_token])\n \n # You can now perform authenticated requests.\n end",
"def create\n\n campaign_id = params[:campaign_id]\n credit_card_id = params[:credit_card_id]\n amount = params[:amount]\n\n #testing\n campaign = Campaign.find_by_id(campaign_id)\n user_id = campaign.user_id\n wepay_payment_type = \"credit_card\"\n if(amount>1)\n if(campaign!=nil)\n #create the payment object\n payment = Payment.new({\n campaign_id: campaign_id,\n payer_id: user_id,\n wepay_payment_id: credit_card_id,\n wepay_payment_type: wepay_payment_type,\n amount: amount\n })\n if !payment.valid?\n render json: error(payment.errors.full_messages)\n end\n if payment.valid? && payment.create_checkout && payment.save\n campaign.update_amount_donated\n render json: {\"checkout_id\" => payment[\"wepay_checkout_id\"]}\n else\n render json: payment_invalid_error\n end\n end\n end\n end",
"def add_card(access_token,payment_method)\n begin\n if Rails.env.production?\n @url =\"https://#{APP_CONFIG.auth_api_key}/billing/addCard\"\n @authKey = APP_CONFIG.auth_api_key\n else\n @url = \"https://dev-#{APP_CONFIG.auth_api_key}:3018/billing/addCard\"\n @authKey = APP_CONFIG.auth_api_key\n end\n uri = URI(@url)\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n req = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'});\n # debugger\n req.body ={\t\t\t\n :access_token => access_token,\n :user_id => user_id,\n :auth_key => @authKey,\n :offering => 2,\n :payment_method => payment_method\n }.to_json\n res1 = https.request(req)\n @authBody = JSON.parse(res1.body)\n raise @authBody[\"message\"] if @authBody[\"status\"] == 201\n return @authBody\n rescue Exception => e\n puts \"add_card exception\"\n puts e\n raise e\n end\n end",
"def successful_purchase_response\n end",
"def create\n @stripe = Stripe.new\n @stripe.comic = @comic\n set_image\n if @stripe.save(stripe_params.except(:image))\n render json: (render_to_string(partial: 'stripe', locals: { stripe: @stripe })), status: :created\n else\n render json: {:errors => @stripe.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def purchase_events_existing_card\n\n @number = params[:peu][:number]\n coupon = params[:peu][:coupon] # this is the coupon name/code, a string\n cost = params[:peu][:cost] #in cents\n\n # retrieve stripe customer object (downstream from user having a customer_id)\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n if existing_customer_purchase_events_existing_card(@number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n #if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n #end \n flash[:success] = \"Thank you! You have purchased an additional #{@number} event pages.\"\n redirect_to current_user\n else #errors in processing the card shouldn't usually happen, because the card was originally ok. Can test by using stripes card number that binds to customer but does not charge correctly.\n # YES THE REDIRECT WORKS WITH THAT STRIPE TESTING NUMBER\n redirect_to existing_user_purchase_path\n end \n\n\n \nend",
"def process_stripe_event(req, json)\n log.debug(\"type=data stripe_type=#{json['type']}\")\n case json['type']\n when 'customer.deleted' then stripe_customer_deleted(json, req)\n when 'customer.subscription.updated' then stripe_customer_subscription_updated(json, req)\n when 'customer.subscription.trial_will_end' then stripe_customer_trial_ending(json, req)\n when 'invoice.payment_failed' then stripe_invoice_payment_failed(json, req)\n end\n Rack::Response.new\n end",
"def purchase_events_existing_card_couple\n\n @number = params[:peu][:number]\n coupon = params[:peu][:coupon] # this is the coupon name/code, a string\n cost = params[:peu][:cost]\n\n # retrieve stripe customer object (downstream from user having a customer_id)\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n if existing_customer_purchase_events_existing_card(@number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n #if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n #end \n flash[:success] = \"Thank you! You have purchased #{@number} VoiceGems pages.\"\n redirect_to current_user\n else #errors in processing the card shouldn't usually happen, because the card was originally ok. Can test by using stripes card number that binds to customer but does not charge correctly.\n # YES THE REDIRECT WORKS WITH THAT STRIPE TESTING NUMBER\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \n\nend",
"def create\n #@order = Order.new(order_params)\n @order = current_user.orders.build(order_params)\n @order.add_line_items_from_cart(@cart)\n \n @amount = @cart.total_price.to_i * 100\n\n customer = Stripe::Customer.create(\n email: params[:stripeEmail],\n source: params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n customer: customer.id,\n amount: @amount,\n description: 'Grassy Payment',\n currency: 'cad'\n )\n\n # GET SWIFT INTEGRATION\n # api_key = ENV[\"swift_api_key\"]\n \n dropoffAddress = \"#{current_user.street_address}, #{current_user.city}, #{current_user.postal_code}, #{current_user.province}\"\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": ENV[\"swift_api_key\"],\n \"booking\":{\n \"items\": $items,\n \"pickupDetail\": {\n \"name\": \"Grassy\",\n \"phone\": \"7788368819\",\n \"address\": \"375 Water Street, Vancouver, BC V6B 5C6\"\n },\n \"dropoffDetail\": {\n \"name\": current_user.name,\n \"phone\": current_user.telephone,\n \"address\": dropoffAddress\n }\n }\n }.to_json, \n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n\n respond_to do |format|\n if @order.save\n\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n UserNotifier.send_order_confirmation(@order).deliver # sends order confirmation email to user\n UserNotifier.send_order_confirmation_to_grassy_owner(@order).deliver # sends order confirmation email to user\n format.html { redirect_to root_url, notice: 'Thank you for your order.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_url and return\n end",
"def create\n @order = Order.new(order_params)\n\n @record = Record.find(params[:record_id])\n @seller =@record.user\n\n @order.record_id = @record.id\n # this tells rails that the buyer id is equal to the current user id\n @order.buyer_id = current_user.id\n @order.seller_id = @seller.id\n\n #this first line tells stripe the secret key i added earlier from the stripe site and tells what acc to charge\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n # looks in the submitted form data. then pulls out the token stipe has given us, and hides it in the token.\n token = params[:stripeToken]\n\n #this code is available on the stripe API page for charging accounts.\n # i multiplied the selling price by 100 and use the .floor extension to keep the price in a integer\n begin\n charge = Stripe::Charge.create(\n :amount => (@record.Selling_Price * 100).floor,\n :currency => \"eur\",\n :card => token\n )\n flash[:notice] = \"Thank you for ordering with WaxDigger, Come back soon!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_url}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 create_stripe\n # Order created by promotions#order and passed to merchant/orders/order_form\n # Cases: 1) not a customer; saving card\n # 2) not a customer; not saving card\n # 3) customer; using saved card\n # 4) customer; using new card and saving it\n # 5) customer; using new card and not saving it\n #\n # NOTE: I'm saving the associated user object in the orders controller, instead of trying to do it in the User model\n # I think it makes more sense to isolate all the Stripe stuff here, than have it scattered through models.\n # I also removed Stripe code from the Order model. It is all in the controller and User model (where it belongs).\n\n @stripe_customer = @order.user.stripe_customer_obj\n\n # Calculate total charge, adjusting for macho bucks. Do we need to charge the card?\n total_charge = @order.total_cost - @order.user.total_macho_bucks\n if total_charge > 0\n # We need to charge the credit card \n if @stripe_customer.nil?\n charge_success = false\n \n if params[:save_card] == 'true'\n # case 1\n @stripe_customer = Stripe::Customer.create(:email => @order.email,\n :description => @order.description,\n :card => @order.stripe_card_token)\n \n # Not in attr_accessible for security; must assign explicitly\n @order.user.stripe_id = @stripe_customer.id\n if @order.user.save\n charge_success = charge_customer(@order, @stripe_customer, total_charge)\n else\n flash[:notice] = \"Card could not be saved.\"\n charge_success = charge_card(@order, total_charge)\n end\n else \n # case 2\n charge_success = charge_card(@order, total_charge)\n end\n else\n # get existing customer\n if params[:new_card] == 'true'\n if params[:save_card] == 'true'\n # case 4\n # Update the card information for an existing customer\n @stripe_customer.card = @order.stripe_card_token\n @stripe_customer.save\n \n charge_success = charge_customer(@order, @stripe_customer, total_charge)\n else\n # case 5\n charge_success = charge_card(@order, total_charge)\n end\n else\n # case 3\n charge_success = charge_customer(@order, @stripe_customer, total_charge)\n end\n end\n else\n # No charge necessary\n charge_success = true\n # Validated, so it has to be there\n @order.transaction_id = Order::MACHO_BUCKS_TRANSACTION_ID\n end\n \n # Charge operation should either succeed or throw an exception\n if charge_success\n # If the charge was successful, order will have charge_id (validated on save)\n if @order.save\n # After saving the order, create the associated vouchers using the promotion strategy\n # status defaults to Available; uuid is created upon save\n if @order.promotion.strategy.generate_vouchers(@order)\n flash[:notice] = I18n.t('order_successful')\n \n # If everything worked (voucher(s) saved), send the email\n # Products are handled differently in the mailer\n UserMailer.delay.promotion_order_email(@order)\n @order.user.log_activity(@order)\n \n # Debit the Macho Bucks. Usually 0, but possible they had more bucks than it cost\n # In the pathological case where they have negative macho bucks, the card was charged extra. That has to be cleared as well.\n # So we have to check for != 0, not > 0\n if @order.user.total_macho_bucks != 0\n deduction = @order.user.total_macho_bucks < 0 ? @order.user.total_macho_bucks : [@order.user.total_macho_bucks, @order.total_cost].min\n bucks = @order.build_macho_buck(:user_id => @order.user.id, :amount => -deduction, :notes => \"Credited on order: #{@order.description}\")\n if !bucks.save\n flash[:alert] = 'Unable to apply macho bucks!'\n end\n UserMailer.delay.macho_bucks_order_email(bucks)\n end\n \n redirect_to merchant_order_path(@order) and return\n end\n else\n @order.errors.add :base, \"Could not save order.\"\n end\n end\n\n # Should never get here, put theoretically possible if orders don't validate somehow; avoid template error\n render 'new' \n \n # Don't need a begin inside a def\n rescue Stripe::InvalidRequestError => error\n logger.error \"Stripe error while creating customer: #{error.message}\"\n @order.errors.add :base, \"There was a problem with your credit card. #{error.message}\"\n @promotion = @order.promotion\n render 'promotions/order'\n \n rescue Stripe::CardError => error\n logger.error \"Stripe error: #{error.message}\"\n @order.errors.add :base, \"There was a problem with your credit card. #{error.message}\"\n @promotion = @order.promotion\n render 'promotions/order'\n end",
"def show\n @stripe_client_id = ENV['CLIENT_ID']\n respond_with(@profile)\n end",
"def create_charge\n # Amount in cents\n @amount = 500\n\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'usd'\n )\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_path\n end",
"def show\n\n stripe_session = Stripe::Checkout::Session.create(\n payment_method_types: ['card'],\n client_reference_id: current_user ? current_user.id : nil,\n customer_email: current_user ? current_user.email : nil,\n\n line_items: [{ \n price_data: {\n unit_amount: @artefact.price.to_i * 100,\n currency: 'aud',\n product_data: { \n name: @artefact.name,\n description: @artefact.description\n },\n },\n quantity: 1\n }],\n\n payment_intent_data: {\n metadata: {\n artefact_id: @artefact.id,\n borrower_id: current_user ? current_user.profile.borrower.id : nil,\n loaner_id: current_user ? @artefact.loaner.id : nil\n }\n },\n mode: 'payment',\n success_url: \"#{root_url}payments/success?artefactId=#{@artefact.id}\",\n cancel_url: \"#{root_url}artefacts\"\n )\n\n @session_id = stripe_session.id\n pp stripe_session\n end",
"def oauth\n connector = StripeOauth.new(current_customer)\n\n logger.debug(connector)\n\n # logger.debug(\"===> #{stripe_confirm_url}\")\n\n url, error = connector.oauth_url(redirect_uri: stripe_confirm_url)\n\n if url.nil?\n flash[:alert] = error\n redirect_to customer_path(current_customer)\n else\n redirect_to url\n end\n end",
"def new_customer\n @org = Organisation.find_by(permalink: params[:organisation_id])\n @customer = Customer.new\n\n Stripe.api_key = ENV[\"STRIPE_SECRET_KEY\"]\n end",
"def webhook\n payment_id = params[:data][:object][:payment_intent]\n payment = Stripe::PaymentIntent.retrieve(payment_id)\n receipt_url = payment.charges.data[0].receipt_url\n listing_id = payment.metadata.listing_id\n buyer_id = payment.metadata.user_id\n listing = Listing.find(listing_id)\n\n # Only changes deposit paid when payment has been successfully made.\n\n # Creates a purchase, which has the listing_id (technically don't need seller_id since that data is already stored in the Listings table in user_id column),\n # the buyer_id, payment_id, receipt_url and deposit_paid: to be true. But to make querying easier, added the seller_id in purchase table as well.\n paid = Purchase.create!(listing_id: listing_id, deposit_paid: true, buyer_id: buyer_id, seller_id: listing.user_id, payment_id: payment_id, receipt_url: receipt_url)\n end",
"def call\n if card\n jwt = JsonWebToken.encode(card_id: card.id, user_id: @user_id)\n if card.user && card.user.id == @user_id\n Shortlink.where(jwt: jwt).where('expires_at < ? ', Time.now).destroy_all\n url = Shortlink.create(jwt: jwt, expires_at: 48.hours.from_now)\n else\n url = Shortlink.find_or_create_by(jwt: jwt)\n end\n url.token\n end\n end",
"def create\n # Amount in cents\n @amount = 1300\n\n customer = Stripe::Customer.create(\n :email => 'example@stripe.com',\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'usd'\n )\n\nrescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to charges_path\nend",
"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 confirm\n \tGoCardless.confirm_resource params\n \trender \"gocardless/success\"\nrescue GoCardless::ApiError => e\n \trender :text => \"Could not confirm new subscription. Details: #{e}\"\nend",
"def update_stripe\n Stripe.api_key = \"sk_test_fVKfBEBDcWPZl5mLFk44KBJX\"\n \n # create the charge on Stripe's servers - this will charge the user's card\n if customer = Stripe::Customer.create(\n :card => stripe_token,\n :plan => \"basic_plan\",\n :description => email\n )\n \n User.update(user_id, :status => 'paid', :stripe_customer_id => customer.id)\n end\n end",
"def create\n @order = Order.new(order_params)\n @seller = @listing.user\n @order.buyer_id = current_user.id\n @order.seller_id = @seller.id\n @order.listing_id = @listing.id\n\n Stripe.api_key = Rails.application.secrets.stripe_api_key\n begin\n Stripe::Charge.create(amount: (@listing.price * 100).floor,\n currency: 'usd',\n source: params[:stripe_token],\n description: \"Charge for #{@listing.description}\")\n flash[:notice] = 'Thanks for your order!'\n rescue Stripe::CardError => error\n flash[:danger] = error.message\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_path }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 show\n @listing = Listing.find(params[:id])\n session = Stripe::Checkout::Session.create(\n payment_method_types: ['card'],\n customer_email: \"test@gmail.com\",\n line_items: [{\n name: @listing.title,\n description: @listing.description,\n amount: (@listing.price * 100),\n currency: 'aud',\n quantity: 1,\n images: @listing.images.empty? ? nil : [@listing.images.first.service_url]\n }],\n payment_intent_data: {\n metadata: {\n listing_id: @listing.id,\n user_id: current_user ? current_user.id : nil\n }\n },\n success_url: \"#{root_url}purchases/success?listingId=#{@listing.id}\",\n cancel_url: \"#{root_url}\"\n )\n @session_id = session.id\n end",
"def create\n @amount = ((current_order.subtotal + 8)*100).to_i\n @description = \"Order: #{current_order.id}\"\n\n @checkout = Checkout.new(checkout_params)\n @checkout.add_order_items_from_cart(current_order) \n token = params[:stripeToken]\n\n charge = Stripe::Charge.create({\n source: token,\n amount: @amount,\n currency: \"usd\",\n description: @description\n })\n\n respond_to do |format|\n if @checkout.save\n Order.destroy(session[:order_id])\n session[:order_id] = nil\n OrderMailer.order_recived(@checkout).deliver_now\n format.html { redirect_to root_path, notice: 'Thanks for you order!' }\n format.json { render :show, status: :created, location: @checkout }\n else\n format.html { render :new }\n format.json { render json: @checkout.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash.alert = e.message\n render action: :new\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 wepay_postfill\n # If the user approved the 'preapproval' and \n if params.has_key?('preapproval_id')\n @order = Order.find_by_token(params[:preapproval_id])\n unless @order.nil?\n wepay = WePay.new(Settings.wepay_client_id, Settings.wepay_access_token, _use_stage = (!Rails.env.production?))\n # Let's find the user information on Wepay end..\n response = wepay.call('/preapproval', Settings.wepay_access_token, {\n :preapproval_id => params[:preapproval_id]\n })\n \n @order.wepay_postfill(response)\n if params['status'] != 'approved' \n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n end",
"def show\n @car = Car.find(params[:id])\n if user_signed_in?\n # ----------STRIPE ---------\n session = Stripe::Checkout::Session.create(\n payment_method_types: ['card'],\n customer_email: current_user.email,\n line_items: [ \n {\n name: @car.make,\n description: @car.model,\n images: ['https://thumbs.dreamstime.com/z/writing-note-showing-need-loanquestion-business-concept-offering-money-demonstratingal-finances-photo-showcasing-157951074.jpg'],\n # images: [@car.picture],\n amount: (@car.price * 100),\n currency: 'aud',\n quantity: 1\n } \n ],\n payment_intent_data: {\n metadata: {\n car_id: @car.id,\n user_name: current_user.name\n }\n },\n success_url: \"#{root_url}payments/success?carId=#{@car.id}\",\n cancel_url: \"#{root_url}cars\"\n )\n @session_id = session.id\n end\n end",
"def create_account_link\n render json: Stripe::AccountLink.create(account_params.to_h), status: :created\n end",
"def new \n @stripe_btn_data = {\n key: \"#{ Rails.configuration.stripe[:publishable_key] }\",\n description: \"Premium Membership - #{current_user.name}\",\n amount: amount_for_upgrade\n }\n end",
"def update_card_and_subscription(token, plan) # plan is now a my_plan_id\n \n c = Stripe::Customer.retrieve(current_user.customer_id) #have this in the enveloping controller action as well, because of the 'undefined variable c' error i was getting from the 4000000000000341 card test\n\n #updates customer with new card\n c.card = token\n c.save\n\n #updates subscription plan in stripe \n c.update_subscription(:plan => plan, :prorate => true)\n\n rescue Stripe::InvalidRequestError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n \n rescue Stripe::CardError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n\n rescue Stripe::StripeError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n flash[:error] = \"There was a problem processing your credit card. #{e.message}. Please try again.\"\n false\n\n end",
"def create\n # Amount in cents\n @amount = 1500\n\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Tshirtgram T-shirt',\n :currency => 'GBP'\n )\n\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_path\n\n @addtosaletable=Sale.create(:email=>current_user.email, :user_id=>current_user.id, :amount=>@amount, :stripe_id=>customer.id,\n :stripe_token=>params[:stripeToken], :picture_id=>params[:picture_id], :size=>params[:size], :address=>params[:address], :country=>params[:country], :postal_code=>params[:postal_code], :card_expiration=>Date.new(charge.card.exp_year,charge.card.exp_month,1) )\n \n end",
"def post_buy_token\n # Whitelist parameters for buying tokens\n purchase_params \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 purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #UserMailer.ordered(\"google.com\", response.params.to_s, User.find(cart.user_id), cart).deliver\n cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def subscription_checkout\n\n @code = params[:couponCode]\n\n if !@code.blank?\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 test@example.com\",\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 create\n @user.account = Account.new if @user.account.nil?\n\n if @user.account.save_with_stripe(params)\n redirect_to user_url(@user), notice: 'Account was successfully created.'\n else\n handle_account_errors(@user, params)\n render :new\n end\n end",
"def create\n\n # @stripe_account = StripeAccount.new(stripe_account_params)\n # @user = User.find(params[:user_id])\n # @stripe_account.user_id = current_user.id\n\n @user = (current_user || current_affiliate)\n @stripe_account = @user.build_stripe_account(stripe_account_params)\n\n\n\n acct = Stripe::Account.create({\n :country => \"US\",\n :type => \"custom\",\n legal_entity: {\n first_name: stripe_account_params[:first_name].capitalize,\n last_name: stripe_account_params[:last_name].capitalize,\n type: stripe_account_params[:account_type],\n dob: {\n day: stripe_account_params[:dob_day],\n month: stripe_account_params[:dob_month],\n year: stripe_account_params[:dob_year]\n },\n address: {\n line1: stripe_account_params[:address_line1],\n city: stripe_account_params[:address_city],\n state: stripe_account_params[:address_state],\n postal_code: stripe_account_params[:address_postal]\n },\n ssn_last_4: stripe_account_params[:ssn_last_4]\n },\n tos_acceptance: {\n date: Time.now.to_i,\n ip: request.remote_ip\n }\n\n })\n\n @stripe_account.acct_id = acct.id\n # @user.stripe_token = acct.id\n\n\n\n respond_to do |format|\n\n # @user = User.find(params[:id])\n\n if @stripe_account.save!\n # && @user.save\n\n\n\n\n format.html { redirect_to new_bank_account_path, notice: 'Stripe account was successfully created.' }\n format.json { render :show, status: :created, location: @stripe_account }\n\n\n else\n format.html { render :new }\n format.json { render json: @stripe_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 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 create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n @order.donor_id = current_donor.id\n @order.price = @cart.total_price\n respond_to do |format|\n if @order.save\n @order.line_items.each do |line|\n thing = Product.find(line.product_id)\n thing.sold = true\n thing.save\n end\n token = params[:stripeToken]\n @amount = @cart.total_price.to_i*100\n\n charge = Stripe::Charge.create({\n amount: @amount,\n currency: 'aud',\n description: 'Example charge',\n source: token,\n \n })\n \n Order.new[:params]\n\n redirect_to controller: 'orders', action: 'show', id: Order.last.id\n\n\n Cart.destroy(session[:cart_id])\n session[:cart_id]\n format.html \n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 buy\n @amount = (@payment.shopping_cart.total*100).to_i\n\n customer = Stripe::Customer.create(\n :email => @payment.user.email,\n :source => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'usd'\n )\n\n @shopping_cart.save\n session[:shopping_cart_id] = nil\n session[:payment_id] = nil\n\n @payment.complete = true\n @payment.save\n\n redirect_to payments_success_path\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to payments_success_path\n end",
"def index\n @stripes = Stripe.where(:comic_id => @comic.id)\n end",
"def create_order\n @order = Order.find(params[:order_id])\n @tire_listing = TireListing.find(params[:tire_listing_id])\n\n # can we find it? If not we need to recreate it.\n if !@order.stripe_buyer_customer_token.blank?\n begin\n @customer = Stripe::Customer.retrieve(@order.stripe_buyer_customer_token)\n rescue Exception => e\n # could not retrieve the customer record, so let's just re-create the customer\n @customer = nil \n @order.stripe_buyer_customer_token = \"\"\n end\n end\n\n if @order.stripe_buyer_customer_token.blank?\n begin\n @customer = Stripe::Customer.create(:card => params[:stripeToken], :description => params[:email])\n rescue Exception => e\n @order.destroy\n redirect_to @order.tire_listing, notice: \"There was an error with your data - message: #{e.to_s}\"\n return\n end\n @order.stripe_buyer_customer_token = @customer.id\n @order.uuid = SecureRandom.uuid\n elsif @customer.nil?\n @customer = Stripe::Customer.retrieve(@order.stripe_buyer_customer_token)\n end\n\n stripe_buyer_customer_cc_token = @customer.default_source #@customer.active_card.id\n @order.buyer_name = @customer.sources.first.name #@customer.active_card.name\n @order.buyer_email = params[:email]\n @order.buyer_phone = params[:phone]\n @order.notify_buyer_with_text = params[:notify_buyer_via_text]\n @order.buyer_address1 = @customer.sources.first.address_line1 #@customer.active_card.address_line1\n @order.buyer_city = @customer.sources.first.address_city #@customer.active_card.address_city\n @order.buyer_state = @customer.sources.first.address_state #@customer.active_card.address_state\n @order.buyer_zip = @customer.sources.first.address_zip #@customer.active_card.address_zip\n\n @order.status = order_status_array[:ready_for_billing]\n @order.save\n\n @order.delay.bill_order\n\n flash[:alert] = 'Your credit card will be billed shortly. It is important for you to schedule an appointment time now to complete the order. You will receive a confirmation email in 10 minutes -OR- after scheduling your appointment.'\n redirect_to :action => :new, :controller => :appointments, :tire_store_id => @order.tire_listing.tire_store_id, :tire_listing_id => @order.tire_listing_id, :order_id => @order.id, :order_uuid => @order.uuid\n end",
"def amazon_postfill\n unless params[:callerReference].blank?\n @order = Order.postfill!(params)\n end\n # \"A\" means the user cancelled the preorder before clicking \"Confirm\" on Amazon Payments.\n if params['status'] != 'A' && @order.present?\n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n end",
"def chargeUser(msisdn,amount,userToken)\n \tcontent = open('https://devapi.globelabs.com.ph/payments/2307').read\n\tjson = JSON.parse(content)\n\tincrement = json['result'].first['reference_code'].to_i+1\n\turi = URI.parse(\"https://devapi.globelabs.com.ph/payment/v1/transactions/amount/\")\n uri.query = \"access_token=#{userToken}\"\n response = HTTParty.post(uri,\n\t:body => {:description => 'desc', :endUserId => msisdn, :amount => amount, :referenceCode => 91131000001,\n\t:transactionOperationStatus => 'charged'})\n output(response)\n response.code.eql?(201) ? (Transaction.successful(msisdn,amount) ; sendSms(msisdn,amount,userToken)) : (Transaction.failed(msisdn,amount))\n end",
"def create\n @traveler = Traveler.new(traveler_params)\n @amount = 2000\n @traveler.user_id = current_user.id\n\n token = params[:stripeToken]\n card_brand = params[:user][:card_brand]\n card_exp_month = params[:user][:card_exp_month]\n card_exp_year = params[:user][:card_exp_year]\n card_last4 = params[:user][:card_last4]\n\n charge = Stripe::Charge.create(\n amount: @amount,\n currency: \"myr\",\n description: \"ReadyBus\",\n source: token\n )\n\n current_user.stripe_id = charge.id\n current_user.card_brand = card_brand\n current_user.card_exp_month = card_exp_month\n current_user.card_exp_year = card_exp_year\n current_user.card_last4 = card_last4\n current_user.save!\n\n\n respond_to do |format|\n if @traveler.save\n format.html { redirect_to @traveler, notice: 'Your travel has successfully booked.' }\n format.json { render :show, status: :created, location: @traveler }\n else\n format.html { render :new }\n format.json { render json: @traveler.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash.alert = e.message\n render action: :new\n end",
"def buy_now\n @game = Game.find(params[:game_id])\n @user = current_user\n customer = Stripe::Customer.create({\n email: params[:stripeEmail],\n source: params[:stripeToken],\n })\n begin\n charge = Stripe::Charge.create({\n customer: customer.id,\n amount: params[:amount],\n description: 'Rails Stripe customer',\n currency: 'usd',\n })\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to game_path(@game)\n end\n # After the paymen is successful Create an Order to store the information.\n order = Order.create(user: @user, publisher: @game.publisher, game: @game)\n \n GameMailer.with(user: current_user, key: order.game_key).new_key_email.deliver_now\n redirect_to new_charge_path\n end",
"def save_with_subscription\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n # save customer id in DB with response\n self.stripe_customer_token = customer.id \n # runs save\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 stripe_create(options)\n begin\n charge = Stripe::Charge.create({\n :amount => options[:amount],\n :currency => \"usd\",\n :capture => false,\n :description => \"Order Number #{options[:order_id]}\",\n :source => {\n :exp_month => options[:exp_month],\n :exp_year => options[:exp_year],\n :number => options[:card_number],\n :cvc => options[:cvc],\n :name => options[:full_name],\n :address_zip => options[:zip_code]\n }\n })\n self.update(:stripe_charge_id => charge[:id], :gateway => \"stripe\")\n \n if charge[:status] == \"succeeded\"\n self.update(:status => :authorized)\n return true\n else\n self.update(:status => :failed, :response_message => charge[:failure_message])\n return false\n end\n rescue Stripe::CardError => e\n self.update(:status => :failed, :response_message => e.message)\n return false\n rescue Stripe::StripeError => e\n self.update(:status => :failed, :response_message => e.message)\n return false\n end\n end",
"def on_subscription_success\n redirect_to(action: :index) \n end",
"def pay\n # Find the user to pay.\n user = User.find( params[:id] )\n\n # Charge $10.\n amount = 1000\n # Calculate the fee amount that goes to the application.\n fee = (amount * Rails.application.secrets.fee_percentage).to_i\n\n begin\n charge = Stripe::Charge.create(\n {\n amount: amount,\n currency: user.currency,\n card: params[:token],\n description: \"Test Charge via Stripe Connect\",\n application_fee: fee\n },\n\n # Use the user-to-be-paid's access token\n # to make the charge.\n user.secret_key\n )\n flash[:notice] = \"Charged successfully! <a target='_blank' rel='connected-account' href='https://dashboard.stripe.com/test/payments/#{charge.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 create\n @cart = Cart.find(params[:cart_id].to_i)\n token = params[:stripeToken]\n #payment old changes\n # if @cart.instant_total_price_cents != 0\n # begin\n # puts \"Processing payment\"\n # if params[:payment_method].blank? or params[:payment_method] == \"card\"\n # sub = Subscription.find_by(user_id: current_user.id, stripe_customer_token: token)\n # if sub.nil?\n # last4 = params[:last4]\n # exp_year = params[:exp_year]\n # exp_month = params[:exp_month]\n # subscription = Subscription.new(stripe_customer_token: token, user_id: current_user.id,last4: last4,exp_year: exp_year,exp_month: exp_month)\n # new_sub = Order.save_with_payment(params[:email],token,current_user.name,@cart.instant_total_price_cents)\n # subscription.stripe_user_id = new_sub\n # subscription.save\n # else\n # Order.payment_only(current_user.name,@cart.instant_total_price_cents,sub.stripe_user_id)\n # end\n # else\n # account = current_user.bank_accounts.first\n # if account.stripe_user_id.nil?\n # account.stripe_user_id = Order.save_with_payment(params[:email],account.stripe_customer_token,current_user.name,@cart.instant_total_price_cents)\n # account.save\n # else\n # Order.payment_only(current_user.name,@cart.instant_total_price_cents,account.stripe_user_id)\n # end\n # end\n # rescue => e\n # puts \"Payment failed\"\n # puts e\n # ExceptionNotifier.notify_exception e\n # render json: {\"error\":\"Payment was unsuccessful\"}, status: :unprocessable_entity and return\n # end\n # end\n\n address_type = params[:address_type].nil? ? \"user\" : params[:address_type]\n if params[:old_address_id].blank?\n current_user.addresses.create!(first_name: params[:first_name], last_name: params[:last_name], mobile: params[:mobile], line_1: params[:line_1], line_2: params[:line_2], line_3: params[:line_3], city: params[:city], state: params[:state], address_type: address_type, pincode: params[:pincode].to_i, name: \"shipping\")\n else\n puts \"Address found. Updating it\"\n address = Address.find params[:old_address_id]\n address.updated_at = DateTime.now\n address.save\n end\n\n CartItem.where(cart: @cart).group_by(&:provider).each do |provider,cart_items_all|\n cart_items_instant = cart_items_all.select {|ci| ci.product.storefront_option == true}\n cart_items_invoice = cart_items_all.select {|ci| ci.product.storefront_option == false}\n [cart_items_instant,cart_items_invoice].each do |cart_items|\n if cart_items.length > 0\n @order = Order.new\n @order.first_name = params[:first_name]\n @order.last_name = params[:last_name]\n @order.mobile_number = params[:mobile_number]\n @order.email = params[:email]\n @order.order_date = DateTime.now\n @order.total_price_cents = 0\n @order.user = current_user\n @order.save!\n # if cart_items.first.product.storefront_option\n # @order.status = :unpaid\n # @order.save!\n # end\n\n cart_items.each do |cart_item|\n @order.total_price_cents += cart_item.price_cents * cart_item.quantity\n order_item = @order.order_items.new(price_cents: cart_item.price_cents, product: cart_item.product, quantity: cart_item.quantity,provider: cart_item.provider)\n cart_item.destroy\n end\n\n @order.recalcuate_order_total\n @order.addresses.create!(first_name: params[:first_name], last_name: params[:last_name], mobile: params[:mobile], line_1: params[:line_1], line_2: params[:line_2], line_3: params[:line_3], city: params[:city], state: params[:state], address_type: address_type, pincode: params[:pincode].to_i, name: \"shipping\")\n SupplierMailer.order_email(@order).deliver_later\n end\n end\n end\n\n respond_to do |format|\n format.html { render json: @order.id, status: :ok }\n format.json { render json: @order.id, status: :ok}\n end\n end",
"def create\n @order = Order.new(order_params)\n @service = Service.find(params[:service_id])\n @seller = @service.userID\n\n @order.service_id = @service.id\n @order.buyer_id = current_user.id\n @order.seller_id = @seller\n\n PinPayment.secret_key = 'CRuWFFtjN2m3djtcNB439A'\n card_token = params[:card_token]\n number = params[:number]\n name = params[:name]\n expiry_year = params[:expiry_year]\n expiry_month = params[:expiry_month]\n cvc = params[:cvc]\n\n charge = PinPayment::Charge.create(\n email: current_user.email,\n description: @service.description,\n amount: (@service.price * 100).floor,\n currency: 'AUD',\n ip_address: request.remote_ip,\n card: {\n number: number,\n expiry_month: expiry_month,\n expiry_year: expiry_year,\n cvc: cvc,\n name: current_user.name,\n }\n ) \n\n if charge.success?\n alert (\"yo success\")\n end\n\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to root_url, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.new(payment_params)\n #tells you to find the id in the URL\n @challenge = Challenge.find(params[:challenge_id])\n @host = @challenge.user\n\n @payment.challenge_id = @challenge.id\n #fill in player id when you enter a new player, authenticate above, in purple\n @payment.player_id = current_user.id\n @payment.host_id = @host.id\n @payment.update_attribute(:paid, true)\n \n#stripe credit card payment begins\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => (@challenge.stake * 100).floor,\n :currency => \"usd\",\n :card => token\n )\n flash[:notice] = \"Thanks for ordering!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n \n#stripe bank transfer > insert expression here: if @challengewinner=Y, $ pushes into the user's balance summation of credit card charge amount) #2 challenge stake+challenge stake\n\n transfer = Stripe::Transfer.create(\n :amount => (@challenge.stake * 95).floor,\n :currency => \"usd\",\n :recipient => @host.recipient\n )\n\n#stripe credit card payment begins\n\n#stripe bank transfer > insert expression here: if @challengewinner=Y, $ pushes into the user's balance summation of credit card charge amount) #2 challenge stake+challenge stake\n\n# Set your secret key: remember to change this to your live secret key in production\n# See your keys here https://dashboard.stripe.com/account\n #Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n #token = params[:stripeToken]\n\n\n \n\n respond_to do |format|\n if @payment.save\n #redirect them to DASHBOARD\n format.html { redirect_to @challenge, notice: 'Payment was successfully created.'}\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6696342",
"0.6291564",
"0.62733585",
"0.6211091",
"0.61686",
"0.6157328",
"0.6155153",
"0.6155148",
"0.6149929",
"0.61406296",
"0.61396617",
"0.613404",
"0.61200106",
"0.60977656",
"0.60968477",
"0.6092011",
"0.6063209",
"0.60606515",
"0.6047602",
"0.6030292",
"0.6026652",
"0.602066",
"0.6007202",
"0.5958824",
"0.59588057",
"0.595713",
"0.5943102",
"0.59348327",
"0.59314805",
"0.59276146",
"0.5926403",
"0.59243184",
"0.59228706",
"0.59165686",
"0.587131",
"0.58712",
"0.5847465",
"0.5847461",
"0.58385664",
"0.58323705",
"0.5830739",
"0.5809609",
"0.57971555",
"0.579576",
"0.57948154",
"0.5790827",
"0.578889",
"0.5787634",
"0.578365",
"0.57822853",
"0.5779074",
"0.5768978",
"0.5764711",
"0.57582563",
"0.5755676",
"0.57538223",
"0.57510906",
"0.57510316",
"0.5745953",
"0.57444763",
"0.5742228",
"0.5738426",
"0.57282734",
"0.57226795",
"0.5715455",
"0.57102567",
"0.57074237",
"0.5702571",
"0.5697747",
"0.56924355",
"0.569025",
"0.5679913",
"0.567833",
"0.56724006",
"0.56686705",
"0.5668228",
"0.5665946",
"0.56657386",
"0.5659947",
"0.5659129",
"0.56581175",
"0.5645722",
"0.56443065",
"0.56333786",
"0.56292266",
"0.56287295",
"0.56226194",
"0.56224126",
"0.5621563",
"0.56180334",
"0.56035703",
"0.5602944",
"0.55956995",
"0.5592723",
"0.5589063",
"0.5585985",
"0.5583822",
"0.5582741",
"0.557973",
"0.55790967",
"0.55759835"
] | 0.0 | -1 |
other sport name actions are scoped to venue; we need all possible sport names for all venues | def sport_name_options
authorize :report
sport_names = company.venues.
flat_map { |venue| venue.supported_sports_options }.
uniq { |hash| hash[:value] }
render json: sport_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unusual_sport; end",
"def venue_name\n venue.name if venue\n end",
"def national_sport; end",
"def unusual_sport\n fetch('sport.unusual')\n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect{|item| \"#{item.capitalize}!\" }\nend",
"def select_options_for_court_sports\n @court_sports_enums = Court.where(venue_id: authorized_scope(company.venues).select(:id)).active.\n pluck('distinct sport_name')\n @court_sports = @court_sports_enums.map { |n| Court.sport_names.key(n) }\n render json: @court_sports.map { |x| { value: x, label: x.humanize } }\n end",
"def national_sport\n fetch('team.sport')\n end",
"def winter_olympics_sport; end",
"def summer_olympics_sport; end",
"def sport; end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect {|i| i + \"!\"}.map(&:capitalize)\nend",
"def winter_paralympics_sport; end",
"def team_names\n game_hash.collect {|home_or_away, stats| team_name = stats[:team_name].to_s}\nend",
"def venue\n\t\"Town Hall\"\nend",
"def summon_captain_planet(planeteer_calls)\nplaneteer_calls.map { |string| \"#{string.capitalize}!\" }\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + '!' }\nend",
"def summer_paralympics_sport; end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map do |call|\n call.capitalize + \"!\"\n end\nend",
"def show_teams\n puts \"\\nWhat sport would you like to see the teams for? (Enter a sport please)\"\n sport_name = gets.chomp\n\n @sport = Sport.find_by(name: sport_name)\n\n puts \"\\nHere is a list of the teams for #{sport_name}\"\n @sport.teams.each do |x|\n puts \"\\n#{x.name} - #{x.city.name}\\n\"\n # puts x.info\n end\n end",
"def play_sports\n end",
"def initialize(client, sport)\n super(client)\n @sport = sport.downcase.to_sym\n end",
"def sport(sport_id, **options) = get(\"/sports/#{sport_id}\", **options)",
"def team_names\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend",
"def name_all_players()\n set_name()\n set_other_name()\n end",
"def team_names\n game_hash.collect do |location, attributes|\n attributes[:team_name]\n end\nend",
"def team_names\n game = Game.find(self.game_id)\n type = self.bet_type\n if over_under?\n return \"#{game.away_team} vs #{game.home_team}\"\n elsif type == \"lay\"\n if game.spread <= 0\n return game.home_team\n else\n return game.away_team\n end\n else\n if game.spread <= 0\n return game.away_team\n else\n return game.home_team\n end\n end\n end",
"def summon_captain_planet(captain_planet)\n captain_planet.collect{ |food, index| \"#{index}#{food.capitalize}!\"}\n # Your code here\nend",
"def summon_captain_planet(planeteer_calls) # Your code here\n planeteer_calls.map {|powers| powers.capitalize.concat(\"!\")}\nend",
"def fullname()\n\t\t[self.name(), self.sport().titleize, self.variety().titleize].join(\" \")\n\tend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |element| element.capitalize! + \"!\"}\nend",
"def \n \n summon_captain_planet(planeteer_calls)\n \n planeteer_calls.map { |element| element.capitalize + \"!\" }\n \nend",
"def get_champion_names\n Static.get_champion_list.keys\n end",
"def get_full_name\n \"#{season.get_season_type}, #{get_event_type} #{get_category_type} #{get_gender_type_code}: #{get_timing}\"\n end",
"def innings_name\n \"#{match.matchname}: Batting team: #{self.battingteam}\"\n end",
"def marketplace_names\n %w(graphicriver themeforest activeden codecanyon videohive audiojungle photodune 3docean)\n end",
"def summon_captain_planet(calls)\n calls.map do |call|\n call.capitalize + \"!\"\n end\nend",
"def full_name\n Venue.find(venue_id).name + \" - \" + roomName\n end",
"def add_named_season_name(named_season_name)\r\n named_season_name << named_season_name\r\n end",
"def sport_name=(name)\n sport = Sport.find_by_name(name)\n self.sport_id = sport.try(:id)\n end",
"def addSport(name, sport)\n @sports[name] = sport\n end",
"def team_names\n teams = []\n teams << game_hash[:home][:team_name]\n teams << game_hash[:away][:team_name]\n return teams\nend",
"def team_names\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend",
"def team_names\n game_hash.map do |location, team_data|\n team_data[:team_name]\n end\nend",
"def court_sports\n render json: @venue.supported_sports_options\n end",
"def matchname\n \"#{self.date}: #{self.hometeam.name} V #{self.awayteam.name}\"\n end",
"def set_sport\n @sport = Sport.friendly.find(params[:id])\n end",
"def remove_sport\n 'basketball|baseball|softball|football|womens basketball'\n end",
"def summon_captain_planet(planeteer_calls)\n calls = [];\n planeteer_calls.collect { |call| calls.push(\"#{call.capitalize}!\")}\n return calls;\nend",
"def sport_params\n params.require(:sport).permit(:name)\n end",
"def fAddSport (name, sport)\n @sports.addSport(name,sport)\n end",
"def summon_captain_planet(array)\n array.collect{ |planeteer_call| planeteer_call.capitalize + \"!\"\n }\nend",
"def both_team_names(game)\n both_teams = []\n both_teams << game[:home_team][:team_name]\n both_teams << game[:away_team][:team_name]\n both_teams\nend",
"def summon_captain_planet(planeteer_calls) # code an argument here\n # Your code here\n planeteer_calls.map! { |planeteer| planeteer.capitalize + \"!\" }\nend",
"def team_names\n game_hash.map do |place, team|\n team[:team_name]\n end\nend",
"def get_standard_name(name)\n # BACHELORS\n if @medicine_surgery_bachelors.include? name\n standard_name = 'Bachelor of Medicine, Bachelor of Surgery (MBBS)'\n elsif @med_sci_bachelors.include? name\n standard_name = 'Bachelor of Medical Science (BMedSci)'\n elsif @science_bachelors.include? name\n standard_name = 'Bachelor of Science (BSc)'\n elsif @art_bachelors.include? name\n standard_name = 'Bachelor of Arts (BA)'\n elsif @philosophy_bachelors.include? name\n standard_name = 'Bachelor of Philosophy (BPhil)'\n elsif @engineering_bachelors.include? name\n standard_name = 'Bachelor of Engineering (BEng)'\n elsif @law_bachelors.include? name\n standard_name = 'Bachelor of Laws (LLB)'\n # MASTERS\n elsif @philosophy_masters_by_pubs.include? name\n standard_name = 'Master of Philosophy by publications (MPhil)'\n elsif @philosophy_masters.include? name\n standard_name = 'Master of Philosophy (MPhil)'\n elsif @art_masters_by_research.include? name\n standard_name = 'Master of Arts (by research) (MA (by research))'\n elsif @art_masters.include? name\n standard_name = 'Master of Arts (MA)'\n elsif @science_masters_by_research.include? name\n standard_name = 'Master of Science (by research) (MSc (by research))'\n elsif @science_masters_by_thesis.include? name\n standard_name = 'Master of Science (by thesis) (MSc (by thesis))'\n elsif @science_masters_msc.include? name\n standard_name = 'Master of Science (MSc)'\n elsif @science_masters_msci.include? name\n standard_name = 'Master of Science (MSci)'\n elsif @laws_masters.include? name\n standard_name = 'Master of Laws (LLM)'\n elsif @law_masters.include? name\n standard_name = 'Master of Law (MLaw)'\n elsif @public_admin_masters.include? name\n standard_name = 'Master of Public Administration (MPA)'\n elsif @biology_masters.include? name\n standard_name = 'Master of Biology (MBiol)'\n elsif @bio_chem_masters.include? name\n standard_name = 'Master of Biochemistry (MBiochem)'\n elsif @bio_med_masters.include? name\n standard_name = 'Master of Biomedical Science (MBiomedsci)'\n elsif @chemistry_masters.include? name\n standard_name = 'Master of Chemistry (MChem)'\n elsif @engineering_masters.include? name\n standard_name = 'Master of Engineering (MEng)'\n elsif @math_masters.include? name\n standard_name = 'Master of Mathematics (MMath)'\n elsif @physics_masters.include? name\n standard_name = 'Master of Physics (MPhys)'\n elsif @psych_masters.include? name\n standard_name = 'Master of Psychology (MPsych)'\n elsif @env_masters.include? name\n standard_name = 'Master of Environment (MEnv)'\n elsif @nursing_masters.include? name\n standard_name = 'Master of Nursing (MNursing)'\n elsif @public_health_masters.include? name\n standard_name = 'Master of Public Health (MPH)'\n elsif @soc_work_and_sci_masters.include? name\n standard_name = 'Master of Social Work and Social Science (MSWSS)'\n # order crucial so more specific name above is searched for first\n elsif @social_work_masters.include? name\n standard_name = 'Master in Social Work (MSocW)'\n elsif @research_masters.include? name\n standard_name = 'Master of Research (MRes)'\n # DOCTORATES\n elsif @letters_docts.include? name\n standard_name = 'Doctor of Letters (DLitt)'\n elsif @music_docts.include? name\n standard_name = 'Doctor of Music (DMus)'\n elsif @science_docts.include? name\n standard_name = 'Doctor of Science (ScD)'\n elsif @engineering_docts.include? name\n standard_name = 'Doctor of Engineering (EngD)'\n elsif @medical_docts_by_pubs.include? name\n standard_name = 'Doctor of Medicine by publications (MD)'\n elsif @medical_docts.include? name\n standard_name = 'Doctor of Medicine (MD)'\n elsif @philosophy_docts_by_pubs.include? name\n standard_name = 'Doctor of Philosophy by publications (PhD)'\n elsif @philosophy_docts.include? name\n standard_name = 'Doctor of Philosophy (PhD)'\n\n # OTHER EXAMS\n elsif @foundation_degrees.include? name\n standard_name = 'Foundation Degree (FD)'\n elsif @cert_hes.include? name\n standard_name = 'Certificate of Higher Education (CertHE)'\n elsif @dip_hes.include? name\n standard_name = 'Diploma of Higher Education (DipHE)'\n elsif @grad_certs.include? name\n standard_name = 'Graduate Certificate (GradCert)'\n elsif @grad_diplomas.include? name\n standard_name = 'Graduate Diploma (GradDip)'\n elsif @uni_certs.include? name\n standard_name = 'University Certificate'\n elsif @foundation_certs.include? name\n standard_name = 'Foundation Certificate (F Cert)'\n elsif @foundation.include? name\n standard_name = 'Foundation'\n elsif @pre_masters.include? name\n standard_name = 'Pre-Masters'\n elsif @conservation_diplomas.include? name\n standard_name = 'Postgraduate Diploma in Conservation Studies (PGDip)'\n elsif @medieval_diplomas.include? name\n standard_name = 'Postgraduate Diploma in Medieval Studies (PGDip)'\n # this is more general so crucial it is tested AFTER more specific diplomas\n elsif @pg_diplomas.include? name\n standard_name = 'Postgraduate Diploma (PGDip)'\n elsif @pgces.include? name\n standard_name = 'Postgraduate Certificate in Education (PGCE)'\n elsif @pg_medical_certs.include? name\n standard_name = 'Postgraduate Certificate in Medical Education (PGCert)'\n elsif @cpds.include? name\n standard_name = 'Continuing Professional Development (CPD)'\n elsif @pg_certs.include? name\n standard_name = 'Postgraduate Certificate (PgCert)'\n elsif @cefrs.include? name\n standard_name = 'CEFR Module'\n else\n # UNMATCHED\n standard_name = 'COULD NOT MATCH ' + name\n end\n standard_name\n end",
"def summon_captain_planet(planateer_calls)\n planateer_calls.collect {|call| call.capitalize + \"!\"}\n #planateer_calls.map {|call| call.capitalize + \"!\"}\nend",
"def index\n @venues = Venue.all.order('name')\n @page_title = \"Event venues around Cornwall\"\n end",
"def game_title\n\t\t\"#{home_team} vs. #{visitor_team}\"\n\tend",
"def team_names\n names = []\n game_hash.each do |location, data|\n names << data[:team_name]\n end\n names\nend",
"def show\r\n \r\n @free_filter = params[:freefilter]\r\n @uhd_filter = params[:uhdfilter]\r\n @search_string = params[:search] \r\n @start_dates = BroadcastEvent.current.distinct.pluck(:formatted_local_start_date).sort\r\n\r\n if params[:sport_name] && params[:sport_name] != params[:sport_name].downcase\r\n # handle URLs with uppercase sport name\r\n new_downcase_path = (\"/\" + params[:region_name] + \"/\" + params[:sport_name]).downcase\r\n redirect_to new_downcase_path, status: 301\r\n\r\n elsif params[:region_name] && params[:region_name] != params[:region_name].downcase\r\n # handle URLs with uppercase region name \r\n new_downcase_path = (\"/\" + params[:region_name]).downcase\r\n redirect_to new_downcase_path, status: 301\r\n\r\n elsif @search_string && @search_string != \"\"\r\n # GET /guides/:region_name/?search=:search\r\n @broadcast_events = @region.broadcast_events.joins(:program).where(formatted_local_start_date: @start_dates).where(\"programs.title like ? or programs.episode_title like ?\", \"%#{@search_string}%\", \"%#{@search_string}%\").includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n elsif @sport\r\n # GET /guides/:region_name/:sport_name \r\n @broadcast_events = @region.broadcast_events.where(formatted_local_start_date: @start_dates).where(sports: {id: @sport.id}).includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n else\r\n # GET /guides/:region_name\r\n @broadcast_events = @region.broadcast_events.where(formatted_local_start_date: @start_dates).includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n end \r\n \r\n if @free_filter && (@free_filter == \"true\")\r\n # GET /guides/:region_name/?freefilter=:freefilter\r\n # GET /guides/:region_name/:sport_name/?freefilter=:freefilter\r\n @broadcast_events = @broadcast_events.joins(:channel => :provider).where(channels: {providers: {service_tier: \"Free\"}})\r\n end\r\n if @uhd_filter && (@uhd_filter == \"true\")\r\n # GET /guides/:region_name/?uhd_filter=:uhd_filter\r\n # GET /guides/:region_name/:sport_name/?uhd_filter=:uhd_filter\r\n @broadcast_events = @broadcast_events.where(channels: {four_k_flag: true})\r\n end\r\n\r\n end",
"def sport_tournaments(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/tournaments.xml\")\n end",
"def team_names\n team_names = []\n game_hash.each do |home_or_away, team_stats|\n team_names << team_stats[:team_name]\n end\n team_names\nend",
"def index\n\t\t#render all venue or dancer in venues or dancer controller\n\tend",
"def summon_captain_planet(planeteer_calls) \n planeteer_calls.map do |n| \n n.capitalize << \"!\" \n end\nend",
"def team_names\n [\n game_hash.dig(:home, :team_name),\n game_hash.dig(:away, :team_name)\n ]\nend",
"def index\n @nba = Googlesheet.find_by_sport('NBA')\n @nfl = Googlesheet.find_by_sport('NFL')\n @mlb = Googlesheet.find_by_sport('MLB')\n @pga = Googlesheet.find_by_sport('PGA')\n end",
"def all_supplies_in_holidays(holiday_hash)\n holiday_string = \"\"\n supply_string = \"\"\n holiday_hash.each do |season, holiday|\n season = season.to_s.capitalize\n puts \"#{season}:\"\n holiday.each do |holiday_name, supply|\n holiday_name = holiday_name.to_s\n name_array = holiday_name.split(\"_\")\n name_array.collect do |word|\n word.capitalize!\n end\n holiday_name = name_array.join(\" \")\n holiday_string = \" #{holiday_name}: \"\n supply_string = supply.join(\", \")\n holiday_string << supply_string\n puts holiday_string\n end\n end\nend",
"def scrap_team_names_helper(team_element)\n if team_element.key?('title') &&\n team_element['title'].match?(/^[a-záàâãéèêíïóôõöúç\\s]+ - [a-z]{2}$/i)\n\n # Extract team's name (e.g Santos - SP => Santos)\n team_element['title'][/^[a-záàâãéèêíïóôõöúç\\s]{3,50}/i].strip\n end\n end",
"def check_for_sport_event\n events = SportEvent.where('sport_events.event_date = ? AND sport_events.team_first = ? AND sport_events.team_second = ? AND sport_events.sport = ? AND sport_events.scenario_name = ?', self.event_date, self.team_first, self.team_second, self.sport, self.scenario_name)\n # Second round to found nearly same events\n if events.empty?\n events = SportEvent.where('sport_events.event_date = ? AND sport_events.team_first ILIKE ? AND sport_events.team_second ILIKE ? AND sport_events.sport = ? AND sport_events.scenario_name = ?', self.event_date, \"%#{self.team_first}%\", \"%#{self.team_second}%\", self.sport, self.scenario_name)\n end\n\n if events.empty?\n event = SportEvent.create_from_sport_trade(self)\n else\n event = events.first\n end\n\n # Add the Sport Trade to the Sport Event\n event.sport_trades << self\n end",
"def index\n @sports = Sport.all.sort_by{|x| [x.season.start, x.start_date, x.name, x.group]}\n end",
"def team_names\n game_hash.collect do |team, all_info_hash|\n all_info_hash[:team_name]\n end\nend",
"def getname\n @name = params[:name]\n @highestsponsorshipofcsievent = Institute.where(\"name like ?\", \"%#{@name}%\").first\n end",
"def sport_params\n params.require(:sport).permit(:name, :season_id, :gender)\n end",
"def summon_captain_planet(planteers)\n updated = []\n planteers.each do |planteer|\n planteer = planteer.capitalize() \n updated << \"#{planteer}!\"\n end\n updated\nend",
"def teams \n \"teams\" \n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + \"!\" }\n end",
"def get_sport_choice(sports_reg_ex)\n print \"Please enter the full name of a sport you would like information about:\"\n # Converts input to match format how sports are stored\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n while !sports_reg_ex.has_key? sport\n sport_suggestion = auto_suggest sport, sports_reg_ex\n\n if sport_suggestion != \"\"\n if (yes_no_input \"Did you mean #{sport_suggestion}? (Y/N): \") == \"Y\"\n sport = sport_suggestion\n else\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n else\n puts \"Couldn't identify a sport!\"\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n end\n sport\nend",
"def change_name\n\t\tif not_allowed()\n\t\t\treturn\n\t\tend\n\n\t\tif missing_params(params, ['competition_id', 'round_number', 'new_name', 'old_name'])\n\t\t\treturn\n\t\tend\n\n\t\tbegin\n\t\t\thost = Host.where(host: request.host).take\n\t\t\tcompetition = host.organization.competitions.find(params[:competition_id])\n\t\trescue\n\t\t\trender json: {:result => false, :message => \"Could not find competition.\"}\n\t\t\treturn\n\t\tend\n\t\trender json: {:result => true}\n\n\t\tevent_hash = {};\n\t\tevent_hash[:event] = \"change_name\"\n\t\tevent_hash[:round_number] = params[:round_number]\n\t\tevent_hash[:new_name] = params[:new_name]\n\t\tevent_hash[:old_name] = params[:old_name]\n\n\t\tnew_event(competition, event_hash)\n\tend",
"def stod2sport\n Apis.client.get('/tv/stod2sport')\n end",
"def team_names\n game_hash.collect do |team_key, team_value|\n team_value[:team_name]\n end\nend",
"def modif_town_hall_name(all_town_hall)\n i = 0\n while i != all_town_hall.length\n all_town_hall[i] = all_town_hall[i].downcase!.split.join('-')\n i += 1\n end\n return all_town_hall\nend",
"def appropriate_tool_name\n case name\n when \"Ore Vein\"\n \"Pickaxe\"\n when \"Seeds\"\n \"Plow\"\n when \"Wild Game\"\n \"Traps\"\n when \"Cattle\"\n \"Lasso\"\n end\n end",
"def season_sponsors\n season_id = params[:season_id].to_i\n @season = Season.find_by(:id => season_id)\n season_teams = get_teams_by_given_season(season_id, true)\n # get the list of teams in ever division\n season_team_ids = Array.new\n \n season_teams.each do |team|\n season_team_ids.push(team.id)\n end\n \n teams_sponsors = TeamsSponsor.where(:team_id => season_team_ids)\n @team_sponsors = sponsors_by_team(teams_sponsors)\n end",
"def get_first_name_of_season_winner(data, season)\n winner = match_contestant(data[season], 'status', 'Winner')\n winner['name'].split[0]\nend",
"def get_contestant_name(data, occupation)\n data.each do |season_hash, info|\n info.each do |detail|\n if detail[\"occupation\"] == occupation\n return detail[\"name\"]\n end\n end\n end\n# binding.pry\nend",
"def service_name_variations(name)\n name = name.to_s\n variations = []\n variations << name\n if name.start_with? 'p_'\n variations << name.gsub(/^p_/, '')\n else\n variations << \"p_#{name}\"\n end\n\n simple_name = name.gsub(/^(ms-)|(clone-)/, '')\n unless simple_name == name\n variations << simple_name\n if simple_name.start_with? 'p_'\n variations << simple_name.gsub(/^p_/, '')\n else\n variations << \"p_#{simple_name}\"\n end\n end\n variations\n end",
"def index\n if params[:season] == \"both\"\n @sports = Sport.all\n elsif params[:season] == \"summer\"\n @sports = Sport.where(season: Season.find(1))\n elsif params[:season] == \"winter\"\n @sports = Sport.where(season: Season.find(2))\n elsif params[:season] == nil\n redirect_to '/'\n end\n puts \"GOT TO HERE\"\n \n\n # @sports = Sport.all\n\n # @winter_sports = []\n # @summer_sports = []\n \n\n # @sports.each do |sport| \n # if sport.season[:id] == 2\n # @winter_sports << sport\n # elsif\n # sport.season[:id] == 1\n # @summer_sports << sport\n # end\n # end \n #new variable (@season) when selected \n end",
"def names_from_context\n search = [team_name_from_channel_name] + team_names_from_roles\n\n (search + [bot.config.dig(server.id, 'default_team')]).compact\n end",
"def autocomplete_venue_name\n term = params[:term]\n if term && !term.empty?\n items = Venue.verified.select(\"name\").\n where(\"name like ?\", '%' + term.downcase + '%').\n limit(10).order(:name)\n else\n items = {}\n end\n render :json => json_for_autocomplete(items, :name)\n end",
"def summon_captain_planet(array)\n array.collect do |calls|\n \"#{calls.capitalize}!\"\n end\nend",
"def target_name\n team_name\n end",
"def team_names\n team_names = []\n for location in game_hash.keys\n team_names.push(game_hash[location][:team_name])\n end\n return team_names\nend",
"def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @genre = StringUtils.mixed_case(@genre)\n \n @remix = capitalize_remix_name(@remix)\n\n @featured_artists.collect! { |artist| StringUtils.mixed_case(artist) }\n end",
"def teamName _args\n \"teamName _args;\" \n end",
"def team_names\n output =[]\n game_hash.each do |location, team_data|\n output.push(team_data[:team_name])\n end\n output\nend",
"def worst_coach(seasonasstring) # coach name in game team stats\n #inverse of above\n end",
"def vs(player_name)\n @vs = player_name.dup.to_s\n end",
"def team_colors(team_name)\n game_hash.each do |home_away, keys|\n if keys[:team_name] == team_name\n return keys[:colors].map(&:capitalize)\n end\n end\nend",
"def team_colors(team_name)\n game_hash.each do |home_away, keys|\n if keys[:team_name] == team_name\n return keys[:colors].map(&:capitalize)\n end\n end\nend",
"def team_names\n names = []\n game_hash.each do | team, attributes|\n names << game_hash[team][:team_name]\n end\n return names\nend"
] | [
"0.68725216",
"0.64305365",
"0.6364664",
"0.6239143",
"0.6028444",
"0.5989123",
"0.59350896",
"0.5926912",
"0.5918938",
"0.5874233",
"0.5868325",
"0.58343124",
"0.5799144",
"0.57866204",
"0.57598597",
"0.5754906",
"0.57469916",
"0.5715616",
"0.5698548",
"0.56727165",
"0.56646705",
"0.56460345",
"0.5622015",
"0.5603109",
"0.5576798",
"0.5568143",
"0.5559922",
"0.5551083",
"0.5546724",
"0.55413485",
"0.55239296",
"0.5517423",
"0.55076927",
"0.55053467",
"0.55028063",
"0.54950905",
"0.5480284",
"0.54749894",
"0.54704106",
"0.5436975",
"0.5419765",
"0.5415289",
"0.5415289",
"0.5412181",
"0.5409103",
"0.53943557",
"0.53934073",
"0.538666",
"0.53819656",
"0.5374787",
"0.5374286",
"0.5372004",
"0.53669393",
"0.5366421",
"0.5358968",
"0.53524286",
"0.534854",
"0.5341122",
"0.5340052",
"0.53373146",
"0.53293633",
"0.53215295",
"0.5320669",
"0.531542",
"0.53079766",
"0.5306166",
"0.52723616",
"0.5256389",
"0.5249247",
"0.52381694",
"0.5233612",
"0.5233505",
"0.52319866",
"0.5231373",
"0.5231185",
"0.5228831",
"0.5215949",
"0.5213319",
"0.52114236",
"0.52048206",
"0.52041894",
"0.5201582",
"0.51971805",
"0.5192748",
"0.5188672",
"0.5178392",
"0.51709235",
"0.5168742",
"0.51639",
"0.51619637",
"0.5157299",
"0.51571435",
"0.5144153",
"0.5143126",
"0.5142344",
"0.51414335",
"0.5134968",
"0.51320446",
"0.51320446",
"0.5128368"
] | 0.672665 | 1 |
Add more helper methods to be used by all extension tests here... | def assert_included(collection, item)
assert_block "#{collection} was expected to include #{item} but does not." do
collection.include?(item)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n assert_nil @patron.secondary_address_mobile_phone\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def define_helpers; end",
"def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end",
"def my_tests\n end",
"def helpers(*extensions, &block)\n instance_eval(&block) if block\n extend(*extensions) if extensions.any?\n end",
"def tests; end",
"def tests; end",
"def test_added_methods\r\n assert_respond_to @default_user, :roles\r\n assert_respond_to @default_user, :has_role?\r\n \r\n assert_respond_to @default_user, :permissions\r\n assert_respond_to @default_user, :has_static_permission?\r\n end",
"def self_test; end",
"def self_test; end",
"def test_defaults\n end",
"def helpers(*extensions, &block)\n self.class.helpers(*extensions, &block)\n end",
"def general_mime_magic_specs\n it { is_expected.to contain_apache__mod('mime_magic') }\nend",
"def test_extended\r\n\t\tassert('two'.length == 3)\t\t\t\t\t\t# Boolean expression\r\n\t\tassert_not_equal(\"Expected\", \"Actual\")\t\t\t# != \r\n\t\tassert_raise(ZeroDivisionError) { 2/0} \t\t\t# Exception type\r\n\t\tassert_nothing_raised(ZeroDivisionError) { 2/1 }# Positive if the none of the exceptions raised\r\n\t\tassert_instance_of(String, 23) \t\t\t\t# Checks the object against its type\r\n\tend",
"def default_test; end",
"def testing\n # ...\n end",
"def extensions; end",
"def extensions; end",
"def extensions; end",
"def test_get_content_for\n end",
"def default_test\n end",
"def test_hack\n assert(true)\n end",
"def default_test\n end",
"def test_respond_to\r\n\r\n assert_respond_to @storage, :add\r\n assert_respond_to @storage, :contains?\r\n assert_respond_to @storage, :find\r\n\r\n end",
"def __dummy_test__\n end",
"def default_test\r\n end",
"def test_entry_attrs\n raise 'Implement the method \"test_entry_attrs\" in your test class'\n end",
"def extension; end",
"def extension; end",
"def extension; end",
"def extension; end",
"def helper_method(*methods); end",
"def test_entry_attrs\n raise \"Implement this method in your test class\"\n end",
"def spec; end",
"def spec; end",
"def test_respond_to\n assert_respond_to system_wide, :role\n assert_respond_to system_wide, :role=\n assert_respond_to system_wide, :inspect\n assert_respond_to system_wide, :object_id\n end",
"def file_utils; end",
"def adapter_helpers(adapter)\n adapter.class.ancestors.each_with_object([]) do |klass, ret|\n next unless klass.is_a?(Class)\n next unless klass.const_defined?(HELPERS_MODULE_NAME)\n ret.unshift klass.const_get(HELPERS_MODULE_NAME)\n end\n end",
"def extended(*) end",
"def test_extract_files_and_options\n files, options = public_extract_files_and_options('some')\n assert_equal(['some'], files)\n assert_equal({}, options)\n \n files, options = public_extract_files_and_options('some', 'other')\n assert_equal(['some', 'other'], files)\n assert_equal({}, options)\n \n \n files, options = public_extract_files_and_options('some', 'other', :key => :value)\n assert_equal(['some', 'other'], files)\n assert_equal({:key => :value}, options)\n \n files, options = public_extract_files_and_options('some', 'other', {})\n assert_equal(['some', 'other'], files)\n assert_equal({}, options)\n end",
"def before_test(test); end",
"def before_test(test); end",
"def define_name_helpers; end",
"def test_frameworks; end",
"def include_helpers(scope); end",
"def test_case; end",
"def assertions; end",
"def assertions; end",
"def test_method\n end",
"def stest_method_1(test); end",
"def helpers(helper_name)\r\n extend _package_.load_helper(helper_name)\r\n end",
"def ext; end",
"def ext; end",
"def test_nothing\n end",
"def test_should_eat()\n yay_or_nay = should_eat(\"ice cream\", \"winter\")\n assert_equal(\"False\", should_eat)\n end",
"def test_setup\r\n \r\n end",
"def prepare_helpers\n base = File.join(config[:test_base_path], \"helpers\")\n\n helper_files.each do |src|\n dest = File.join(sandbox_suites_dir, src.sub(\"#{base}/\", \"\"))\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest, preserve: true)\n end\n end",
"def path_helpers_module; end",
"def all_application_helpers; end",
"def should; super end",
"def modules_for_helpers(modules_or_helper_prefixes); end",
"def test_nothing\n end",
"def test_entry\n raise 'Implement the method \"test_entry\" in your test class'\n end",
"def build_test_helper \n \n return if skip_method(__method__)\n \n puts \"build Rails test helper for #{model_name} in test/helpers\"\n filename = \"#{plural_table_name}_helper_test.rb\"\n\n template = File.read(template(\"rails/test/helper_test.rb\"))\n # #text = ERB.new(template, nil, '-').result(binding)\n text = Erubis::Eruby.new(template).evaluate( self )\n\n path = namespaced_path(\"test/helpers\",filename)\n write_artifact(path,text) \n end",
"def compare_tests(test_a, test_b); end",
"def compare_tests(test_a, test_b); end",
"def test_nothing; end",
"def helpers_paths; end",
"def helpers_paths; end",
"def helpers_paths; end",
"def helpers_paths; end",
"def override_test_helper\n if config.dig(\"test_suite\") == \"minitest\"\n template \"templates/minitest_test_helper.tt\", \"test/test_helper.rb\", force: true\n else\n template \"templates/rspec_test_helper.tt\", \"spec/rails_helper.rb\", force: true\n end\n end",
"def application_helpers\n copy_file \"app/helpers/layout_helper.rb\"\n copy_file \"app/helpers/retina_image_helper.rb\"\n copy_file \"app/helpers/meta_tag_helper.rb\"\nend",
"def prepare_helpers\n base = File.join(test_folder, \"helpers\")\n\n helper_files.each do |src|\n dest = File.join(sandbox_path, src.sub(\"#{base}/\", \"\"))\n debug(\"Copying #{src} to #{dest}\")\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest, preserve: true)\n end\n end",
"def test_entry\n raise \"Implement this method in your test class\"\n end",
"def require_test_helper\n record_api_supportability_metric(:require_test_helper)\n require File.expand_path('../../../test/agent_helper', __FILE__)\n end",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend"
] | [
"0.6967062",
"0.6659195",
"0.6659195",
"0.6659195",
"0.6358651",
"0.6245406",
"0.6243533",
"0.60632026",
"0.6008646",
"0.6008646",
"0.5974782",
"0.5950157",
"0.5950157",
"0.5921214",
"0.5915907",
"0.5897097",
"0.5883888",
"0.5813109",
"0.58130866",
"0.57578146",
"0.57578146",
"0.57578146",
"0.57464594",
"0.57175946",
"0.5707481",
"0.56983906",
"0.56886905",
"0.56758165",
"0.5670044",
"0.56574136",
"0.5641595",
"0.5641595",
"0.5641595",
"0.5641595",
"0.56409913",
"0.56275076",
"0.56268764",
"0.56268764",
"0.5619568",
"0.5618229",
"0.5608624",
"0.55896306",
"0.558444",
"0.5566892",
"0.5566892",
"0.5559645",
"0.5547977",
"0.5535431",
"0.55285877",
"0.55239046",
"0.55239046",
"0.5522046",
"0.552122",
"0.5519366",
"0.55086976",
"0.55086976",
"0.5486096",
"0.54747415",
"0.5464529",
"0.54620653",
"0.5461477",
"0.5432034",
"0.5430874",
"0.54196125",
"0.54193395",
"0.54177666",
"0.5415023",
"0.54101914",
"0.54101914",
"0.54053056",
"0.5389499",
"0.5389499",
"0.5389499",
"0.5389499",
"0.5386561",
"0.53841066",
"0.53738606",
"0.5366592",
"0.53657407",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959",
"0.5360959"
] | 0.0 | -1 |
Override the == to check meta information class. | def ==(other)
info == other.info rescue false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 description == o.description &&\n name == o.name &&\n type == o.type &&\n system == o.system\n end",
"def meta?\r\n self.class.meta?\r\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n active == o.active &&\n additional_properties == o.additional_properties &&\n author == o.author &&\n authored == o.authored &&\n banned == o.banned &&\n category == o.category &&\n comments == o.comments &&\n contributors == o.contributors &&\n created_date == o.created_date &&\n embed == o.embed &&\n extension == o.extension &&\n height == o.height &&\n id == o.id &&\n length == o.length &&\n location == o.location &&\n long_description == o.long_description &&\n mime_type == o.mime_type &&\n name == o.name &&\n priority == o.priority &&\n privacy == o.privacy &&\n published == o.published &&\n short_description == o.short_description &&\n size == o.size &&\n tags == o.tags &&\n template == o.template &&\n thumbnail == o.thumbnail &&\n updated_date == o.updated_date &&\n uploader == o.uploader &&\n views == o.views &&\n width == o.width\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 hardware_status == o.hardware_status &&\n hcl_cimc_version == o.hcl_cimc_version &&\n hcl_driver_name == o.hcl_driver_name &&\n hcl_driver_version == o.hcl_driver_version &&\n hcl_firmware_version == o.hcl_firmware_version &&\n hcl_model == o.hcl_model &&\n inv_cimc_version == o.inv_cimc_version &&\n inv_driver_name == o.inv_driver_name &&\n inv_driver_version == o.inv_driver_version &&\n inv_firmware_version == o.inv_firmware_version &&\n inv_model == o.inv_model &&\n reason == o.reason &&\n software_status == o.software_status &&\n status == o.status &&\n component == o.component &&\n hcl_status == o.hcl_status && super(o)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n name == o.name &&\n type == o.type &&\n sub_attributes == o.sub_attributes &&\n multi_valued == o.multi_valued &&\n description == o.description &&\n required == o.required &&\n canonical_values == o.canonical_values &&\n case_exact == o.case_exact &&\n mutability == o.mutability &&\n returned == o.returned &&\n uniqueness == o.uniqueness &&\n reference_types == o.reference_types\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n key == o.key &&\n name == o.name &&\n description == o.description &&\n kind == o.kind &&\n creation_date == o.creation_date &&\n include_in_snippet == o.include_in_snippet &&\n temporary == o.temporary &&\n maintainer_id == o.maintainer_id &&\n tags == o.tags &&\n variations == o.variations &&\n goal_ids == o.goal_ids &&\n _version == o._version &&\n custom_properties == o.custom_properties &&\n _links == o._links &&\n _maintainer == o._maintainer &&\n environments == o.environments &&\n archived_date == o.archived_date &&\n archived == o.archived &&\n client_side_availability == o.client_side_availability &&\n defaults == o.defaults\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n author == o.author &&\n created == o.created &&\n icon == o.icon &&\n id == o.id &&\n integration_id == o.integration_id &&\n is_favorite == o.is_favorite &&\n is_read_only == o.is_read_only &&\n is_shared == o.is_shared &&\n modified == o.modified &&\n popularity == o.popularity &&\n tags == o.tags &&\n title == o.title &&\n type == o.type &&\n url == o.url\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 application == o.application &&\n authorized_entity == o.authorized_entity &&\n platform == o.platform &&\n attest_status == o.attest_status &&\n app_signer == o.app_signer &&\n connection_type == o.connection_type &&\n connect_date == o.connect_date &&\n rel == o.rel\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n avatar == o.avatar &&\n banner == o.banner &&\n created_at == o.created_at &&\n description == o.description &&\n handle == o.handle &&\n hidden_modules == o.hidden_modules &&\n link_count == o.link_count &&\n modified_at == o.modified_at &&\n name == o.name &&\n summary == o.summary &&\n user_count == o.user_count &&\n visible_modules == o.visible_modules\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 compatibility_mode == o.compatibility_mode &&\n controller_key == o.controller_key &&\n device_name == o.device_name &&\n disk_mode == o.disk_mode &&\n disk_type == o.disk_type &&\n key == o.key &&\n limit == o.limit &&\n lun_uuid == o.lun_uuid &&\n serial == o.serial &&\n shares == o.shares &&\n sharing == o.sharing &&\n storage_allocation_type == o.storage_allocation_type &&\n unit_number == o.unit_number &&\n uuid == o.uuid &&\n vdisk_id == o.vdisk_id &&\n vendor == o.vendor &&\n virtual_disk_path == o.virtual_disk_path &&\n vm_identity == o.vm_identity &&\n datastore == o.datastore &&\n virtual_machine == o.virtual_machine && super(o)\n end",
"def == other\n self.class == other.class && self.name == other.name\n end",
"def ==(other)\n self.class == other.class\n end",
"def == other\n\t\tcase other when FalseClass, self.class\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"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 name == o.name &&\n slug == o.slug &&\n model == o.model &&\n status == o.status &&\n type == o.type &&\n short_description == o.short_description &&\n full_description == o.full_description &&\n free_shipping == o.free_shipping &&\n sku == o.sku &&\n price == o.price &&\n cost_price == o.cost_price &&\n retail_price == o.retail_price &&\n sale_price == o.sale_price &&\n manage_inventory == o.manage_inventory &&\n stock_level == o.stock_level &&\n minimum_stock_level == o.minimum_stock_level &&\n maximum_sell_count == o.maximum_sell_count &&\n item_dimensions == o.item_dimensions &&\n package_dimensions == o.package_dimensions &&\n package_weight == o.package_weight &&\n require_shipping == o.require_shipping &&\n availability == o.availability &&\n availability_date == o.availability_date &&\n allow_pre_order == o.allow_pre_order &&\n brand == o.brand &&\n main_photo == o.main_photo &&\n photos == o.photos &&\n files == o.files &&\n promotions == o.promotions &&\n related_products == o.related_products &&\n stock_status == o.stock_status &&\n categories == o.categories &&\n tax_class == o.tax_class &&\n option_set == o.option_set &&\n variants == o.variants\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 active_admin == o.active_admin &&\n days_left == o.days_left &&\n end_time == o.end_time &&\n enforce_mode == o.enforce_mode &&\n error_desc == o.error_desc &&\n evaluation_period == o.evaluation_period &&\n extra_evaluation == o.extra_evaluation &&\n license_count == o.license_count &&\n license_state == o.license_state &&\n license_type == o.license_type &&\n start_time == o.start_time &&\n trial_admin == o.trial_admin &&\n account_license_data == o.account_license_data && super(o)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n self_uri == o.self_uri &&\n alternate_links == o.alternate_links &&\n accent1 == o.accent1 &&\n accent2 == o.accent2 &&\n accent3 == o.accent3 &&\n accent4 == o.accent4 &&\n accent5 == o.accent5 &&\n accent6 == o.accent6 &&\n dark1 == o.dark1 &&\n dark2 == o.dark2 &&\n followed_hyperlink == o.followed_hyperlink &&\n hyperlink == o.hyperlink &&\n light1 == o.light1 &&\n light2 == o.light2\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",
"def == other\n self.class == other.class and\n self.name == other.name and\n self.rw == other.rw and\n self.singleton == other.singleton\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n format == o.format &&\n text_compression == o.text_compression &&\n embed_full_fonts == o.embed_full_fonts &&\n compliance == o.compliance &&\n sufficient_resolution == o.sufficient_resolution &&\n jpeg_quality == o.jpeg_quality &&\n draw_slides_frame == o.draw_slides_frame &&\n show_hidden_slides == o.show_hidden_slides &&\n save_metafiles_as_png == o.save_metafiles_as_png &&\n password == o.password &&\n embed_true_type_fonts_for_ascii == o.embed_true_type_fonts_for_ascii &&\n additional_common_font_families == o.additional_common_font_families &&\n notes_position == o.notes_position &&\n comments_position == o.comments_position &&\n comments_area_width == o.comments_area_width &&\n comments_area_color == o.comments_area_color &&\n show_comments_by_no_author == o.show_comments_by_no_author &&\n image_transparent_color == o.image_transparent_color &&\n apply_image_transparent == o.apply_image_transparent\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n author_handle == o.author_handle &&\n author_name == o.author_name &&\n created_at == o.created_at &&\n description == o.description &&\n id == o.id &&\n is_read_only == o.is_read_only &&\n layout_type == o.layout_type &&\n modified_at == o.modified_at &&\n notify_list == o.notify_list &&\n reflow_type == o.reflow_type &&\n restricted_roles == o.restricted_roles &&\n tags == o.tags &&\n template_variable_presets == o.template_variable_presets &&\n template_variables == o.template_variables &&\n title == o.title &&\n url == o.url &&\n widgets == o.widgets\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 ==(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 eql? other\n self.class === other and @version == other.version\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 name == o.name &&\n order == o.order &&\n persistent_bindings == o.persistent_bindings &&\n placement == o.placement &&\n static_wwpn_address == o.static_wwpn_address &&\n type == o.type &&\n vif_id == o.vif_id &&\n wwpn == o.wwpn &&\n wwpn_address_type == o.wwpn_address_type &&\n fc_adapter_policy == o.fc_adapter_policy &&\n fc_network_policy == o.fc_network_policy &&\n fc_qos_policy == o.fc_qos_policy &&\n profile == o.profile &&\n san_connectivity_policy == o.san_connectivity_policy &&\n scp_vhba == o.scp_vhba &&\n sp_vhbas == o.sp_vhbas &&\n wwpn_lease == o.wwpn_lease &&\n wwpn_pool == o.wwpn_pool && super(o)\n end",
"def ==(other)\n super\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n height == o.height &&\n id == o.id &&\n is_mobile == o.is_mobile &&\n name == o.name &&\n width == o.width\n end",
"def eql?(other)\n self.class === other and @version == other.version\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n self._name.eql?(other._name) &&\n self._type.eql?(other._type) &&\n self._klass.eql?(other._klass)\n end",
"def ==(o)\n o.is_a?(self.class) && db == o.db && opts == o.opts\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 ==(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 ===(other)\n return true if super\n return (self == other.content_class) if other.respond_to?(:content_class)\n false\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n self_uri == o.self_uri &&\n alternate_links == o.alternate_links &&\n name == o.name &&\n width == o.width &&\n height == o.height &&\n alternative_text == o.alternative_text &&\n alternative_text_title == o.alternative_text_title &&\n hidden == o.hidden &&\n x == o.x &&\n y == o.y &&\n z_order_position == o.z_order_position &&\n fill_format == o.fill_format &&\n effect_format == o.effect_format &&\n three_d_format == o.three_d_format &&\n line_format == o.line_format &&\n hyperlink_click == o.hyperlink_click &&\n hyperlink_mouse_over == o.hyperlink_mouse_over &&\n type == o.type\n 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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n is_bot == o.is_bot &&\n is_tor_node == o.is_tor_node &&\n is_threat == o.is_threat &&\n is_eu == o.is_eu &&\n location == o.location &&\n currency_code == o.currency_code &&\n currency_name == o.currency_name &&\n region_area == o.region_area &&\n subregion_area == o.subregion_area\n end",
"def ==(other)\n self.class == other.class\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n status == o.status &&\n rating == o.rating &&\n title == o.title &&\n url == o.url &&\n publisher_date == o.publisher_date &&\n business_id == o.business_id &&\n comments == o.comments &&\n content == o.content &&\n date == o.date &&\n author_name == o.author_name &&\n author_email == o.author_email &&\n location_id == o.location_id &&\n last_yext_update_time == o.last_yext_update_time &&\n publisher_id == o.publisher_id &&\n id == o.id\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n self_uri == o.self_uri &&\n alternate_links == o.alternate_links &&\n index == o.index &&\n orientation == o.orientation &&\n size == o.size &&\n type == o.type &&\n shape == o.shape\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n ach_type == o.ach_type &&\n routing_number == o.routing_number &&\n account_number == o.account_number &&\n account_type == o.account_type &&\n check_number == o.check_number &&\n check_type == o.check_type &&\n product_code == o.product_code &&\n manual_id_info == o.manual_id_info &&\n supplement_id_info == o.supplement_id_info &&\n agent_id == o.agent_id &&\n terminal_id == o.terminal_id &&\n registration_id == o.registration_id &&\n registration_date == o.registration_date &&\n release_type == o.release_type &&\n vip_customer == o.vip_customer &&\n session_id == o.session_id &&\n terminal_state == o.terminal_state &&\n terminal_city == o.terminal_city &&\n ach_bill_to == o.ach_bill_to\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n super\n end",
"def ==(other)\n super\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n description == o.description &&\n routing_number == o.routing_number &&\n account_number == o.account_number &&\n account_type == o.account_type &&\n signatory == o.signatory &&\n metadata == o.metadata &&\n id == o.id &&\n signature_url == o.signature_url &&\n bank_name == o.bank_name &&\n verified == o.verified &&\n date_created == o.date_created &&\n date_modified == o.date_modified &&\n deleted == o.deleted &&\n object == o.object\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n self_uri == o.self_uri &&\n alternate_links == o.alternate_links &&\n name == o.name &&\n width == o.width &&\n height == o.height &&\n alternative_text == o.alternative_text &&\n alternative_text_title == o.alternative_text_title &&\n hidden == o.hidden &&\n x == o.x &&\n y == o.y &&\n z_order_position == o.z_order_position &&\n fill_format == o.fill_format &&\n effect_format == o.effect_format &&\n three_d_format == o.three_d_format &&\n line_format == o.line_format &&\n hyperlink_click == o.hyperlink_click &&\n hyperlink_mouse_over == o.hyperlink_mouse_over &&\n type == o.type &&\n shape_type == o.shape_type &&\n audio_cd_end_track == o.audio_cd_end_track &&\n audio_cd_end_track_time == o.audio_cd_end_track_time &&\n audio_cd_start_track == o.audio_cd_start_track &&\n audio_cd_start_track_time == o.audio_cd_start_track_time &&\n embedded == o.embedded &&\n hide_at_showing == o.hide_at_showing &&\n play_loop_mode == o.play_loop_mode &&\n play_mode == o.play_mode &&\n volume == o.volume &&\n base64_data == o.base64_data &&\n play_across_slides == o.play_across_slides &&\n rewind_audio == o.rewind_audio &&\n picture_fill_format == o.picture_fill_format\n end",
"def ==(other)\n if equal?(other)\n return true\n end\n\n unless other.respond_to?(:name)\n return false\n end\n\n unless other.respond_to?(:options)\n return false\n end\n\n unless other.respond_to?(:resource_naming_convention)\n return false\n end\n\n unless other.respond_to?(:field_naming_convention)\n return false\n end\n\n cmp?(other, :==)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n rel == o.rel &&\n href == o.href\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class && super(o)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n currency_code == o.currency_code &&\n memo == o.memo &&\n partial_auth == o.partial_auth &&\n transaction_type == o.transaction_type &&\n description == o.description &&\n transaction_category_id == o.transaction_category_id &&\n use_audit_log == o.use_audit_log &&\n merchant_category_code == o.merchant_category_code &&\n card_id == o.card_id &&\n transaction_category == o.transaction_category &&\n cleanse_data == o.cleanse_data &&\n auth_type == o.auth_type &&\n mid == o.mid &&\n transaction_status_scope == o.transaction_status_scope &&\n location == o.location &&\n merchant == o.merchant &&\n amount == o.amount &&\n date == o.date &&\n merchant_id == o.merchant_id\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n title_code == o.title_code &&\n _class == o._class &&\n tenure == o.tenure &&\n commonhold == o.commonhold &&\n addresses == o.addresses &&\n is_not_main_title == o.is_not_main_title &&\n is_scottish == o.is_scottish &&\n purchase_register_entry_date == o.purchase_register_entry_date &&\n purchase_prices == o.purchase_prices &&\n purchase_dates == o.purchase_dates\n end",
"def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n self_uri == o.self_uri &&\n alternate_links == o.alternate_links &&\n name == o.name &&\n width == o.width &&\n height == o.height &&\n alternative_text == o.alternative_text &&\n alternative_text_title == o.alternative_text_title &&\n hidden == o.hidden &&\n x == o.x &&\n y == o.y &&\n z_order_position == o.z_order_position &&\n fill_format == o.fill_format &&\n effect_format == o.effect_format &&\n three_d_format == o.three_d_format &&\n line_format == o.line_format &&\n hyperlink_click == o.hyperlink_click &&\n hyperlink_mouse_over == o.hyperlink_mouse_over &&\n type == o.type &&\n is_object_icon == o.is_object_icon &&\n substitute_picture_title == o.substitute_picture_title &&\n substitute_picture_format == o.substitute_picture_format &&\n object_name == o.object_name &&\n embedded_file_base64_data == o.embedded_file_base64_data &&\n embedded_file_extension == o.embedded_file_extension &&\n object_prog_id == o.object_prog_id &&\n link_path == o.link_path &&\n update_automatic == o.update_automatic\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 ==(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 type == o.type &&\n id == o.id &&\n updated_at == o.updated_at &&\n version == o.version &&\n is_deleted == o.is_deleted &&\n catalog_v1_ids == o.catalog_v1_ids &&\n present_at_all_locations == o.present_at_all_locations &&\n present_at_location_ids == o.present_at_location_ids &&\n absent_at_location_ids == o.absent_at_location_ids &&\n item_data == o.item_data &&\n category_data == o.category_data &&\n item_variation_data == o.item_variation_data &&\n tax_data == o.tax_data &&\n discount_data == o.discount_data &&\n modifier_list_data == o.modifier_list_data &&\n modifier_data == o.modifier_data\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n mode == o.mode &&\n detection_timeout == o.detection_timeout &&\n silence_timeout == o.silence_timeout &&\n speech_threshold == o.speech_threshold &&\n speech_end_threshold == o.speech_end_threshold &&\n delay_result == o.delay_result &&\n callback_url == o.callback_url &&\n callback_method == o.callback_method &&\n fallback_url == o.fallback_url &&\n fallback_method == o.fallback_method &&\n username == o.username &&\n password == o.password &&\n fallback_username == o.fallback_username &&\n fallback_password == o.fallback_password\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 background_color == o.background_color &&\n content == o.content &&\n font_size == o.font_size &&\n has_padding == o.has_padding &&\n show_tick == o.show_tick &&\n text_align == o.text_align &&\n tick_edge == o.tick_edge &&\n tick_pos == o.tick_pos &&\n type == o.type &&\n vertical_align == o.vertical_align\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 @klass == other.class && @attributes == strip_active_record(other)\n end",
"def ==(object)\n return true if object.equal?(self)\n if object.instance_of?(self.class)\n %w{antecedent num_antecedent_transactions \n support consequent confidence}.each do |key|\n return false unless object.send(key) == self.send(key)\n end\n return true\n else\n return false\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n contact == o.contact &&\n extensions == o.extensions &&\n external_resources == o.external_resources &&\n info == o.info &&\n integrations == o.integrations &&\n org == o.org &&\n schema_version == o.schema_version &&\n tags == o.tags\n end",
"def ==(other)\n self.class == other.class and\n self.name == other.name\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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n check_id == o.check_id &&\n exceptions == o.exceptions &&\n key == o.key &&\n links == o.links &&\n port == o.port &&\n proof == o.proof &&\n protocol == o.protocol &&\n since == o.since &&\n status == o.status\n end",
"def ==(other)\n if equal?(other)\n return true\n end\n\n unless other.respond_to?(:model) && other.respond_to?(:name)\n return false\n end\n\n cmp?(other, :==)\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 annotation == o.annotation &&\n config_name == o.config_name &&\n connection_state == o.connection_state &&\n cpu_hot_add_enabled == o.cpu_hot_add_enabled &&\n cpu_shares == o.cpu_shares &&\n cpu_socket_info == o.cpu_socket_info &&\n custom_attributes == o.custom_attributes &&\n default_power_off_type == o.default_power_off_type &&\n dhcp_enabled == o.dhcp_enabled &&\n disk_commit_info == o.disk_commit_info &&\n dns_server_list == o.dns_server_list &&\n dns_suffix_list == o.dns_suffix_list &&\n extra_config == o.extra_config &&\n folder == o.folder &&\n guest_state == o.guest_state &&\n host_compatibility == o.host_compatibility &&\n instance_uuid == o.instance_uuid &&\n inventory_path == o.inventory_path &&\n is_template == o.is_template &&\n mac_address == o.mac_address &&\n mem_shares == o.mem_shares &&\n memory_hot_add_enabled == o.memory_hot_add_enabled &&\n network_count == o.network_count &&\n port_groups == o.port_groups &&\n protected_vm == o.protected_vm &&\n remote_display_info == o.remote_display_info &&\n remote_display_vnc_enabled == o.remote_display_vnc_enabled &&\n resource_pool == o.resource_pool &&\n resource_pool_owner == o.resource_pool_owner &&\n resource_pool_parent == o.resource_pool_parent &&\n tool_running_status == o.tool_running_status &&\n tools_version == o.tools_version &&\n virtual_disks == o.virtual_disks &&\n virtual_network_interfaces == o.virtual_network_interfaces &&\n vm_disk_count == o.vm_disk_count &&\n vm_overall_status == o.vm_overall_status &&\n vm_path == o.vm_path &&\n vm_version == o.vm_version &&\n vm_vnic_count == o.vm_vnic_count &&\n vnic_device_config_id == o.vnic_device_config_id &&\n cluster == o.cluster &&\n datacenter == o.datacenter &&\n datastores == o.datastores &&\n host == o.host &&\n networks == o.networks &&\n parent_folder == o.parent_folder\n end",
"def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end",
"def ==\n end",
"def ==(other)\n return false unless super\n true\n end",
"def ==(*)\n true\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n assets == o.assets &&\n duration == o.duration &&\n enabled == o.enabled &&\n id == o.id &&\n links == o.links &&\n next_runtimes == o.next_runtimes &&\n on_scan_repeat == o.on_scan_repeat &&\n repeat == o.repeat &&\n scan_engine_id == o.scan_engine_id &&\n scan_name == o.scan_name &&\n scan_template_id == o.scan_template_id &&\n start == o.start\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 accessibility_summary == o.accessibility_summary &&\n creation_time == o.creation_time &&\n datastore_kind == o.datastore_kind &&\n datastore_status == o.datastore_status &&\n dsconfig == o.dsconfig &&\n free_capacity_in_bytes == o.free_capacity_in_bytes &&\n host_mount_status == o.host_mount_status &&\n is_encrypted == o.is_encrypted &&\n last_access_time == o.last_access_time &&\n last_modified_time == o.last_modified_time &&\n mount_summary == o.mount_summary &&\n parent_uuid == o.parent_uuid &&\n site == o.site &&\n total_capacity_in_bytes == o.total_capacity_in_bytes &&\n un_compressed_used_bytes == o.un_compressed_used_bytes &&\n unshared_used_bytes == o.unshared_used_bytes &&\n uuid == o.uuid &&\n data_protection_peer == o.data_protection_peer &&\n src_cluster == o.src_cluster &&\n tgt_cluster == o.tgt_cluster\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 action == o.action &&\n cache_state == o.cache_state &&\n cached_time == o.cached_time &&\n last_access_time == o.last_access_time &&\n md5sum == o.md5sum &&\n original_sha512sum == o.original_sha512sum &&\n path == o.path &&\n registered_workflows == o.registered_workflows &&\n used_count == o.used_count &&\n file == o.file &&\n network_element == o.network_element\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n color == o.color &&\n cards == o.cards &&\n address_placement == o.address_placement &&\n custom_envelope == o.custom_envelope &&\n double_sided == o.double_sided &&\n extra_service == o.extra_service &&\n mail_type == o.mail_type &&\n return_envelope == o.return_envelope &&\n bleed == o.bleed &&\n file_original_url == o.file_original_url\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 == x\n return false unless self.class === x\n @advice == x.advice && @mod == x.mod && @meth == x.meth && @kind == x.kind\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n aid == o.aid &&\n created_on == o.created_on &&\n description == o.description &&\n enabled == o.enabled &&\n error == o.error &&\n id == o.id &&\n index == o.index &&\n invalidated_on == o.invalidated_on &&\n language_version == o.language_version &&\n modified_on == o.modified_on &&\n name == o.name &&\n rule == o.rule &&\n uid == o.uid &&\n warning == o.warning &&\n owner == o.owner\n end",
"def eql?(o)\n self.class == o.class &&\n name.downcase == o.name.downcase\n end",
"def ==(other)\n @klass == other.klass && @version == other.version && @timestamp == other.timestamp\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n name == o.name &&\n address == o.address &&\n timezone == o.timezone &&\n capabilities == o.capabilities &&\n status == o.status &&\n created_at == o.created_at &&\n merchant_id == o.merchant_id &&\n country == o.country &&\n language_code == o.language_code &&\n currency == o.currency &&\n phone_number == o.phone_number &&\n business_name == o.business_name &&\n type == o.type &&\n website_url == o.website_url\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 accessibility_summary == o.accessibility_summary &&\n data_block_size == o.data_block_size &&\n host_mount_status == o.host_mount_status &&\n in_use == o.in_use &&\n kind == o.kind &&\n last_access_time == o.last_access_time &&\n last_modified_time == o.last_modified_time &&\n mount_status == o.mount_status &&\n mount_summary == o.mount_summary &&\n provisioned_capacity == o.provisioned_capacity &&\n provisioned_volume_capacity_utilization == o.provisioned_volume_capacity_utilization &&\n type == o.type &&\n un_compressed_used_bytes == o.un_compressed_used_bytes &&\n uuid == o.uuid &&\n volume_count == o.volume_count &&\n cluster == o.cluster &&\n volumes == o.volumes\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n author_email == o.author_email &&\n author_name == o.author_name &&\n author_time == o.author_time &&\n branch == o.branch &&\n commit_time == o.commit_time &&\n committer_email == o.committer_email &&\n committer_name == o.committer_name &&\n default_branch == o.default_branch &&\n message == o.message &&\n repository_url == o.repository_url &&\n sha == o.sha &&\n tag == o.tag\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n admin == o.admin &&\n created_at == o.created_at &&\n customer_id == o.customer_id &&\n description == o.description &&\n event_type == o.event_type &&\n ip == o.ip &&\n metadata == o.metadata &&\n service_id == o.service_id &&\n user_id == o.user_id &&\n token_id == o.token_id\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 ==(n)\n n.kind_of?(self.class) && name == n.name && env == n.env\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n cusip == o.cusip &&\n ticker == o.ticker &&\n security_name == o.security_name &&\n security_type == o.security_type &&\n title_of_class == o.title_of_class &&\n stock_exchange == o.stock_exchange &&\n filing_date == o.filing_date &&\n value == o.value &&\n amount == o.amount &&\n type == o.type &&\n investment_discretion == o.investment_discretion &&\n other_manager == o.other_manager &&\n sole_voting_authority == o.sole_voting_authority &&\n shared_voting_authority == o.shared_voting_authority &&\n no_voting_authority == o.no_voting_authority\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n save_format == o.save_format &&\n lookup_paths == o.lookup_paths &&\n file_name == o.file_name &&\n file_format == o.file_format &&\n show_grid == o.show_grid &&\n show_rulers == o.show_rulers &&\n show_ui == o.show_ui &&\n orientation_box == o.orientation_box &&\n up_vector == o.up_vector &&\n far_plane == o.far_plane &&\n near_plane == o.near_plane &&\n look_at == o.look_at &&\n camera_position == o.camera_position &&\n field_of_view == o.field_of_view\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 account_moid == o.account_moid &&\n create_time == o.create_time &&\n domain_group_moid == o.domain_group_moid &&\n mod_time == o.mod_time &&\n moid == o.moid &&\n owners == o.owners &&\n shared_scope == o.shared_scope &&\n tags == o.tags &&\n version_context == o.version_context &&\n ancestors == o.ancestors &&\n parent == o.parent &&\n permission_resources == o.permission_resources &&\n display_names == o.display_names\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n device == o.device &&\n duration == o.duration &&\n execution_rule == o.execution_rule &&\n location == o.location &&\n result_id == o.result_id &&\n retries == o.retries &&\n status == o.status &&\n test_name == o.test_name &&\n test_public_id == o.test_public_id &&\n test_type == o.test_type\n end",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n name == o.name &&\n based_on == o.based_on &&\n custom_calendar == o.custom_calendar &&\n default_flag == o.default_flag &&\n application_order == o.application_order &&\n hi_impact_hi_urgency == o.hi_impact_hi_urgency &&\n hi_impact_med_urgency == o.hi_impact_med_urgency &&\n hi_impact_low_urgency == o.hi_impact_low_urgency &&\n med_impact_hi_urgency == o.med_impact_hi_urgency &&\n med_impact_med_urgency == o.med_impact_med_urgency &&\n med_impact_low_urgency == o.med_impact_low_urgency &&\n low_impact_hi_urgency == o.low_impact_hi_urgency &&\n low_impact_med_urgency == o.low_impact_med_urgency &&\n low_impact_low_urgency == o.low_impact_low_urgency &&\n respond_hours == o.respond_hours &&\n respond_percent == o.respond_percent &&\n plan_within == o.plan_within &&\n plan_within_percent == o.plan_within_percent &&\n resolution_hours == o.resolution_hours &&\n resolution_percent == o.resolution_percent &&\n _info == o._info\n end",
"def meta_type?(meta)\n\t\treturn (self.type & meta == meta)\n\tend",
"def meta_type?(meta)\n\t\treturn (self.type & meta == meta)\n\tend",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n access_complexity == o.access_complexity &&\n access_vector == o.access_vector &&\n authentication == o.authentication &&\n availability_impact == o.availability_impact &&\n confidentiality_impact == o.confidentiality_impact &&\n exploit_score == o.exploit_score &&\n impact_score == o.impact_score &&\n integrity_impact == o.integrity_impact &&\n score == o.score &&\n vector == o.vector\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n author == o.author &&\n created_at == o.created_at &&\n dashboard_id == o.dashboard_id &&\n dashboard_type == o.dashboard_type &&\n global_time == o.global_time &&\n global_time_selectable_enabled == o.global_time_selectable_enabled &&\n public_url == o.public_url &&\n selectable_template_vars == o.selectable_template_vars &&\n share_list == o.share_list &&\n share_type == o.share_type &&\n token == o.token\n end",
"def ==(other)\n return false unless other.kind_of?(self.class)\n return false unless @method_name == other.method_name\n self.class == other.class\n end"
] | [
"0.678994",
"0.6736585",
"0.66741955",
"0.6668646",
"0.6637086",
"0.6630656",
"0.66192955",
"0.6601734",
"0.65938324",
"0.65807176",
"0.6580404",
"0.6569267",
"0.65652585",
"0.65626097",
"0.6532882",
"0.65273446",
"0.65181917",
"0.6510914",
"0.6507518",
"0.64653176",
"0.64574707",
"0.6456731",
"0.6453738",
"0.64450586",
"0.6443924",
"0.6439189",
"0.64381266",
"0.643348",
"0.64331156",
"0.64198506",
"0.64168423",
"0.6407608",
"0.64029306",
"0.6400206",
"0.6399886",
"0.63988715",
"0.63981646",
"0.6397231",
"0.6392597",
"0.63582885",
"0.63555485",
"0.63555485",
"0.63555485",
"0.6351662",
"0.6351662",
"0.6350763",
"0.6349159",
"0.63455814",
"0.634318",
"0.63424873",
"0.63412225",
"0.6341217",
"0.63349324",
"0.63341236",
"0.63321143",
"0.6329713",
"0.6323052",
"0.63199306",
"0.631812",
"0.6316825",
"0.63145036",
"0.63145036",
"0.6313252",
"0.63123256",
"0.6311287",
"0.6309896",
"0.63069904",
"0.63060594",
"0.6304751",
"0.62957937",
"0.62948865",
"0.62936985",
"0.62930727",
"0.6290705",
"0.6289869",
"0.6288332",
"0.6281146",
"0.6280848",
"0.62790734",
"0.62685823",
"0.62679666",
"0.6266194",
"0.6261881",
"0.62618315",
"0.6252725",
"0.624931",
"0.6247272",
"0.62470436",
"0.6235688",
"0.62320435",
"0.6228616",
"0.62283146",
"0.62270445",
"0.6226411",
"0.6224993",
"0.62227774",
"0.62227774",
"0.62214845",
"0.6220236",
"0.62172765"
] | 0.6699941 | 2 |
Doesn't work 1 Step one + two def oauth | def xauth_token
consumer = oauth_consumer
request_token = consumer.get_request_token
consumer.get_access_token(
request_token, {},
{
:x_auth_mode => 'client_auth',
:x_auth_username => cred['username'],
:x_auth_password => cred['password']
}
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oauth_authentication; end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def use_oauth\n\t\t\t\n\t\tend",
"def exchange_oauth_tokens\n end",
"def finish_oauth\n\tRails.logger.warn 'here'\n\n @consumer = OAuth::Consumer.new('l9tUlXD0IOoGhC9HnDJBA', '9YZWGkxQJgieQ3Ta89mPE4xpXXhryEbRD9GS0WAt4',{:site=>\"http://twitter.com\" })\n @req_token = OAuth::RequestToken.new(@consumer,session[:request_token],session[:request_token_secret])\n \n # Request user access info from Twitter\n @access_token = @req_token.get_access_token\n\n # Store the OAuth info for the user\n #@user = {}\n #@user.update_attributes(:token=>@access_token.token,:token_secret=>@access_token.secret)\n Rails.logger.warn \"Second Request #{@access_token.params['user_id']}\"\n # Send the user on their way\n session[:tokens] ={:token=>@access_token.token, :token_secret=>@access_token.secret}\n session[:id] = @access_token.params['user_id']\n redirect_to '/'\nend",
"def oauth\n request_token = @oauth_consumer.get_request_token\n authorize_url = request_token.authorize_url(:oauth_consumer_key => \n Netflix::Client.consumer_key)\n Launchy.open(authorize_url)\n puts \"Go to browser, a page has been opened to establish oauth\"\n printf \"Pin from Netflix:\"\n pin = gets.chomp\n access_token = request_token.get_access_token(:oauth_verifier => pin)\n end",
"def start_oauth\n @consumer = OAuth::Consumer.new('l9tUlXD0IOoGhC9HnDJBA', '9YZWGkxQJgieQ3Ta89mPE4xpXXhryEbRD9GS0WAt4',{:site=>\"http://twitter.com\" })\n @req_token = @consumer.get_request_token(:oauth_callback=>\"http://127.0.0.1:3000/a2\")\n Rails.logger.warn \"First Request #{@req_token.inspect}\"\n session[:request_token] = @req_token.token\n session[:request_token_secret] = @req_token.secret\n redirect_to @req_token.authorize_url\nend",
"def oauth\n if params[:code]\n token_response = get_user_tokens(params[:code])\n signup_or_login(token_response)\n end\n\n render json: params\n end",
"def step2\n initialize_vars\n url = \"#{@oauth_vars[:token_url]}?code=#{params[:code]}&grant_type=authorization_code&client_id=#{@oauth_vars[:client_id]}&client_secret=#{@oauth_vars[:client_secret]}&response_type=code&redirect_uri=#{@redirect_uri}\"\n rep = JSON.parse(get_json_from_https(url))\n session[:access_token] = rep[\"access_token\"]\n\n do_API_call\n end",
"def signin\n oauth_authorize\n end",
"def auth\r\n OAuth2\r\n end",
"def oauth\n teapot_q\n end",
"def oauth\n Auth.new(params[:uid], params[:oauth_token], action_name)\n end",
"def oauth!(key = :consumer_key, token = :token, secret = :token_secret, consumer_secret = :consumer_secret)\n @authenticates = :oauth\n @credentials = [key, token, secret, consumer_secret]\n end",
"def conection\n\n #cliente para el oauth\n cliente=OAuth::Consumer.new(\n @token,\n @secret,\n {\n :site=>\"http://twitter.com\",\n :request_token_url=>\"https://api.twitter.com/oauth/request_token\",\n :access_token_url =>\"https://api.twitter.com/oauth/access_token\",\n :authorize_url =>\"https://api.twitter.com/oauth/authorize\"\n }\n )\n #se solicita al api el token y el secret del usuario\n request_token = cliente.get_request_token\n token2 = request_token.token\n secret2 = request_token.secret\n #se abre el navegador predeterminado del sistema con la pagina de autorizacion\n direccion = cliente.authorize_url + \"?oauth_token=\" + token2\n puts \"Abriendo en el navegador: \"+direccion\n system('start '+direccion)\n #solicita el pin brindado por twitter\n print \"Clic al link anterior e ingrese el pin que aparese en la pagina del Tweeter de su navegador:\"\n pin = gets.chomp\n\tputs\n #se autentica al usuario con los datos brindados\n begin\n OAuth::RequestToken.new(cliente, token2, secret2)\n access_token=request_token.get_access_token(:oauth_verifier => pin)\n Twitter.configure do |config|\n config.consumer_key = @token\n config.consumer_secret = @secret\n config.oauth_token = access_token.token\n config.oauth_token_secret = access_token.secret\n end\n $client = Twitter::Client.new\n $client.verify_credentials\n puts \"Autenticado Correctamente\"\n\n rescue Twitter::Unauthorized\n puts \"Error de Autorizacion\"\n end\n end",
"def add_oauth(req)\n client.sign!(req)\n end",
"def oauth_access\n client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret})\n\n request_token = client.request_token\n token = request_token.token\n secret = request_token.secret\n\n puts \"Go to http://www.fitbit.com/oauth/authorize?oauth_token=#{token} and then enter the verifier code below and hit Enter\"\n verifier = gets.chomp\n\n access_token = client.authorize(token, secret, { :oauth_verifier => verifier })\n\n puts \"Verifier is: \"+verifier\n puts \"Token is: \"+access_token.token\n puts \"Secret is: \"+access_token.secret\n\n token = access_token.token\n secret = access_token.secret\n user_id = '3B8C8S'\n\n client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret, :token => token, :secret => secret, :user_id => user_id})\n access_token = client.reconnect(token, secret)\n # Pass client to runner here\n client\n end",
"def add_oauth(req, consumer, atok, asec)\r\n access_token = OAuth::AccessToken.new(consumer, atok, asec)\r\n consumer.sign!(req, access_token)\r\nend",
"def find_oauth_access_token\n end",
"def add_oauth(req)\n @consumer.sign!(req, @access_token)\nend",
"def oauth_callback\n at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])\n \n #There can only be one...\n Qbo.destroy_all\n\n # Save the authentication information \n qbo = Qbo.new\n qbo.qb_token = at.token\n qbo.qb_secret = at.secret\n qbo.token_expires_at = 6.months.from_now.utc\n qbo.reconnect_token_at = 5.months.from_now.utc\n qbo.company_id = params['realmId']\n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n end",
"def oauth_login oauth\n method = ::AuthMethod.by_provider_data oauth.provider_data\n\n if !method\n user = find_by_email(oauth.email) || create_from_oauth(oauth)\n\n if user.respond_to? :add_auth_method\n method = user.add_auth_method oauth.provider_data\n else\n method = user.auth_methods.create! oauth.provider_data\n end\n end\n\n method.create_token access_token: oauth.access_token\n end",
"def omni_common\n \n success = false\n failure = false\n failure_message = \"There was an error processing your request\"\n\n begin\n \n model_class = request.env[\"devise.mapping\"]\n if model_class.nil?\n \n redirect_to omniauth_failed_path_for(\"no_resource\"), :notice => \"No resource was specified in the omniauth callback request.\" and return \n else\n resource_klazz = request.env[\"devise.mapping\"].to\n \n omni_hash = get_omni_hash\n \n puts \"the omni hash is:\"\n puts omni_hash\n \n identity = Auth::Identity.new.build_from_omnihash(omni_hash)\n\n ##this index is used for the first query during oauth, to check whether the user already has registered using oauth with us.\n puts \"identity is:\"\n puts identity\n existing_oauth_resources = \n resource_klazz.collection.find(\n {\"identities\" =>\n {\"$elemMatch\" => \n {\"provider\" => identity.provider, \"uid\" => identity.uid}\n }\n })\n \n \n\n if existing_oauth_resources.count == 1\n \n puts \"found matching identity.\"\n \n if update_access_token_and_expires_at(existing_oauth_resources,resource_klazz,identity.attributes.except(\"_id\",\"provider\",\"uid\"),identity.provider)\n puts \"updated access token.\" \n success = true\n #respond_with @resource, location: after_sign_in_path_for(@resource) \n else\n puts \"failed to update access token.\"\n success = false\n #redirect_to omniauth_failed_path_for(resource_klazz.name),:notice => \"Failed to update the acceess token and token expires at\"\n\n end\n\n \n elsif signed_in?\n\n puts(\"it is a current user trying to sign up with oauth.\")\n \n after_sign_in_path_for(current_res) \n\n else \n \n puts(\"no such user exists, trying to create a new user by merging the fields.\")\n \n @resource = resource_klazz.new\n @resource.email = identity.email\n @resource.password = Devise.friendly_token(20)\n @resource.regenerate_token\n @resource.identities = [identity.attributes.except(\"_id\")]\n if @resource.respond_to?(:confirmed_at)\n @resource.confirmed_at = Time.now.utc \n end\n \n ## skip_email_unique_validation is set to true in omni_concern in the situation:\n ##1.there is no user with the given identity.\n ## however it is possible that a user with this email exists.\n ## in that case, if we try to do versioned_create, then the prepare_insert block in mongoid_versioned_atomic, runs validations. these include, checking if the email is unique, and in this case, if a user with this email already exists, then the versioned_create doesnt happen at all. We don't want to first check if there is already an account with this email, and in another step then try to do a versioned_update, because in the time in between another user could be created. So instead we simply just set #skip_email_unique_validation to true, and as a result the unique validation is skipped.\n @resource.skip_email_unique_validation = true\n \n\n @resource.m_client = self.m_client\n \n ## end.\n @resource.versioned_create({\"email\" => @resource.email})\n ##reset so that no other issues crop up later.\n @resource.skip_email_unique_validation = false\n \n #puts \"@resource email is:\"\n #puts @resource.email.to_s \n\n if @resource.op_success\n puts \"create was successfull\"\n sign_in @resource\n puts \"signed in resource.\"\n #respond_with @resource, location: after_sign_in_path_for(@resource)\n success = true\n #respond_to do |format|\n # format.html { redirect_to after_sign_in_path_for(@resource) and return}\n # format.json { render json: @resource, status: :updated and return}\n #end \n puts \"came after the response.\"\n\n ##do the update.\n elsif @resource.matched_count == 1\n #puts \"found such a resource.\" \n \n ## this means a resource with this email account was found.\n ## if the account is not confirmed, then we can push the identity.\n ## and we can reset the password.\n\n @resource = resource_klazz.where(:email => @resource.email).first\n @resource.m_client = self.m_client\n \n if @resource.confirmed?\n failure_message = \"That email is in use by another account\"\n end\n\n if Auth.configuration.prevent_oauth_merger == true\n\n success = false\n \n else\n\n @resource.identities.push(identity.attributes.except(\"_id\"))\n\n @resource.versioned_update({\"identities\" => 1})\n\n if @resource.op_success\n puts \"succeeded and signed in user.\"\n sign_in @resource\n \n success = true\n\n #respond_with @resource, location: after_sign_in_path_for(@resource)\n\n else\n puts \"op success failure\"\n success = false\n #redirect_to omniauth_failed_path_for(resource_klazz.name),:notice => \"Failed to create new identity\"\n end\n\n end\n \n else\n \n puts \"resource create failed.\"\n puts @resource.errors.full_messages.to_s\n success = false\n #redirect_to omniauth_failed_path_for(resource_klazz.name),:notice => \"Failed to create new identity\"\n end\n\n\n\n end\n\n end\n \n \n\n rescue => e\n puts \"SOME OTHER ERROR\"\n puts e.to_s\n puts e.backtrace\n redirect_to omniauth_failed_path_for(\"error\"), :notice => \"error\" and return\n success = false\n end\n\n puts \"Success is :#{success.to_s}\"\n\n \n respond_to do |format|\n if success == true\n format.html { redirect_to after_sign_in_path_for(@resource) and return}\n format.json { render json: @resource, status: :updated and return}\n else\n #@resource.errors.add(:_id,\"failed\")\n format.html { redirect_to omniauth_failed_path_for(failure_message), :notice => failure_message and return}\n format.json { render json: {:errors => failure_message}, status: :unprocessible_entity and return}\n end\n end \n \n\n end",
"def oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end",
"def oauth\n session[:return_to_url] = params[:redirect_after_login] if params[:redirect_after_login]\n login_at(auth_params[:provider])\n end",
"def oauth\n {\n consumer_key: @consumer_key,\n consumer_secret: @consumer_secret,\n token: @token,\n token_secret: @token_secret\n }\n end",
"def authorized_twitter\n oauth = Twitter::OAuth.new($configure[:twitter][:ctoken], $configure[:twitter][:csecret])\n # Request OAuth authentication if there are no access token yet\n unless($configure[:twitter][:atoken] && $configure[:twitter][:asecret])\n rtoken = oauth.request_token\n puts \"Open next url, authorize this application: #{rtoken.authorize_url}\"\n puts \"Then, enter PIN code:\"\n pin = STDIN.gets.chomp\n # Authrize request token using PIN code (this is required for an application which type is \"Client\")\n atoken = OAuth::RequestToken.new(oauth.consumer, rtoken.token, rtoken.secret).get_access_token(:oauth_verifier => pin)\n # Save access token\n $configure[:twitter][:atoken] = atoken.token\n $configure[:twitter][:asecret] = atoken.secret\n end\n oauth.authorize_from_access($configure[:twitter][:atoken], $configure[:twitter][:asecret])\n # Create Twitter client instance with OAuth\n Twitter::Base.new(oauth)\nend",
"def oauth\n profile = OAuthProfile.from_omniauth(env['omniauth.auth'])\n # TODO check for error\n # temp_password = SecureRandom.hex\n if !profile.user\n oauth_custom_params = request.env[\"omniauth.params\"] || {}\n session[:oauth_reason] = oauth_custom_params.fetch(\"dbdesigner_action\", \"\")\n session[:profile_id] = profile.id\n redirect_to new_registration_path\n # profile.user.create({\n # username: profile.username,\n # email: profile.email,\n # password: temp_password,\n # password_confirmation: temp_password\n # })\n else\n session[:user_id] = profile.user.id\n profile.user.record_login(request: request, oauth_profile: profile)\n redirect_to designer_path\n end\n end",
"def facebook\n handle_oauth\n end",
"def using_oauth?\n oauth_request? || oauth_response? || stored_oauth_token_and_secret?\n end",
"def gen_auth()\n options = get_options()\n auth = {\"cookie\" => {}, \"authorization\" => {}}\n\n if options.include?(:access_token)\n puts \"Using pre-authenticated access token\"\n puts \"Logging into self service @ #{options[:selfservice_url]}\"\n ss_login_req = RestClient::Request.new(\n :method => :get,\n :url => \"#{options[:selfservice_url]}/api/catalog/new_session?account_id=#{options[:account_id]}\",\n :headers => {\"Authorization\" => \"Bearer #{options[:access_token]}\"}\n )\n ss_login_resp = ss_login_req.execute\n auth[\"authorization\"] = {\"Authorization\" => \"Bearer #{options[:access_token]}\"}\n return auth\n end\n\n if options.include?(:refresh_token)\n # OAuth\n puts \"Logging into RightScale API 1.5 using OAuth @ #{options[:api_url]}\"\n cm_login_req = RestClient::Request.new(\n :method => :post,\n :payload => URI.encode_www_form({\n :grant_type => \"refresh_token\",\n :refresh_token => options[:refresh_token]\n }),\n :url => \"#{options[:api_url]}/api/oauth2\",\n :headers => {\"X-API-VERSION\" => \"1.5\"}\n )\n cm_login_resp = cm_login_req.execute\n oauth_token = JSON.parse(cm_login_resp.to_s)[\"access_token\"]\n puts \"Logging into self service @ #{options[:selfservice_url]}\"\n ss_login_req = RestClient::Request.new(\n :method => :get,\n :url => \"#{options[:selfservice_url]}/api/catalog/new_session?account_id=#{options[:account_id]}\",\n :headers => {\"Authorization\" => \"Bearer #{oauth_token}\"}\n )\n ss_login_resp = ss_login_req.execute\n auth[\"authorization\"] = {\"Authorization\" => \"Bearer #{oauth_token}\"}\n return auth\n end\n\n if options.include?(:email) && options.include?(:password)\n puts \"Logging into RightScale API 1.5 @ #{options[:api_url]}\"\n cm_login_req = RestClient::Request.new(\n :method => :post,\n :payload => URI.encode_www_form({\n :email => options[:email],\n :password => options[:password],\n :account_href => \"/api/accounts/#{options[:account_id]}\"\n }),\n :url => \"#{options[:api_url]}/api/session\",\n :headers => {\"X_API_VERSION\" => \"1.5\"}\n )\n cm_login_resp = cm_login_req.execute\n\n puts \"Logging into self service @ #{options[:selfservice_url]}\"\n ss_login_req = RestClient::Request.new(\n :method => :get,\n :url => \"#{options[:selfservice_url]}/api/catalog/new_session?account_id=#{options[:account_id]}\",\n :cookies => {\"rs_gbl\" => cm_login_resp.cookies[\"rs_gbl\"]}\n )\n ss_login_resp = ss_login_req.execute\n auth[\"cookie\"] = cm_login_resp.cookies\n return auth\n end\n\n if options.include?([\"instance_token\"])\n raise \"Sorry, don't think we can authenticate with SS using an instance token\"\n end\n raise \"No auth methods found\"\nend",
"def oauth_github_flow\n case params[:step]\n when 1\n oauth_github_flow_authorize\n when 2\n oauth_github_flow_access_token\n else\n raise \"Unsupported OAuth step\"\n end\n end",
"def add_oauth(req)\n access_token = OAuth::AccessToken.new(@consumer,@auth[:token],@auth[:token_secret])\n @consumer.sign!(req,access_token)\n end",
"def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n authorize_url = request_token.authorize_url\n\n # Launchy is a gem that opens a browser tab for us\n Launchy.open(authorize_url)\n\n # Because we don't use a redirect URL; user will receive a short PIN\n # (called a **verifier**) that they can input into the client\n # application. The client asks the service to give them a permanent\n # access token to use.\n puts \"Login, and type your verification code in\"\n oauth_verifier = gets.chomp\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier\n )\nend",
"def twitter\n handle_oauth\n end",
"def bind_with_oauth\n if u = User.find_by_email(params[:user][:email])\n flash[:alert] = I18n.t 'devise.oauth_services.user.email_has_been_token'\n redirect_to new_oauth_user_registration_path and return\n end \n u = build_resource permitted_params.merge(name: session[:oauth].info.name, password: SecureRandom.hex )\n\n u.bypass_humanizer = true\n if u.save\n u.apply_oauth session[:oauth]\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: (I18n.t \"devise.oauth_services.providers.#{session[:oauth].provider}\") if session[:oauth].present?\n sign_in_and_redirect @user, :event => :authentication\n else\n flash[:alert] = I18n.t 'devise.oauth_services.user.failure'\n redirect_to new_oauth_user_registration_path\n end\n end",
"def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end",
"def auth\n\n @user = current_user\n puts @user.email\n Rails.cache.write(\"user_id\", @user.id)\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => (\n \"http://localhost:3000/mob/flickr/callback\"))\n Rails.cache.write(\"oauth_token_secret\",token['oauth_token_secret'])\n auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'read')\n redirect_to(auth_url)\n end",
"def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end",
"def create\n #request_token = @client.request_token(:oauth_callback => 'http://127.0.0.1:3000/twitter/new')\n #request_token = @client.request_token(:oauth_callback => 'https://gentle-snow-7462.herokuapp.com/twitter/new')\n request_token = @client.request_token(:oauth_callback => TWITTER_CALLBACK_URL)\n\n session['oauth_request_token_token'] = request_token.token\n session['oauth_request_token_secret'] = request_token.secret\n\n redirect_to request_token.authorize_url\n end",
"def doc_auth_oauth2(name, flows)\n add_auth_method name,{\n type: 'oauth2',\n flows: flows\n }\n end",
"def authorize\n oauth_verifier = params[:oauth_verifier]\n request_token = session[:request_token]\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n \n user = User.login(access_token)\n session[:user] = user.id unless user.nil?\n redirect_to :controller => :home\n end",
"def authenticate!\n redirect \"https://github.com/login/oauth/authorize?scope=user:email,read:org&client_id=#{CLIENT_ID}\"\nend",
"def authenticate!(type = :portal)\n load_consumer_config(type) if oauth_consumer.nil?\n\n @oauth_request = oauth_consumer.get_request_token\n @oauth_authorize_url = oauth_request.authorize_url\n\n @oauth_consumer.instance_eval do\n # The token request reponse is scoped only in the token_request method, but I need to get access to the response\n # headers so that I can pull back the Content-Location header and get the authenticated user URI\n def token_request(http_method, path, token = nil, request_options = {}, *arguments)\n @tr_response = request(http_method, path, token, request_options, *arguments)\n case @tr_response.code.to_i\n\n when (200..299)\n if block_given?\n yield @tr_response.body\n else\n # symbolize keys\n # TODO this could be considered unexpected behavior; symbols or not?\n # TODO this also drops subsequent values from multi-valued keys\n CGI.parse(@tr_response.body).inject({}) do |h,(k,v)|\n h[k.strip.to_sym] = v.first\n h[k.strip] = v.first\n h\n end\n end\n when (300..399)\n # this is a redirect\n @tr_response.error!\n when (400..499)\n raise OAuth::Unauthorized, @tr_response\n else\n @tr_response.error!\n end\n end\n \n # The HTTP response from token_request\n def token_request_response\n @tr_response\n end\n end\n \n oauth_authorize_url\n end",
"def applicazioni_oauth2\n #creo jwt\n hash_jwt_app = {\n 'iss' => 'soluzionipa.it',\n 'start' => DateTime.now.new_offset(0).strftime(\"%d%m%Y%H%M%S\") #datetime in formato utc all'invio\n }\n jwt_token = JsonWebToken.encode(hash_jwt_app)\n redirect_to \"#{Settings.app_oauth2_url}/oauth/applications?jwt=#{jwt_token}\"\n end",
"def oauth\n puts '*'*50\n puts session[:category]\n session[:category] = nil\n session[:category] = params[:category]\n puts '*'*50\n puts session[:category]\n login_at(auth_params[:provider])\n end",
"def oauth\n\t\tdropbox = DropboxConnection.new\n\t\n\t\tif params[:not_approved] == 'true'\n\t\t\tredirect_to dropbox_path, flash: { error: 'You just cancelled, didn\\'t you?' }\n\t\telse\n\t\t\t# the user has returned from Dropbox so save the session and go away\n\t\t\tdropbox.authorized\n\t\t\tredirect_to :root\n\t\tend\n\tend",
"def request_token\n localcallback = \"http://localhost:3000/twitter/callback\"\n herokucallback = \"http://twitter-fobot.herokuapp.com/twitter/callback\"\n @callback_url = Rails.env == 'production' ? herokucallback : localcallback\n @consumer = OAuth::Consumer.new(ENV['consumer_key'],ENV['consumer_secret'],:site=>\"https://api.twitter.com\")\n @consumer.options[:authenticate_path] = \"/oauth/authenticate\"\n \n #@request_token is app specific not user specific\n @request_token = @consumer.get_request_token(:oauth_callback => @callback_url)\n \n session[:request_token] = @request_token\n #redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)\n redirect_to \"https://api.twitter.com/oauth/authenticate?oauth_callback=\" + @callback_url + \"&oauth_token=\" + @request_token.token\n end",
"def login\n params = {\n :head => { 'authorization' => [@username, @password] },\n :body => {}\n }\n params[:body]['client_id'] = @client_id if @client_id\n params[:body]['client_secret'] = @client_secret if @client_secret\n http = EM::HttpRequest.new(API_OAUTH_URL).post(params)\n\n http.errback do |http|\n fail(http.error, *@deferrable_args)\n end\n\n http.callback do |http|\n if http.response_header.status != 200\n fail(http.response, *@deferrable_args)\n next\n end\n\n @access_token = http.response\n if @access_token.nil?\n fail('OAuth request did not return an access token', *@deferrable_args)\n next\n else\n yield if block_given?\n end\n end\n end",
"def oauth\n session[:auth_token] = GoogleOauth.oauth(params)\n puts \"saving auth token #{session[:auth_token]}\"\n redirect_to(\"/characters/#{session[:char_id]}\")\nend",
"def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end",
"def auth\n end",
"def auth\n end",
"def userauth_request(username, next_service, auth_method, *others); end",
"def github\n process_oauth_callback\n end",
"def oauth_required\n head oauth.no_access! unless oauth.authenticated?\n end",
"def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end",
"def oauth?\n oauth_consumer_key && oauth_consumer_secret\n end",
"def use_oauth1\r\n @auth_method = AuthMethod::OAUTH1_SIGNATURE\r\n @username = nil\r\n @password = nil\r\n @current_oauth_request = nil\r\n end",
"def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end",
"def authenticate\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_data = @discogs.get_request_token(DISCOGS_API_KEY, DISCOGS_API_SECRET, \"http://127.0.0.1:3000/callback\")\n \n session[:request_token] = request_data[:request_token]\n \n redirect_to request_data[:authorize_url]\n end",
"def authorize(req_token, given_num)\n # Clean up tokens\n #clean_tokens()\n begin\n rows = @db.execute(\"SELECT * FROM request_tokens WHERE request_token=?\", req_token)\n rescue\n puts \"Failed to find request token: #{$!}\"\n return false\n end\n req_secret = rows[0][2]\n begin\n puts \"Authorizing #{req_token} #{req_secret} #{given_num}\"\n @oauth.authorize_from_request(req_token, req_secret, given_num)\n rescue\n puts \"Failed to authorize user #{$!}\"\n return false\n end\n # If it works, save off the data.\n puts \"OMFG it works.\"\n acct = Twitter::Base.new(@oauth)\n begin\n profile = acct.verify_credentials\n @db.execute( \"INSERT INTO users VALUES (NULL,?,?,?,?)\",\n profile.name, given_num, @oauth.access_token.token, @oauth.access_token.secret)\n rescue Exception => e\n if e.class == SQLite3::SQLException \n # We already have this user!\n puts \"User #{profile.name} already has credentials\"\n else\n puts \"Failed to insert user #{profile.name}: #{$!}, #{e.class}\"\n return false\n end\n end\n acct\n end",
"def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.token\n session[:secret_token] = @access_token.secret\n session[:user_id] = @access_token.params[\"user_id\"] rescue \"\"\n session[:screen_name] = @access_token.params[\"screen_name\"] rescue \"\"\n session[:authorized] = true\n @log.info \"authorized, user [#{session[:screen_name]}]\"\n \n if session[:redirect_to]\n url = session[:redirect_to]\n session[:redirect_to] = nil \n redirect url\n else\n redirect '/'\n end\n\n end",
"def callback\n @T_OAUTH = TwitterOAuth::Client.new(:consumer_key => TWITTER_KEY, :consumer_secret => TWIITER_SECRET )\n @oauth_verifier = params[:oauth_verifier]\n access_token = @T_OAUTH.authorize(session['token'], session['secret'], auth_verifier => @oauth_verifier)\n if (@result = @T_OAUTH.authorized?)\n current_user.create_or_update_twitter_account_with_oauth_token(access_token.token, access_token.secret)\n session['token'] = nil\n session['secret'] = nil\n flash[:notice] = \"Authorize complete\"\n else\n flash[:notice] = \"Authorize failed\"\n end\n\n rescue\n flash[:notice] = \"Authorize failed\"\n end",
"def authenticate!\n @client = Octokit::Client.new\n url = @client.authorize_url(CLIENT_ID)\n redirect url\nend",
"def login\n oauth_callback = url_for(:action => :authorize)\n request_token = @consumer.get_request_token(:oauth_callback => oauth_callback)\n session[:request_token] = request_token\n redirect_to request_token.authorize_url\n end",
"def authorise\n @oauth_client = OauthClient.find(params[:id])\n\n response = @oauth_client.exchange(params[:code], request.original_url) if params[:code]\n @oauth_client.access_token = response[\"access_token\"]\n @oauth_client.refresh_token = response[\"refresh_token\"]\n @oauth_client.expires_at = response[\"expires_at\"]\n\n respond_to do |format|\n if @oauth_client.save\n format.html { redirect_to oauth_client_path(@oauth_client), notice: 'OAuth client was successfully authorised.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\", error: 'OAuth client was not successfully authorised.' }\n format.json { render json: @oauth_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def oauth_login?\n github_id.present? || facebook_id.present?\n end",
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def oauth2callback\n @g_cal_api.oauth2callback\n end",
"def twitter_auth\n consumer = OAuth::Consumer.new Twitter.options[:consumer_key],\n Twitter.options[:consumer_secret],\n { :site => 'http://twitter.com/',\n :request_token_path => '/oauth/request_token',\n :access_token_path => '/oauth/access_token',\n :authorize_path => '/oauth/authorize'}\n\n request_token = consumer.get_request_token\n system(\"open\", request_token.authorize_url)\n print \"Enter the number they give you: \"\n pin = STDIN.readline.chomp\n\n access_token = request_token.get_access_token(:oauth_verifier => pin)\n\n puts access_token.get('/account/verify_credentials.json')\n return access_token\nend",
"def oauth_consumer\n @oauth_consumer\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end",
"def oauth?\n type == 'OAuth'\n end",
"def oauth_response?\n !oauth_response.nil? && auth_session? && auth_session[:auth_request_class] == self.class.name && auth_session[:auth_method] == \"oauth\"\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def auth\n\t\tclient = TwitterOAuth::Client.new(\n\t\t :consumer_key => CONSUMER_KEY,\n\t\t :consumer_secret => CONSUMER_SECRET\n\t\t)\n\t\taccess_token = client.authorize(\n\t\t\tsession[:request_token],\n\t\t\tsession[:request_token_key],\n\t\t\t:oauth_verifier => params[:oauth_verifier]\n\t\t)\n\t\tif client.authorized?\n\t\t\tsession[:access_token] = access_token.token\n\t\t\tsession[:access_token_secret] = access_token.secret\n\t\t\tsession[:user_name] = client.info['name']\n\t\tend\n\t\tredirect_to root_url\n\tend",
"def create_client_from_outhAccount(scope, oob_uri, user_id, oauth_cred_file)\n #oob_uri = 'urn:ietf:wg:oauth:2.0:oob'\n #user_id = 'eyemole@gmail.com'\n client_id = Google::Auth::ClientId.from_file(oauth_cred_file)\n token_store = Google::Auth::Stores::FileTokenStore.new(:file => 'tokens.yaml')\n authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: oob_uri )\n #Launchy.open(url)\n puts \"Open this URL in Browser and enter the code you got from browser below\"\n puts \"URL: #{url}\"\n print \"enter the code you got from browser here and press Enter: \"\n # code = gets\n code = STDIN.gets.chomp\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: oob_uri)\n end\n blogger = Google::Apis::BloggerV3::BloggerService.new\n blogger.authorization = credentials\n return blogger\nend",
"def authenticating_with_oauth?\n correct_request_class? && using_oauth?\n end",
"def update_tokens(oauth_params)\n# binding.pry\n self.oauth_token = oauth_params.credentials.token\n # facebook, google provide this; twitter, linkedin don't\n self.oauth_expires_at = Time.at(oauth_params.credentials.expires_at) if oauth_params.credentials.expires_at\n # twitter\n self.oauth_secret = oauth_params.credentials.secret if oauth_params.credentials.secret\n end",
"def authorize\n setup_client(@user.id)\n @user.integrations.create!(name: 'google_calendar', status: 'pending')\n redirect_to authorizer.get_authorization_url base_url: 'http://localhost:8080'\n # redirect_to oauth_callback_url(@companies.first)\n end",
"def authenticate\n oauth2_client = Qbo.get_client\n callback = Setting.host_name + \"/qbo/oauth_callback/\" \n grant_url = oauth2_client.auth_code.authorize_url(redirect_uri: callback, response_type: \"code\", state: SecureRandom.hex(12), scope: \"com.intuit.quickbooks.accounting\")\n redirect_to grant_url\n end",
"def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end",
"def http_auth?; end",
"def token_auth(*args, &block); end",
"def oauth?; stripe_account_type == 'oauth'; end",
"def oauth_required\n invalid_oauth_response and return false unless current_token\n end",
"def oauth_callback\n if params[:state].present?\n oauth2_client = Qbo.get_client\n # use the state value to retrieve from your backend any information you need to identify the customer in your system\n redirect_uri = Setting.host_name + \"/qbo/oauth_callback/\"\n if resp = oauth2_client.auth_code.get_token(params[:code], redirect_uri: redirect_uri)\n \n # Remove the last authentication information\n Qbo.delete_all\n \n # Save the authentication information \n qbo = Qbo.new\n qbo.company_id = params[:realmId]\n \n # Generate Access Token & Serialize it into the database\n access_token = OAuth2::AccessToken.new(oauth2_client, resp.token, refresh_token: resp.refresh_token)\n qbo.token = access_token.to_hash\n qbo.expire = 1.hour.from_now.utc\n \n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n \n end\n end\n end",
"def rack_oauth!(name)\n oauth_instance(name).get_access_token!(oauth_request_env)\n end",
"def oauth_signup\n @user = User.new(\n nickname: params[:nickname],\n sex: params[:sex],\n phone: params[:phone],\n birthday: params[:birthday],\n province: params[:province],\n city: params[:city],\n area: params[:area] )\n @user.created_by_oauth = 'mobile'\n @user.authentications.build(\n uid: params[:oauth_uid],\n provider: params[:provider],\n access_token: params[:access_token])\n if @user.save\n @user.confirm!\n render :login\n else\n render json: {\n success: false,\n message: @user.errors.messages\n }\n end\n end",
"def oauth_complete(code)\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + \"/oauth2/access_token?client_id=%i&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s\" % [@client_id, @application_secret, @redirect_uri, code]\n \n # And call it.\n response = Curl::Easy.perform(url) do |req|\n req.headers['Accept'] = 'application/json'\n end\n\n # Use Crack to parse the JSON\n response = JSON.parse(response.body_str)\n\n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n\n # Save it locally.\n @access_token = response.access_token\n\n # Return it\n response\n end",
"def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => get_redirect_uri)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n session[:linkedin_token] = access_token.token\n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n #logger.debug \"test putting string #{response.body}\"\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end",
"def authorize\n ##FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n if !File.exist?(CLIENT_SECRETS_PATH)\n puts \"Error: OAuth2認証用のsecretファイルが見つかりませんでした\"\n puts \"以下のURLからこのプロジェクト用のsecretを作成し、'client_secret.json'というファイル名でこのディレクトリに保存してください。\"\n puts\n puts \"https://console.developers.google.com/start/api?id=sheets.googleapis.com\"\n exit 1\n end\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"以下のURLにWebブラウザでアクセスし、認証を行った後、表示されるコードを入力してください:\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end",
"def generate_access_token\n @user = current_user\n begin \n request_token = OAuth::RequestToken.new(TwitterAccount.twitter_consumer,\n params[\"oauth_token\"], params[\"oauth_verifier\"])\n if @user.twitter_account\n @user.twitter_account.delete\n end\n t_account = @user.create_twitter_account(request_token)\n\n unless t_account.new_record?\n flash[:notice] = 'You are now connected to twitter $green'\n l = Log.new\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1.humanize} is now connected to twitter account\"\n l.loggingtype = 0\n l.save\n\n else \n flash[:notice] = 'Couldn\\'t connect to twitter $red'\n end \n redirect_to controller: 'users', action: 'connect_social_accounts'\n\n rescue \n flash[:notice] = 'Couldn\\'t connect to twitter $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end \n end",
"def authorize\n\n # redirect to kpass for authorization (and authentication if they're not\n # signed in.)\n # \n \n\n authorize_url = \"#{ENV['KPASS_ENDPOINT']}/oauth/authorize?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to authorize_url\n end",
"def init\n init_oauth_access_token\n end",
"def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end",
"def grantAccess()\n\t\t\tif File.zero?('lib/data.txt') #if files doesn't exist it then gets the access_tokens\n\t\t\t\t@request_token = @consumer.get_request_token\n\t\t\t\tLaunchy.open(\"#{@request_token.authorize_url}\")\n\t\t\t\tprint \"Enter pin that the page gave you:\" \n\t\t\t\t@pin = STDIN.readline.chomp\n\t\t\t\t@access_token = @request_token.get_access_token(:oauth_verifier => @pin)\n\t\t\t\tputs @access_token.token\n\t\t\t\tFile.open('lib/data.txt','w') do |f|\n\t\t\t\t\tf.puts @access_token.token\n\t\t\t\t\tf.puts @access_token.secret\n\t\t\t\tend\n\t\t\telse #if they exist it simple reads them into token_hash\n\t\t\t\tFile.open('lib/data.txt','r') do |f|\n\t\t\t\t\t@token_hash = { :oauth_token => f.readline.chomp,\n\t\t\t\t\t\t\t\t\t\t\t :oauth_token_secret => f.readline.chomp\n\t\t\t\t\t\t\t\t\t\t \t\t}\n\t\t\t\t\tend\n\t\t\tend\n\t\tend"
] | [
"0.8049021",
"0.7187448",
"0.7187448",
"0.71234417",
"0.7036954",
"0.6910445",
"0.689526",
"0.6874275",
"0.6873518",
"0.6865121",
"0.6848702",
"0.6803173",
"0.6740005",
"0.6731169",
"0.67184645",
"0.6690623",
"0.66871554",
"0.6673406",
"0.66719854",
"0.66177344",
"0.6616024",
"0.6603044",
"0.66005063",
"0.6571886",
"0.6564001",
"0.65486234",
"0.6544984",
"0.65416235",
"0.653735",
"0.65238076",
"0.6504328",
"0.64981115",
"0.64980847",
"0.6473527",
"0.6465732",
"0.64532584",
"0.64411974",
"0.6435184",
"0.64277285",
"0.64154905",
"0.6413135",
"0.6409767",
"0.6406891",
"0.640163",
"0.6391881",
"0.6391136",
"0.63865566",
"0.6369927",
"0.63693374",
"0.6364701",
"0.6363318",
"0.63576066",
"0.63547987",
"0.63547987",
"0.6337668",
"0.6324851",
"0.63203555",
"0.63155556",
"0.6308553",
"0.63056827",
"0.62742865",
"0.6272212",
"0.6269881",
"0.6264065",
"0.62505096",
"0.62451357",
"0.62423676",
"0.62288004",
"0.62151206",
"0.6214709",
"0.62131596",
"0.6206361",
"0.61978465",
"0.61882704",
"0.6179057",
"0.61689603",
"0.6155788",
"0.6149877",
"0.61429954",
"0.6133934",
"0.61301184",
"0.61223376",
"0.6120141",
"0.6117822",
"0.6113619",
"0.6109031",
"0.610892",
"0.6105592",
"0.6104822",
"0.6103384",
"0.61014575",
"0.61000806",
"0.6097755",
"0.6097628",
"0.6096103",
"0.6088784",
"0.60880935",
"0.6085216",
"0.60701096",
"0.6067001",
"0.6066149"
] | 0.0 | -1 |
Copied private helpers from lazy_high_charts/lib/lazy_high_charts/layout_helper.rb | def generate_json_from_value(value)
if value.is_a? Hash
%({ #{generate_json_from_hash value} })
elsif value.is_a? Array
%([ #{generate_json_from_array value} ])
elsif value.respond_to?(:js_code) && value.js_code?
value
else
value.to_json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layout(historical_orders)\r\n # first we have to create a ranking of all the historical order\r\n historical_orders=historical_orders\r\n\r\n hist_order_flatten = historical_orders.flatten\r\n # uniq_order = hist_order.uniq\r\n #Create a hash table to store the frequency of the items\r\n # h=Hash.new\r\n # for i in 0...uniq_order.length\r\n # key = uniq_order[i]\r\n # count = hist_order.count(key)\r\n # h[key]= count\r\n # end\r\n l_score = lengthscore(historical_orders)\r\n h = finalscore(l_score,hist_order_flatten,historical_orders)\r\n\r\n h_sorted = h.sort_by {|k,v| v}\r\n h_sorted= Hash[h_sorted.map {|key, value| [key, value]}]\r\n ranked_order = h_sorted.keys.reverse\r\n # puts \"this is ranked order = #{ranked_order}\"\r\n\r\n #This is the algo filled by columns\r\n layout = [[], [], [], [], []]\r\n row_counter = 0\r\n # for i in 0...ranked_order.length\r\n # layout[row_counter] << ranked_order[i]\r\n # row_counter += 1\r\n # row_counter %= 5 # if row_counter becomes 5, it gets reset back to 0\r\n # end\r\n\r\n # this is the algo filled by row\r\n per_row = (ranked_order.length)/5\r\n layout =ranked_order.each_slice(per_row).to_a\r\n\r\n\r\n\r\n return layout\r\nend",
"def layout_children\n \n end",
"def multiple_series\n render :layout => false\n end",
"def render_layout(output, layout, info); end",
"def _conditional_layout?; end",
"def layout(legend_info_array, vertical = false)\n if vertical\n longest = 0\n legend_info_array.each {|elem|\n cur_length = relative(50) * elem[:title].length\n longest = longest < cur_length ? cur_length : longest\n }\n y_positions = []\n (0..legend_info_array.length - 1).each {|y|\n y_positions << y * @line_height\n }\n [longest, y_positions]\n else\n legend_info_array.inject([0, []]) do |enum, elem|\n enum[0] += (relative(50) * 2) if enum.first != 0 # Add spacer between elements\n enum[1] << enum.first # Add location to points\n enum[0] += relative(50) # Add room for color box\n enum[0] += (relative(50) * elem[:title].length) # Add room for text\n\n [enum.first, enum.last]\n end \n end\n end",
"def layout(layout_width)\n idx, str = 0, ''\n\n #layout_width = 4\n layout_length = object.length - (layout_remainder = object.length % layout_width)\n\n while idx < layout_length - 1 do\n generate_division(layout_width).each do | val |\n # [5, 5].each do | val |\n str += h.render partial: \"layouts/layout_#{val}\", locals: { posts: object.slice(idx, val)}\n idx += val\n end\n end\n\n if layout_remainder > 0\n str += h.render partial: \"layouts/layout_#{layout_remainder}\", locals: { posts: object.slice(idx, layout_remainder)}\n end\n\n str.html_safe\n end",
"def setup_graph_measurements\n @marker_caps_height = @hide_line_markers ? 0 :\n calculate_caps_height(@marker_font_size)\n @title_caps_height = @hide_title ? 0 :\n calculate_caps_height(@title_font_size)\n @legend_caps_height = @hide_legend ? 0 :\n calculate_caps_height(@legend_font_size)\n\n if @hide_line_markers\n (@graph_left,\n @graph_right_margin,\n @graph_bottom_margin) = [@left_margin, @right_margin, @bottom_margin]\n else\n longest_label_width = 0\n longest_left_label_width = 0\n longest_right_label_width = 0\n \n if @has_left_labels\n longest_label_width = calculate_width(@marker_font_size,\n labels.values.inject('') { |value, memo| (value.to_s.length > memo.to_s.length) ? value : memo }) * 1.25\n else\n if @has_left_data && @has_right_data\n left_maximum_value = @left_maximum_value\n right_maximum_value = @right_maximum_value\n\n longest_left_label_width = calculate_width(@marker_font_size, label(left_maximum_value, :left))\n longest_right_label_width = calculate_width(@marker_font_size, label(right_maximum_value, :right))\n\n longest_label_width = (longest_left_label_width > longest_right_label_width) ?\n longest_left_label_width : longest_right_label_width\n elsif @has_left_data\n maximum_value = @left_maximum_value\n longest_label_width = calculate_width(@marker_font_size, label(maximum_value, :left))\n elsif @has_right_data\n maximum_value = @right_maximum_value\n longest_label_width = calculate_width(@marker_font_size, label(maximum_value, :right))\n end\n end\n\n # Shift graph if left line numbers are hidden\n line_number_width = @hide_line_numbers && !@has_left_labels ?\n 0.0 :\n (longest_label_width + LABEL_MARGIN * 2)\n\n @graph_left = @left_margin + line_number_width +\n (@y_axis_label.nil? ? 0.0 : @marker_caps_height + LABEL_MARGIN * 2)\n\n # Make space for half the width of the rightmost column label.\n # Might be greater than the number of columns if between-style bar markers are used.\n# last_label = @labels.keys.sort.last.to_i\n# extra_room_for_long_label = (last_label >= (@column_count-1) && @center_labels_over_point) ?\n# calculate_width(@marker_font_size, @labels[last_label]) / 2.0 :\n# 0\n# @graph_right_margin = @right_margin + extra_room_for_long_label\n @graph_right_margin = @right_margin + line_number_width +\n (@y_axis_label.nil? ? 0.0 : @marker_caps_height + LABEL_MARGIN * 2)\n\n @graph_bottom_margin = @bottom_margin + @marker_caps_height + LABEL_MARGIN\n end\n\n# @graph_right = @raw_columns - @graph_right_margin\n# @graph_width = @raw_columns - @graph_left - @graph_right_margin\n#\n# # When @hide title, leave a title_margin space for aesthetics.\n# # Same with @hide_legend\n# @graph_top = @top_margin +\n# (@hide_title ? title_margin : @title_caps_height + title_margin ) +\n# (@hide_legend ? legend_margin : @legend_caps_height + legend_margin)\n#\n# x_axis_label_height = @x_axis_label.nil? ? 0.0 :\n# @marker_caps_height + LABEL_MARGIN\n# @graph_bottom = @raw_rows - @graph_bottom_margin - x_axis_label_height\n# @graph_height = @graph_bottom - @graph_top\n end",
"def basic_chart\n \n end",
"def _implied_layout_name; end",
"def custom_layout\n case action_name\n when \"industry_xls\"\n \"no_layout\"\n when \"supplier_profiles\"\n \"no_layout\"\n when \"total_xls\"\n \t \"no_layout\"\n when \"industry_level\"\n \"no_layout\"\n when \"supplier_level\"\n \"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\n when \"customer_record\"\n \t\"no_layout\"\n when \"most_company_xls\"\n \t\"no_layout\"\n when \"conversion_industry\"\n \t\"no_layout\"\n when \"conversion_company\"\n \t\"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\t\n when \"suppliers_profiles\"\n \t\"no_layout\"\n when \"registered_suppliers\"\n \t\"no_layout\"\n when \"unregistered_suppliers\"\n \t\"no_layout\"\n when \"all_customers\"\n \t\"no_layout\"\n when \"jagent\"\n \t\"no_layout\"\n when \"sagent\"\n \t\"no_layout\"\n when \"poll\"\n \"no_layout\"\t\n when \"industry_conversion\"\n \"no_layout\"\t\n when \"company_conversion\"\t\t\n \"no_layout\"\n when \"reviews_processed\"\n \"no_layout\"\n when \"agent_output\"\n \"no_layout\"\n when \"agent_performance\"\n \"no_layout\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n else\n \"admin\"\n end\n end",
"def do_layout(payload, layouts)\n end",
"def setup_graph_measurements\n @marker_caps_height = calculate_caps_height(@marker_font_size)\n @title_caps_height = calculate_caps_height(@title_font_size)\n @legend_caps_height = calculate_caps_height(@legend_font_size)\n\n if @hide_line_markers\n (@graph_left,\n @graph_right_margin,\n @graph_bottom_margin) = [LEFT_MARGIN, RIGHT_MARGIN, BOTTOM_MARGIN]\n else\n longest_left_label_width = 0\n if @has_left_labels\n longest_left_label_width = calculate_width(@marker_font_size,\n labels.values.inject('') { |value, memo| (value.to_s.length > memo.to_s.length) ? value : memo }) * 1.25\n else\n longest_left_label_width = calculate_width(@marker_font_size,\n label(@maximum_value.to_f))\n end\n\n # Shift graph if left line numbers are hidden\n line_number_width = @hide_line_numbers && !@has_left_labels ?\n 0.0 :\n (longest_left_label_width + LABEL_MARGIN * 2)\n\n @graph_left = LEFT_MARGIN +\n line_number_width +\n (@y_axis_label.nil? ? 0.0 : @marker_caps_height + LABEL_MARGIN * 2)\n # Make space for half the width of the rightmost column label.\n # Might be greater than the number of columns if between-style bar markers are used.\n last_label = @labels.keys.sort.last.to_i\n extra_room_for_long_label = (last_label >= (@column_count-1) && @center_labels_over_point) ?\n calculate_width(@marker_font_size, @labels[last_label])/2.0 :\n 0\n @graph_right_margin = RIGHT_MARGIN + extra_room_for_long_label\n\n @graph_bottom_margin = BOTTOM_MARGIN +\n @marker_caps_height + LABEL_MARGIN\n end\n @graph_right = @raw_columns - @graph_right_margin\n @graph_width = @raw_columns - @graph_left - @graph_right_margin\n\n # When @hide title, leave a TITLE_MARGIN space for aesthetics.\n # Same with @hide_legend\n @graph_top = TOP_MARGIN +\n (@hide_title ? TITLE_MARGIN : @title_caps_height + TITLE_MARGIN * 2) +\n (@hide_legend ? LEGEND_MARGIN : @legend_caps_height + LEGEND_MARGIN * 2)\n\n @graph_bottom = @raw_rows - @graph_bottom_margin -\n (@x_axis_label.nil? ? 0.0 : @marker_caps_height + LABEL_MARGIN)\n\n @graph_height = @graph_bottom - @graph_top\n end",
"def default_layout(width=@width, height=@height)\n if @nodes.length > 0\n set_static_nodes(width,height)\n static_wheel_nodes(width,height)\n fruchterman_reingold(100,width,height) #fast, little bit of layout for now\n normalize_graph(width,height)\n #do_kamada_kawai\n else\n @notice = NO_ITEM_ERROR\n end\n end",
"def show\n @chart = Chart.find(params[:id])\n @chartnodes = @chart.chartnodes\n data = @chart.chartnodes.map {|node| [node.xaxis, node.yaxis]}.transpose\n if @chart.charttype == 'column'\n @h1 = LazyHighCharts::HighChart.new('graph') do |f|\n f.title({ :text=> @chart.name})\n f.options[:xAxis][:categories] = data[0]\n f.series(:type=> 'column',:name=> @chart.name,:data=> data[1])\n end\n elsif @chart.charttype == 'spline'\n @h1 = LazyHighCharts::HighChart.new('graph') do |f|\n f.title({ :text=> @chart.name})\n f.options[:xAxis][:categories] = data[0]\n f.series(:type=> 'spline',:name=> @chart.name,:data=> data[1])\n f.plot_options( :spline => {\n :dataLabels => {\n :enabled => true\n }})\n f.tooltip( :crosshairs => true, :shared => true)\n end\n elsif @chart.charttype == 'pie'\n @h1 = LazyHighCharts::HighChart.new('pie') do |f|\n f.chart({:defaultSeriesType=>\"pie\" , :margin=> [50, 200, 60, 170]} )\n series = {\n :type=> 'pie',\n :name=> @chart.name,\n :data=> data.transpose\n }\n f.series(series)\n f.options[:title][:text] = \"Browser share\"\n f.legend(:layout=> 'vertical',:style=> {:left=> 'auto', :bottom=> 'auto',:right=> '50px',:top=> '100px'}) \n f.plot_options(:pie=>{\n :allowPointSelect=>true, \n #:cursor=>\"pointer\" , \n :dataLabels=>{\n :enabled=>true,\n :color=>\"black\",\n :style=>{\n :font=>\"13px Trebuchet MS, Verdana, sans-serif\"\n }\n }\n })\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chart }\n end\n end",
"def _layout(*_arg0); end",
"def imagined_layout\n 1.upto(9).to_a.join\n end",
"def place_in_layout?; end",
"def place_in_layout?; end",
"def simple_chart\n \n end",
"def draw_plotly_chart(chart_div, data, title, height, width, type)\n %(\n var data = [{\n values: #{data.map(&:last)},\n labels: #{data.map{|x| fir(x)}},\n hole: #{type},\n type: 'pie'\n }];\n\n var layout = {\n title: '#{title}',\n titlefont: {\n size: 12,\n color: 'black'\n },\n height: #{height + data.size * 15}, // Each legend entry is 15 high.\n width: #{width},\n showlegend: true,\n\t legend: {\n \"orientation\": \"h\"\n }\n };\n\n Plotly.newPlot('plotly_chart_div_#{chart_div}', data, layout);\n )\nend",
"def complex_bar_graph(data)\n html = <<-\"HTML\"\n <style>\n /* Complex Bar Graph */\n div#complex_bar_graph dl { \n \tmargin: 0; \n \tpadding: 0; \n \tfont-family: \"Lucida Grande\", Verdana, Arial;\t\n }\n div#complex_bar_graph dt { \n \tposition: relative; /* IE is dumb */\n \tclear: both;\n \tdisplay: block; \n \tfloat: left; \n \twidth: 104px; \n \theight: 20px; \n \tline-height: 20px;\n \tmargin-right: 17px; \n \tfont-size: .75em; \n \ttext-align: right; \n }\n div#complex_bar_graph dd { \n \tposition: relative; /* IE is dumb */\n \tdisplay: block; \n \tfloat: left;\t \n \twidth: 197px; \n \theight: 20px; \n \tmargin: 0 0 15px; \n \tbackground: url(\"/images/css_graphs/g_colorbar.jpg\"); \n }\n * html div#complex_bar_graph dd { float: none; } /* IE is dumb; Quick IE hack, apply favorite filter methods for wider browser compatibility */\n\n div#complex_bar_graph dd div { \n \tposition: relative; \n \tbackground: url(\"/images/css_graphs/g_colorbar2.jpg\"); \n \theight: 20px; \n \twidth: 75%; \n \ttext-align:right; \n }\n div#complex_bar_graph dd div strong { \n \tposition: absolute; \n \tright: -5px; \n \ttop: -2px; \n \tdisplay: block; \n \tbackground: url(\"/images/css_graphs/g_marker.gif\"); \n \theight: 24px; \n \twidth: 9px; \n \ttext-align: left;\n \ttext-indent: -9999px; \n \toverflow: hidden;\n }\n </style>\n <div id=\"complex_bar_graph\"> \n <dl>\n HTML\n\n data.each do |d|\n html += <<-\"HTML\"\n <dt class=\"#{d[0].to_s.downcase}\">#{d[0].to_s.humanize}</dt>\n <dd class=\"#{d[0].to_s.downcase}\" title=\"#{d[1]}\">\n <div style=\"width: #{d[1]}%;\"><strong>#{d[1]}%</strong></div>\n </dd>\n HTML\n end\n\n html += \"</dl>\\n</div>\"\n return html \n end",
"def layout()\n layout_children()\n end",
"def to_html(input_args=Hash.new)\n #puts \"to_html arg #{input_args}\"\n\n reset_chart(input_args)\n \n open_tag('script',script_content)\n open_tag('div',\"\",class: get_chart_size(input_args[:size])[:column]) do\n if @id\n if @do_not_save_chart\n open_tag('small',\"user generated json has no chart expand function\") \n else \n open_tag('small') do\n #open_tag('span','',class: 'chart_btn') do\n # open_tag('a',\"Expand\",href: \"/chart_expand/#{chart_url}\")\n #end\n #if @args[:time] # if time chart, srg wants to button user can click to show status last month\n # open_tag('span','',class: 'chart_btn') do\n # open_tag('a',\"last month\",href: \"/chart_last_month/#{chart_url}\")\n # end\n #end\n if @args[:title] # jason 111516, intentionally write the chart's title here. this one is useful when there are a lot of chart and people can search chart by using browser's search function\n open_tag('span',\"#{@args[:title]}\");\n end\n open_tag('span','',id: 'tooltip_info') do # this field gets populated when user hovers on tool tip\n end\n end\n end\n end\n open_tag('div',\"\",class: get_chart_size(input_args[:size])[:css]) do\n open_tag('canvas',\"\",id: \"#{@chart_id}\" ) do # matches the javascript code which expect to populate LineChart\n end \n end \n end\n @out\n end",
"def horizontal_bar_graph(data, user_options = {}, number_formatter = method(:add_percent))\n options = {:show_names => false, \n :normalize => false, \n :width => \"240px;\",\n :bar_color => \"#B1D632\", \n :text_color => \"#333\", \n :background_color => nil}.merge(user_options)\n \n # figure out the max\n if options[:normalize]\n data_max = data.inject(0) { |max, array| array.last > max ? array.last : max }\n else\n data_max = 100\n end\n \n background_color = \"background-color: #{options[:background_color]};\" if options[:background_color]\n \n html = <<-\"HTML\"\n <style>\n /* Basic Bar Graph */\n .graph { \n position: relative; /* IE is dumb */\n width: #{options[:width]}; \n border: 1px solid #{options[:bar_color]}; \n padding: 2px; \n margin-bottom: .5em;\t\t\t\t\t\n #{background_color}\n color: #{options[:text_color]};\n }\n .graph .bar { \n display: block;\t\n position: relative;\n background: #{options[:bar_color]}; \n text-align: center; \n color: #{options[:text_color]}; \n height: 2em; \n line-height: 2em;\t\t\t\t\t\t\t\t\t\n }\n .graph .bar span { position: absolute; left: 1em; } /* This extra markup is necessary because IE does not want to follow the rules for overflow: visible */\t \n </style>\n HTML\n\n data.each do |d|\n name = \"#{d[0].to_s.humanize}<br/>\" if options[:show_names]\n html += <<-\"HTML\"\n <div class=\"graph\">\n #{name}<strong class=\"bar\" style=\"width: #{scale_graph_value(d[1], data_max, 100)}%;\" title=\"#{d[0].to_s.humanize}\"><span>#{number_formatter.call(d[1])}</span> </strong>\n </div>\n HTML\n end\n return html\n end",
"def _write_layout_method\n case @_layout\n when String\n self.class_eval %{def _layout() #{@_layout.inspect} end}\n when Symbol\n self.class_eval %{def _layout() #{@_layout} end}\n when false\n self.class_eval %{def _layout() end}\n else\n self.class_eval %{\n def _layout\n if view_paths.find_by_parts?(\"#{_implied_layout_name}\", {:formats => formats}, \"layouts\")\n \"#{_implied_layout_name}\"\n else\n super\n end\n end\n }\n end\n end",
"def getLayoutData\n @layoutData\n end",
"def no_layout?; end",
"def horizontal_bar_graph(*data)\n html = <<-\"HTML\"\n <style>\n /* Basic Bar Graph */\n .graph { \n position: relative; /* IE is dumb */\n width: 200px; \n #border: 1px solid #B1D632; \n padding: 2px; \n margin-bottom: .5em;\t\t\t\t\t\n }\n .graph .bar { \n display: block;\t\n position: relative;\n background: #E8112D;\n text-align: center; \n color: #333; \n height: 2em; \n line-height: 2em;\t\t\t\t\t\t\t\t\t\n }\n .graph .bar span { position: relative; left: 10em; } /* This extra markup is necessary because IE does not want to follow the rules for overflow: visible */\t \n </style>\n HTML\n \n data.each do |d|\n html += <<-\"HTML\"\n <div class=\"graph\">#{d[0]}\n<strong class=\"bar\" style=\"width: #{d[1]}%;\" title=\"#{d[0].to_s.humanize}\"><span>#{d[1]}%</span> </strong>\n </div>\n HTML\n end\n return html\n end",
"def do_layout\n _init_layout\n r = @top_margin\n c = @left_margin\n #\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fixed_ctr = 0 # how many items have a fixed wt\n var_ctr = 0\n var_wt = 0.0\n @components.each do |e|\n $log.debug \" looping 1 #{e.name} \"\n _tmpwt = cget(e, :weight) || 0\n # what of field and button placed side by side\n if e.is_a? Field or e.is_a? Button or e.is_a? Label\n # what to do here ?\n @wts[e] ||= 1\n ht += @wts[e] || 1\n fixed_ctr += 1\n elsif _tmpwt >= 1\n ht += _tmpwt || 0\n fixed_ctr += 1\n elsif _tmpwt > 0 and _tmpwt <= 1\n # FIXME how to specify 100 % ???\n var_ctr += 1\n var_wt += _tmpwt\n end\n end\n unaccounted = @components.count - (fixed_ctr + var_ctr)\n $log.debug \" unacc #{unaccounted} , fixed #{fixed_ctr} , var : #{var_ctr} , ht #{ht} height #{@height} \"\n balance_ht = @width - ht # use this for those who have specified a %\n balance_ht1 = balance_ht * (1 - var_wt )\n average_ht = (balance_ht1 / unaccounted).floor # give this to those who have not specified ht\n average_ht = (balance_ht1 / unaccounted) # give this to those who have not specified ht\n $log.debug \" #{balance_ht} , #{balance_ht1} , #{average_ht} \"\n # not accounted for gap in heights\n rem = 0 # remainder to be carried over\n @components.each do |e|\n $log.debug \" looping 2 #{e.name} #{e.class.to_s.downcase} \"\n next if @ignore_list.include? e.class.to_s.downcase\n $log.debug \" looping 3 #{e.name} \"\n e.row = r\n e.col = c\n wt = cget(e, :weight)\n if wt\n if wt.is_a? Integer\n e.width = wt\n elsif wt.is_a? Float\n e.width = (wt * balance_ht).floor\n end\n else\n # no wt specified, give average of balance wt\n e.width = average_ht\n hround = e.width.floor\n\n rem += e.width - hround\n e.width = hround\n # see comment in prev block regarding remaininder\n if rem >= 1\n e.width += 1\n rem = 0\n end\n end\n $log.debug \" layout #{e.name} , w: #{e.width} r: #{e.row} , c = #{e.col} \"\n\n e.height = @height\n c += e.width.floor\n c += @gap\n end\n $log.debug \" layout finished \"\n end",
"def complex_bar_graph(*data)\n html = <<-\"HTML\"\n <style>\n /* Complex Bar Graph */\n div#complex_bar_graph dl { \n \tmargin: 0; \n \tpadding: 0; \n \tfont-family: \"Lucida Grande\", Verdana, Arial;\t\n }\n div#complex_bar_graph dt { \n \tposition: relative; /* IE is dumb */\n \tclear: both;\n \tdisplay: block; \n \tfloat: left; \n \twidth: 104px; \n \theight: 20px; \n \tline-height: 20px;\n \tmargin-right: 17px; \n \tfont-size: .75em; \n \ttext-align: right; \n }\n div#complex_bar_graph dd { \n \tposition: relative; /* IE is dumb */\n \tdisplay: block; \n \tfloat: left;\t \n \twidth: 197px; \n \theight: 20px; \n \tmargin: 0 0 15px; \n \tbackground: url(\"/images/css_graphs/g_colorbar.jpg\"); \n }\n * html div#complex_bar_graph dd { float: none; } /* IE is dumb; Quick IE hack, apply favorite filter methods for wider browser compatibility */\n \n div#complex_bar_graph dd div { \n \tposition: relative; \n \tbackground: url(\"/images/css_graphs/g_colorbar2.jpg\"); \n \theight: 20px; \n \twidth: 75%; \n \ttext-align:right; \n }\n div#complex_bar_graph dd div strong { \n \tposition: absolute; \n \tright: -5px; \n \ttop: -2px; \n \tdisplay: block; \n \tbackground: url(\"/images/css_graphs/g_marker.gif\"); \n \theight: 24px; \n \twidth: 9px; \n \ttext-align: left;\n \ttext-indent: -9999px; \n \toverflow: hidden;\n }\n </style>\n <div id=\"complex_bar_graph\"> \n <dl>\n HTML\n\n data.each do |d|\n html += <<-\"HTML\"\n <dt class=\"#{d[0].to_s.downcase}\">#{d[0].to_s.humanize}</dt>\n <dd class=\"#{d[0].to_s.downcase}\" title=\"#{d[1]}\">\n <div style=\"width: #{d[1]}%;\"><strong>#{d[1]}%</strong></div>\n </dd>\n HTML\n end\n \n html += \"</dl>\\n</div>\"\n return html \n end",
"def get_layout_metrics\n {\n method: \"Page.getLayoutMetrics\"\n }\n end",
"def chart_layout_path\n \"ManageIQ_Providers_ContainerManager\"\n end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def init_chart_size\n @chart_size = {}\n @chart_size[\"huge\"] = { css: \"huge_chart\", column: \"col-lg-12\" }\n @chart_size[\"large\"] = { css: \"large_chart\", column: \"col-lg-6\" }\n @chart_size[\"medium\"] = { css: \"medium_chart\", column: \"col-lg-4\" }\n @chart_size[\"small\"] = { css: \"small_chart\", column: \"col-lg-3\" }\n @chart_size[\"tiny\"] = { css: \"tiny_chart\", column: \"col-lg-2\" }\n @chart_size[\"puny\"] = { css: \"puny\", column: \"col-lg-1\" }\n end",
"def determine_layout\n 'akinu'\n end",
"def show_charts_menu(separator = ' | ')\n res = \"\"\n RedmineCharts::Utils.controllers_for_routing do |name, controller_name| \n link_name = l(\"charts_link_#{name}\".to_sym)\n\n if controller.controller_name == controller_name\n res << separator << link_name\n else\n res << separator << link_to(link_name, :controller => controller_name, :project_id => @project)\n end\n end\n res\n end",
"def render_data(data)\n # calculate quartiles for plot, use this as data\n @data_quartiles = DATA.collect { |row|\n data = quartiles(row[1])\n OpenStruct.new(\n :name => row[0],\n :q0 => data[0],\n :q1 => data[1],\n :q2 => data[2],\n :q3 => data[3],\n :q4 => data[4],\n :index => 0\n ) \n }\n # NOTE: need index to lay out coloumns horizontally\n @data_quartiles.each_with_index { |d, i|\n d.index = i\n }\n # find limits of data so we know where axes are\n data_min = @data_quartiles.collect { |col| col.q0 }.min()\n data_max = @data_quartiles.collect { |col| col.q4 }.max()\n bounds = bounds([data_min, data_max])\n plot_range = bounds[1] - bounds[0]\n\n \n # make area for plotting\n # left, etc. set padding so actual size is ht/wt + padding\n vis = pv.Panel.new()\n .width(@canvas_wt)\n .height(@canvas_ht)\n .margin(@margin)\n .left(30)\n .bottom(20)\n .top(10)\n .right(10)\n \n # adhoc guess at bar width\n bar_width = @plot_wt / @data_quartiles.size() * 0.8\n \n # scaling to position datapoints in plot\n vert = pv.Scale.linear(bounds[0], bounds[1]).range(0, @plot_ht)\n horiz = pv.Scale.linear(0, @data_quartiles.size()).range(0, @plot_wt)\n\n # where to draw labels on graph\n label_ticks = vert.ticks.each_slice(4).map(&:first)\n\n # make horizontal lines:\n # - what values are drawn\n # - where the bottom of it appears\n # - what color to make the line\n # - the width of the line\n # - antialias it?\n # - add a label\n # - where does label appear relative to line\n # - how is the text aligned in own space\n # - align text vertically (\"top\" looks like \"middle\")\n # - what appears in the label\n vis.add(pv.Rule)\n .data(vert.ticks()) \n .bottom(lambda {|d| vert.scale(d)}) \n .strokeStyle(lambda { |d| label_ticks.member?(d) ? \"black\" : \"lightblue\" })\n .line_width(lambda { |d| label_ticks.member?(d) ? 0.5 : 0.1 })\n .antialias(true)\n .add(pv.Label) \n .left(0) \n .textAlign(\"right\")\n .textBaseline(\"top\")\n .text(lambda {|d| label_ticks.member?(d) ? sprintf(\"%0.2f\", d) : '' }) \n \n # y (vertical) axis\n vis.add(pv.Rule)\n .data([0])\n .left(horiz.scale(0))\n .bottom(@margin)\n .strokeStyle(\"black\")\n \n # make the main body of boxplot\n vis.add(pv.Rule)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5) })\n .bottom(lambda {|d| vert.scale(d.q1)})\n .lineWidth(bar_width)\n .height(lambda {|d| vert.scale(d.q3) - vert.scale(d.q1)})\n .strokeStyle(@bar_clr)\n\n # add bottom labels\n vis.add(pv.Label)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5) })\n .bottom(0)\n .text_baseline(\"top\")\n .text_margin(15)\n .textAlign(\"center\")\n .text(lambda {|d| d.name })\n\n # make the whisker \n vis.add(pv.Rule)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5)})\n .bottom(lambda {|d| vert.scale(d.q0)})\n .lineWidth(1)\n .height(lambda {|d| vert.scale(d.q4) - vert.scale(d.q0)})\n .strokeStyle(@bar_clr)\n\n # make the median line \n vis.add(pv.Rule)\n .data(@data_quartiles)\n .left(lambda {|d| horiz.scale(d.index + 0.5)})\n .bottom(lambda {|d| vert.scale(d.q2)})\n .height(1)\n .lineWidth(bar_width)\n .strokeStyle(\"white\")\n \n vis.render()\n return vis.to_svg()\n end",
"def layout(model)\n #Rfm.layout(model.storage_name, options.symbolize_keys) #query.repository.adapter.options.symbolize_keys)\n model.layout\n end",
"def draw_legend\n return if @hide_legend\n\n @legend_labels = @left_data.collect {|item| item[DATA_LABEL_INDEX] }\n @right_legend_labels = @right_data.collect {|item| item[DATA_LABEL_INDEX]}\n\n legend_square_width = @legend_box_size # small square with color of this item\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n label_widths = [[]] # Used to calculate line wrap\n @legend_labels.each do |label|\n metrics = @d.get_type_metrics(@base_image, label.to_s)\n label_width = metrics.width + legend_square_width * 2.7\n label_widths.last.push label_width\n\n if sum(label_widths.last) > (@raw_columns - LEFT_MARGIN)\n label_widths.push [label_widths.last.pop]\n end\n end\n\n right_label_widths = [[]] # Used to calculate line wrap\n @right_legend_labels.each do |label|\n right_metrics = @d.get_type_metrics(@base_image, label.to_s)\n right_label_width = right_metrics.width + legend_square_width * 2.7\n right_label_widths.last.push right_label_width\n\n if sum(right_label_widths.last) > (@raw_columns - LEFT_MARGIN)\n right_label_widths.push [right_label_widths.last.pop]\n end\n end\n\n current_x_offset = LEFT_MARGIN #center(sum(label_widths.first))\n current_y_offset = @hide_title ?\n @top_margin + TITLE_MARGIN :\n @top_margin + TITLE_MARGIN + @title_caps_height\n\n @legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n @d = @d.stroke('transparent')\n @d = @d.fill @left_data[index][DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset,\n current_y_offset - legend_square_width / 2.0,\n current_x_offset + legend_square_width,\n current_y_offset + legend_square_width / 2.0)\n\n @d.pointsize = @legend_font_size\n metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n label_widths.first.shift\n if label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n label_widths.shift\n current_x_offset = LEFT_MARGIN #unless label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if label_widths.length > 0 || index == @left_data.length - 1\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n\n @right_legend_labels.each_with_index do |legend_label, index|\n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke('transparent')\n @d.font_weight = NormalWeight\n @d.gravity = WestGravity\n @d = @d.annotate_scaled( @base_image,\n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset,\n legend_label.to_s, @scale)\n\n # Now draw box with color of this dataset\n# @d = @d.stroke('transparent')\n @d = @d.fill @right_data[index][DATA_COLOR_INDEX]\n\n @d.line(current_x_offset, current_y_offset, current_x_offset+legend_square_width, current_y_offset)\n circle_radius = 1.5\n org_x = current_x_offset + (legend_square_width/2.0)\n @d.circle(org_x, current_y_offset, org_x - circle_radius, current_y_offset)\n\n @d.pointsize = @legend_font_size\n right_metrics = @d.get_type_metrics(@base_image, legend_label.to_s)\n current_string_offset = right_metrics.width + (legend_square_width * 2.7)\n\n # Handle wrapping\n right_label_widths.first.shift\n if right_label_widths.first.empty?\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n right_label_widths.shift\n current_x_offset = LEFT_MARGIN #unless right_label_widths.empty?\n line_height = [@legend_caps_height, legend_square_width].max + LEGEND_MARGIN\n if right_label_widths.length > 0\n # Wrap to next line and shrink available graph dimensions\n current_y_offset += line_height\n @graph_top += line_height\n @graph_height = @graph_bottom - @graph_top\n end\n else\n current_x_offset += current_string_offset\n end\n end\n @color_index = 0\n end",
"def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end",
"def line_on_column(xmlparams)\n\n xml = xmlparams[:xml]\n min = xmlparams[:min] ? xmlparams[:min] : 400\n max = xmlparams[:max] ? xmlparams[:max] : 1000\n explode = xmlparams[:explode] ? xmlparams[:explode] : false\n\n explode_str=''\n if explode\n explode_str=%Q(\n <series_explode>\n <number>200</number>\n </series_explode>\n )\n end\n \n\n # data string for the chart\n data=%Q(\n <chart>\n \n <axis_value min='#{min}' max='#{max}' font='arial' bold='true' size='10' \n color='000000' alpha='50' steps='4' prefix='' suffix='' decimals='0' separator='' show_min='true' />\n \n <chart_border color='000000' top_thickness='1' bottom_thickness='2' left_thickness='0' right_thickness='0' />\n \n #{xml}\n \n <chart_grid_h alpha='20' color='000000' thickness='1' type='dashed' />\n <chart_rect x='55' y='70' width='300' height='200' positive_color='ffffff' negative_color='000000' \n positive_alpha='10' negative_alpha='30' />\n <!--chart_transition type='scale' delay='.5' duration='0.5' order='series' /-->\n <chart_value color='ffffff' alpha='85' font='arial' bold='true' size='10' \n position='middle' prefix='' suffix='' decimals='0' separator='' as_percentage='false' />\n \n <legend_label layout='horizontal' font='arial' bold='true' size='12' color='333355' alpha='90' />\n <legend_rect x='55' y='5' width='300' height='15' margin='5' fill_color='000066' fill_alpha='8' \n line_color='000000' line_alpha='0' line_thickness='0' />\n \n <chart_type>\n <string>column</string>\n <string>line</string>\n <string>line</string>\n <string>line</string>\n </chart_type>\n \n <series_color>\n <color>050222</color>\n <color>41A317</color>\n <color>FFF380</color>\n <color>F660AB</color>\n </series_color>\n <series_gap set_gap='40' bar_gap='-5' />\n \n #{explode_str}\n \n </chart>\n ) #'\n \n data\n end",
"def _layout_for_option(name); end",
"def layout_fields\n \n end",
"def show\n \n @end_at = Date.today\n @start_at = @end_at - 6\n @categories = @start_at.upto(@end_at).to_a\n\n \t#Sales Historyグラフ\n @sales_data = [500, 600, 300, 100, 200, 400, 700,500, 600, 300, 100, 200, 400, 700,100, 200, 400, 700,500, 600, 600, 300, 100, 200,]\n @sales_history = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"Sales History\", :align =>\"left\")\n f.chart(:type => \"column\")\n f.xAxis(:categories => @categories)\n f.series(:name => \"Sales\", :data => @sales_data)\n\t end\n\n#Order Historyのグラフ\n @order_data = [80, 60, 30, 10, 40, 50, 90,60, 30, 10, 40, 50, 90,50, 90,60, 30, 10, 40, 50,]\n @order_history = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: 'Order History',:align =>\"left\")\n f.xAxis(:categories => @categories)\n f.series(name: 'Order', :data => @order_data)\n end\n\n#Price Historyのグラフ\n @price_data = [80, 60, 30, 10, 40, 50, 90,60, 30, 10, 40, 50, 90,50, 90,60, 30, 10, 40, 50,]\n @price_history = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: 'Order History',:align =>\"left\")\n f.xAxis(:categories => @categories)\n f.series(name: 'Order', :data => @price_data)\n end\n \n \n end",
"def chart_title(chart_type, ind)\n \"#{ind + 1} - #{chart_type}\"\nend",
"def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end",
"def title_from_layout(layout)\n # no layout, leave title alone\n return nil if layout.blank?\n\n case layout\n when \"automation_manager\"\n _(\"Automation Managers\")\n when \"catalogs\"\n _(\"Catalogs\")\n when \"configuration\"\n _(\"My Settings\")\n when \"configuration_job\"\n _(\"Configuration Jobs\")\n when \"container_dashboard\"\n _(\"Container Dashboard\")\n when \"dashboard\"\n _(\"Dashboard\")\n when \"chargeback\"\n _(\"Chargeback\")\n when \"about\"\n _(\"About\")\n when \"ems_cluster\"\n _(\"Clusters\")\n when \"generic_object_definition\"\n _(\"Generic Object Definitions\")\n when \"host\"\n _(\"Hosts\")\n when \"miq_server\"\n _(\"Servers\")\n when \"services\"\n _(\"Services\")\n when \"usage\"\n _(\"VM Usage\")\n when \"scan_profile\"\n _(\"Analysis Profiles\")\n when \"miq_policy_rsop\"\n _(\"Policy Simulation\")\n when \"report\"\n _(\"Reports\")\n when \"ops\"\n _(\"Configuration\")\n when \"pxe\"\n _(\"PXE\")\n when \"switch\"\n _(\"Switches\")\n when \"explorer\"\n \"#{controller_model_name(params[:controller])} Explorer\"\n when \"timeline\"\n _(\"Timelines\")\n when \"vm_cloud\"\n _(\"Instances\")\n when \"vm_infra\"\n _(\"Virtual Machines\")\n when \"vm_or_template\"\n _(\"Workloads\")\n when \"all_tasks\"\n _(\"All Tasks\")\n when \"my_tasks\"\n _(\"My Tasks\")\n\n # Specific titles for groups of layouts\n when /^miq_ae_/\n _(\"Automation\")\n when /^miq_capacity_utilization/\n _(\"Utilization\")\n when /^miq_request/\n _(\"Requests\")\n when \"manageiq/providers/ansible_tower/automation_manager/playbook\"\n _(\"Playbooks (Ansible Tower)\")\n when \"manageiq/providers/embedded_ansible/automation_manager/playbook\"\n _(\"Playbooks\")\n when \"manageiq/providers/embedded_ansible/automation_manager/credential\", \"manageiq/providers/workflows/automation_manager/credential\"\n _(\"Credentials\")\n when \"manageiq/providers/embedded_ansible/automation_manager/configuration_script_source\"\n _(\"Repositories\")\n when \"manageiq/providers/workflows/automation_manager/configuration_script_source\"\n _(\"Repositories\")\n when \"manageiq/providers/workflows/automation_manager/workflow\"\n _(\"Workflows\")\n\n else\n fallback_title(layout)\n end\n end",
"def do_layout\n $log.debug \" inside do_layout\"\n _init_layout\n raise \"please implement this in your subclass \"\n c = @left_margin\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fixed_ctr = 0 # how many items have a fixed wt\n var_ctr = 0\n var_wt = 0.0\n @components.each do |e|\n $log.debug \" looping 1 #{e.name} \"\n _tmpwt = @wts[e] || 0\n # what of field and button placed side by side\n if e.is_a? Field or e.is_a? Button or e.is_a? Label\n @wts[e] ||= 1\n ht += @wts[e] || 1\n fixed_ctr += 1\n elsif _tmpwt >= 1\n ht += @wts[e] || 0\n fixed_ctr += 1\n elsif _tmpwt > 0 and _tmpwt <= 1\n # FIXME how to specify 100 % ???\n var_ctr += 1\n var_wt += @wts[e]\n end\n end\n unaccounted = @components.count - (fixed_ctr + var_ctr)\n $log.debug \" unacc #{unaccounted} , fixed #{fixed_ctr} , var : #{var_ctr} , ht #{ht} height #{@height} \"\n balance_ht = @height - ht # use this for those who have specified a %\n balance_ht1 = balance_ht * (1 - var_wt )\n average_ht = (balance_ht1 / unaccounted).floor # give this to those who have not specified ht\n average_ht = (balance_ht1 / unaccounted) # give this to those who have not specified ht\n $log.debug \" #{balance_ht} , #{balance_ht1} , #{average_ht} \"\n # not accounted for gap in heights\n rem = 0 # remainder to be carried over\n @components.each do |e|\n $log.debug \" looping 2 #{e.name} #{e.class.to_s.downcase} \"\n next if @ignore_list.include? e.class.to_s.downcase\n $log.debug \" looping 3 #{e.name} \"\n e.row = r\n e.col = c\n wt = @wts[e]\n if wt\n if wt.is_a? Integer\n e.height = wt\n elsif wt.is_a? Float\n e.height = (wt * balance_ht).floor\n end\n else\n # no wt specified, give average of balance wt\n e.height = average_ht\n hround = e.height.floor\n\n rem += e.height - hround\n e.height = hround\n # see comment in prev block regarding remaininder\n if rem >= 1\n e.height += 1\n rem = 0\n end\n end\n $log.debug \" layout #{e.name} , h: #{e.height} r: #{e.row} , c = #{e.col} \"\n\n e.width = @width\n r += e.height.floor\n r += @gap\n end\n $log.debug \" layout finished \"\n end",
"def getchart()\n # The data for the chart\n data0 = [42, 49, ChartDirector::NoValue, 38, 64, 56, 29, 41, 44, 57]\n data1 = [65, 75, 47, 34, 42, 49, 73, ChartDirector::NoValue, 90, 69, 66, 78]\n data2 = [ChartDirector::NoValue, ChartDirector::NoValue, 25, 28, 38, 20, 22,\n ChartDirector::NoValue, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 360 pixels. Set background color to\n # brushed silver, with a 2 pixel 3D border. Use rounded corners.\n c = ChartDirector::XYChart.new(600, 360, ChartDirector::brushedSilverColor(),\n ChartDirector::Transparent, 2)\n c.setRoundedFrame()\n\n # Add a title using 18 pts Times New Roman Bold Italic font. #Set top/bottom\n # margins to 6 pixels.\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n title.setMargin2(0, 0, 6, 6)\n\n # Add a separator line just under the title\n c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(),\n ChartDirector::LineColor)\n\n # Add a legend box where the top-center is anchored to the horizontal center of\n # the chart, just under the title. Use horizontal layout and 10 points Arial Bold\n # font, and transparent background and border.\n legendBox = c.addLegend(c.getWidth() / 2, title.getHeight(), false, \"arialbd.ttf\",\n 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Tentatively set the plotarea at (70, 75) and of 460 x 240 pixels in size. Use\n # transparent border and black (000000) grid lines\n c.setPlotArea(70, 75, 460, 240, -1, -1, ChartDirector::Transparent, 0x000000, -1)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Show the same scale on the left and right y-axes\n c.syncYAxis()\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Set all axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n c.yAxis2().setColors(ChartDirector::Transparent)\n\n # Set the x-axis margins to 15 pixels, so that the horizontal grid lines can\n # extend beyond the leftmost and rightmost vertical grid lines\n c.xAxis().setMargin(15, 15)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis2().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n c.yAxis2().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n\n # Add the first line. The missing data will be represented as gaps in the line\n # (the default behaviour)\n layer0 = c.addLineLayer2()\n layer0.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer0.setLineWidth(3)\n\n # Add the second line. The missing data will be represented by using dash lines to\n # bridge the gap\n layer1 = c.addLineLayer2()\n layer1.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer1.setLineWidth(3)\n layer1.setGapColor(c.dashLineColor(0x00ff00))\n\n # Add the third line. The missing data will be ignored - just join the gap with\n # the original line style.\n layer2 = c.addLineLayer2()\n layer2.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer2.setLineWidth(3)\n layer2.setGapColor(ChartDirector::SameAsMainColor)\n\n # layout the legend so we can get the height of the legend box\n c.layoutLegend()\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 15\n # pixels from the left edge, just under the legend box, 16 pixels from the right\n # edge, and 25 pixels from the bottom edge.\n c.packPlotArea(15, legendBox.getTopY() + legendBox.getHeight(), c.getWidth() - 16,\n c.getHeight() - 25)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::JPG), :type => \"image/jpeg\",\n :disposition => \"inline\")\n end",
"def div\n @adapter.generate_body(@chart)\n end",
"def horizontal_bar_graph(_data)\n raise NotImplementedError\n end",
"def draw_graph\n # Setup spacing.\n #\n # Columns sit stacked.\n bar_width = @graph_width / column_count.to_f\n padding = (bar_width * (1 - @bar_spacing)) / 2\n\n height = Array.new(column_count, 0)\n stack_bar_value_label = Gruff::BarValueLabel::StackedBar.new\n\n store.norm_data.each_with_index do |data_row, row_index|\n data_row.points.each_with_index do |data_point, point_index|\n next if data_point == 0\n\n # Use incremented x and scaled y\n left_x = @graph_left + (bar_width * point_index) + padding\n left_y = @graph_top + (@graph_height -\n data_point * @graph_height -\n height[point_index]) + @segment_spacing\n right_x = left_x + bar_width * @bar_spacing\n right_y = @graph_top + @graph_height - height[point_index]\n\n # update the total height of the current stacked bar\n height[point_index] += (data_point * @graph_height)\n\n rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: data_row.color)\n rect_renderer.render(left_x, left_y, right_x, right_y)\n\n # Calculate center based on bar_width and current row\n label_center = left_x + bar_width * @bar_spacing / 2.0\n draw_label(label_center, point_index)\n\n bar_value_label = Gruff::BarValueLabel::Bar.new([left_x, left_y, right_x, right_y], store.data[row_index].points[point_index])\n stack_bar_value_label.add(bar_value_label, point_index)\n end\n end\n\n if @show_labels_for_bar_values\n stack_bar_value_label.prepare_rendering(@label_formatting, bar_width) do |x, y, text|\n draw_value_label(x, y, text)\n end\n end\n end",
"def makeChart(*options)\n\ndisplay = \"\n<div class='charts last'>\n\n<div class='left'>\n\n\n<div id='placeholder' style='width:400px;height:200px;'></div>\n<div id='overview' style='width:400px;height:50px'></div>\n<p id='overviewLegend' style='margin-left:10px'></p>\n\n<p> Try zooming. Click and drag to select a zone.</p>\n</div>\n\n<div class='right'>\n\nWeight Chart<br/>\n<div id='miniWeight' style='width:350px;height:100px;'></div>\nWater Chart<br/>\n<div id='miniWater' style='width:350px;height:100px;'></div>\n\n\nCalories Eaten<br/>\n<div id='miniCalorie' style='width:350px;height:100px;'></div>\nFitness (Calories burned not to include resting metabolism)<br/>\n<div id='miniFitness' style='width:350px;height:100px;'></div><br/>\n\nMeasurements (Total inches)<br/>\n<div id='miniMeasures' style='width:350px;height:100px;'></div>\n\n\n</div>\n\n\n\n\n<div class='last'></div>\n<script id='source' language='javascript' type='text/javascript'>\n\n\n$(function () {\nvar options = {\n xaxis: { mode: 'time' },\n selection: { mode: 'x' },\n legend: { \n show: true, \n container: $('#overviewLegend'),\n noColumns: 2,\n }\n};\n\nvar options_overview = {\n xaxis: { mode: 'time' },\n selection: { mode: 'x' },\n legend: { show: false}\n};\n\n\nvar plot = $.plot($('#placeholder'), \n[ #{@chartable.to_chart } ], options);\n\n\n\n\nvar overview = $.plot($('#overview'), \n[ #{@chartable.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\n\n\n\n\nvar overview_1 = $.plot($('#miniWeight'), \n[ #{@miniWeight.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_2 = $.plot($('#miniWater'), \n[ #{@miniWater.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_3 = $.plot($('#miniCalorie'), \n[ #{@miniCalorie.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_4 = $.plot($('#miniFitness'), \n[ #{@miniFitness.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\nvar overview_5 = $.plot($('#miniMeasures'), \n[ #{@miniMeasures.to_chart}], \n{ lines: { show: true, lineWidth: 3 },\n shadowSize: 0,\n legend: {\n show: false },\n xaxis: { ticks: 3, mode: 'time' },\n selection: { mode: 'x' }\n});\n\n\n// now connect the two\nvar internalSelection = false;\n\n$('#placeholder').bind('selected', function (event, area) {\n // do the zooming\n plot = $.plot($('#placeholder'), \n [#{@chartable.to_chart}],\n $.extend(true, {}, options, {\n xaxis: { min: area.x1, max: area.x2 }\n }));\n \n if (internalSelection)\n return; // prevent eternal loop\n internalSelection = true;\n overview.setSelection(area);\n internalSelection = false;\n});\n\n$('#overview').bind('selected', function (event, area) {\n if (internalSelection)\n return;\n internalSelection = true;\n plot.setSelection(area);\n internalSelection = false;\n});\n\n\n});\n</script>\n\"\n\nend",
"def modified_sample_layout\n lyt = []\n make_modified_start_array(@group_size).each do |j|\n cols = Array.new(@columns) { |c| c }\n cols.each { |c| @group_size.times { |i| lyt << [i + j, c] } }\n end\n lyt\n end",
"def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end",
"def getchart()\n # Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile,\n # medium, 3rd quartile and maximum values of some quantities\n q0Data = [40, 45, 35]\n q1Data = [55, 60, 50]\n q2Data = [62, 70, 60]\n q3Data = [70, 80, 65]\n q4Data = [80, 90, 75]\n\n # The labels for the chart\n labels = [\"<*img=robot1.png*><*br*>Bipedal Type\",\n \"<*img=robot2.png*><*br*>Wolf Type\", \"<*img=robot5.png*><*br*>Bird Type\"]\n\n # Create a XYChart object of size 540 x 320 pixels\n c = ChartDirector::XYChart.new(540, 320)\n\n # swap the x and y axes to create a horizontal box-whisker chart\n c.swapXY()\n\n # Set directory for loading images to current script directory\n c.setSearchPath(File.dirname(__FILE__))\n\n # Set the plotarea at (75, 25) and of size 440 x 270 pixels. Enable both\n # horizontal and vertical grids by setting their colors to grey (0xc0c0c0)\n c.setPlotArea(75, 25, 440, 270).setGridColor(0xc0c0c0, 0xc0c0c0)\n\n # Add a title to the chart\n c.addTitle(\" Robot Shooting Accuracy Scores\")\n\n # Set the labels on the x axis and the font to Arial Bold\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Disable x axis ticks by setting the length to 0\n c.xAxis().setTickLength(0)\n\n # Set the font for the y axis labels to Arial Bold\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a Box Whisker layer using light blue 0x9999ff as the fill color and blue\n # (0xcc) as the line color. Set the line width to 2 pixels\n c.addBoxWhiskerLayer2(q3Data, q1Data, q4Data, q0Data, q2Data).setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def getchart()\n # Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile,\n # medium, 3rd quartile and maximum values of some quantities\n q0Data = [40, 45, 40, 30, 20, 50, 25, 44]\n q1Data = [55, 60, 50, 40, 38, 60, 51, 60]\n q2Data = [62, 70, 60, 50, 48, 70, 62, 70]\n q3Data = [70, 80, 65, 60, 53, 78, 69, 76]\n q4Data = [80, 90, 75, 70, 60, 85, 80, 84]\n\n # The labels for the chart\n labels = [\"Group A\", \"Group B\", \"Group C\", \"Group D\", \"Group E\", \"Group F\",\n \"Group G\", \"Group H\"]\n\n # Create a XYChart object of size 550 x 250 pixels\n c = ChartDirector::XYChart.new(550, 250)\n\n # Set the plotarea at (50, 25) and of size 450 x 200 pixels. Enable both\n # horizontal and vertical grids by setting their colors to grey (0xc0c0c0)\n c.setPlotArea(50, 25, 450, 200).setGridColor(0xc0c0c0, 0xc0c0c0)\n\n # Add a title to the chart\n c.addTitle(\"Computer Vision Test Scores\")\n\n # Set the labels on the x axis and the font to Arial Bold\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Set the font for the y axis labels to Arial Bold\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a Box Whisker layer using light blue 0x9999ff as the fill color and blue\n # (0xcc) as the line color. Set the line width to 2 pixels\n c.addBoxWhiskerLayer(q3Data, q1Data, q4Data, q0Data, q2Data, 0x9999ff, 0x0000cc\n ).setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def find_layout(layout, keys, formats); end",
"def layout_config\n @squeezed_layout_config\n end",
"def draw_vertical_legend\n \n @legend_labels = @data.collect {|item| item[Gruff::Base::DATA_LABEL_INDEX] }\n \n legend_square_width = 40.0 # small square with color of this item\n legend_square_margin = 10.0\n @legend_left_margin = 40.0\n legend_top_margin = 40.0\n\n # May fix legend drawing problem at small sizes\n @d.font = @font if @font\n @d.pointsize = @legend_font_size\n\n current_x_offset = @graph_left + @legend_left_margin\n current_y_offset = @original_rows + legend_top_margin\n\n debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset }\n\n @legend_labels.each_with_index do |legend_label, index| \n\n # Draw label\n @d.fill = @font_color\n @d.font = @font if @font\n @d.pointsize = scale_fontsize(@legend_font_size)\n @d.stroke = 'transparent'\n @d.font_weight = Magick::NormalWeight\n @d.gravity = Magick::WestGravity\n @d = @d.annotate_scaled( @base_image, \n @raw_columns, 1.0,\n current_x_offset + (legend_square_width * 1.7), current_y_offset, \n truncate_legend_label(legend_label), @scale)\n\n # Now draw box with color of this dataset\n @d = @d.stroke 'transparent'\n @d = @d.fill @data[index][Gruff::Base::DATA_COLOR_INDEX]\n @d = @d.rectangle(current_x_offset, \n current_y_offset - legend_square_width / 2.0, \n current_x_offset + legend_square_width, \n current_y_offset + legend_square_width / 2.0)\n \n current_y_offset += calculate_caps_height(@legend_font_size) * 1.7\n end\n @color_index = 0\n end",
"def prepare_charts #:nodoc:\n count = 0\n charts = []\n\n # We sort the charts by row and column but that isn't strictly required.\n #\n rows = @charts.keys.sort\n rows.each do |row|\n cols = @charts[row].keys.sort\n cols.each do |col|\n charts.push(@charts[row][col])\n count += 1\n end\n end\n\n @charts = {}\n @charts_array = charts\n count\n end",
"def getchart()\n # 4 data points to represent the cash flow for the Q1 - Q4\n data = [230, -140, 220, 330]\n\n # We want to plot a waterfall chart showing the 4 quarters as well as the total\n labels = [\"1st Quarter\", \"2nd Quarter\", \"3rd Quarter\", \"4th Quarter\", \"Total\"]\n\n # The top side of the bars in a waterfall chart is the accumulated data. We use\n # the ChartDirector ArrayMath utility to accumulate the data. The \"total\" is\n # handled by inserting a zero point at the end before accumulation (after\n # accumulation it will become the total).\n boxTop = ChartDirector::ArrayMath.new(data).insert2(0, 1, data.length).acc(\n ).result()\n\n # The botom side of the bars is just the top side of the previous bar. So we\n # shifted the top side data to obtain the bottom side data.\n boxBottom = ChartDirector::ArrayMath.new(boxTop).shift(1, 0).result()\n\n # The last point (total) is different. Its bottom side is always 0.\n boxBottom[boxBottom.length - 1] = 0\n\n # In this example, we want to use different colors depending on the data is\n # positive or negative.\n posColor = 0x00ff00\n negColor = 0xff0000\n\n # Create a XYChart object of size 500 x 280 pixels. Set background color to light\n # blue (ccccff), with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(500, 300, 0xccccff, 0x000000, 1)\n\n # Add a title to the chart using 13 points Arial Bold Itatic font, with white\n # (ffffff) text on a deep blue (0x80) background\n c.addTitle(\"Corporate Cash Flow - Year 2004\", \"arialbi.ttf\", 13, 0xffffff\n ).setBackground(0x000080)\n\n # Set the plotarea at (55, 50) and of size 430 x 215 pixels. Use alternative\n # white/grey background.\n c.setPlotArea(55, 50, 430, 215, 0xffffff, 0xeeeeee)\n\n # Add a legend box at (55, 25) using 8 pts Arial Bold font with horizontal layout,\n # with transparent background and border color.\n b = c.addLegend(55, 25, false, \"arialbd.ttf\", 8)\n b.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Add keys to show the colors for positive and negative cash flows\n b.addKey(\"Positive Cash Flow\", posColor)\n b.addKey(\"Negative Cash Flow\", negColor)\n\n # Set the labels on the x axis using Arial Bold font\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Set the x-axis ticks and grid lines to be between the bars\n c.xAxis().setTickOffset(0.5)\n\n # Use Arial Bold as the y axis label font\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"USD (in millions)\")\n\n # Add a box-whisker layer to represent the waterfall bars\n layer = c.addBoxWhiskerLayer(boxTop, boxBottom)\n\n # Color the bars depending on whether it is positive or negative\n 0.upto(boxTop.length - 1) do |i|\n if boxTop[i] >= boxBottom[i]\n layer.setBoxColor(i, posColor)\n else\n layer.setBoxColor(i, negColor)\n end\n end\n\n # Put data labels on the bars to show the cash flow using Arial Bold font\n layer.setDataLabelFormat(\"{={top}-{bottom}}M\")\n layer.setDataLabelStyle(\"arialbd.ttf\").setAlignment(ChartDirector::Center)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def layout; end",
"def render_all_layouts(layouts, payload, info); end",
"def sub_charts\n @sub_charts\n end",
"def display_charts(is_reload)\n @entries.each_with_index do |entry, i|\n break if i == Cfg.max_items\n iter = is_reload ? @lsc.get_iter(i.to_s) : @lsc.append\n iter[COL_RANK] = entry.rank #.to_s\n if @count_type == COUNT_PLAYED\n iter[COL_PLAYED] = entry.played.to_s\n else\n if view_tracks_or_records?\n iter[COL_PLAYED] = entry.played.to_hr_length\n else\n iter[COL_PLAYED] = entry.played.to_day_length\n end\n end\n iter[COL_REF] = entry.ref\n iter[COL_PIX] = entry.pix\n iter[COL_TEXT] = entry.title\n end\n end",
"def getchart()\n # The data for the chart\n data0 = [32, 39, 23, 28, 41, 38, 26, 35, 29]\n data1 = [50, 55, 47, 34, 47, 53, 38, 40, 51]\n\n # The labels for the chart\n labels = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\"]\n\n # Create a XYChart object of size 600 x 300 pixels, with a pale red (ffdddd)\n # background, black border, 1 pixel 3D border effect and rounded corners.\n c = ChartDirector::XYChart.new(600, 300, 0xffdddd, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set directory for loading images to current script directory\n c.setSearchPath(File.dirname(__FILE__))\n\n # Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white (ffffff)\n # background. Set horizontal and vertical grid lines to grey (cccccc).\n c.setPlotArea(55, 58, 520, 195, 0xffffff, -1, -1, 0xcccccc, 0xcccccc)\n\n # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9\n # pts Arial Bold font. Set the background and border color to Transparent.\n c.addLegend(55, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a title box to the chart using 15 pts Times Bold Italic font. The title is\n # in CDML and includes embedded images for highlight. The text is white (ffffff)\n # on a dark red (880000) background, with soft lighting effect from the right\n # side.\n c.addTitle(\n \"<*block,valign=absmiddle*><*img=star.png*><*img=star.png*> Performance \" \\\n \"Enhancer <*img=star.png*><*img=star.png*><*/*>\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x880000, -1, ChartDirector::softLighting(ChartDirector::Right\n ))\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"Energy Concentration (KJ per liter)\")\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a title to the x axis using CMDL\n c.xAxis().setTitle(\n \"<*block,valign=absmiddle*><*img=clock.png*> Elapsed Time (hour)<*/*>\")\n\n # Set the axes width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Add a spline layer to the chart\n layer = c.addSplineLayer()\n\n # Set the default line width to 2 pixels\n layer.setLineWidth(2)\n\n # Add a data set to the spline layer, using blue (0000c0) as the line color, with\n # yellow (ffff00) circle symbols.\n layer.addDataSet(data1, 0x0000c0, \"Target Group\").setDataSymbol(\n ChartDirector::CircleSymbol, 9, 0xffff00)\n\n # Add a data set to the spline layer, using brown (982810) as the line color, with\n # pink (f040f0) diamond symbols.\n layer.addDataSet(data0, 0x982810, \"Control Group\").setDataSymbol(\n ChartDirector::DiamondSymbol, 11, 0xf040f0)\n\n # Add a custom CDML text at the bottom right of the plot area as the logo\n c.addText(575, 250,\n \"<*block,valign=absmiddle*><*img=small_molecule.png*> <*block*>\" \\\n \"<*font=timesbi.ttf,size=10,color=804040*>Molecular\\nEngineering<*/*>\"\n ).setAlignment(ChartDirector::BottomRight)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def getchart()\n # The data for the area chart\n data = [3.0, 2.8, 4.0, 5.5, 7.5, 6.8, 5.4, 6.0, 5.0, 6.2, 7.5, 6.5, 7.5, 8.1, 6.0,\n 5.5, 5.3, 3.5, 5.0, 6.6, 5.6, 4.8, 5.2, 6.5, 6.2]\n\n # The labels for the area chart\n labels = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\",\n \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\", \"24\"]\n\n # Create a XYChart object of size 300 x 180 pixels. Set the background to pale\n # yellow (0xffffa0) with a black border (0x0)\n c = ChartDirector::XYChart.new(300, 180, 0xffffa0, 0x000000)\n\n # Set the plotarea at (45, 35) and of size 240 x 120 pixels. Set the background to\n # white (0xffffff). Set both horizontal and vertical grid lines to black (&H0&)\n # dotted lines (pattern code 0x0103)\n c.setPlotArea(45, 35, 240, 120, 0xffffff, -1, -1, c.dashLineColor(0x000000,\n 0x000103), c.dashLineColor(0x000000, 0x000103))\n\n # Add a title to the chart using 10 pts Arial Bold font. Use a 1 x 2 bitmap\n # pattern as the background. Set the border to black (0x0).\n c.addTitle(\"Snow Percipitation (Dec 12)\", \"arialbd.ttf\", 10).setBackground(\n c.patternColor([0xb0b0f0, 0xe0e0ff], 2), 0x000000)\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"mm per hour\")\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Display 1 out of 3 labels on the x-axis.\n c.xAxis().setLabelStep(3)\n\n # Add an area layer to the chart\n layer = c.addAreaLayer()\n\n # Load a snow pattern from an external file \"snow.png\".\n snowPattern = c.patternColor2(File.dirname(__FILE__) + \"/snow.png\")\n\n # Add a data set to the area layer using the snow pattern as the fill color. Use\n # deep blue (0x0000ff) as the area border line color (&H0000ff&)\n layer.addDataSet(data).setDataColor(snowPattern, 0x0000ff)\n\n # Set the line width to 2 pixels to highlight the line\n layer.setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def layout \n return @layout\n end",
"def layout\n lookup_layout\n end",
"def main_chart total_days, models\n content_tag :div, { id: 'chart_data', style: 'display:none;', 'data-custom-fdate' => total_days } do\n models.each_with_index.map do |model, i|\n filters = relevant_filters model\n content_tag :div, { id: \"serie_#{i+1}\", \"data-custom-label\" => I18n.t(\"activerecord.models.#{model.to_s.underscore.downcase}.other\")} do\n (0..total_days).to_a.collect do |day|\n concat content_tag(:span, daily_count(model, total_days-day, filters), class: day, style: 'display:none;', \"data-custom-date\" => (total_days-day).days.ago.to_i*1000)\n end\n end\n end.join.html_safe\n end.html_safe\n end",
"def swt_layout_data_class\n DisplayProxy.instance.auto_exec do\n parent_layout_class_name = @widget_proxy.swt_widget.getParent.getLayout.class.name\n layout_data_class_name = parent_layout_class_name.sub(/Layout$/, 'Data')\n eval(layout_data_class_name)\n end\n end",
"def rows\n layout_text.blank? ? 12 : layout.size\n end",
"def getchart()\n # The data for the chart\n data0 = [100, 100, 100, 100, 100]\n data1 = [90, 85, 85, 80, 70]\n data2 = [80, 65, 65, 75, 45]\n\n # The labels for the chart\n labels = [\"Population<*br*><*font=arial.ttf*>6 millions\",\n \"GDP<*br*><*font=arial.ttf*>120 billions\",\n \"Export<*br*><*font=arial.ttf*>25 billions\",\n \"Import<*br*><*font=arial.ttf*>24 billions\",\n \"Investments<*br*><*font=arial.ttf*>20 billions\"]\n\n # Create a PolarChart object of size 480 x 460 pixels. Set background color to\n # silver, with 1 pixel 3D border effect\n c = ChartDirector::PolarChart.new(480, 460, ChartDirector::silverColor(),\n 0x000000, 1)\n\n # Add a title to the chart using 15 pts Times Bold Italic font. The title text is\n # white (ffffff) on a deep green (008000) background\n c.addTitle(\"Economic Growth\", \"timesbi.ttf\", 15, 0xffffff).setBackground(0x008000)\n\n # Set plot area center at (240, 270), with 150 pixels radius\n c.setPlotArea(240, 270, 150)\n\n # Use 1 pixel width semi-transparent black (c0000000) lines as grid lines\n c.setGridColor(0xc0000000, 1, 0xc0000000, 1)\n\n # Add a legend box at top-center of plot area (240, 35) using horizontal layout.\n # Use 10 pts Arial Bold font, with silver background and 1 pixel 3D border effect.\n b = c.addLegend(240, 35, false, \"arialbd.ttf\", 10)\n b.setAlignment(ChartDirector::TopCenter)\n b.setBackground(ChartDirector::silverColor(), ChartDirector::Transparent, 1)\n\n # Add area layers of different colors to represent the data\n c.addAreaLayer(data0, 0xcc8880, \"Year 2004\")\n c.addAreaLayer(data1, 0xffd080, \"Year 1994\")\n c.addAreaLayer(data2, 0xa0bce0, \"Year 1984\")\n\n # Set the labels to the angular axis as spokes.\n c.angularAxis().setLabels(labels)\n\n # Set radial axis from 0 - 100 with a tick every 20 units\n c.radialAxis().setLinearScale(0, 100, 20)\n\n # Just show the radial axis as a grid line. Hide the axis labels by setting the\n # label color to Transparent\n c.radialAxis().setColors(0xc0000000, ChartDirector::Transparent)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def setup_graph_measurements\n @marker_caps_height = setup_marker_caps_height\n @title_caps_height = setup_title_caps_height\n @legend_caps_height = setup_legend_caps_height\n\n margin_on_right = graph_right_margin\n @graph_right = @raw_columns - margin_on_right\n @graph_left = setup_left_margin\n @graph_top = setup_top_margin\n @graph_bottom = setup_bottom_margin\n\n @graph_width = @raw_columns - @graph_left - margin_on_right\n @graph_height = @graph_bottom - @graph_top\n end",
"def to_s\n\t\t%Q(\n\t\t\t#{@layout[0][0]}|#{@layout[0][1]}|#{@layout[0][2]}\n\t\t\t-+-+-\n\t\t\t#{@layout[1][0]}|#{@layout[1][1]}|#{@layout[1][2]}\n\t\t\t-+-+-\n\t\t\t#{@layout[2][0]}|#{@layout[2][1]}|#{@layout[2][2]}\n\t\t\t)\n\tend",
"def summaryX\n render :layout => \"general\"\n end",
"def set_layout\n @layoutme = 1\n end",
"def add_title(input_args=Hash.new)\n @content[:options] ||= Hash.new\n @content[:options][:scales] ||= Hash.new\n if @args[:title]\n @content[:options][:title] = {\n display: true,\n text: @args[:title]\n }\n end\n\n # adjust where x-axis start or end\n x_scale_ticks = { } # Note this doesn't work for Time, which needs to specifies its own Time Min and Max\n y_scale_ticks = { }\n\n y_axes_left = { position: 'left', id: 'y-axis-left', ticks: y_scale_ticks}\n y_axes_right = {position: 'right', id: 'y-axis-right', ticks: y_scale_ticks}\n x_axes = { ticks: x_scale_ticks }\n\n \n\n # y_label(left) is always the first color, and y_label_right is always the second color\n if @args[:y_label]\n y_axes_left[:scaleLabel] = { display: true, labelString: @args[:y_label], fontColor: @colors[0] }\n end\n if @args[:y_right_label] # Jason 090216 right y axis label doesn't work\n y_axes_right[:scaleLabel] = { display: true, labelString: @args[:y_right_label] , fontColor: @colors[1] }\n\n end\n\n if @args[:stacked] \n x_axes[:stacked] = true\n y_axes_left[:stacked] = true \n end\n @content[:options][:scales][:yAxes] = [ y_axes_left]\n if @args[:y_right_label] # Jason 090216 right y axis label doesn't work\n @content[:options][:scales][:yAxes] << y_axes_right\n end\n @content[:options][:maintainAspectRatio] = @args[:aspect_ratio]\n @content[:options][:showLines] = @args[:showLines] if @args.has_key? :showLines\n\n # Chart Zoom plugin options\n @content[:options][:pan] = { enabled: true, mode: 'xy' }\n @content[:options][:zoom] = { enabled: true, mode: 'xy'}\n\n if self.class == ChartMaker::Scatter\n if @args[:time] # x axis is time (same as localtime, time since 1970) \n x_axes[:type] = 'time'\n else # x axis is number\n x_axes[:type] = 'linear'\n end\n x_axes[:position] = 'bottom'\n end\n \n if @args[:x_label]\n x_axes[:scaleLabel] = { display: true, labelString: @args[:x_label] }\n end\n if @args[:time]\n if ! ['hour','day','week','month','year'].include? @args[:time] # check Chart.js Time Scale for all the different Time Units\n raise \"unsupported time format #{@args[:time]}\"\n end\n x_axes[:time] = {}\n x_axes[:time][:unit] = @args[:time] \n x_axes[:time][:tooltipFormat] = \"MMMM Do YYYY, h a\" # need this or time will be display in integer in tooltip mode (when you hover over data point), note this will return invalid if tooltip doesn't contain time\n if input_args[:last_month]\n #puts \"show just last month\"\n a_month_ago = Time.now.to_i - (86400 * 30) # 30 days in terms of seconds\n x_axes[:time][:min] = to_js_time(a_month_ago)\n # also if last_month, then you know a good time unit is week\n x_axes[:time][:unit] = 'week'\n end\n end\n @content[:options][:scales][:xAxes] = [ x_axes]\n=begin\n jchen I have my own tooltips callback function, check def script_content()\n so below is not needed\n @content[:options][:tooltips] = Hash.new\n @content[:options][:tooltips][:callbacks] = Hash.new\n @content[:options][:tooltips][:callbacks][:label] = \"function(tooltipItem,data) { return \\\"jason\\\"; }\"\n=end\n\n end",
"def getchart()\n # The data for the chart\n dataY0 = [4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5]\n dataX0 = [Time.mktime(1997, 1, 1), Time.mktime(1998, 6, 25), Time.mktime(1999, 9,\n 6), Time.mktime(2000, 2, 6), Time.mktime(2000, 9, 21), Time.mktime(2001, 3, 4\n ), Time.mktime(2001, 6, 8), Time.mktime(2002, 2, 4), Time.mktime(2002, 5, 19),\n Time.mktime(2002, 8, 16), Time.mktime(2002, 12, 1), Time.mktime(2003, 1, 1)]\n\n dataY1 = [7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5]\n dataX1 = [Time.mktime(1997, 1, 1), Time.mktime(1997, 7, 1), Time.mktime(1997, 12,\n 1), Time.mktime(1999, 1, 15), Time.mktime(1999, 6, 9), Time.mktime(2000, 3, 3\n ), Time.mktime(2000, 8, 13), Time.mktime(2001, 5, 5), Time.mktime(2001, 9, 16\n ), Time.mktime(2002, 3, 16), Time.mktime(2002, 6, 1), Time.mktime(2003, 1, 1)]\n\n # Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff)\n # background, black border, 1 pixel 3D border effect and rounded corners\n c = ChartDirector::XYChart.new(600, 300, 0xe0e0ff, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff)\n # background. Set horizontal and vertical grid lines to grey (cccccc).\n c.setPlotArea(50, 60, 525, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc)\n\n # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9\n # pts Arial Bold font. Set the background and border color to Transparent.\n c.addLegend(55, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a title box to the chart using 15 pts Times Bold Italic font. The text is\n # white (ffffff) on a deep blue (000088) background, with soft lighting effect\n # from the right side.\n c.addTitle(\"Long Term Interest Rates\", \"timesbi.ttf\", 15, 0xffffff).setBackground(\n 0x000088, -1, ChartDirector::softLighting(ChartDirector::Right))\n\n # Set the y axis label format to display a percentage sign\n c.yAxis().setLabelFormat(\"{value}%\")\n\n # Add a red (ff0000) step line layer to the chart and set the line width to 2\n # pixels\n layer0 = c.addStepLineLayer(dataY0, 0xff0000, \"Country AAA\")\n layer0.setXData(dataX0)\n layer0.setLineWidth(2)\n\n # Add a blue (0000ff) step line layer to the chart and set the line width to 2\n # pixels\n layer1 = c.addStepLineLayer(dataY1, 0x0000ff, \"Country BBB\")\n layer1.setXData(dataX1)\n layer1.setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end",
"def layout\n yield(monitoring_layout)\n monitoring_layout\n end",
"def draw_stacked_bar_graph(data,data_description,alpha=50,contiguous=false)\n # /* Validate the Data and data_description array */\n data_description = validate_data_description(\"draw_bar_graph\",data_description)\n validate_data(\"draw_bar_graph\",data)\n graph_id = 0\n series = (data_description[\"values\"].count)\n if ( contiguous )\n series_width = @division_width\n else\n series_width = @division_width * 0.8\n end\n y_zero = @g_area_y2 - ((0-@vmin) * @division_ratio)\n y_zero = @g_area_y2 if ( y_zero > @g_area_y2 )\n series_id = 0\n last_value = {}\n id = 0\n color_id = 0\n data_description[\"values\"].each do |col_name|\n data_description[\"description\"].each do |key_i,value_i|\n if ( key_i == col_name )\n color_id = id\n id = id+1\n end\n end\n x_pos = @g_area_x1 + @g_area_x_offset - series_width / 2\n x_last = -1\n data.each do |key|\n if ( !key[col_name].nil?)\n if ( key[col_name].is_a?(Numeric) )\n value = key[col_name]\n if (!last_value[key].nil?)\n y_pos = @g_area_y2 - (((value+last_value[key])-@vmin) * @division_ratio)\n y_bottom = @g_area_y2 - ((last_value[key]-@vmin) * @division_ratio)\n last_value[key] += value\n else\n y_pos = @g_area_y2 - ((value-@vmin) * @division_ratio)\n y_bottom = y_zero\n last_value[key] = value\n end\n # Save point into the image map if option activated\n if ( @build_map )\n #add_to_image_map(x_pos+1,[y_bottom,y_pos].min,x_pos+series_width-1,[y_bottom,y_pos].max,data_description[\"description\"][col_name],data[key][col_name].data_description[\"unit\"][\"y\"],\"sBar\")\n end\n draw_filled_rectangle(x_pos+1,y_bottom,x_pos+series_width-1,y_pos,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"],true,alpha)\n end\n end\n x_pos = x_pos + @division_width\n end\n series_id+=1\n end\n end",
"def python_charts\n os = RbConfig::CONFIG['host_os'].downcase\n python = 'python3'\n python = 'python' unless os.include?('linux') || os.include?('darwin')\n\n # create Python charts for homepage\n `#{python} python/charts.py`\nend",
"def build_console_layout(x, width, height, pane_ids)\n console_layouts = distribute_vertically(x, width, height, pane_ids)\n Layout.new(\"#{width}x#{height}\", x, 0,\n VerticalNesting.new(console_layouts))\nend",
"def index\n @title = get_title\n\n @show_conditions = false\n\n if show_date_condition\n @date_condition = true\n @show_conditions = true\n else\n @date_condition = false\n end\n\n if show_pages\n @show_pages = true\n end\n\n unless get_grouping_options.empty?\n @grouping_options = RedmineCharts::GroupingUtils.to_options(get_grouping_options)\n @show_conditions = true\n else\n @grouping_options = []\n end\n\n unless get_conditions_options.empty?\n @conditions_options = RedmineCharts::ConditionsUtils.to_options(get_conditions_options, @project.id)\n @show_conditions = true\n else\n @conditions_options = []\n end\n \n @show_left_column = @show_conditions\n\n unless get_help.blank?\n @help = get_help\n @show_left_column = true\n else\n @help = nil\n end\n\n @range = RedmineCharts::RangeUtils.from_params(params)\n @pagination = RedmineCharts::PaginationUtils.from_params(params)\n @grouping = RedmineCharts::GroupingUtils.from_params(get_grouping_options, params)\n @conditions = RedmineCharts::ConditionsUtils.from_params(get_conditions_options, @project.id, params)\n\n @data = data\n\n render :template => \"charts/index\"\n end",
"def to_html\n <<-EOF\n <span id=\"#{container_id}\" class=\"#{chart_css_class}\">\n #{series.join(',')}\n </span>\n EOF\n end",
"def layout(value = nil)\n if value\n @layout = value\n else\n @layout\n end\n end",
"def layout=(_arg0); end",
"def per_legend_height\n 5\n end",
"def write_plot_labels(x_start, y_start, ymax, stat_max, stat_min, y_interval, x_left_boundary, title,\n numbers_first=false, precision=2, rotate=false, number_intervals = 10)\n x_adjustment = standard_font_size / 5 + 1\n\n x_start -= x_adjustment\n # now write them as right-aligned and horizontally\n stat_interval = stat_max-stat_min\n stat_break = stat_interval.to_f/number_intervals\n y_break = y_interval.to_f/number_intervals\n y=ymax\n current_stat_value = stat_min\n\n if rotate\n current_stat_value = stat_max\n stat_break = -stat_break\n end\n\n\n font_size = standard_font_size\n if font_size_multiple > 1\n font_size *= 0.85\n end\n\n num_x = @box_size/2.8\n letters_x = @box_size/2\n number_intervals.times do |curr_break|\n @canvas.g.translate(x_start, y_start).text(num_x, y) do |text|\n label = compress_number(current_stat_value, precision)\n text.tspan(label).styles(:font_size=>font_size/1.2, :text_anchor=>'end')\n # add tick mark\n current_stat_value += stat_break\n y -= y_break\n end\n end\n\n final_stat_value = stat_max\n if rotate\n final_stat_value = stat_min\n end\n\n @canvas.g.translate(x_start, y_start).text(num_x, y) do |text|\n text.tspan(compress_number(final_stat_value, precision)).styles(:font_size=>font_size/1.2, :text_anchor=>'end')\n end\n\n x_start -= calculate_coordinate(0.0005 * box_size * 18)\n\n # add labels\n # center around middle of the vertical axis\n if rotate\n title_adjust = 2 * @box_size + (font_size_multiple-1.0) * 1.2 * @box_size\n rotation = 90\n else\n title_adjust = -@box_size - (font_size_multiple-1.0) * 1.2 * @box_size\n rotation = -90\n end\n\n @canvas.g.translate(x_start, y_start).text(num_x+title_adjust, y_interval/2).rotate(rotation) do |text|\n text.tspan(title).styles(:font_size=>font_size*1.2, :text_anchor=>'middle')\n end\n\n end",
"def layouts; end",
"def layouts; end",
"def write_chart_type; end",
"def validate_layout(layout); end",
"def show_graph\n url_for_data = url_for(controller.params.merge(:action => :data)).gsub('&', '&')\n relative_url_path = ActionController::Base.respond_to?(:relative_url_root) ? ActionController::Base.relative_url_root : ActionController::AbstractRequest.relative_url_root\n html, div_name = controller.open_flash_chart_object_and_div_name('100%', '400', url_for_data, true, \"#{relative_url_path}/\")\n\n html << '<script type=\"text/javascript\">' << \"\\n\"\n html << \"var charts_to_image_title = '#{h(controller.title)}';\\n\" \n html << \"var charts_to_image_id = '#{div_name}';\\n\"\n html << '</script>'\n\n html\n end",
"def get_layout(layout)\n logger.debug( [ 'layout', \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\" ] )\n \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\"\n end",
"def build_editor_layout(width, height, pane_ids)\n if pane_ids.count == 1\n build_single_editor_layout(width, height, pane_ids.first)\n else\n build_multiple_editor_layout(width, height, pane_ids)\n end\nend",
"def sparkline_barchart_setup(options={})\n\t return if defined?(@barchart_setup)\n\t options[\"barSpacing\"] ||= 1\n\t options[\"barWidth\"] ||= 1\n\t @barchart_setup=1\n out=\"<script type='text/javascript'>\n jQuery.noConflict();\n jQuery(function() {\n jQuery('.inlinebarchart').sparkline('html', {type: 'bar', barColor: 'darkgrey', zeroColor: 'red', barWidth: #{options['barWidth']}, barSpacing: #{options['barSpacing']}} );\n });\n </script>\"\n out\n end"
] | [
"0.62270296",
"0.6205541",
"0.6055754",
"0.60324526",
"0.59804726",
"0.59769464",
"0.59614563",
"0.59038866",
"0.5829682",
"0.58250576",
"0.57558066",
"0.5755558",
"0.5738169",
"0.5706015",
"0.5700915",
"0.5688048",
"0.56782794",
"0.56724465",
"0.56724465",
"0.5668606",
"0.5656775",
"0.55439717",
"0.5532573",
"0.5528336",
"0.55267173",
"0.5525503",
"0.54901737",
"0.5486074",
"0.54369766",
"0.5430192",
"0.5417756",
"0.54138607",
"0.5400841",
"0.53587925",
"0.53587925",
"0.53500795",
"0.53332907",
"0.533201",
"0.5319371",
"0.5318213",
"0.5303279",
"0.52948403",
"0.5293027",
"0.5287035",
"0.5285491",
"0.52683234",
"0.5247457",
"0.52428454",
"0.52295697",
"0.5218998",
"0.52132857",
"0.5212014",
"0.51969296",
"0.5195747",
"0.5192265",
"0.518928",
"0.5168784",
"0.5165991",
"0.5162892",
"0.5159688",
"0.5159115",
"0.5158376",
"0.5156004",
"0.5148545",
"0.51442194",
"0.5122791",
"0.512244",
"0.51190823",
"0.5115645",
"0.51138914",
"0.51079834",
"0.510631",
"0.5099356",
"0.50991493",
"0.50919384",
"0.5088877",
"0.508173",
"0.5077497",
"0.5065729",
"0.5062172",
"0.5061993",
"0.5052729",
"0.50525606",
"0.50522286",
"0.50449675",
"0.5044565",
"0.5043354",
"0.5043075",
"0.5033541",
"0.5030852",
"0.5024535",
"0.50194955",
"0.5012073",
"0.5010733",
"0.5010733",
"0.5010491",
"0.49932826",
"0.49919936",
"0.49905527",
"0.49834326",
"0.49771664"
] | 0.0 | -1 |
TODO add the rest based methods | def edit
# @postalAddress = PostalAddress.find(params[:id])
render :layout => 'content'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def apis; end",
"def get; end",
"def get()\n \n end",
"def api; end",
"def api; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def respond(); end",
"def parent_api; end",
"def parent_api; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def weber; end",
"def rest_endpoint; end",
"def consume_rest; end",
"def req\n \n end",
"def preflight; end",
"def http; end",
"def schubert; end",
"def rest_positionals; end",
"def endpoints; end",
"def scan_rest; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def refutal()\n end",
"def relatorios\n end",
"def operations; end",
"def operations; end",
"def get\n end",
"def rest_end_point; end",
"def GET; end",
"def probers; end",
"def get_parameters; end",
"def get_parameters; end",
"def fetch; end",
"def fetch; end",
"def post_reader; end",
"def methods() end",
"def formation; end",
"def implementation; end",
"def implementation; end",
"def resource; end",
"def rest_endpoint=(_arg0); end",
"def resolver; end",
"def fetch\n end",
"def retrieve\n end",
"def rest\n @@rest\n end",
"def get\n end",
"def custom; end",
"def custom; end",
"def request_doc\n \n end",
"def request_data; end",
"def request_result\n \n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def retire\n\n end",
"def who_we_are\r\n end",
"def get_info\n end",
"def get_info\n end",
"def get_info\n end",
"def operation; end",
"def call\n\n\tend",
"def call\n\n\tend",
"def request(*args); end",
"def wrapper; end",
"def serializer; end",
"def details; end",
"def private_method\n end",
"def strategy; end",
"def get_rover_details; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def rest_keywords; end",
"def uri; end",
"def uri; end",
"def uri; end",
"def uri; end"
] | [
"0.70525354",
"0.6641224",
"0.65778184",
"0.63527584",
"0.63467914",
"0.63467914",
"0.62161964",
"0.62161964",
"0.62161964",
"0.62161964",
"0.6211875",
"0.6197219",
"0.6197219",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61677575",
"0.61676025",
"0.61676025",
"0.61676025",
"0.61676025",
"0.6144046",
"0.6139001",
"0.6128799",
"0.6105799",
"0.6103257",
"0.607959",
"0.60736763",
"0.6059442",
"0.6048565",
"0.6029517",
"0.602344",
"0.602344",
"0.602344",
"0.602344",
"0.6013381",
"0.6004554",
"0.60028225",
"0.60028225",
"0.59867716",
"0.5971269",
"0.5968923",
"0.596056",
"0.5953234",
"0.5953234",
"0.5951156",
"0.5951156",
"0.59344405",
"0.59267783",
"0.59113294",
"0.5876304",
"0.5876304",
"0.58589673",
"0.58292973",
"0.5795336",
"0.5783874",
"0.5782527",
"0.57291317",
"0.5728937",
"0.57232845",
"0.57232845",
"0.57104605",
"0.57084215",
"0.56991684",
"0.56864524",
"0.56864524",
"0.56864524",
"0.5681948",
"0.56593525",
"0.5659228",
"0.5659228",
"0.5659228",
"0.5655087",
"0.5648869",
"0.5648869",
"0.56479865",
"0.56425375",
"0.56303877",
"0.56227726",
"0.5616477",
"0.5604098",
"0.560302",
"0.5597663",
"0.5597663",
"0.5597663",
"0.5597663",
"0.5597663",
"0.5597663",
"0.5597663",
"0.5593164",
"0.55929816",
"0.55929816",
"0.55929816",
"0.55929816"
] | 0.0 | -1 |
GET /trips GET /trips.xml | def explore
@center = Geocoder.coordinates(params[:city])
@trips = Trip.nearest_with_index(@center)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n \t@trips = Trip.all\n end",
"def index\n @trips = Trip.all\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 index\n @trips = current_user.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def list\n @trips = Trips.my_trips(cookies[ :user_id ] )\n end",
"def index\n @trips = Trip.all\n render :json => @trips\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 trips = Trip.all\n respond_with trips\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def user_trips(user_id=self.username)\n connection.get(\"/users/#{user_id}/trips\").body.trips\n end",
"def index\n @profile = Profile.find_by_user_id(current_user.id)\n @trips = @profile.trips\n end",
"def index\n redirect_to find_trips_path\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 trips_by_trip_id(trip_id)\n get \"/gtfs/trips/tripId/#{trip_id}\"\n end",
"def index\n if params[:passenger_id]\n @passenger = Passenger.find_by(id: params[:passenger_id])\n @trips = @passenger.trips\n else\n render :notfound, status: :not_found\n end\n end",
"def show\n @rip = Rip.find params[:id]\n respond_to do |format|\n format.html\n format.xml { render :xml => @rip.to_xml }\n end\n end",
"def get_user_trips\n\n\t\tputs \"Trips driving\"\n\t\tputs current_user.past_trips_driven[0]\n\t\tputs current_user.trips_requested\n\t\tif current_user \n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrips_requested: Trip.where( :_id.in => current_user.trips_requested ),\n\t\t\t\ttrips_listed: Trip.where( :_id.in => current_user.trips_driving ),\n\t\t\t\ttrips_accepted: Trip.where( :_id.in => current_user.trips_accepted ),\n\t\t\t\texpired_requests: Trip.where( :_id.in => current_user.past_trips_requested),\n\t\t\t\texpired_listings: Trip.where( :_id.in => current_user.past_trips_driven),\n\t\t\t\tcurrent_userstrips: current_user.trips_driving\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'User is not signed in!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def index\n @trip = Trip.find(params[:trip_id])\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 trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def show\n # raise\n authorize @trip\n @user = current_user\n @routes = @trip.routes\n add_markers_and_site_geoloc if !@routes.first.nil? # add the markers and the @site_loc. Reject routes without localisation.\n\n @trips = []\n @trips << @user.trips\n @trips << @user.joint_user_trips.map { |jut| jut.trip }\n @trips = @trips.flatten\n end",
"def trips\n @agent.get(TRIPS_URL)\n\n # If session expires, re-login to citibikenyc.com. The site will redirect\n # back to TRIPS_URL upon sign in (friendly forwarding)\n login unless @agent.page.title == TRIPS_PAGE_TITLE\n\n rows = Nokogiri::HTML(@agent.page.body).xpath('//table/tbody/tr')\n\n # Reject bike trips that are either in progress or have durations <\n # MIN_TRIP_DURATION minutes.\n rows = rows.reject do |row|\n duration = row.at_xpath('td[6]/text()').to_s.match(/(\\d{1,2})m/)\n !duration || (duration.captures[0].to_i < MIN_TRIP_DURATION)\n end\n rows.map { |row| row_to_trip(row) }\n end",
"def show\n \tif params[:id] != \"search\"\n\t @trip = Trip.find(params[:id])\n\t\tend\n respond_to do |format|\n \t \tif params[:id] != \"search\"\n\t format.html # show.html.erb\n \t format.xml { render :xml => @trip }\n \t else \n\t \t format.html {redirect_to :controller => \"trips\", :action => \"index\" }\n \t end\n end\n end",
"def trips\n trips = RideShare::Trip.trips_by_rider(@id)\n if trips != nil\n return trips\n else\n return []\n end\n end",
"def trips_by_route_id(route_id)\n get \"/gtfs/trips/routeid/#{route_id}\"\n end",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def index\n # redirect /oj to here\n load_trips\n\n respond_to do |format|\n format.html { render :index }\n end\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def show\n @user = current_user\n @itinerary = Itinerary.find(params[:id])\n @move = Move.find(params[:move_id])\n @installation = @move.end.installation_id\n @trips = @itinerary.trips.find(:all, :order => 'date')\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def index\n @trips = Trip.all\n @now = Date.today\n end",
"def show\n @trip = Trip.find(params[:id])\nend",
"def show\n @trip_story = TripStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_story }\n end\n end",
"def view_current_trips\n @trips = Request.all\n @count = Request.count\n @trips.each do |trip|\n @curLoc = trip.currentLoc\n @destination = trip.destination\n end\n end",
"def show\n @trip = Trips.find_trip(params[ :id ] )\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 @request = Request.find(params[:id])\n #@sorted_trips = @request.get_sorted_trips\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\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 trips\n @analysis[:trips]\n end",
"def show\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.find(params[:id])\n end",
"def index\n @trips = Trip.where(user: current_user)\n @trip = Trip.new\n end",
"def index\n @class_trips = ClassTrip.all\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def show\n @gtfs_trip = GtfsTrip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_trip }\n end\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_feature }\n end\n end",
"def show\n @trip = Trip.find(params[:trip_id])\n end",
"def my\n @trips = Trip.completed.\n includes(:driver, {trip_request: :rider}).\n joins(trip_request: :rider).\n where(users: {id: params[:rider_id]})\n\n options = {}\n # JSON API: https://jsonapi.org/format/#fetching-sparse-fieldsets\n # fast_jsonapi: https://github.com/Netflix/fast_jsonapi#sparse-fieldsets\n #\n # convert input params to options arguments\n if params[:fields]\n trip_params = params[:fields].permit(:trips).to_h.\n inject({}) { |h, (k,v)| h[k.singularize.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: trip_params)\n end\n\n render json: TripSerializer.new(@trips, options).serializable_hash\n end",
"def index\n @travel = Travel.find(params[:travel_id])\n @itineraries = Itinerary.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @itineraries }\n end\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 vips\n request :get, '/vips'\n end",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def index\n @trips = current_user.trips_validated\n @pending_trips = current_user.pending_trips\n\n @visitor = current_user\n respond_to do |format|\n format.html{}\n format.js{}\n end\n end",
"def index\n @tips_tricks = @tips_tricks.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tips_tricks }\n end\n end",
"def show\n @trip = Trip.find_by_marketable_url(params[:marketable_url])\n end",
"def personal_trips\n @personal_trips = trips.where(driver_id: 0)\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def index\n @trip_routes = TripRoute.all\n end",
"def show\n @trip_enrollment = TripEnrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_enrollment }\n end\n end",
"def index\n @future_trips = FutureTrip.all\n end",
"def show\n redirect_to trips_path\n end",
"def find_trip\n @trip = Trip.find(params[:id])\n end",
"def index\n @trip_stories = TripStory.all\n @main_header = \"Trip Write-ups\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trip_stories }\n end\n end",
"def search_trips(trips, opts = {})\n service_id = opts[:service_id]\n route_id = opts[:route_id]\n service_id ||= 'S1'\n\n valid_trips = trips.select { |trip| \n trip[:service_id].eql? service_id\n }\n trips_with_route = valid_trips.select{ |trip| \n if !route_id.nil? then \n trip[:route_id].eql? route_id \n else \n true\n end \n }\n trips_with_route.map {|trip| trip[:trip_id]}\n end",
"def index\n @guide_trips = GuideTrip.all\n end",
"def index\n @trips = current_user.trips\n @unvalidated = @trips.where(:validated => false)\n @validated = @trips.where(:validated => true)\n end",
"def flights(params={})\n perform_get('/flights.xml', params)\n end",
"def trips\n #will find upcoming trips/reservations for guests\n Reservation.where(guest_id: self.id)\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def show\n @field_trip = FieldTrip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @field_trip }\n end\n end",
"def index\n @trip_enrollments = TripEnrollment.find(:all)\n\n respond_to do |format|\n #format.html # index.html.erb\n format.html { render(:action => :index, :layout => false) && return } \n format.xml { render :xml => @trip_enrollments }\n end\n end",
"def trips \n Trips.all.each do |trip|\n trip \n end \n\n #return to airbnb\n \n\n\n \nend",
"def index\n cookies[:default_view] = { :value => 'list', :expires => 6.month.from_now }\n @rips = Rip.get(params)\n respond_to do |format|\n format.html\n format.rss\n format.xml { render :xml => @rips.to_xml }\n format.js { render :partial => 'rip', :collection => @rips }\n format.json { render :json => @rips.to_json }\n end\n end",
"def index\n @tourpoints = Tourpoint.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tourpoints }\n end\n end",
"def index\n @upcoming_trips =\n Trip.where('departure > ?', DateTime.now).order(departure: :asc)\n @previous_trips =\n Trip.where('departure < ?', DateTime.now).order(departure: :desc)\n end",
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def index\n # @locations = Location.all.where(:trip_id => @trip)\n @locations = Location.all.where(trip_id: @trip)\n @trip = Trip.find(params[:trip_id])\n end",
"def create\n @user = current_user()\n @trip = @user.own_trips.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @trivia_item = Trivia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trivia_item }\n end\n end"
] | [
"0.80714715",
"0.75858504",
"0.75858504",
"0.757641",
"0.7477425",
"0.70685476",
"0.6992922",
"0.6992922",
"0.6992922",
"0.6992922",
"0.6992922",
"0.6992922",
"0.6992922",
"0.6989182",
"0.6943742",
"0.68573016",
"0.66799456",
"0.66799456",
"0.66767234",
"0.6628429",
"0.6599227",
"0.65933275",
"0.65933275",
"0.65532553",
"0.64621454",
"0.64621454",
"0.64023364",
"0.6399838",
"0.6364536",
"0.6316771",
"0.6300853",
"0.6278822",
"0.6236447",
"0.623471",
"0.6154824",
"0.614955",
"0.6122524",
"0.6103954",
"0.6090066",
"0.60543513",
"0.60233355",
"0.60189235",
"0.60135794",
"0.60013103",
"0.59783494",
"0.5965534",
"0.59204125",
"0.59172475",
"0.5872221",
"0.5868092",
"0.5867064",
"0.5856967",
"0.58569175",
"0.5849286",
"0.584425",
"0.583954",
"0.5834892",
"0.57921046",
"0.57863694",
"0.57833356",
"0.57833356",
"0.5775586",
"0.57294667",
"0.57256377",
"0.57256377",
"0.57232195",
"0.57155246",
"0.5696885",
"0.568333",
"0.5680634",
"0.56772774",
"0.5675013",
"0.565756",
"0.56431645",
"0.56237996",
"0.5619304",
"0.5619069",
"0.5619069",
"0.5619069",
"0.5615569",
"0.561103",
"0.5591116",
"0.5588954",
"0.55792993",
"0.5577452",
"0.55764925",
"0.5551234",
"0.5548713",
"0.55298406",
"0.55267984",
"0.55266684",
"0.55014586",
"0.54983747",
"0.54933447",
"0.54929316",
"0.5489025",
"0.5487957",
"0.54805094",
"0.5446645",
"0.54247427",
"0.54240894"
] | 0.0 | -1 |
GET /trips/1 GET /trips/1.xml | def show
@trip = Trip.find(params[:id])
respond_to do |format|
if @trip
@owner = user_can_modify(@trip)
format.html # show.html.erb
format.xml { render :xml => @trip }
else
format.html { redirect_to root_url, :status => 301} # show.html.erb
format.xml { render :xml => @trip }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def show\n @rip = Rip.find params[:id]\n respond_to do |format|\n format.html\n format.xml { render :xml => @rip.to_xml }\n end\n end",
"def index\n \t@trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\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 respond_with trips\n end",
"def trips_by_trip_id(trip_id)\n get \"/gtfs/trips/tripId/#{trip_id}\"\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def index\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n @trip_story = TripStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_story }\n end\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 show\n \tif params[:id] != \"search\"\n\t @trip = Trip.find(params[:id])\n\t\tend\n respond_to do |format|\n \t \tif params[:id] != \"search\"\n\t format.html # show.html.erb\n \t format.xml { render :xml => @trip }\n \t else \n\t \t format.html {redirect_to :controller => \"trips\", :action => \"index\" }\n \t end\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\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 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 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 trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\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 @gtfs_trip = GtfsTrip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_trip }\n end\n end",
"def index\n redirect_to find_trips_path\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def show\n @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_feature }\n end\n end",
"def index\n if params[:passenger_id]\n @passenger = Passenger.find_by(id: params[:passenger_id])\n @trips = @passenger.trips\n else\n render :notfound, status: :not_found\n end\n end",
"def show\n @trip = Trips.find_trip(params[ :id ] )\n end",
"def show\n @trip = Trip.find(params[:id])\nend",
"def trips_by_route_id(route_id)\n get \"/gtfs/trips/routeid/#{route_id}\"\n end",
"def index\n @profile = Profile.find_by_user_id(current_user.id)\n @trips = @profile.trips\n end",
"def show\n @user = current_user\n @itinerary = Itinerary.find(params[:id])\n @move = Move.find(params[:move_id])\n @installation = @move.end.installation_id\n @trips = @itinerary.trips.find(:all, :order => 'date')\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def index\n @travel = Travel.find(params[:travel_id])\n @itineraries = Itinerary.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @itineraries }\n end\n end",
"def show\n @trip_enrollment = TripEnrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_enrollment }\n end\n end",
"def list\n @trips = Trips.my_trips(cookies[ :user_id ] )\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 # redirect /oj to here\n load_trips\n\n respond_to do |format|\n format.html { render :index }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def show\n @travel = Travel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def show\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n @trivia_item = Trivia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trivia_item }\n end\n end",
"def index\n @trip_stories = TripStory.all\n @main_header = \"Trip Write-ups\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trip_stories }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @field_trip = FieldTrip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @field_trip }\n end\n end",
"def show\n @travel = Travel.find(params[:travel_id])\n @itinerary = Itinerary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def show\n @toilet = Toilet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @toilet }\n end\n end",
"def show\n @trivia = Trivia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trivia }\n end\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def show\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.find(params[:id])\n end",
"def show\n @tpago = Tpago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def show\n @request = Request.find(params[:id])\n #@sorted_trips = @request.get_sorted_trips\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def show\n @tire = Tire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tire }\n end\n end",
"def user_trips(user_id=self.username)\n connection.get(\"/users/#{user_id}/trips\").body.trips\n end",
"def find_trip\n @trip = Trip.find(params[:id])\n end",
"def show\n @lift = Lift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lift }\n end\n end",
"def show\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_repair }\n end\n end",
"def index\n @trips = Trip.all\n @now = Date.today\n end",
"def show\n @travel_log = TravelLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @travel_log }\n end\n end",
"def show\n @trip = Trip.find_by_marketable_url(params[:marketable_url])\n end",
"def index\n @tourpoints = Tourpoint.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tourpoints }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n @ministry = @trip.ministry\n @tab = 'ministries'\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end",
"def show\n # raise\n authorize @trip\n @user = current_user\n @routes = @trip.routes\n add_markers_and_site_geoloc if !@routes.first.nil? # add the markers and the @site_loc. Reject routes without localisation.\n\n @trips = []\n @trips << @user.trips\n @trips << @user.joint_user_trips.map { |jut| jut.trip }\n @trips = @trips.flatten\n end",
"def view_current_trips\n @trips = Request.all\n @count = Request.count\n @trips.each do |trip|\n @curLoc = trip.currentLoc\n @destination = trip.destination\n end\n end",
"def show\n @tourpoint = Tourpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end",
"def show\n @tour = Tour.find_by_url(params[:id])\n @stops = @tour.stops\n @ratings = @tour.ratings\n @title = @tour.name\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tour }\n format.json { render :json => @tour }\n end\n end",
"def index\n @trip_enrollments = TripEnrollment.find(:all)\n\n respond_to do |format|\n #format.html # index.html.erb\n format.html { render(:action => :index, :layout => false) && return } \n format.xml { render :xml => @trip_enrollments }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # { redirect_to edit_trip_path(@trip) } \n format.xml { render :xml => @trip }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\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 flights(params={})\n perform_get('/flights.xml', params)\n end",
"def vips\n request :get, '/vips'\n end",
"def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end",
"def show\n @technician = Technician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @technician }\n end\n end",
"def show\n @tstat = Tstat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def index\n @lifts = Lift.all\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lifts }\n end\n end",
"def index\n cookies[:default_view] = { :value => 'list', :expires => 6.month.from_now }\n @rips = Rip.get(params)\n respond_to do |format|\n format.html\n format.rss\n format.xml { render :xml => @rips.to_xml }\n format.js { render :partial => 'rip', :collection => @rips }\n format.json { render :json => @rips.to_json }\n end\n end",
"def show\n @tracker = Tracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.erb\n format.xml { render :xml => @tracker.to_xml }\n end\n end",
"def index\n @trips = Trip.where(user: current_user)\n @trip = Trip.new\n end",
"def show\n @rute = Rute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rute }\n end\n end",
"def index\n @class_trips = ClassTrip.all\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def index\n # @locations = Location.all.where(:trip_id => @trip)\n @locations = Location.all.where(trip_id: @trip)\n @trip = Trip.find(params[:trip_id])\n end"
] | [
"0.75066376",
"0.74006474",
"0.73905426",
"0.73905426",
"0.7244806",
"0.6716845",
"0.66819704",
"0.66819704",
"0.6571074",
"0.65355915",
"0.65111315",
"0.65111315",
"0.65111315",
"0.65111315",
"0.65111315",
"0.65111315",
"0.65111315",
"0.64055055",
"0.63193667",
"0.62750876",
"0.6273842",
"0.6228294",
"0.6199726",
"0.618065",
"0.6175226",
"0.61450505",
"0.61306566",
"0.6098677",
"0.6098677",
"0.6090918",
"0.6068493",
"0.60666054",
"0.604837",
"0.6025256",
"0.6006736",
"0.6006308",
"0.6006308",
"0.59889114",
"0.5984294",
"0.5956644",
"0.5948039",
"0.59446615",
"0.5902228",
"0.5889357",
"0.5854726",
"0.5843412",
"0.5835631",
"0.5806245",
"0.5797657",
"0.57879794",
"0.57879794",
"0.57879794",
"0.5779873",
"0.57789284",
"0.5763454",
"0.5762993",
"0.5754591",
"0.5754591",
"0.5733552",
"0.5729332",
"0.5727701",
"0.5724628",
"0.5710175",
"0.56960094",
"0.5695453",
"0.569378",
"0.56925744",
"0.56909364",
"0.5663669",
"0.5636164",
"0.56339824",
"0.56299734",
"0.5614876",
"0.5612848",
"0.56038356",
"0.5579248",
"0.55752987",
"0.55637205",
"0.5558272",
"0.5555077",
"0.5554793",
"0.55460054",
"0.5536656",
"0.5525859",
"0.55066544",
"0.5482704",
"0.5479319",
"0.54690635",
"0.54663885",
"0.54659003",
"0.5459847",
"0.54572237",
"0.54524386",
"0.5449619",
"0.5447036",
"0.5444716",
"0.54358345",
"0.5431361",
"0.5425188",
"0.5423297",
"0.54182225"
] | 0.0 | -1 |
GET /trips/new GET /trips/new.xml | def new
@trip = Trip.new
respond_to do |format|
format.html # { redirect_to edit_trip_path(@trip) }
format.xml { render :xml => @trip }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @tipp = Tipp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def new\n @user = current_user()\n @trip = @user.own_trips.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @field_trip = FieldTrip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @field_trip }\n end\n end",
"def new\n @gtfs_trip = GtfsTrip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_trip }\n end\n end",
"def new\n @trip_feature = TripFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip_feature }\n end\n end",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def create\n @rip = Rip.new(params[:rip]) \n respond_to do |format|\n if @rip.save\n format.html { redirect_to rip_url(@rip) }\n format.xml { head :created, :location => rip_url(@rip) }\n else\n format.html { render :action => 'new' }\n format.xml { render :xml => @rip.errors.to_xml }\n end\n end\n end",
"def new\n\t\t@new_trip = Trip.new\n\tend",
"def new\n @travel_fix = TravelFix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel_fix }\n end\n end",
"def create\n @user = current_user()\n @trip = @user.own_trips.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @lift = Lift.new\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lift }\n end\n end",
"def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def new\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @tire = @vehicle.tires.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tire }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def new\n @snippit = Snippit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snippit }\n end\n end",
"def new\n @trivia = Trivia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trivia }\n end\n end",
"def new\n @trivia_item = Trivia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trivia_item }\n end\n end",
"def trips\n get '/gtfs/trips'\n end",
"def new\n @trip_item = TripItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @town = Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town }\n end\n end",
"def new\n @trip_story = TripStory.new\n @main_header = \"New Trip Write-up\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip_story }\n end\n end",
"def new\n @tourist_sight_tip = TouristSightTip.new\n @tourist_sight_tip.tip = Tip.new\n @tourist_sight = TouristSight.find(params[:tourist_sight_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tip }\n end\n end",
"def new\n @tipp = Tipp.new\n respond_to do |format|\n \n format.html do # new.html.erb\n @spielbegegnungs = Spielbegegnung.all\n @spielbegegnung = Spielbegegnung.find(params[:id])\n @spielbegegnung.tipps << @tipp\n \n @tg = current_tippgemeinschaft\n @tg.tipps << @tipp\n end\n format.xml { render :xml => @tipp }\n end\n end",
"def new\n @tape = Tape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tape }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def 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 new\n @trip = current_user.trips.new\n @places = []\n end",
"def new\n @travel = Travel.find(params[:travel_id])\n @itinerary = Itinerary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n @ptid = Ptid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptid }\n end\n end",
"def new\n @tour = Tour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tour }\n end\n end",
"def new\n @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 @sti = Sti.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sti }\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 @tourpoint = Tourpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end",
"def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def new\n @pilot_flight = PilotFlight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pilot_flight }\n end\n end",
"def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"def new\n @m_tip = MTip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @m_tip }\n end\n end",
"def new\n @partei = Partei.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partei }\n end\n end",
"def new\n @trip = Trip.new\n @author_info = AuthorInfo.new\n @location_val = \"\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = current_user.trips.build\n 5.times {@trip.places.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n @trip = Trip.new\n @trains = Train.all.map { |train| [train.name, train.id] }\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @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 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 @intake = Intake.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @intake }\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 # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @tweak = Tweak.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tweak }\n end\n end",
"def new\n @way = Way.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @way }\n end\n end",
"def new\n @ministry = Ministry.find(params[:ministry])\n @trip = @ministry.trips.build\n @data_files = DataFile.find(:all, :order => :name)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flight }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @pinrequest = Pinrequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pinrequest }\n end\n end",
"def new\r\n @transportation_slip = TransportationSlip.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @transportation_slip }\r\n end\r\n end",
"def create\n @trip = Trip.new(params[:trip])\n @trip.user = @current_user\n r = Request.find_by_url(@trip.url)\n if r; r.destroy; end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to(@trip, :notice => 'Trip was successfully created.') }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n format.json { render :json => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n format.json { render :json => @trip.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tweet }\n end\n end",
"def new\n @tiposcontrato = Tiposcontrato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposcontrato }\n end\n end",
"def new\n @serie = (params[:id] ? Serie.find(params[:id]) : Serie.new)\n @serie_new = params[:id] || true\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @serie }\n end\n end",
"def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @lote = Lote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lote }\n end\n end",
"def new\n @trip = Trip.find(params[:trip_id])\n @prev_day = @trip.days[-1]\n @day = Day.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\n end\n end",
"def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end",
"def new\n @tipos_pagamento = TiposPagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipos_pagamento }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\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 @pokemon = Pokemon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pokemon }\n end\n end",
"def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end",
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @station }\n end\n end",
"def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def new\n @travel_log = TravelLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel_log }\n end\n end",
"def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tv }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end"
] | [
"0.7394252",
"0.7394252",
"0.7394252",
"0.69261056",
"0.68196785",
"0.6739118",
"0.6737067",
"0.6732369",
"0.66951734",
"0.66224825",
"0.66224825",
"0.65944386",
"0.65944386",
"0.6537531",
"0.65359807",
"0.6525924",
"0.6495073",
"0.64941627",
"0.64913",
"0.6484872",
"0.64481694",
"0.643207",
"0.643207",
"0.6420878",
"0.64157844",
"0.641076",
"0.64050835",
"0.6401285",
"0.6398115",
"0.6369487",
"0.6352586",
"0.6351084",
"0.63499635",
"0.63423795",
"0.63421434",
"0.6341699",
"0.6314351",
"0.6309446",
"0.6301504",
"0.6298658",
"0.6285575",
"0.6277521",
"0.6274829",
"0.62730855",
"0.6271126",
"0.6262092",
"0.62562335",
"0.62532645",
"0.62450755",
"0.624004",
"0.6227193",
"0.6224553",
"0.62098366",
"0.6207786",
"0.6199628",
"0.6197315",
"0.6197162",
"0.6197162",
"0.61956394",
"0.6193016",
"0.6192269",
"0.61859953",
"0.61708254",
"0.6170675",
"0.6169771",
"0.6167507",
"0.61652887",
"0.6152244",
"0.61457366",
"0.6144827",
"0.6134001",
"0.613375",
"0.61320657",
"0.612643",
"0.61243933",
"0.6123903",
"0.61146635",
"0.61113906",
"0.6102356",
"0.6102319",
"0.609943",
"0.60928893",
"0.60888463",
"0.60868734",
"0.60858893",
"0.608459",
"0.6082268",
"0.60782564",
"0.60782564",
"0.6076805",
"0.6076119",
"0.60749",
"0.6071496",
"0.6068315",
"0.60680115",
"0.6066552",
"0.6065571",
"0.6065571",
"0.6065571",
"0.6065571"
] | 0.6791647 | 5 |
POST /trips POST /trips.xml | def create
@trip = Trip.new(params[:trip])
@trip.user = @current_user
r = Request.find_by_url(@trip.url)
if r; r.destroy; end
respond_to do |format|
if @trip.save
format.html { redirect_to(@trip, :notice => 'Trip was successfully created.') }
format.xml { render :xml => @trip, :status => :created, :location => @trip }
format.json { render :json => @trip }
else
format.html { render :action => "new" }
format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }
format.json { render :json => @trip.errors.full_messages, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trips\n get '/gtfs/trips'\n end",
"def create\n @user = current_user()\n @trip = @user.own_trips.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n trip = Trip.create(trip_params)\n\n respond_with trip\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def create\n @rip = Rip.new(params[:rip]) \n respond_to do |format|\n if @rip.save\n format.html { redirect_to rip_url(@rip) }\n format.xml { head :created, :location => rip_url(@rip) }\n else\n format.html { render :action => 'new' }\n format.xml { render :xml => @rip.errors.to_xml }\n end\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to trips_path, notice: 'Cesta byla vytvořena.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = current_user.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n end\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 @ministry = Ministry.find(params[:ministry])\n @trip = @ministry.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n #flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created,\n :location => @trip }\n else\n @data_files = DataFile.find(:all, :order => :name)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trips_connect = TripsConnect.new(params[:trips_connect])\n\n respond_to do |format|\n if @trips_connect.save\n format.html { redirect_to @trips_connect, notice: 'Trips connect was successfully created.' }\n format.json { render json: @trips_connect, status: :created, location: @trips_connect }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trips_connect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def create\n @trip = current_user.trips.build(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\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 create\n @trip = Trip.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, :notice => 'Trip was successfully created.' }\n format.json { render :json => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = current_user.trips.new(params[:trip].except(:places))\n params[:trip][:places] ||= []\n @trip.add_trip_places(params[:trip][:places])\n if @trip.save\n flash[:notice] = \"Trip succesfully created\"\n redirect_to @trip\n else\n flash.now[:error] = @trip.errors.full_messages\n @places = params[:trip][:places]\n render \"new\"\n end\n end",
"def create\n\n # inflate a trip proxy object from the form params\n @trip_proxy = create_trip_proxy_from_form_params\n \n if @trip_proxy.valid?\n @trip = create_trip(@trip_proxy)\n end\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n\n respond_to do |format|\n if @trip\n if @trip.save\n @trip.reload\n @planned_trip = @trip.planned_trips.first\n @planned_trip.create_itineraries\n format.html { redirect_to user_planned_trip_path(@traveler, @planned_trip) }\n format.json { render json: @planned_trip, status: :created, location: @planned_trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_proxy.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\", flash[:alert] => t(:correct_errors_to_create_a_trip) }\n end\n end\n end",
"def index\n \t@trips = Trip.all\n end",
"def create\n err_objs=[]\n error=false\n user_id=MobileDevice.where(:access_token=>params[:access_token]).first.user_id\n if params.has_key?('trips')\n params[:trips].each do |trip|\n trip_id=trip[1][:trip_id] #save ref to trip id in case @trip.save fails (used in return response)\n if !create_trip(trip[1],user_id)\n error=true\n err_objs.push(trip_id)\n end\n end\n else\n error=true\n end\n respond_to do |format|\n if !error\n format.json { render json: {:msg => \"success\"}, status: :created }\n else\n format.json { render json: {:msg => \"Could not save the following trips. Please check that all required fields are filled out (license_plate, cargo, start_location, end_location, start_timestamp, end_timestamp)\", :err_ids => err_objs}, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:starts_on, :ends_on, :name, :location, {:item_ids => []})\n end",
"def create\r\n # @trip = Trip.new(trip_params)\r\n @trip = current_user.trips.build(trip_params)\r\n if @trip.save\r\n redirect_to trips_path, notice: 'Trip was successfully created.'\r\n else\r\n redirect_to new_trip_path, notice: 'Cannot leave information blank.'\r\n end\r\n end",
"def create\n @trip_item = TripItem.new(params[:trip_item])\n\n respond_to do |format|\n if @trip_item.save\n format.html { redirect_to @trip_item, notice: 'Trip item was successfully created.' }\n format.json { render json: @trip_item, status: :created, location: @trip_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n end",
"def create_trip\n # Only attempt to create trip if all the necessary pieces are there\n return false unless @itinerary && @trip && @service && @user\n \n label = request_label(:book, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/create_trip\", \n :post,\n head: headers,\n body: body_for_booking(@booking_options).to_json\n ).response!(label)\n end",
"def create\n @trip = Trip.new(trip_name: trip_params[:trip_name], user_id: current_user.id)\n respond_to do |format|\n if @trip.save\n UserTrip.create(user_id: current_user.id, trip_id: @trip.id)\n UserTrip.add_users_to_trip(params[:trippers], @trip.id, current_user)\n Exchange.set_defaults(@trip.id)\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:sightsnum, :location, :location_radius, :tag, :user_id)\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 create\n @trip = Trip.new(params[:trip])\n\t@trip.seat = params[:trip][:seat].to_i + 1\n\t\n\tif params[:trip][:on_demand] == 'Passager'\n\t\t@trip.on_demand = true\n\t\t@trip.driver = nil\n\telse\n\t\t@trip.on_demand = false\n\t\t@trip.driver = current_user\n\tend\n respond_to do |format|\n if @trip.save\n\t\t @trip.users << current_user\n\t\t @trip.save\n format.html { redirect_to(@trip, :notice => 'Le trajet à correctement été enregistré') }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip_waypoint = TripWaypoint.new\n @trip_waypoint.place_id = params[:place_id]\n @trip_waypoint.trip_id = params[:trip_id]\n @trip_waypoint.save\n\n respond_to do |format|\n if @trip_waypoint.save\n format.html { redirect_to edit_partner_trip_path(params[:trip_id]), notice: \"Le lieu a été ajouté à l'itinéraire\" }\n # format.json { render :show, status: :created, location: @trip_waypoint }\n else\n format.html { render :new }\n # format.json { render json: @trip_waypoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to current_user, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { redirect_to current_user, notice: \"Trip can't be created\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def index\n redirect_to find_trips_path\n end",
"def create\n @field_trip = FieldTrip.new(params[:field_trip])\n\n respond_to do |format|\n if @field_trip.save\n format.html { redirect_to(@field_trip, :notice => 'Field trip was successfully created.') }\n format.xml { render :xml => @field_trip, :status => :created, :location => @field_trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @field_trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:location, :latitude, :longitude, :start_date, :end_date, :days, :notes, :name, clips_attributes: [:uri, :day_list, :date_list, :type_list, :day, :date, :external_reference])\n end",
"def new\n @user = current_user()\n @trip = @user.own_trips.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n\n if @trip.save\n Notifier.confirmation(@trip).deliver\n redirect_to trip_details_path(:marketable_url => @trip.marketable_url), notice: \"Trip was successfully created.\"\n else\n render action: \"new\"\n end\n end",
"def create\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @tire = @vehicle.tires.new(params[:tire])\n \n respond_to do |format|\n if @tire.save\n format.html { redirect_to(fleet_vehicle_tires_path(@fleet, @vehicle), :notice => 'Tire records was successfully created.') }\n format.xml { render :xml => @tire, :status => :created, :location => @tire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tire.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:name, :description, :user_id, :start_date, :airport_id, :base64, attendee_ids:[], leg_ids:[])\n end",
"def trips\n @agent.get(TRIPS_URL)\n\n # If session expires, re-login to citibikenyc.com. The site will redirect\n # back to TRIPS_URL upon sign in (friendly forwarding)\n login unless @agent.page.title == TRIPS_PAGE_TITLE\n\n rows = Nokogiri::HTML(@agent.page.body).xpath('//table/tbody/tr')\n\n # Reject bike trips that are either in progress or have durations <\n # MIN_TRIP_DURATION minutes.\n rows = rows.reject do |row|\n duration = row.at_xpath('td[6]/text()').to_s.match(/(\\d{1,2})m/)\n !duration || (duration.captures[0].to_i < MIN_TRIP_DURATION)\n end\n rows.map { |row| row_to_trip(row) }\n end",
"def create\n @gtfs_trip = GtfsTrip.new(params[:gtfs_trip])\n\n respond_to do |format|\n if @gtfs_trip.save\n format.html { redirect_to(@gtfs_trip, :notice => 'Gtfs trip was successfully created.') }\n format.xml { render :xml => @gtfs_trip, :status => :created, :location => @gtfs_trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n @trip.user = current_user\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_trips(user_id=self.username)\n connection.get(\"/users/#{user_id}/trips\").body.trips\n end",
"def trip_params\n params.require(:trip).permit(:idRio, :nomeRio)\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def trip_params\n params.require(:trip).permit(:student_id, :ymen_trips, :num_ymen_camping_trips, :camping_locations, :num_vocational_trips, :businesses_visited, :num_cultural_trips, :cultural_places_visited, :ymen_trips_fun_listed)\n end",
"def create_trip(trip_proxy)\n\n trip = Trip.new()\n trip.creator = current_or_guest_user\n trip.user = @traveler\n trip.trip_purpose = TripPurpose.find(trip_proxy.trip_purpose_id)\n\n # get the start for this trip\n from_place = TripPlace.new()\n from_place.sequence = 0\n place = get_preselected_place(trip_proxy.from_place_selected_type, trip_proxy.from_place_selected.to_i, true)\n if place[:poi_id]\n from_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n from_place.place = @traveler.places.find(place[:place_id])\n else\n from_place.raw_address = place[:address]\n from_place.lat = place[:lat]\n from_place.lon = place[:lon] \n end\n\n # get the end for this trip\n to_place = TripPlace.new()\n to_place.sequence = 1\n place = get_preselected_place(trip_proxy.to_place_selected_type, trip_proxy.to_place_selected.to_i, false)\n if place[:poi_id]\n to_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n to_place.place = @traveler.places.find(place[:place_id])\n else\n to_place.raw_address = place[:address]\n to_place.lat = place[:lat]\n to_place.lon = place[:lon] \n end\n\n # add the places to the trip\n trip.trip_places << from_place\n trip.trip_places << to_place\n\n planned_trip = PlannedTrip.new\n planned_trip.trip = trip\n planned_trip.creator = trip.creator\n planned_trip.is_depart = trip_proxy.arrive_depart == 'departing at' ? true : false\n planned_trip.trip_datetime = trip_proxy.trip_datetime\n planned_trip.trip_status = TripStatus.find_by_name(TripStatus::STATUS_NEW) \n \n trip.planned_trips << planned_trip\n\n return trip\n end",
"def create\n # binding.pry\n @trip = Trip.new(trip_params)\n respond_to do |format|\n if @trip.save\n @trip_user_list = TripUserList.new(trip_id: @trip.id,user_id: session[:user_id])\n # binding.pry\n @trip_user_list.save\n format.html { redirect_to \"/trips/#{@trip.id}/locations\", notice: 'Trip was successfully created.' }\n else\n format.html { render :index }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n @trip.user = current_user\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def index\n trips = Trip.all\n respond_with trips\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 post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def trip_params\n #Ajouter identifiant de l’utilisateur dans le post\n params.require(:trip).permit(:city, :user_id)\n\tend",
"def trip_params\n params.require(:trip).permit(:trip_name, :tripper)\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 list\n @trips = Trips.my_trips(cookies[ :user_id ] )\n end",
"def my\n @trips = Trip.completed.\n includes(:driver, {trip_request: :rider}).\n joins(trip_request: :rider).\n where(users: {id: params[:rider_id]})\n\n options = {}\n # JSON API: https://jsonapi.org/format/#fetching-sparse-fieldsets\n # fast_jsonapi: https://github.com/Netflix/fast_jsonapi#sparse-fieldsets\n #\n # convert input params to options arguments\n if params[:fields]\n trip_params = params[:fields].permit(:trips).to_h.\n inject({}) { |h, (k,v)| h[k.singularize.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: trip_params)\n end\n\n render json: TripSerializer.new(@trips, options).serializable_hash\n end",
"def new\n @trip = current_user.trips.build\n 5.times {@trip.places.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def trip_params\n params.require(:trip).permit(:driver_id, :source_id, :destination_id, :departure_time, :seats, :users)\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(parse_post params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(parse_post params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:code, :name, :price, :temperature, :depart_at, :return_at, :url)\n end",
"def trip_params\n params.require(:trip).permit(:name, :accomodation_url, :price_per_night, :number_of_possible_attendees, :start_date, :end_date, :start_location, :end_location, :type_of_trip, :total_possible_cost, :total_confirmed_cost, :started, :ended)\n end",
"def create\n @trip_todo = TripTodo.new(trip_todo_params)\n\n respond_to do |format|\n if @trip_todo.save\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully created.' }\n format.json { render :show, status: :created, location: @trip_todo }\n else\n format.html { render :new }\n format.json { render json: @trip_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_user_trips\n\n\t\tputs \"Trips driving\"\n\t\tputs current_user.past_trips_driven[0]\n\t\tputs current_user.trips_requested\n\t\tif current_user \n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrips_requested: Trip.where( :_id.in => current_user.trips_requested ),\n\t\t\t\ttrips_listed: Trip.where( :_id.in => current_user.trips_driving ),\n\t\t\t\ttrips_accepted: Trip.where( :_id.in => current_user.trips_accepted ),\n\t\t\t\texpired_requests: Trip.where( :_id.in => current_user.past_trips_requested),\n\t\t\t\texpired_listings: Trip.where( :_id.in => current_user.past_trips_driven),\n\t\t\t\tcurrent_userstrips: current_user.trips_driving\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'User is not signed in!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def trip_params\n params.require(:trip).permit(:name, :start_date, :end_date, :town_id)\n end",
"def create\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.build(params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id))\n if @trip.save\n redirect_to profile_trip_url(@profile, @trip)\n else\n render :action => \"new\"\n end\n end",
"def set_trip\n @trip = current_user.trips.find(params[:id])\n end",
"def create\n @trip_feature = TripFeature.new(params[:trip_feature])\n\n respond_to do |format|\n if @trip_feature.save\n format.html { redirect_to(@trip_feature, :notice => 'TripFeature was successfully created.') }\n format.xml { render :xml => @trip_feature, :status => :created, :location => @trip_feature }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip_feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n # Get the permission's type which represent an usual user and an admin one.\n permUser = Permission_type.find_by(permission: \"user\").id\n permAdmin = Permission_type.find_by(permission: \"admin\").id\n\n # Create current user's admin permission on the new created trip.\n adminPerm = Permission.new(:user_id => current_user.id, :trip_id => @trip.id, :permission_type_id => permAdmin, :accepted => 1)\n adminPerm.save\n # Create a \"user\" permission for each selected users.\n if params[\"users\"]\n params[\"users\"].each do |user|\n userId = user[2, user.length]\n\n # We don't add the current user, which is an admin.\n if userId != String(current_user.id)\n currentPermission = user[0] == \"1\" ? permAdmin : permUser\n\n perm = Permission.new(:user_id => userId, :trip_id => @trip.id, :permission_type_id => currentPermission, :accepted => 0)\n perm.save\n end\n end\n end\n\n # Create each waypoint of the trip.\n if params['waypoints']\n i = 0\n params['waypoints'].each do |waypoint|\n i += 1\n w = Stop.new(:title => @trip.title + \" - #{i}\", :loc_lat => waypoint[1][0], :loc_lon => waypoint[1][1], :trip_id => @trip.id, :etape_nb => i)\n w.save\n end\n\n # If the endpoint is also the startpoint, add an extra stop.\n if params['arrivalEqualsStart']\n w = Stop.new(:title => @trip.title + \" - #{i + 1}\", :loc_lat => params[\"waypoints\"][\"0\"][0], :loc_lon => params[\"waypoints\"][\"0\"][1], :trip_id => @trip.id, :etape_nb => (i + 1))\n w.save\n end\n end\n\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:date, :destination, :distance, :price)\n end",
"def index\n @trip = Trip.find(params[:trip_id])\n end",
"def trip_params\n params.require(:trip).permit(:start_date, :end_date, :name, :completed, :notes)\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.nomad_id = current_nomad.id\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_trip\n @trip = Trip.find(params['id'])\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.session_id = session.id\n @trip.user_id = current_user.id\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully created.', change: 'list' }\n format.json { render action: 'show', status: :created, location: @trip, day: 1 }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.69789785",
"0.63354826",
"0.63348866",
"0.63348866",
"0.6160354",
"0.60880387",
"0.60880387",
"0.60462004",
"0.6016248",
"0.59629536",
"0.59593844",
"0.5951899",
"0.5945519",
"0.5935993",
"0.5928302",
"0.59043634",
"0.58977807",
"0.5896994",
"0.5795958",
"0.5795958",
"0.5795958",
"0.5795958",
"0.5795958",
"0.5795958",
"0.5795958",
"0.57802325",
"0.57312924",
"0.5729367",
"0.5723724",
"0.5723561",
"0.5690431",
"0.5676336",
"0.567603",
"0.5670266",
"0.5664214",
"0.5663497",
"0.5652217",
"0.559438",
"0.5591632",
"0.5587413",
"0.5587413",
"0.5584823",
"0.55688095",
"0.55647147",
"0.5560012",
"0.5543019",
"0.553466",
"0.5528201",
"0.5528031",
"0.5510365",
"0.55061394",
"0.5479733",
"0.5460911",
"0.54498875",
"0.5444604",
"0.54381454",
"0.5433954",
"0.5431218",
"0.5424261",
"0.542341",
"0.54195833",
"0.54195833",
"0.5412524",
"0.54110545",
"0.53934675",
"0.53727114",
"0.5360609",
"0.5356436",
"0.5356436",
"0.5356436",
"0.5348052",
"0.53299135",
"0.5305259",
"0.530078",
"0.52978104",
"0.5293699",
"0.52790564",
"0.5275378",
"0.5268499",
"0.52629757",
"0.5256535",
"0.5256535",
"0.5256535",
"0.5253874",
"0.5253874",
"0.5244142",
"0.5241831",
"0.5233025",
"0.52328014",
"0.52261156",
"0.5224206",
"0.52232933",
"0.52229965",
"0.5219415",
"0.5217348",
"0.52105355",
"0.5210328",
"0.52069616",
"0.52069587",
"0.5201214"
] | 0.58467597 | 18 |
PUT /trips/1 PUT /trips/1.xml | def update
@trip = Trip.find(params[:id])
respond_to do |format|
if user_can_modify(@trip) and @trip.update_attributes(params[:trip])
format.html { redirect_to(@trip, :notice => 'Trip was successfully updated.') }
format.xml { head :ok }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }
format.json { render :json => @trip.errors.full_messages, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to(@trip, :notice => 'Trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(parse_post params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(parse_post params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rip = Rip.find(params[:id])\n respond_to do |format|\n if @rip.update_attributes(params[:rip])\n format.html { redirect_to rip_url(@rip) }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @rip.errors.to_xml }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n trip = Trip.find(params[:id])\n if trip.update(trip_params)\n redirect_to trip_path\n else\n render :edit, status: :bad_request\n end\n end",
"def trips\n get '/gtfs/trips'\n end",
"def update\n @trip = Trip.find(params[:id])\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to oj_path, notice: 'Trip was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n if @trip_item.update_attributes(params[:trip_item])\n format.html { redirect_to @trip_item, notice: 'Trip item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip_item.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 @trip = Trip.find_by(id: params[:id])\n if @trip.nil?\n head :not_found\n return\n elsif @trip.update(trip_params)\n redirect_to trip_path\n end\n end",
"def update\n @gtfs_trip = GtfsTrip.find(params[:id])\n\n respond_to do |format|\n if @gtfs_trip.update_attributes(params[:gtfs_trip])\n format.html { redirect_to(@gtfs_trip, :notice => 'Gtfs trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n @ministry = @trip.ministry\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n #flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n @data_files = DataFile.find(:all, :order => :name)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip_story = TripStory.find(params[:id])\n\n respond_to do |format|\n if @trip_story.update_attributes(params[:trip_story])\n flash[:notice] = 'TripStory was successfully updated.'\n format.html { redirect_to(@trip_story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip_story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n if @trips_connect.update_attributes(params[:trips_connect])\n format.html { redirect_to @trips_connect, notice: 'Trips connect was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trips_connect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n if @trip_feature.update_attributes(params[:trip_feature])\n format.html { redirect_to(@trip_feature, :notice => 'TripFeature was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip_feature.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 edit\n @trip = Trip.find(params[:id])\n end",
"def put(*args)\n request :put, *args\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @trip = Trip.find(params[:id])\n if current_user.has_permission?(:trips)\n @trip.accessible = :all\n end\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to [:admin, @trip], :notice => \"Trip was successfully updated.\" }\n else\n flash[:error] = \"Trip was not updated.\"\n format.html { render active_admin_template(:edit) }\n end\n end\n end",
"def update\n @field_trip = FieldTrip.find(params[:id])\n\n respond_to do |format|\n if @field_trip.update_attributes(params[:field_trip])\n format.html { redirect_to(@field_trip, :notice => 'Field trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @field_trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n @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 respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to trips_path, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def put!\n request! :put\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 @trip = Trip.find(params[:id])\n @trip.assign_attributes(trip_params)\n\n if @trip.save\n redirect_to passenger_trip_path(@trip.passenger_id, @trip.id)\n end\n end",
"def set_trip\r\n @trip = Trip.find(params[:id])\r\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def update\n @trip = Trip.find(params[:id])\n #params[:trip][:participations] ||=[]\n respond_to do |format|\n if @trip.owner_id == current_user.id && @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.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 respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @snippit = Snippit.find(params[:id])\n\n respond_to do |format|\n if @snippit.update_attributes(params[:snippit])\n format.html { redirect_to(@snippit, :notice => 'Snippit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snippit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @sti = Sti.find(params[:id])\n\n respond_to do |format|\n if @sti.update_attributes(params[:sti])\n flash[:notice] = 'Sti was successfully updated.'\n format.html { redirect_to(@sti) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sti.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def set_trip\n \t@trip = Trip.find(params[:id])\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def set_trip\n @trip = current_user.trips.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params['id'])\n end",
"def update\n @tape = Tape.find(params[:id])\n\n respond_to do |format|\n if @tape.update_attributes(params[:tape])\n flash[:notice] = 'Tape was successfully updated.'\n format.html { redirect_to(@tape) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tape.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @taxi = Taxi.find(params[:id])\n\n respond_to do |format|\n if @taxi.update_attributes(params[:taxi])\n format.html { redirect_to @taxi, notice: 'Taxi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n else\n format.html { render :index }\n end\n end\n end",
"def update\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n if @troop.update_attributes(params[:troop])\n format.html { redirect_to @troop, notice: 'Troop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\n end",
"def set_trip\n @trip = Trip.find(params[:id])\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 trip_url(@user.trips.last.id), notice: 'User 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 authorize @trip, :update?\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource @ride, ride_params\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def set_trip\n @trip = Trip.find(params[:trip_id])\n end",
"def update\n Trip.transaction do\n trip_params[:segments_attributes].each do |seg_params|\n segment = nil\n if !seg_params[:id].nil?\n segment = Segment.find(seg_params[:id])\n segment.update(:order => seg_params[:order],\n :transportation => seg_params[:transportation])\n else\n segment = Segment.new\n segment.order = seg_params[:order]\n segment.transportation = seg_params[:transportation]\n segment.trip = @trip\n segment.save!\n end\n seg_params[:locations_attributes].each do |loc_params|\n if !loc_params[:id].nil?\n location = Location.find(loc_params[:id])\n location.segment = segment\n location.update(loc_params)\n else\n location = Location.new(loc_params)\n location.segment = segment\n location.save!\n end\n end\n end\n if !trip_params[:destroyed].nil?\n trip_params[:destroyed].each do |id|\n segment = Segment.find(id)\n segment.destroy\n end\n end\n @trip.validated = true\n @trip.save!\n end\n flash[:notice] = 'Trip updated successfully.'\n flash.keep(:notice)\n render :status => 200, :json => { :success => true }\n rescue\n flash[:error] = 'Trip update failed. Please try again'\n flash.keep(:error)\n render :status => 400, :json => { :success => false }\n end",
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end"
] | [
"0.6216352",
"0.6210457",
"0.6210457",
"0.6115239",
"0.6048212",
"0.5921058",
"0.58874875",
"0.5873431",
"0.5873431",
"0.58534455",
"0.57654846",
"0.5761491",
"0.57256335",
"0.57152385",
"0.57075423",
"0.5695536",
"0.5679363",
"0.5652797",
"0.5652144",
"0.56412137",
"0.5596418",
"0.5547894",
"0.55422944",
"0.5533686",
"0.5523773",
"0.5522829",
"0.55142206",
"0.55100346",
"0.5504479",
"0.5501675",
"0.5498435",
"0.5496876",
"0.5490439",
"0.548814",
"0.5486262",
"0.5482835",
"0.54770625",
"0.5474985",
"0.547171",
"0.547171",
"0.547171",
"0.5471664",
"0.54642236",
"0.54642236",
"0.54642236",
"0.54642236",
"0.54642236",
"0.54642236",
"0.5459473",
"0.5458512",
"0.5458512",
"0.5455952",
"0.54493004",
"0.544463",
"0.5440611",
"0.5439799",
"0.5439799",
"0.543687",
"0.5433667",
"0.54268557",
"0.5424849",
"0.5412023",
"0.5406656",
"0.54051006",
"0.53840566",
"0.53742695",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53741914",
"0.53730404",
"0.53685224",
"0.53681",
"0.536232",
"0.53554523",
"0.53554523",
"0.53554523",
"0.53522116",
"0.5351359",
"0.5335191"
] | 0.5560466 | 21 |
DELETE /trips/1 DELETE /trips/1.xml | def destroy
@trip = Trip.find(params[:id])
respond_to do |format|
if user_can_modify(@trip) and @trip.destroy
format.html { redirect_to(trips_url) }
format.xml { head :ok }
else
flash[:error] = "It appears you attempted to delete a suggestion that you did not create. Perhaps you need to log in?"
format.html { redirect_to root_path }
format.xml { head :ok }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(trips_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @trip = Trips.find_trip( params[ :id ])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @gtfs_trip = GtfsTrip.find(params[:id])\n @gtfs_trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @field_trip = FieldTrip.find(params[:id])\n @field_trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(field_trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @ministry = @trip.ministry\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(@ministry) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n\n head :no_content\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = Trip.find(params[:id])\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to profile_trips_path(@profile) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trips_connect = TripsConnect.find(params[:id])\n @trips_connect.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_connects_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @trip_item = TripItem.find(params[:id])\n @trip_item.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_items_url }\n format.json { head :no_content }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destory\n @trip = Trips.delete_trip( params[ :id ] )\n flash[:notice] = \"Trip Deleted successfuly\"\n redirect_to(:action => 'list')\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to @trip.parent || trips_url, change: 'trip' }\n format.json { head :no_content }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @trip = Trip.find_by(id: params[:id])\n \n if @trip.nil?\n return\n end\n @trip.destroy\n redirect_to trips_path\n return\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def destroy\n @trip_story = TripStory.find(params[:id])\n @trip_story.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_stories_url) }\n format.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\n end\n end",
"def delete\n @trip = Trip.find_by(deletion_token: params[:id])\n if @trip\n if @trip.soft_delete!\n # do nothing, render update page\n else\n render :not_found # let's give no information on this error to the internet\n end\n else\n render :not_found # let's give no information on this error to the internet\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip_feature = TripFeature.find(params[:id])\n @trip_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_features_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n trip = Trip.find(params[:id])\n trip.destroy\n render json: {message: \"Successfully deleted trip\"}\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @trip_enrollment = TripEnrollment.find(params[:id])\n @trip_enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_enrollments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @trip.destroy\r\n redirect_to trips_path, notice: 'Trip was successfully removed.'\r\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @settlement = @transaction.settlements.find(params[:id])\n @settlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_transaction_settlements_url(@client, @transaction)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize @trip, :destroy?\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tape = Tape.find(params[:id])\n @tape.destroy\n\n respond_to do |format|\n format.html { redirect_to(tapes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n# @trip_report = TripReport.find(params[:id])\n# @trip_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_reports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @travel = Travel.find(params[:id])\n @travel.destroy\n\n respond_to do |format|\n format.html { redirect_to(travels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @travel = Travel.find(params[:id])\n @travel.destroy\n\n respond_to do |format|\n format.html { redirect_to(travels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, alert: \"L'itinéraire a été supprimé.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bp_triple = BpTriple.find(params[:id])\n @bp_triple.destroy\n\n respond_to do |format|\n format.html { redirect_to(bp_triples_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy\n @trivia_item = Trivia.find(params[:id])\n @trivia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(trivia_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @trivia = Trivia.find(params[:id])\n @trivia.destroy\n\n respond_to do |format|\n format.html { redirect_to(trivias_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @trip = Trip.find_by(deletion_token: params[:token])\n if @trip\n if @trip.soft_delete!\n render :show, notice: \"Votre annonce est supprimée. Pour annuler cliquez ici: <a href='/trips/@trip.id/confirm?confirmation_token: #{@trip.confirmation_token}'>Annuler</a>\"\n else\n render :not_found # let's give no information on this error to the internet\n end\n else\n render :not_found # let's give no information on this error to the internet\n end\n end",
"def destroy\n\t\t@trip = @user.organized_trips.find(params[:id])\n\t\t@trip.destroy\n\t\trespond_with @trip\n\tend",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def destroy\n @tire = Tire.find(params[:id])\n @tire.destroy\n\n respond_to do |format|\n format.html { redirect_to(tires_url) }\n format.xml { head :ok }\n end\n end",
"def delete(*uris); end",
"def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n @tipo_restaurante.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_restaurantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # DELETE\n # TODO: removes a specific restaurant\n DB.execute(\"DELETE FROM restaurants WHERE id = #{@id}\")\n nil\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n\n # set the @traveler variable\n get_traveler\n # set the @trip variable\n get_trip\n \n if @trip\n @trip.planned_trips.each do |pt| \n pt.itineraries.each { |x| x.destroy }\n end\n @trip.planned_trips.each { |x| x.destroy }\n @trip.trip_places.each { |x| x.destroy}\n @trip.destroy\n message = t(:trip_was_successfully_removed)\n else\n render text: t(:error_404), status: 404\n return\n end\n\n respond_to do |format|\n format.html { redirect_to(user_planned_trips_path(@traveler), :flash => { :notice => message}) } \n format.json { head :no_content }\n end\n \n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete\n request(:delete)\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n @ptid = Ptid.find(params[:id])\n @ptid.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptids_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\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 delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, flash: {success: \"Trip was successfully deleted.\" } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sti = Sti.find(params[:id])\n @sti.destroy\n\n respond_to do |format|\n format.html { redirect_to(stis_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @tso = Tso.find(params[:id])\n @tso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tsos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_all(xpath); end",
"def destroy\n @tcliente = Tcliente.find(params[:id])\n @tcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tclientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to user_trips_url(@user) }\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 # First delete trip's permissions.\n @trip.permissions.each do |perm|\n perm.destroy\n end\n\n # Then delete the trip itself.\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @rep = Rep.find(params[:id])\n @rep.destroy\n\n respond_to do |format|\n format.html { redirect_to(reps_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7081429",
"0.7081429",
"0.7081429",
"0.6829502",
"0.65826833",
"0.6540821",
"0.65368223",
"0.6535535",
"0.64503074",
"0.6418653",
"0.6414347",
"0.6414347",
"0.639877",
"0.6387876",
"0.6387876",
"0.6387876",
"0.63117677",
"0.62694466",
"0.62405735",
"0.62405735",
"0.62405735",
"0.62035984",
"0.61998403",
"0.6197664",
"0.6195576",
"0.61914736",
"0.6187417",
"0.61760527",
"0.6171487",
"0.61669",
"0.6164484",
"0.6155197",
"0.6155002",
"0.61504394",
"0.61504394",
"0.6140823",
"0.6136554",
"0.61284405",
"0.6126464",
"0.61250776",
"0.61147285",
"0.60985714",
"0.6097972",
"0.6097629",
"0.6065352",
"0.60465443",
"0.60429984",
"0.6039422",
"0.60384816",
"0.602624",
"0.6025202",
"0.6025202",
"0.6025202",
"0.6025202",
"0.6025202",
"0.6025202",
"0.6025202",
"0.6024059",
"0.60225374",
"0.60225374",
"0.6018292",
"0.60168195",
"0.5981998",
"0.59813595",
"0.5981051",
"0.59793943",
"0.5974223",
"0.5973841",
"0.5969705",
"0.59678257",
"0.59678257",
"0.59678257",
"0.59656435",
"0.5961245",
"0.5960459",
"0.5954793",
"0.5954676",
"0.5951358",
"0.59508854",
"0.59502",
"0.5947241",
"0.5945053",
"0.59409356",
"0.59352124",
"0.5932639",
"0.5928967",
"0.59270567",
"0.5919624",
"0.59184366",
"0.5917238",
"0.5913971",
"0.59102446",
"0.5908858",
"0.5908833",
"0.59045184",
"0.59039503",
"0.5903671",
"0.5898952",
"0.5896909",
"0.588849"
] | 0.60874635 | 44 |
alive PRs above ============= | def test_library_book_shop_prs
CartoCSSHelper::VisualDiff.visualise_on_synthethic_data({ 'shop' => 'books', 'name' => 'ÉÉÉÉÉÉ ÉÉÉÉÉÉ' }, 'node', false, 22..22, 'also_shop', 'master')
n = 6
skip = 3
locator = CartoCSSHelper::LocateTagsInsideLoadedDatabases.new({ 'shop' => 'books' }, skip: skip)
diff_on_loaded_database(location_provider: locator, to: 'also_shop', from: 'master', zlevels: 16..19, image_size: 375, count: n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending?; end",
"def query_pull_requests\n # This line is where we want to add :accept => 'application/vnd.github.shadow-cat-preview+json' for draft PRs\n pull_requests = github_query(@client) { @client.pull_requests(@repository, :state => 'open', :per_page => 50) }\n\n @pull_request_details = []\n\n pull_requests.each do |p|\n issue = github_query(@client) { @client.issue(@repository, p.number) }\n\n $logger.debug(\"Issue loaded: #{issue}\")\n\n notification_users = Set.new\n\n notification_users << issue.assignee.login if issue.assignee\n\n notification_users << p.user.login if p.user.login\n\n aging_pull_requests_notify = true\n aging_pull_requests_num_days = 7\n\n # TODO: p.head.repo can be null if the fork repo is deleted. Need to protect that here.\n if p.head.repo.nil?\n $logger.info(\"Skipping potential PR (#{p.number}): Forked repo is null (deleted?)\")\n else\n begin\n pb = PotentialBuild.new(@client, @token, p.head.repo.full_name, nil, p.head.sha, p.head.ref, p.head.user.login, nil, nil, p.number, p.base.repo.full_name, p.base.ref)\n configured_notifications = pb.configuration.notification_recipients\n unless configured_notifications.nil?\n $logger.debug(\"Merging notifications user: #{configured_notifications}\")\n notification_users.merge(configured_notifications)\n end\n\n aging_pull_requests_notify = pb.configuration.aging_pull_requests_notification\n aging_pull_requests_num_days = pb.configuration.aging_pull_requests_numdays\n\n if p.head.repo.full_name == p.base.repo.full_name\n $logger.info(\"Skipping pull-request originating from head repo: #{p.number}\")\n else\n $logger.info(\"Found an external PR to add to potential_builds: #{p.number}\")\n @potential_builds << pb\n end\n rescue DecentCIKnownError => e\n $logger.info(\"Skipping potential PR (#{p.number}): #{e}\")\n rescue => e\n $logger.info(\"Skipping potential PR (#{p.number}): #{e} #{e.backtrace}\")\n end\n end\n # TODO: Should this be here?\n @pull_request_details << {\n :id => p.number,\n :creator => p.user.login,\n :owner => (issue.assignee ? issue.assignee.login : nil),\n :last_updated => issue.updated_at,\n :repo => @repository,\n :notification_users => notification_users,\n :aging_pull_requests_notification => aging_pull_requests_notify,\n :aging_pull_requests_numdays => aging_pull_requests_num_days\n }\n end\n end",
"def backlog; end",
"def backlog; end",
"def probers; end",
"def pending_requests; end",
"def pending_requests; end",
"def pending_requests; end",
"def process_stale_issues\n handle_newly_stale_issues\n handle_stale_and_unmergable_prs\n end",
"def pr_production\n prs = @deploy.changeset.pull_requests\n return nil if prs.empty?\n\n prs.sum { |pr| @deploy.updated_at.to_i - pr.created_at.to_i } / prs.size\n end",
"def review_bottlenecks\n pull_requests = non_reviewed_pull_requests\n notify_review(pull_requests) if pull_requests.length >= config['flow']['pending_pr_to_notify']\n end",
"def cheap_wait; end",
"def released_specs; end",
"def alive?; @alive end",
"def active; end",
"def active; end",
"def next_release\n return @next_release if @next_release\n list = `git branch -a | grep origin\\/RB-`\n list_numbers = []\n list.each do |item|\n item =~ /RB-([0-9].*)/\n list_numbers << $1.to_i\n end\n @next_release = list_numbers.sort.last.to_i + 1\nend",
"def badge; end",
"def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end",
"def prev_pull_requests(pr, action)\n\n if action == 'merged'\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from pull_request_history prh, pull_requests pr\n where prh.action = 'opened'\n and prh.created_at < (select min(created_at) from pull_request_history prh1 where prh1.pull_request_id = ? and prh1.action = 'opened')\n and prh.actor_id = (select min(actor_id) from pull_request_history prh1 where prh1.pull_request_id = ? and prh1.action = 'opened')\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = (select pr1.base_repo_id from pull_requests pr1 where pr1.id = ?);\n QUERY\n\n pull_reqs = db.fetch(q, pr[:id], pr[:id], pr[:id]).all\n pull_reqs.reduce(0) do |acc, pull_req|\n if not @close_reason[pull_req[:pullreq_id]].nil? and @close_reason[pull_req[:pullreq_id]][1] != :unknown\n acc += 1\n end\n acc\n end\n else\n q = <<-QUERY\n select pr.pullreq_id, prh.pull_request_id as num_pull_reqs\n from pull_request_history prh, pull_requests pr\n where prh.action = ?\n and prh.created_at < (select min(created_at) from pull_request_history prh1 where prh1.pull_request_id = ?)\n and prh.actor_id = (select min(actor_id) from pull_request_history prh1 where prh1.pull_request_id = ? and action = ?)\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = (select pr1.base_repo_id from pull_requests pr1 where pr1.id = ?);\n QUERY\n db.fetch(q, action, pr[:id], pr[:id], action, pr[:id]).all.size\n end\n end",
"def active_instances; end",
"def workload(pr)\n q = <<-QUERY\n select count(distinct(prh.pull_request_id)) as num_open\n from pull_request_history prh, pull_requests pr, pull_request_history prh3\n where prh.created_at < prh3.created_at\n and prh.action = 'opened'\n and pr.id = prh.pull_request_id\n and prh3.pull_request_id = ?\n and (exists (select * from pull_request_history prh1\n where prh1.action = 'closed'\n and prh1.pull_request_id = prh.pull_request_id\n and prh1.created_at > prh3.created_at)\n or not exists (select * from pull_request_history prh1\n where prh1.action = 'closed'\n and prh1.pull_request_id = prh.pull_request_id)\n )\n and pr.base_repo_id = (select pr3.base_repo_id from pull_requests pr3 where pr3.id = ?)\n QUERY\n db.fetch(q, pr[:id], pr[:id]).first[:num_open]\n end",
"def work_in_progress\n has_wip_label = danger_file.github.pr_labels.any? { |label| label.include? 'WIP' }\n has_wip_title = danger_file.github.pr_title.include? '[WIP]'\n\n danger_file.warn('PR is classed as Work in Progress') if has_wip_label || has_wip_title\n end",
"def enter_pending; end",
"def pausable; end",
"def releases\n Release.branch(self)\n end",
"def pending_response_requests; end",
"def outdated; end",
"def p_request_issues(ris)\n quietly do\n dis = ris.first.decision_review.decision_issues\n puts \"---- #{ris.count} RequestIssues with #{dis.count} DecisionIssues\"\n ris.order(:id).each_with_index do |ri, i|\n p_request_issue(ri, i)\n end.map(&:to_s)\n dis\n puts \"^^^^^^^^^^^^^^^^^^^^\"\n end\nend",
"def prerelease_specs; end",
"def frame_managers(_pry_); end",
"def process_pull_requests(merge_pretest_success)\n pull_requests = []\n mergeability_in_flux = false\n pull_request_statuses = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = {} } }\n $repo_to_pull_regex.keys.each do |repo|\n $stderr.puts \"\\nProcessing repo '#{repo}'\"\n pull_request_statuses[:closed_prs][repo] = \"#{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pulls?q=is%3Apr+is%3Aclosed\"\n list_pull_requests(repo).each do |req|\n id = req['number']\n $stderr.puts \"Analyzing pull request: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pull/#{id}\"\n\n branch = req['base']['ref']\n\n # We only want to consider pull requests into branches we care about\n if $branches.include?(branch) || $branches.include?('*')\n\n $stderr.puts \" Updated at: #{req['updated_at']}\"\n # We only want to consider pull requests that have been modified in\n # the last twelve hours, to stop us from doing extra work when we\n # don't need to. Also, just to ensure that we don't forget a pull\n # request forever on accident, there is a 10% chance we'll consider\n # a pull request even if it is inactive\n if Time.now - Time.parse(req['updated_at']) < (12*60*60) || (rand(20) < 1)\n login = req['user']['login']\n comments = nil\n # Skip if it's not mergeable\n mergeable = is_mergeable?(id, repo)\n $stderr.puts \" Mergeable: #{mergeable}\"\n if mergeable\n comments = get_comments(id, repo) if comments.nil?\n set_mergeable(id, repo, login, comments)\n else\n if set_not_mergeable(id, repo, login) == MERGEABLE\n mergeability_in_flux = true\n end\n next\n end\n\n comments = get_comments(id, repo) if comments.nil?\n\n # We only want to consider pull requests where the last trigger we found\n # is from a trusted user\n permission_denied = Array.new(Properties['settings'].length, false)\n # Has a merge or test been requested by a trusted user?\n Properties['settings'].values.each_with_index do |settings, i|\n updated_at, changed_after_eval = get_updated_at(req, comments, settings)\n trigger_regex = /\\[#{settings['name']}\\]/i\n if req['title'] =~ trigger_regex || req['body'] =~ trigger_regex\n if user_trusted?(login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, comments, settings]\n permission_denied[i] = false\n next\n else\n $stderr.puts \" User '#{login}' not trusted\"\n permission_denied[i] = true\n end\n end\n\n comments = sort_comments(comments)\n comments.each do |comment|\n if comment['body'] =~ trigger_regex\n comment_login = comment['user']['login']\n if user_trusted?(comment_login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, comments, settings]\n permission_denied[i] = false\n break\n else\n $stderr.puts \" User '#{comment_login}' not trusted\"\n permission_denied[i] = true\n end\n end\n end\n end\n if permission_denied.include? true\n create_or_update_comment(id, repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n end\n else\n $stderr.puts \" Skipping due to age and inactivity\"\n end\n else\n create_or_update_comment(id, repo, ACTION_PREFIX, ACTION_UNSUPPORTED_BRANCH)\n end\n end\n end\n\n if mergeability_in_flux\n $stderr.puts \"Waiting till next run to see if mergeability is in flux\"\n exit\n end\n\n # Consider the pull requests we have deemed valid in\n # order of the time they were last updated, oldest first\n sorted_pull_requests = pull_requests.sort_by do |req_info|\n req_info[1]\n end\n\n skipped_count = {}\n $branches.each do |branch|\n skipped_count[branch] = {}\n end\n\n # If we're only allowing sequential tests in this tag, we want to find\n # any pull request in the 'running tests' state and signal that there\n # is a test running.\n sorted_pull_requests.each do |req_info|\n req = req_info[0]\n comments = req_info[3]\n settings = req_info[4]\n branch = req['base']['ref']\n\n if !settings['allow_multiple']\n comments.each do |comment|\n begin\n fields = extract_bot_comment_fields(comment['body'], settings)\n if (comment['user']['login'] == Properties['bot_github_user']) && fields[:state] == :running\n submitted_tests = submitted_tests_for_branch(branch)\n submitted_tests[settings['name']] = true\n break\n end\n rescue Exception => e\n next\n end\n end\n end\n end\n\n sorted_pull_requests.each do |req_info|\n # Process the pull request\n req = req_info[0]\n updated_at = req_info[1]\n changed_after_eval = req_info[2]\n comments = req_info[3]\n settings = req_info[4]\n branch = req['base']['ref']\n repo = req['base']['repo']['name']\n\n process_pull_request(req, updated_at, changed_after_eval, comments, settings, merge_pretest_success)\n\n submitted_tests = submitted_tests_for_branch(branch)\n\n if !settings['allow_multiple'] && submitted_tests[settings['name']]\n # If we're only allowing sequential tests on this tag and there is a test running,\n # and we are waiting to test, we need to correctly determine the position in the\n # test queue that we are at and post it in a bot comment on the pull request\n comments = get_comments(req['number'], repo)\n\n bot_comment = get_comment_with_prefix(req['number'], repo, settings['test_prefix'], comments)\n if bot_comment\n fields = extract_bot_comment_fields(bot_comment['body'], settings)\n if (waiting_in_queue_state?(fields[:state]))\n skipped_count_branch = skipped_count[branch] ? skipped_count[branch] : skipped_count['*']\n skipped_count_branch[settings['name']] = 0 if skipped_count_branch[settings['name']].nil?\n skipped_count_branch[settings['name']] += 1\n queued_comment = compose_bot_comment(settings['test_prefix'], :state => :wait_in_queue, :content => waiting_in_queue_comment_segment(skipped_count_branch[settings['name']].to_s))\n pull_request_statuses[:enqueued][req['html_url']][:title] = req['title'].force_encoding(\"UTF-8\")\n pull_request_statuses[:enqueued][req['html_url']][:queue_pos] = skipped_count_branch[settings['name']]\n pull_request_statuses[:enqueued][req['html_url']][:repo] = repo\n create_or_update_comment(req['number'], repo, settings['test_prefix'], queued_comment , comments)\n $stderr.puts \" Pull ##{req['number']} in repo '#{repo}' is at build position ##{skipped_count_branch[settings['name']]}\"\n # Get ahead of the game and pretest requests\n if settings['pretest_settings_key'] && settings['pretest_comment'] && settings['pretest_queue_threshold'] && (skipped_count_branch[settings['name']] >= settings['pretest_queue_threshold'])\n trusted_trigger_time, _ = get_trusted_trigger_time(req, comments, Properties['settings'][settings['pretest_settings_key']])\n create_or_update_comment(req['number'], repo, settings['pretest_comment'].gsub('[', '\\[').gsub(']', '\\]'), settings['pretest_comment'], comments) unless trusted_trigger_time\n end\n elsif fields[:state] == :running\n pull_request_statuses[:running][req['html_url']][:title] = req['title'].force_encoding(\"UTF-8\")\n pull_request_statuses[:running][req['html_url']][:status] = \"merging\"\n pull_request_statuses[:running][req['html_url']][:repo] = repo\n end\n end\n end\n end\n # Commit merge queue records to disk\n IO.write(MERGE_QUEUE_RECORD, pull_request_statuses.to_json, {:mode => 'w'})\n end",
"def is_alive;\t@alive \t\tend",
"def check_for_release\n\t \tcheck_count = 0\n\t \tmax_checks = configatron.lending_club.max_checks\n\t \tstarting_loan_list_size = fresh_loan_list.values[1].size\n\t \tputs \"starting_loan_list_size: #{starting_loan_list_size}\"\n\t \twhile check_count < max_checks\n\t \t\tcheck_count = check_count + 1\n\t \t\tputs \"check_for_release #{check_count}\"\n\t \t\tcurrent_loan_list_size = fresh_loan_list.values[1].size\n\t \t\tputs \"current_loan_list_size: #{current_loan_list_size}\"\n\t \t\tif current_loan_list_size > starting_loan_list_size \n\t \t\t\tputs \"Loans have been released. Preparing to purchasing loans.\"\n\t \t\t\t@pb.add_line(\"Pre-Filtered Loan Count: #{current_loan_list_size}\")\n\t \t\t\treturn true\n\t \t\tend\n\t \t\tputs \"Pre-Filtered Loan Count: #{current_loan_list_size}\"\n\t \t\tsleep(1) # wait X seconds before checking again\n\t \tend\n\t \t@pb.add_line(\"After #{check_count} checks the number of available loans remained at or below #{starting_loan_list_size}.\")\n\t \treturn false\n\t end",
"def pull; end",
"def production_curtailment; end",
"def reap; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def process_pull_request(pr, lang)\n\n # Statistics across pull request commits\n stats = pr_stats(pr)\n merged = !pr[:merged_at].nil?\n git_merged, merge_reason, merge_person = @close_reason[pr[:github_id]]\n\n # Count number of src/comment lines\n src = src_lines(pr[:id].to_f)\n\n if src == 0 then raise Exception.new(\"Bad src lines: 0, pr: #{pr[:github_id]}, id: #{pr[:id]}\") end\n\n months_back = 3\n commits_incl_prs = commits_last_x_months(pr, false, months_back)\n prev_pull_reqs = prev_pull_requests(pr,'opened')\n\n # Create line for a pull request\n {\n :pull_req_id => pr[:id],\n :project_name => \"#{pr[:login]}/#{pr[:project_name]}\",\n :lang => lang,\n :github_id => pr[:github_id],\n :created_at => Time.at(pr[:created_at]).to_i,\n :merged_at => merge_time(pr, merged, git_merged),\n :closed_at => Time.at(pr[:closed_at]).to_i,\n :lifetime_minutes => pr[:lifetime_minutes],\n :mergetime_minutes => merge_time_minutes(pr, merged, git_merged),\n :merged_using => merge_reason.to_s,\n :conflict => conflict?(pr),\n :forward_links => forward_links?(pr),\n :team_size => team_size_at_open(pr, months_back),\n :num_commits => num_commits(pr),\n :num_commits_open => num_commits_at_open(pr),\n :num_pr_comments => num_pr_comments(pr),\n :num_issue_comments => num_issue_comments(pr),\n :num_commit_comments => num_commit_comments(pr),\n :num_comments => num_pr_comments(pr) + num_issue_comments(pr) + num_commit_comments(pr),\n :num_participants => num_participants(pr),\n :files_added => stats[:files_added],\n :files_deleted => stats[:files_removed],\n :files_modified => stats[:files_modified],\n :files_changed => stats[:files_added] + stats[:files_modified] + stats[:files_removed],\n :src_files => stats[:src_files],\n :doc_files => stats[:doc_files],\n :other_files => stats[:other_files],\n :perc_external_contribs => commits_last_x_months(pr, true, months_back) / commits_incl_prs,\n :sloc => src,\n :src_churn => stats[:lines_added] + stats[:lines_deleted],\n :test_churn => stats[:test_lines_added] + stats[:test_lines_deleted],\n :commits_on_files_touched => commits_on_files_touched(pr, months_back),\n :commits_to_hottest_file => commits_to_hottest_file(pr, months_back),\n :test_lines_per_kloc => (test_lines(pr[:id]).to_f / src.to_f) * 1000,\n :test_cases_per_kloc => (num_test_cases(pr[:id]).to_f / src.to_f) * 1000,\n :asserts_per_kloc => (num_assertions(pr[:id]).to_f / src.to_f) * 1000,\n :watchers => watchers(pr),\n :requester => requester(pr),\n :closer => closer(pr),\n :merger => merge_person,\n :prev_pullreqs => prev_pull_reqs,\n :requester_succ_rate => if prev_pull_reqs > 0 then prev_pull_requests(pr, 'merged').to_f / prev_pull_reqs.to_f else 0 end,\n :followers => followers(pr),\n :intra_branch => if intra_branch?(pr) == 1 then true else false end,\n :main_team_member => main_team_member?(pr, months_back),\n :social_connection_tsay => social_connection_tsay?(pr),\n :hotness_vasilescu => hotness_vasilescu(pr, months_back),\n :team_size_vasilescu => team_size_vasilescu(pr, months_back),\n :description_complexity => description_complexity(pr),\n :workload => workload(pr),\n :prior_interaction_issue_events => prior_interaction_issue_events(pr, months_back),\n :prior_interaction_issue_comments => prior_interaction_issue_comments(pr, months_back),\n :prior_interaction_pr_events => prior_interaction_pr_events(pr, months_back),\n :prior_interaction_pr_comments => prior_interaction_pr_comments(pr, months_back),\n :prior_interaction_commits => prior_interaction_commits(pr, months_back),\n :prior_interaction_commit_comments => prior_interaction_commit_comments(pr, months_back),\n :first_response => first_response(pr),\n :ci_latency => ci_latency(pr),\n :ci_errors => ci_errors?(pr),\n :ci_test_failures => ci_test_failures?(pr),\n }\n end",
"def available; end",
"def available; end",
"def ridicule_faultfully_prerevision()\n end",
"def badges\n end",
"def alive?() end",
"def github_released\n puts green(\"Release completed\")\n end",
"def ready; end",
"def ready; end",
"def num_waiting\n end",
"def num_waiting\n end",
"def active?; end",
"def release_status\n return unless DeployGroup.enabled?\n return unless current_version = version(@reference)\n return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence\n\n # code above is hot ... so keep it optimized and re-fetch here only if something bad was found\n interfering_stage_ids = deploy_scope.where(reference: higher_references).pluck(:stage_id)\n interfering_stages = Stage.where(id: interfering_stage_ids).pluck(:name)\n\n {\n state: \"error\", # `pending` is also supported in deploys.js, but that seems even worse\n statuses: [{\n state: \"Old Release\",\n description:\n \"#{higher_references.join(', ')} was deployed to deploy groups in this stage\" \\\n \" by #{interfering_stages.join(\", \")}\"\n }]\n }\n end",
"def release_status\n return unless DeployGroup.enabled?\n return unless current_version = version(@reference)\n return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence\n\n # code above is hot ... so keep it optimized and re-fetch here only if something bad was found\n interfering_stage_ids = deploy_scope.where(reference: higher_references).pluck(:stage_id)\n interfering_stages = Stage.where(id: interfering_stage_ids).pluck(:name)\n\n {\n state: \"error\", # `pending` is also supported in deploys.js, but that seems even worse\n statuses: [{\n state: \"Old Release\",\n description:\n \"#{higher_references.join(', ')} was deployed to deploy groups in this stage\" \\\n \" by #{interfering_stages.join(\", \")}\"\n }]\n }\n end",
"def active_remotes; end",
"def running?; @alive end",
"def check_status\n #binding.pry #TODO: set date_activated/ date_inactive\n return\n end",
"def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`\n result.message << \"Head Branch check |\"\n is_from_feature = github.branch_for_head.start_with?(\"feature/\")\n is_from_refactor = github.branch_for_head.start_with?(\"refactor/\")\n is_from_fix = github.branch_for_head.start_with?(\"fix/\")\n is_from_issue = github.branch_for_head.start_with?(\"issue/\")\n is_from_version = github.branch_for_head.start_with?(\"version/\")\n if is_from_feature || is_from_refactor || is_from_fix || is_from_issue || is_from_version\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR from a from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `develop` branch\n result.message << \"Base Branch check |\"\n is_to_develop = github.branch_for_base == \"develop\"\n if is_to_develop\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR to `develop` branch.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## If PR is sent from a branch that begins with `version/`, do a release modification check\n if is_from_version\n release_modification_check_into_result(result)\n end\n\n ## PR shouldn't contain any merge commits\n result.message << \"Merge Commits check |\"\n contains_merge_commits = git.commits.any? { |c| c.parents.length > 1 }\n unless contains_merge_commits\n result.message << \":o:\\n\"\n else\n fail \"Please don't contain any merge commits in the branch. Consider Rebase if required.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should have less than 1000 lines of modifications if possible.\n result.message << \"Modification Volumn check |\"\n is_fix_too_big = git.lines_of_code > 1_000\n unless is_fix_too_big\n result.message << \":o:\\n\"\n else\n warn \"Too many modifications. Please consider splitting the PR if possible.\"\n result.message << \":heavy_exclamation_mark:\\n\"\n result.warnings += 1\n end\n\n return result\n\nend",
"def used?; end",
"def global_check\n\n #did release checking\n dids = Did.closed.all\n for did in dids\n if did.closed_till < Time.now\n did.status = \"free\"\n did.user_id = 0\n did.device_id = 0\n did.save\n end\n end\n end",
"def announce; end",
"def remaining; end",
"def internship_passed; end",
"def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend",
"def fetch_closed_pull_requests\n pull_requests = []\n options = { state: \"closed\" }\n\n page_i = 0\n count_pages = calculate_pages(@client, \"pull_requests\", options)\n\n iterate_pages(@client, \"pull_requests\", options) do |new_pr|\n page_i += PER_PAGE_NUMBER\n log_string = \"Fetching merged dates... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\"\n print_in_same_line(log_string)\n pull_requests.concat(new_pr)\n end\n print_empty_line\n\n Helper.log.info \"Pull Request count: #{pull_requests.count}\"\n pull_requests.map { |pull_request| stringify_keys_deep(pull_request.to_hash) }\n end",
"def previous_preapprovals_for_pull_request\n previous_preapproved_images = {}\n self.project.pull_requests(self.pull_request_number).each do |build|\n next if build == self\n\n build.test_images.where(image_pull_request_number: self.pull_request_number).where.not(image_pull_request_sha: nil).each do |image|\n previous_preapproved_images[image.test_key] = image\n end\n end\n previous_preapproved_images\n end",
"def villian; end",
"def current_pr_for_branch(repo, branch)\n prs = pull_requests_for_branch(repo, branch)\n raise \"Multiple (#{prs.size}) open PRs for #{branch} found in #{repo}, unable to proceed\" if prs.size > 1\n prs.first\n end",
"def waiting; end",
"def waiting; end",
"def pid; end",
"def pid; end",
"def pid; end",
"def description_complexity(pr)\n pull_req = pull_req_entry(pr[:id])\n (pull_req['title'] + ' ' + pull_req['body']).gsub(/[\\n\\r]\\s+/, ' ').split(/\\s+/).size\n end",
"def set_pr_status(pull_status_url,state,target_url,description)\n url = pull_status_url\n payload = {\n state: state,\n target_url: target_url,\n description: description\n }\n RestClient.post(\n url,\n payload.to_json,\n @git_headers\n )\n end",
"def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend",
"def release_pr_check\n\n result = CheckResult.new(\"Release PR Check Result\")\n\n ## PR should be sent from `develop` branch\n result.message << \"Head Branch check |\"\n is_from_develop = github.branch_for_head == \"develop\"\n if is_from_develop\n result.message += \":o:\\n\"\n else\n fail \"Please send the PR from `develop` branch.\"\n result.message += \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `master` branch\n result.message << \"Base Branch check |\"\n is_to_master = github.branch_for_base == \"master\"\n if is_to_master\n result.message += \":o:\\n\"\n else\n fail \"Please send the PR to `master` branch.\"\n result.message += \":x:\\n\"\n result.errors += 1\n end\n\n ## Release modification check\n release_modification_check_into_result(result)\n\n return result\n\nend",
"def referenced; end",
"def masterwork_prob_bonus; 0; end",
"def watchers(pr)\n q = <<-QUERY\n select count(w.user_id) as num_watchers\n from watchers w, pull_requests pr, pull_request_history prh\n where prh.pull_request_id = pr.id\n and w.created_at < prh.created_at\n and w.repo_id = pr.base_repo_id\n and prh.action='opened'\n and pr.id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:num_watchers]\n end",
"def skip_pr?(pr)\n return false unless pr[:title].include?(SKIP_MERGE)\n\n failure_status(pr, \"Skipping #{pr[:head][:ref]}.\")\n\n true\n end",
"def running; end",
"def running; end",
"def stale_state\n end",
"def ping()\n #This is a stub, used for indexing\n end",
"def check_rbs_availability!; end",
"def released? # for readability\n released\n end",
"def branch; end",
"def prerelease\n self[:draft] == false && self[:prerelease] == true\n end",
"def status(*) end",
"def ping; end",
"def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end",
"def dead?; end",
"def refutal()\n end",
"def now_allocations\n 0\n end"
] | [
"0.59928346",
"0.5909363",
"0.5828025",
"0.5828025",
"0.5815445",
"0.5733575",
"0.5733575",
"0.5733575",
"0.56719023",
"0.56679404",
"0.5664198",
"0.56412005",
"0.55904794",
"0.5586841",
"0.55595",
"0.55595",
"0.55497",
"0.554329",
"0.5538355",
"0.55316156",
"0.552992",
"0.5526991",
"0.55222535",
"0.5506101",
"0.5505476",
"0.5486926",
"0.5471514",
"0.5464228",
"0.5459653",
"0.5435778",
"0.5429171",
"0.54266036",
"0.5423514",
"0.5397362",
"0.5391699",
"0.53897643",
"0.5377069",
"0.5372186",
"0.5372186",
"0.5372186",
"0.5372186",
"0.5372186",
"0.5372186",
"0.5372186",
"0.5372186",
"0.5372186",
"0.53634393",
"0.53484464",
"0.53484464",
"0.53421164",
"0.53256506",
"0.5320049",
"0.52851546",
"0.52824533",
"0.52824533",
"0.5274461",
"0.5274461",
"0.52629715",
"0.5258685",
"0.5258685",
"0.525262",
"0.52513576",
"0.5242422",
"0.52321726",
"0.5229442",
"0.5226114",
"0.52225685",
"0.5197808",
"0.5192119",
"0.51869804",
"0.5185416",
"0.5178625",
"0.51767296",
"0.5176558",
"0.51752204",
"0.51752204",
"0.51712453",
"0.51712453",
"0.51712453",
"0.51703274",
"0.5168959",
"0.5168932",
"0.51670945",
"0.5164181",
"0.5154141",
"0.51528406",
"0.51501805",
"0.5150172",
"0.5150172",
"0.51430774",
"0.5142466",
"0.513798",
"0.51308054",
"0.5128941",
"0.51288265",
"0.51272404",
"0.51252776",
"0.5116492",
"0.5115517",
"0.5114393",
"0.51111436"
] | 0.0 | -1 |
Reload the underlying data for model | def reload
clear_memoizations!
perform_reload
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh\n # re-download the model from the server\n set_model\n end",
"def reload\n self.data = self.class.load_data\n self\n end",
"def reload\n old_data = @data.dup\n self.load\n @data = old_data.merge! @data\n end",
"def reload_data\n reset_collection_data\n reload_collection_data\n end",
"def reload!\n fetch_data!\n end",
"def reload!\n clear_changes_information\n self.exclude_from_save = false\n end",
"def reload!\n @data = reload.raw\n self\n end",
"def reload\n return if new_record?\n refresh\n end",
"def reload\n model = self.class.find(to_remote)\n\n if model.errors?\n add_errors(model.errors)\n else\n copy_from(model)\n persist!\n end\n\n self\n end",
"def reload\n begin_reset_model\n clear\n\n @items_to_models = Hash.new\n @models_to_items = Hash.new\n @names_to_item = Hash.new\n @items_metadata = Hash[self => Metadata.new([], [], Set.new)]\n @resolver_from_model = Hash.new\n\n seen = Set.new\n sorted_roots = @root_models.\n sort_by(&:priority).reverse\n\n sorted_roots.each do |root_model|\n models = discover_model_hierarchy(root_model.model, root_model.categories, root_model.resolver, seen)\n models.each do |m|\n @resolver_from_model[m] = root_model.resolver\n end\n end\n\n rowCount.times do |row|\n compute_and_store_metadata(item(row))\n end\n self.horizontal_header_labels = [\"\"]\n ensure\n end_reset_model\n end",
"def reload\n self.attributes = self.class.find(self.Id).attributes\n self\n end",
"def reload\n return false if !persisted?\n fresh_object = self.class.find(id)\n refresh_data fresh_object.instance_variable_get('@attributes')\n self\n end",
"def reload\n self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data\n end",
"def reload\n @dirty = []\n @cache = Preference.find_all_by_model_type_and_model_id(@model.class.name, @model.id).index_by(&:key)\n end",
"def refresh\n set_attributes\n end",
"def reload\n requires :instance, :identity\n\n data = collection.get(self.instance, self.identity)\n merge_attributes(data.attributes)\n self\n end",
"def refresh\n load if changed?\n end",
"def reload(options = nil)\n clear_changes\n clear_relationships\n clear_composition_cache\n reset_attributes\n unless reload_from_database\n set_deleted_properties\n freeze\n end\n self\n end",
"def reload\n clear_memoizations!\n remove = data.keys.find_all do |k|\n ![:id, :name].include?(k.to_sym)\n end\n remove.each do |k|\n data.delete(k)\n end\n super\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def reload\n requires :instance, :identity\n\n data = collection.get(instance, identity)\n merge_attributes(data.attributes)\n self\n end",
"def reload!\n ensure_service!\n @gapi_json = service.get_model dataset_id, model_id\n @reference = nil\n @exists = nil\n self\n end",
"def reload\n new_attributes = resource.find(self)._attributes_\n @_attributes_ = nil\n mass_assign(new_attributes)\n self\n end",
"def reload_with_clear_original_attributes #:nodoc:\n clear_original_attributes\n reload_without_clear_original_attributes\n end",
"def reload\n raise Couchbase::Error::MissingId, 'missing id attribute' unless @id\n pristine = model.find(@id)\n update_attributes(pristine.attributes)\n @meta[:cas] = pristine.meta[:cas]\n clean!\n self\n end",
"def reload\n reset\n to_a\n self\n end",
"def reload\n begin_reset_model\n @id_to_module = []\n @filtered_out_modules = Set.new\n \n info = discover_module(Object)\n info.id = id_to_module.size\n info.name = title\n update_module_type_info(info)\n info.row = 0\n id_to_module << info\n\n @object_paths = Hash.new\n generate_paths(object_paths, info, \"\")\n ensure\n end_reset_model\n end",
"def reload\n options = { consistent_read: true }\n\n if self.class.range_key\n options[:range_key] = range_value\n end\n\n self.attributes = self.class.find(hash_key, options).attributes\n @associations.values.each(&:reset)\n self\n end",
"def reload\n self\n end",
"def reload\n requires :identity\n\n data = collection.get(identity)\n merge_attributes(data.attributes)\n self\n end",
"def reload\n @instance = nil\n self.instance\n end",
"def reload\n self.attributes = Connection.get(create_route(:get)).body['data']\n self\n end",
"def reload\n refresh\n end",
"def reload\n refresh\n end",
"def reload(options = nil)\n @attributes.update(self.class.find(self.id, options).instance_variable_get('@attributes'))\n self\n end",
"def reload(options = nil)\n self.class.connection.clear_query_cache\n\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { self.class.lock(options[:lock]).find(id) }\n else\n self.class.find(id)\n end\n\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n @new_record = false\n self\n end",
"def reload\n end",
"def reload!\n if data = self.class.load(job_id, job_class)\n @data = data\n end\n self\n end",
"def reload\n @data = self.class.db.single(self.class.table, {:id => @id})\n raise Errno::ENOENT, \"Could not find any data for the object with ID: '#{@id}' in the table '#{self.class.table}'.\" if !@data\n @should_reload = false\n end",
"def reload!\n item = @domain.get_attributes(@key)\n @attributes = item.attributes\n end",
"def reload!\n load force: true\n end",
"def reload(*)\n super.tap do\n @mutations_before_last_save = nil\n @mutations_from_database = nil\n end\n end",
"def reload!\n if saved?\n response = GoodData.get(uri)\n @json = response\n end\n self\n end",
"def refresh!\n load if changed?\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get\n end",
"def reload!\n self.attributes = self.class.real_get(key)\n self\n end",
"def reload!\n self.attributes = self.class.real_get(key)\n self\n end",
"def reload(*)\n super.tap do\n clear_changes_information\n end\n end",
"def reload\n read\n @previous = nil\n self\n end",
"def refresh\n update_attributes_from_id(@id)\n end",
"def save_and_reload! model\n model.save!\n model.reload\nend",
"def reload(*args)\n fresh_object = self.class.find(self.id, *args)\n @attributes.update(fresh_object.instance_variable_get('@attributes'))\n self\n end",
"def refresh_data\n raise NotImplementedError\n end",
"def reload!\n Aura.models.each { |m| m.send :set_columns, nil }\n end",
"def refresh\n @deserialized_values = {}\n super\n end",
"def refresh\n @data = read_data\n end",
"def reload_data\n if can_reload_data?\n self.state = :reloading\n reload_set = subjects.class.new\n data_loader.async.reload_data(reload_set)\n end\n end",
"def reload\n self.load self.class.find(id, @prefix_options).attributes\n end",
"def reload(*)\n super.tap do\n clear_changes_information\n end\n end",
"def reload\n raise \"Can't reload object without id\" if !@id || @id.to_i == 0\n new_obj = self.class.find(@id)\n self.database_fields = new_obj.database_fields\n self.class.table_fields.each {|key| self.send(\"#{key}=\", new_obj.send(key)) }\n end",
"def reload\r\n self.load self.class.find(id, @prefix_options).attributes\r\n end",
"def reload!(conditions = {})\n unless new_record?\n reloaded_object = self.class.find(client, primary_key, scope_parameters, conditions)\n self.attributes.clear\n self.attributes = reloaded_object.attributes\n mark_as_saved!\n end\n\n self\n end",
"def reload_from_rom\n @representation = nil\n clear_cache\n present\n self\n end",
"def reload_data!\n data.merge!(load_data)\n # TODO: after load hooks only run once, not every time reload_data! is called\n run_hook!(:after_load_data)\n # Chainable\n self\n end",
"def reload\n if @self\n @self.reload rescue nil\n @self = nil\n end\n end",
"def _refresh(dataset)\n _refresh_set_values(_refresh_get(dataset) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end",
"def _refresh(dataset)\n _refresh_set_values(_refresh_get(dataset) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end",
"def reload\n @new_info = {}\n read_data\n # run_callbacks_for(:after_load)\n self\n end",
"def reload!\n if new_meta = job_class.get_meta(meta_id)\n @data = new_meta.data\n end\n self\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload!\n end",
"def reload_items\n @item_data = nil\n end",
"def refresh!\n records true\n self\n end",
"def reload\n self.edits.clear\n end",
"def reload_after_odata(options = nil)\n # aggregations.rb\n clear_aggregation_cache\n\n # autosave_association.rb\n @marked_for_destruction = false\n @destroyed_by_association = nil\n\n # associations.rb\n clear_association_cache\n\n # persistence.rb (only 1 line of code chaned in here)\n self.class.connection.clear_query_cache\n\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { self.class.lock(options[:lock]).find(id) }\n else\n # Remove unscope here\n self.class.find(id)\n end\n\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n @new_record = false\n\n # attribute_methods/dirty.rb\n @previous_mutation_tracker = nil\n clear_mutation_trackers\n @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new\n\n self\n end",
"def _refresh(dataset)\n super\n recalculate_values_hashes\n end",
"def reload\n @reloaded = true\n restart\n end",
"def reload\n unless new_record?\n reload_attributes(*loaded_attributes)\n (parent_associations + child_associations).each { |association| association.reload }\n end\n\n self\n end",
"def refresh!\n self.class.find(id)\n end",
"def refresh!\n self.class.find(id)\n end",
"def reload_model(*models)\n models.each &:reload\n end",
"def reload!\n @configuration = nil\n load\n self\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload(params: {}, headers: {})\n @data = self.class.retrieve(id, params: params, headers: headers).to_h\n self\n end",
"def reload!\n get('')[self.class.api_name].each do |attr, value|\n self.send :\"#{attr}=\",value\n end\n end",
"def reload\n end",
"def reload\n end",
"def _save_refresh\n super\n recalculate_values_hashes\n end",
"def after_save\n reload\n end",
"def refresh\n if new_model?\n return WscSdk::Errors.model_does_not_exist(self.endpoint)\n else\n return self.endpoint.refresh(self)\n end\n end"
] | [
"0.8155662",
"0.8036726",
"0.7791224",
"0.77850884",
"0.771851",
"0.76245904",
"0.7586572",
"0.7567339",
"0.75409615",
"0.7474968",
"0.7447054",
"0.7446313",
"0.7319621",
"0.72099227",
"0.71944374",
"0.71546984",
"0.7146751",
"0.7128838",
"0.71270347",
"0.7120487",
"0.7120487",
"0.7112357",
"0.707991",
"0.7075379",
"0.70665926",
"0.7050712",
"0.7006465",
"0.70048845",
"0.6996052",
"0.6965637",
"0.6945038",
"0.69115615",
"0.6909504",
"0.6906732",
"0.6906732",
"0.68838733",
"0.6878197",
"0.6874436",
"0.68682283",
"0.6832157",
"0.6821381",
"0.6817828",
"0.6801613",
"0.6790026",
"0.6789837",
"0.6788842",
"0.67859066",
"0.67859066",
"0.6775173",
"0.6766399",
"0.67660946",
"0.6744715",
"0.6741978",
"0.6732502",
"0.67245364",
"0.66879404",
"0.6682859",
"0.6681793",
"0.6679214",
"0.66778076",
"0.6665227",
"0.66369265",
"0.66306806",
"0.662839",
"0.6625287",
"0.6622879",
"0.661829",
"0.661829",
"0.66045326",
"0.6591348",
"0.6589317",
"0.6589317",
"0.6589317",
"0.6589317",
"0.6589317",
"0.6589317",
"0.6589317",
"0.65823215",
"0.65603167",
"0.6556072",
"0.65556526",
"0.65476173",
"0.65459055",
"0.6543115",
"0.6542624",
"0.65335095",
"0.65335095",
"0.6514731",
"0.65076715",
"0.64873236",
"0.64873236",
"0.64873236",
"0.64873236",
"0.6481076",
"0.6475351",
"0.64652157",
"0.64652157",
"0.64578295",
"0.6443221",
"0.64293164"
] | 0.71832895 | 15 |
Adds an HTTP header to the request | def add_http_header(key, value)
@http_headers[key] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_headers\n @headers.each do |field, value|\n @request_header << \"#{field}: #{value}\"\n end\n end",
"def add_header(header)\n @headers.merge!(header)\n end",
"def add_headers; end",
"def add_header(name, value)\n end",
"def add_header key, value\n\t\t\t@headers ||= {}\n\t\t\t@headers[key] = value\n\t\tend",
"def http_header(field=nil, value=nil)\n @_http_header ||= {}\n @_http_header[field] = value if field\n @_http_header\n end",
"def add_request_headers(request)\n ChefAPI::Log.info \"Adding request headers...\"\n\n headers = {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Connection\" => \"keep-alive\",\n \"Keep-Alive\" => \"30\",\n \"User-Agent\" => user_agent,\n \"X-Chef-Version\" => \"11.4.0\",\n }\n\n headers.each do |key, value|\n ChefAPI::Log.debug \"#{key}: #{value}\"\n request[key] = value\n end\n end",
"def set_header name, value\n response_object.header name, value\n end",
"def prepend_header(name, value)\n end",
"def set_header key, value\n headers.update(key => value)\n end",
"def add_generic_headers(http_method, uri, request_headers, context = nil)\n request_headers.concat(@session.meta_data_provider.meta_data_headers)\n request_headers.push(RequestHeader.new('Date', get_header_date_string))\n if !context.nil? && !context.idempotence_key.nil?\n request_headers.push(RequestHeader.new('X-GCS-Idempotence-Key', context.idempotence_key))\n end\n authenticator = @session.authenticator\n authentication_signature = authenticator.create_simple_authentication_signature(http_method, uri, request_headers)\n request_headers.push(RequestHeader.new('Authorization', authentication_signature))\n end",
"def header(name, value)\n har_headers << [name, value]\n super(name, value)\n end",
"def perform\n add_request_if_new do |request|\n request.header_set(*arguments)\n end\n end",
"def set_request_headers!(request); end",
"def new_header\n SimpleOAuth::Header.new(\n request_method,\n API_URL,\n params,\n client.oauth_options\n )\n end",
"def safe_append_header(key, value)\n resp_headers[key] = value.to_s\n end",
"def set_header(name, value)\n @headers[name] = value\n \n return self\n end",
"def header=(header = {})\n @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)\n end",
"def header=(header = {})\n @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)\n end",
"def add_headers(headers)\n @headers = @headers.merge(headers)\n end",
"def header(name, value)\n name = name.upcase\n name.tr!('-', '_')\n name = \"HTTP_#{name}\" unless name == 'CONTENT_TYPE' || name == 'CONTENT_LENGTH'\n env(name, value)\n end",
"def apply_headers(req)\n req.add_field('API-Version', self.api_version)\n req.add_field('accept','application/json')\n req.add_field('Content-Type','application/json')\n req.add_field('API-Appid', self.app_id)\n req.add_field('API-Username', self.username)\n req.add_field('API-Password', self.password)\n return req\n end",
"def add_headers(opts = {})\n unless opts[:headers].nil?\n opts[:headers].each do |opt, value|\n @headers[opt.to_s] = value\n end\n opts.delete(:headers)\n end\n end",
"def add_headers(current_string)\n return current_string if @headers.nil?\n string_headers = @headers.map { |k, v| \" -H '#{k}:#{v}' \" }.join(\"\")\n current_string + string_headers\n end",
"def upd_header(headers)\n hdr={'Content-Type' =>'application/json'}\n if(headers!=nil)\n headers['Content-Type']='application/json'\n hdr=headers\n end\n hdr\n end",
"def apply_header(options, key, value)\n options.merge! :headers => {} unless options.has_key? :headers\n options[:headers].merge!({ key => value })\n end",
"def add_headers(name, value)\n @headers += ', ' if @headers.length > 0\n @headers += name + '=\"'\n @headers += LoggingUtil.obfuscate_header(name, value) unless value.nil?\n @headers += '\"'\n end",
"def apply_headers(request)\n @custom_headers.each do |key, value|\n request.add_field key, value\n end\n end",
"def set_sasc_request_headers(api_version = nil)\n sasc_request_headers(api_version).each { |header, value| request.headers[header] = value }\n end",
"def header(name, value = nil)\n if value\n (@headers ||= {})[name] = value\n else\n (@headers || {})[name]\n end\n end",
"def header(hash = {})\n @headers.merge!(hash)\n end",
"def add_response_header(key, value)\n new(\n response_headers: ConnSupport::Headers.add(\n response_headers, key, value\n )\n )\n end",
"def set_header(auth_headers)\n header 'access-token', auth_headers['access-token']\n header 'token-type', auth_headers['token-type']\n header 'client', auth_headers['client']\n header 'expiry', auth_headers['expiry']\n header 'uid', auth_headers['uid']\nend",
"def on_after_create_http_request(http_request)\n if self.class.cached_digest_header\n http_request.set_header('authorization', digest_auth_header_from_response)\n end\n end",
"def header(name, value)\n if value.nil?\n @headers.delete(name)\n else\n @headers[name] = value\n end\n end",
"def fill_header(response); end",
"def request_headers=(_arg0); end",
"def default_http_header; end",
"def initialize_http_header(initheader)\n super\n set_headers_for_body\n end",
"def header(hash)\n self._headers.merge!(hash)\n end",
"def header_set(name, value)\n return dup_without_response.header_set(name, value) if response\n\n name = name.to_s\n if value.nil?\n @headers.delete name\n return self\n end\n\n @headers[name] = value.to_s\n self\n end",
"def set_header_insert(opts)\n opts = check_params(opts,[:headers])\n super(opts)\n end",
"def request_headers= request_headers\n @agent.request_headers = request_headers\n end",
"def request_headers; end",
"def request_headers; end",
"def []=(header, value)\n @headers[header] = value\n end",
"def add_authentication(_, request)\n request.headers['X-User-Email'] = self.class.api_user_email\n request.headers['X-User-Token'] = self.class.api_token\n end",
"def make_headers(user_headers); end",
"def set_header(header, value)\n @lunetas_headers[header.to_s] = value\n end",
"def add_link_header(query_parameters)\n response.headers['Link'] = construct_link_header(query_parameters)\n end",
"def add_custom_header(value)\n if value.instance_of? CustomHeaderJson\n @custom_headers.push(value)\n end\n end",
"def update_headers(request_headers)\n @request_headers.merge!(request_headers)\n end",
"def request_headers=(request_headers); end",
"def setCustomHttpHeader(header)\n unless /^.+:.+$/.match(header)\n raise Error.new(Pdfcrowd.create_invalid_value_message(header, \"setCustomHttpHeader\", \"html-to-pdf\", \"A string containing the header name and value separated by a colon.\", \"set_custom_http_header\"), 470);\n end\n \n @fields['custom_http_header'] = header\n self\n end",
"def add_headers(name, value)\n @headers += ', ' if @headers.length > 0\n @headers += name + '=\"'\n @headers += @header_obfuscator.obfuscate_header(name, value) unless value.nil?\n @headers += '\"'\n end",
"def set_header(token)\n response.headers['Authorization'] = \"Bearer #{token.to_jwt}\"\n end",
"def setup_header\n orig_setup_header\n unless chunked? || @header['content-length']\n @header['connection'] = \"close\"\n @keep_alive = false\n end\n end",
"def setup_header\n orig_setup_header\n unless chunked? || @header['content-length']\n @header['connection'] = \"close\"\n @keep_alive = false\n end\n end",
"def with_header(url)\n @header = url\n self\n end",
"def setCustomHttpHeader(header)\n unless /^.+:.+$/.match(header)\n raise Error.new(Pdfcrowd.create_invalid_value_message(header, \"setCustomHttpHeader\", \"html-to-image\", \"A string containing the header name and value separated by a colon.\", \"set_custom_http_header\"), 470);\n end\n \n @fields['custom_http_header'] = header\n self\n end",
"def headers(header = nil)\n @response.headers.merge!(header) if header\n @response.headers\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 make_request_headers(opts); end",
"def []=(key, value)\n @headers[key] = value\n end",
"def setup_proxy_header(req, res)\n # Choose header fields to transfer\n header = Hash.new\n choose_header(req, header)\n set_via(header)\n return header\n end",
"def set_authorisation_header(request)\n request[\"Authorization\"] = \"Bearer #{access_token}\"\n end",
"def add(field, value)\n (@headers[downcased(field)] ||= []) << String(value)\n end",
"def header(key, val)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n _httpsession.resp.header(key, val)\n return nil\n end",
"def add_message_headers(message, operation)\n headers = [\n # Message size.\n 16 + message.size,\n\n # Unique request id.\n request_id = get_request_id,\n\n # Response id.\n 0,\n\n # Opcode.\n operation\n ].pack('VVVV')\n\n message.prepend!(headers)\n\n request_id\n end",
"def headers\n super\n @headers['User-Agent'] = \"Recurly Ruby Client v#{VERSION}\"\n @headers\n end",
"def headers(request)\n raise NotImplementedError\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def render_header\n response_header = \"#{@version} #{@status} #{@reason}#{CRLF}\"\n\n unless @headers.empty?\n response_header << @headers.map do |header, value|\n \"#{header}: #{value}\"\n end.join(CRLF) << CRLF\n end\n\n response_header << CRLF\n end",
"def header(str)\n # {{{\n if @output_started\n raise \"HTTP-Headers are already send. You can't change them after output has started!\"\n end\n unless @output_allowed\n raise \"You just can set headers inside of a Rweb::out-block\"\n end\n if str.is_a?Array\n str.each do | value |\n self.header(value)\n end\n\n elsif str.split(/\\n/).length > 1\n str.split(/\\n/).each do | value |\n self.header(value)\n end\n\n elsif str.is_a? String\n str.gsub!(/\\r/, \"\")\n\n if (str =~ /^HTTP\\/1\\.[01] [0-9]{3} ?.*$/) == 0\n pattern = /^HTTP\\/1.[01] ([0-9]{3}) ?(.*)$/\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n elsif (str =~ /^status: [0-9]{3} ?.*$/i) == 0\n pattern = /^status: ([0-9]{3}) ?(.*)$/i\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n else\n a = str.split(/: ?/, 2)\n\n @header[a[0].downcase] = a[1]\n end\n end\n # }}}\n end",
"def headers\n @headers.merge({ \"Status\" => @status })\n end",
"def set_extra_headers_for(params)\n maor_headers = {\n 'x-tmrk-version' => @version,\n 'Date' => Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\"),\n }\n params[:headers].merge!(maor_headers)\n if params[:method]==\"POST\" || params[:method]==\"PUT\"\n params[:headers].merge!({\"Content-Type\" => 'application/xml'})\n params[:headers].merge!({\"Accept\" => 'application/xml'})\n end\n unless params[:body].empty?\n params[:headers].merge!({\"x-tmrk-contenthash\" => \"Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}\"})\n end\n if @authentication_method == :basic_auth\n params[:headers].merge!({'Authorization' => \"Basic #{Base64.encode64(@username+\":\"+@password).delete(\"\\r\\n\")}\"})\n elsif @authentication_method == :cloud_api_auth\n signature = cloud_api_signature(params)\n params[:headers].merge!({\n \"x-tmrk-authorization\" => %{CloudApi AccessKey=\"#{@access_key}\" SignatureType=\"HmacSha256\" Signature=\"#{signature}\"}\n })\n end\n params[:headers]\n end",
"def header(value = nil)\n value ? self.header = value : @header\n end",
"def add_custom_header(name, value)\n\n if name.kind_of? CustomHeader\n @custom_headers.push(name)\n\n elsif name.kind_of? String\n @custom_headers.push(CustomHeader.new(name, value))\n\n end\n end",
"def header(string, replace=true, http_response_code=nil)\n name, value = string.split(': ', 2)\n headers[name] = value\n end",
"def with_custom_headers(header)\n @header = header\n self\n end",
"def inject_request_headers(state, request)\n cross_app_id = TingYun::Agent.config[:tingyunIdSecret]\n\n request[TY_ID_HEADER] = \"#{cross_app_id};c=1;x=#{state.request_guid}\"\n end",
"def send_headers(request, headers, empty_response: false, chunked: true)\n formatted_headers = format_headers(headers, !empty_response, http1_1?(request) && chunked)\n request.tx_incr(formatted_headers.bytesize)\n @conn.write(formatted_headers)\n end",
"def header\n { \"Authorization\" => 'Bearer ' + request_access_token.token }\n end",
"def generate_headers(request, soap)\n super(request, soap)\n credentials = @credential_handler.credentials\n request.url = soap.endpoint\n request.headers['Authorization'] =\n @auth_handler.auth_string(credentials)\n end",
"def headers(new_headers = {})\n (@headers ||= {}).merge!(new_headers)\n end",
"def header=(header)\n @header = header\n end",
"def add_signing_headers(verb, path, request)\n ChefAPI::Log.info \"Adding signed header authentication...\"\n\n authentication = Authentication.from_options(\n user: client,\n key: key,\n verb: verb,\n path: path,\n body: request.body || request.body_stream\n )\n\n authentication.headers.each do |key, value|\n ChefAPI::Log.debug \"#{key}: #{value}\"\n request[key] = value\n end\n\n if request.body_stream\n request.body_stream.rewind\n end\n end",
"def []=(k, v) @headers[translate_header_to_sym(k)] = v end",
"def add_auth_headers\n @client.headers['Auth-Email'] = '...'\n @client.headers['Auth-Token'] = '...'\n end",
"def []=(key, value)\n @header[key] = value\n end",
"def with_headers(new_headers)\n @with_headers.merge!(new_headers)\n self\n end",
"def append_headers(*headers)\n new_headers = headers.join(\"\\r\\n\")\n new_headers = \"#{new_headers}\\r\\n#{self.raw_headers}\"\n @raw_headers = new_headers\n @raw_validation = nil\n @headers = nil\n end",
"def set_header_options(curl)\n summary = summary_for_feed\n \n unless summary.nil?\n curl.headers['If-None-Match'] = summary[:etag] unless summary[:etag].nil?\n curl.headers['If-Modified-Since'] = summary[:last_modified] unless summary[:last_modified].nil?\n end\n \n curl\n end",
"def add_caching_headers\n if etag = resource.generate_etag\n response.headers['ETag'] = ensure_quoted_header(etag)\n end\n if expires = resource.expires\n response.headers['Expires'] = expires.httpdate\n end\n if modified = resource.last_modified\n response.headers['Last-Modified'] = modified.httpdate\n end\n end",
"def header=(header)\n @header = header\n end",
"def rack_helper(header)\n \"HTTP_#{header.to_s.upcase.gsub(/[-\\s]/, '_')}\"\n end",
"def set_header_fields(request)\n request.smb2_header.tree_id = id\n request.smb2_header.credits = 256\n request\n end",
"def header header, op\n end",
"def post_headers(response=nil)\n hdrs = {\"Content-Type\" => 'application/json',\n \"Accept\" => \"application/json, text/javascript, */*; q=0.01\"}\n @headers.merge!(hdrs)\n end",
"def auth_header\n # headers: { 'Authorization': 'Bearer <token>' }\n\n request.headers['Authorization']\n # => 'Bearer <token>'\n end"
] | [
"0.78114223",
"0.7737657",
"0.76608366",
"0.74980533",
"0.74719864",
"0.72978187",
"0.71946865",
"0.71307015",
"0.71052104",
"0.7026713",
"0.70074236",
"0.6964078",
"0.6944201",
"0.6932701",
"0.6866111",
"0.6844005",
"0.6833592",
"0.68277824",
"0.6827778",
"0.6726953",
"0.6715672",
"0.67043924",
"0.6598186",
"0.65907776",
"0.65906894",
"0.65685666",
"0.6494137",
"0.6491272",
"0.64910764",
"0.6489673",
"0.6472472",
"0.6467046",
"0.64500046",
"0.64313734",
"0.64211184",
"0.64148134",
"0.64136255",
"0.64113486",
"0.64075595",
"0.6406677",
"0.64062285",
"0.6379622",
"0.6370859",
"0.6353928",
"0.6353928",
"0.63427716",
"0.6335918",
"0.63285",
"0.62855333",
"0.62851113",
"0.6284763",
"0.62825793",
"0.6267814",
"0.6262347",
"0.62573576",
"0.6235717",
"0.62327904",
"0.62327904",
"0.6218908",
"0.6209423",
"0.6207929",
"0.6203661",
"0.6198266",
"0.6180013",
"0.61747247",
"0.6173771",
"0.6172309",
"0.61696684",
"0.6161942",
"0.6161934",
"0.61550987",
"0.61506623",
"0.614402",
"0.6137338",
"0.61314195",
"0.61145514",
"0.6112931",
"0.6105966",
"0.6056056",
"0.60446155",
"0.6042855",
"0.6041614",
"0.6035554",
"0.6033366",
"0.6033268",
"0.6017049",
"0.6016259",
"0.6010956",
"0.6007553",
"0.5994543",
"0.5991945",
"0.5984359",
"0.5980609",
"0.59719074",
"0.59718513",
"0.5966333",
"0.595379",
"0.5952816",
"0.59450233",
"0.5940847"
] | 0.8141636 | 0 |
exercise 2 answer nothing because you have not called the block inside the method. Exercise 3 answer It handles predicted errors by providing an alternative to just havin your code error out and thus allows it to continue to execute. Exercise 4 | def execute(&block)
block.call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend",
"def sample()\n begin\n puts \"do something\"\n rescue # can define type of error here if wanted\n puts \"we hit an error!\"\n retry # this will restart from the beginning of the begin body\n else\n puts \"else hit\"\n ensure\n puts \"ensure this please\"\n end\nend",
"def continue?; end",
"def proceed!; end",
"def proceed!; end",
"def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend",
"def for_broke(ci)\n begin\n ci.run\n\n rescue HaltState\n # nop\n rescue err\n puts err.message\n puts 'should not have got this'\n end\nend",
"def one\n too { yield }\nendbegin;1;rescue => e1;e1;end",
"def do_failure; end",
"def may_fail # block\n begin\n yield\n rescue\n end\nend",
"def display_error(i, given, correct)\n puts \"Line #{i+1}: Invalid block number #{given}, should be #{correct.to_i + 1}\"\n end",
"def block_try2(num)\n yield\n puts \"do fourth. num is [#{num}]\"\nend",
"def bad\n i = 0\n begin\n if i < 10\n while i < 20\n i += 2\n end\n end\n rescue => ex\n raise \"failure is an option\"\n end\n i\nend",
"def use_blocker\n blocker do\n # next\n # break\n # return\n \"HA!\"\n # next\n # break\n # return\n end\n puts \"DONE!\"\nend",
"def question_and_answer(with_error, zero_or_one, mistery_num)\n message = \"Do you see your number here: (y)(n). To exit the game enter the letter e.\".colorize(:blue)\n if with_error == true\n puts \"\\nIncorrect Answer. \" + message\n else \n puts \"\\n#{message}\"\n end \n answer = gets.chomp.upcase\n case answer\n when \"Y\", \"YES\"\n if zero_or_one % 2 == 0\n mistery_num +=\"0\"\n else\n mistery_num +=\"1\"\n end\n return mistery_num\n when \"N\", \"NO\"\n if zero_or_one % 2 == 0\n mistery_num +=\"1\"\n else\n mistery_num +=\"0\"\n end\n return mistery_num\n when \"E\"\n return \"break\"\n else\n question_and_answer(true, zero_or_one, mistery_num)\n end \nend",
"def misty ci, &blk\n begin\n print 'stack: '; p ci.ctx.stack\n puts 'vars: '; p ci.ctx.vars\n print 'next instruction: '; p ci.peek\n gets\n ci.step\n rescue HaltState\n puts 'halted'\n rescue OpcodeError => err\n puts err.message\n end\nend",
"def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def program()\n if stmts()\n # these conditionals make sure ifs and fors have a matching 'end' keyword\n if $if == true and $endif == false\n puts \"Error on line #{$time}\"\n return\n end\n if $if == false and $endif == true\n puts \"Error on line #{$time}\"\n return\n end\n if $for == true and $endfor == false\n puts \"Error on line #{$time}\"\n return\n end\n if $for == false and $endfor == true\n puts \"Error on line #{$time}\"\n return\n end\n if $lex.getSymbol() == EOF\n puts \"The file is syntactically correct.\"\n return\n end\n end\n puts \"Error on line #{$time}\"\n return\nend",
"def cube(num)\n return num * num * num #this is an official return statement\n # after return, it will break and jump out from the method\n # nothing after it wiil be executed\n 8\n puts \"print this line\"\nend",
"def return_statement(num)\n puts \"this is before the explicit return...\"\n if num != 1\n return \"yeah you entered something other than 1 !\"\n end\n puts \"this is after explicit return so you must have entered 1!\"\nend",
"def block?; end",
"def continued_exception; end",
"def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend",
"def error?; end",
"def error?; end",
"def error?; end",
"def say_hello\n return\n puts \"Hello!\" #this code will never be reached\nend",
"def run_failed; end",
"def pass\n throw :pass\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def deffered(&block)\n progressbar.show\n thread = Thread.new do\n Thread.current[:result] = suppress { block.call }\n end\n\n loop do\n progressbar.increment\n break if thread.status === false\n\n if thread.status.nil?\n progressbar.erase_line\n say red { Manager.locale.error(self, 'execution_failed') }\n\n exit 102\n end\n\n sleep 0.3\n end\n\n case thread[:result]\n when Octokit::OneTimePasswordRequired\n progressbar.erase_line\n otp_interview\n\n return deffered(&block)\n when NilClass\n progressbar.erase_line\n say red { Manager.locale.error(self, 'empty_response') }\n\n exit 103\n when Exception\n progressbar.erase_line\n say red { thread[:result].message }\n\n exit 104\n else\n # no-op\n end\n\n thread[:result]\n end",
"def method1\n return \"ERROR Method1: no block given\" unless block_given?\n yield\n yield\n yield\nend",
"def continue; end",
"def continue; end",
"def result_of_checking; end",
"def invalid_input\n puts \"Invalid input, please try again\"\nend",
"def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end",
"def failure!\n end",
"def do_it\n\t\tif @type == \"multiple_answer_error\"\n\t\t\tthen puts \"Error: Item #{@holder} raised #{@type} in #{@method}\"\n\t\telsif @type == \"not_found_error\"\n\t\t\tthen puts \"Error: #{@holder} was #{@type} in #{@method}\"\n\t\telse puts \"Error: Have been given an unknown error type: #{@type}\"\n\t\tend\n\tend",
"def block_try1(num, &block)\n block.call\n puts \"do second. num is [#{num}]\"\nend",
"def header(&block)\n puts \"This is our hedaer\"\n block.call\nrescue\n puts \"This is where we would rescue an error.\"\nensure\n puts \"This is our footer.\"\nend",
"def return!(&block); end",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def unsuccessful\n end",
"def some_damn_method\n\tputs \"Enterng method\"\n\t1.times { puts \"Entering block!\"; return }\n\tputs \"Exiting method\" # Never gets executed!\nend",
"def halt; end",
"def halt; end",
"def bagi(a,b)\n \n begin\n hasil = a/b \n rescue\n error = true\n end\n\n if error \n puts \"terjadi error\"\n else\n hasil\n end\n\nend",
"def try!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n type = TRY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 180:7: 'try'\n match( \"try\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n end",
"def complain\n\n end",
"def failures; end",
"def failures; end",
"def failures; end",
"def grade(num_books, has_read_books)\n\n=begin\n if num_books < 10 && has_read_books == false\n return 'D' # if I don't use return, the method keeps executing the code and returns the last expression evaluated, which is nil.\n elsif num_books < 10 && has_read_books == true\n return 'C'\n end\n\n if num_books.between?(10,20) && has_read_books == false\n return 'C'\n elsif num_books.between?(10,20) && has_read_books == true\n return 'B'\n end\n\n if num_books > 20 && has_read_books == false\n return 'B'\n elsif num_books > 20 && has_read_books == true\n return 'A'\n end\n=end\n\n #the solution below is more 'DRY' :)\n\n if has_read_books\n if num_books > 20\n return 'A' # if I don't use return, the method keeps executing the code and returns the last expression evaluated, which is nil.\n elsif num_books.between?(10,20)\n return 'B'\n else\n return 'C'\n end\n else\n if num_books > 20\n return 'B'\n elsif num_books.between?(10,20)\n return 'C'\n else\n return 'D'\n end\n end\n\nend",
"def x\n # ...\nrescue\n # ...\nend",
"def solution1(input)\n return \"Not implemented!\"\nend",
"def do_you_want_to_continue\r\n # Checking if the user wants to continue with Part 2 & 3 of the script, and collecting an input from them\r\n puts \"Do you want to see Parts 2 & 3? (y/n)\"\r\n answer = gets.chomp\r\n # Providing a case that only excepts either \"yes\" or \"y\" to continue, or \"no\" or \"n\" to exit.\r\n case answer\r\n # Instantiating the case that if the user inputs \"yes\" or \"y\" the loop ends and the script continues to Parts 2 & 3.\r\n when \"yes\", \"y\"\r\n # Instantiating the case that if the user inputs \"no\" or \"n\" the terminal session is ended\r\n when \"no\", \"n\"\r\n exit\r\n # Here I placed an else component to the case the user passed an invalid input. I clear the terminal and call the method again, making it look as though\r\n # they have no choice but to put a valid input to continue\r\n else\r\n puts `clear`\r\n do_you_want_to_continue\r\n end\r\nend",
"def block_method\nputs \"called outside block in block_method\"\n#add method, to check if there is a block on this method\nyield if block_given? #predicate method, it have question mark on end\nputs \"now we are returning again to block\"\nend",
"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 block_testing\r\n student1 = \"John\"\r\n student2 = \"Jane\"\r\n puts \"The student has not begun racing yet.\"\r\n yield(student1, student2)\r\nend",
"def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend",
"def errorhandling\n end",
"def error!\n throw :return, -1\n end",
"def method_one\n begin\n raise \"some error\"\n rescue\n puts \"got an error\"\n end\nend",
"def bagi(a,b)\n # begin\n # a / b\n # rescue\n # 0\n # end\n\n ##Kode di atas akan sama dengan, tapi konsekwensinya adalah rescue ini harus ada di bawah karena kita tidak bisa menambah kodingan lagi (solusi lebih baik adalah dengan begin ..... end)\n # a / b\n # rescue\n # 0\n\n begin\n hasil = a / b\n rescue => exception\n error = true\n end\n\n # dengan ada if ini maka hasilnya juga harus ditampilkan, makanya return nya kita tampung di variabel baru ditampilkan\n if error\n puts \"Terjadi error nih\"\n else\n hasil\n end\nend",
"def with_checking(description)\n puts \"Checking #{description}\"\n result = yield\n if result\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend",
"def ok_failed(condition)\n if condition\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend",
"def miltiple_pass\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend",
"def pass?\n raise \"NYI\"\n end",
"def pass; end",
"def pass; end",
"def example_failed(_)\n end",
"def run_and_raise_on_failure\n # TODO ?\n end",
"def get_famous\n begin\n move_to_san_francisco && make_friends\n do_interesting_things\n rescue TotalFailError\n whats_the_worst_that_can_happen\n end\nend",
"def raise_and_rescue \n begin \n puts 'Before the raise.' \n raise 'An error occured.' \n puts 'After the raise.' \n rescue \n puts 'Code rescued.' \n end \n puts 'After the begin block.' \n end",
"def optional\n puts 'A code block isn\\'t required, but it\\'s nice.'\n yield if block_given? #Kernel#block_given?\n puts 'I\\'m happy either way, really.'\nend",
"def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"def failed?; failed_to_start? || (@success == false) end",
"def f n\n puts \"Before critical section\"\n case n\n when 0\n raise \"Error test\"\n when 1\n raise StacError, \"My error\", caller\n else\n puts \"Normal run\"\n end\n puts \"After critical section\"\nend",
"def error; end"
] | [
"0.6389173",
"0.63852507",
"0.62006825",
"0.6045894",
"0.6045894",
"0.60418856",
"0.6027486",
"0.6025705",
"0.6014116",
"0.59757215",
"0.5950362",
"0.5926385",
"0.5924686",
"0.5904691",
"0.58994627",
"0.58215135",
"0.58161676",
"0.581205",
"0.5810828",
"0.5809832",
"0.5805388",
"0.58028066",
"0.5766806",
"0.57640725",
"0.5758746",
"0.5758746",
"0.5758746",
"0.57539314",
"0.57507473",
"0.57491684",
"0.5741148",
"0.57349384",
"0.573244",
"0.5726248",
"0.5726248",
"0.5713248",
"0.5707138",
"0.5703616",
"0.5699531",
"0.56860834",
"0.5680511",
"0.56681824",
"0.56679136",
"0.5667667",
"0.5667667",
"0.564829",
"0.5643932",
"0.5641825",
"0.5641825",
"0.5638522",
"0.563504",
"0.5633305",
"0.5631465",
"0.5631465",
"0.5631465",
"0.5627306",
"0.5609946",
"0.5608425",
"0.56083405",
"0.5600826",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.559896",
"0.5592663",
"0.5589093",
"0.5581915",
"0.5578656",
"0.5571446",
"0.5566934",
"0.5561635",
"0.555943",
"0.55565256",
"0.5544809",
"0.55414075",
"0.55414075",
"0.55399096",
"0.55396795",
"0.55361265",
"0.5533557",
"0.5533542",
"0.55334526",
"0.5531289",
"0.5529362",
"0.5529013"
] | 0.0 | -1 |
For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: 012 021 102 120 201 210 What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? solution: | def factorial(n)
f = 1
(1..n).each do |i|
f *= i
end
f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_permutation n\n n.to_s.chars.sort.join.to_i\nend",
"def lex_permutation(n, digits)\n fact = factorial(digits.size-1)\n lead_digit = n / fact\n count = lead_digit * fact\n perms = (digits - [lead_digit]).permutation.to_a\n ([lead_digit] + perms[n - count - 1]).join\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend",
"def PermutationStep(num)\n possibilities = []\n possibilities = num.to_s.chars.map(&:to_i).permutation.to_a\n possibilities.reject! {|comb| comb.join.to_i <= num}\n possibilities.map! {|comb| comb.join.to_i}\n possibilities.empty? ? -1 : possibilities.min\nend",
"def lexicPerm1(list)\n\tlex_perms = list.permutation(10).to_a\n\tputs lex_perms[1_000_000 - 1].join()\nend",
"def euler_24(permutation = 1000000, digits = %w{ 0 1 2 3 4 5 6 7 8 9 }, join = '', lex = true)\n digits.sort! if lex\n result = digits.permutation(digits.length).to_a[permutation-1]\n join.nil? ? result : result.join(join)\nend",
"def permutation_step(num)\r\n perms = num.to_s.chars.map {|x| x.to_i}.permutation.to_a.map do |perm_arr|\r\n perm_arr.map {|x| x.to_s}.join.to_i\r\n end\r\n\r\n perms.select {|n| n > num}.min.nil? ? -1 : perms.select {|n| n > num}.min\r\nend",
"def max_permutation n\n min_permutation(n).to_s.reverse.ljust(4, '0').to_i\nend",
"def permutation_threshold\n available_letters_permutations = ('A'..'Z').to_a.size**2\n available_numbers_permutations = (0..9).size**3\n available_letters_permutations * available_numbers_permutations\n end",
"def lexicographic_permutation(k)\n k -= 1\n s = self.dup\n n = s.length\n n_less_1_factorial = (n - 1).factorial # compute (n - 1)!\n (1..n-1).each do |j|\n tempj = (k / n_less_1_factorial) % (n + 1 - j)\n s[j-1..j+tempj-1]=s[j+tempj-1,1]+s[j-1..j+tempj-2] unless tempj==0\n n_less_1_factorial = n_less_1_factorial / (n- j)\n end\n s\n end",
"def lexicographic_permutations\n a=Array.new\n (1..self.length.factorial).each { |i| a << self.lexicographic_permutation(i) }\n a\n end",
"def permutations(p)\r\n p.to_s.scan(/\\d/).permutation.map{|e| e.join}.sort\r\nend",
"def lex_perm(n)\n perm = [0,1,2,3,4,5,6,7,8,9].permutation(10).to_a.sort\n return perm[n-1].join\nend",
"def nth_permutation(number_of_permutations)\n\t\tpermutation_array = []\n\t\tnumber_of_permutations -= 1 # assuming we start from the first permutation rather than the zeroth\n\t\twhile lexographic_array.length > 0\n\t\t\tindex = number_of_permutations / (lexographic_array.length - 1).factorial\n\t\t\tnumber_of_permutations %= (lexographic_array.length - 1).factorial\n\t\t\tpermutation_array.push(lexographic_array.delete_at(index))\n\t\tend\n\t\tpermutation_array\n\tend",
"def number_permutations(number)\n permutations = []\n\n [3, 4, 5, 6, 7, 10].each do |pattern|\n permutations << split_in_two(number, pattern)\n end\n [[3, 3], [3, 4], [4, 3]].each do |pattern|\n permutations << split_in_three(number, pattern.first, pattern.last)\n end\n\n permutations\n end",
"def lex_permutation(arr, n)\n\tif arr.size == 1\n\t\tarr.first.to_s\n\telse\n\t\tindex = n / factorial(arr.size-1)\n\t\tarr[index].to_s + lex_permutation(arr.select{|i| i != arr[index]}, n - index * factorial(arr.size-1))\n\tend\nend",
"def lexi(*args)\n digits = Array.new\n args.each { |x|\n digits << x\n }\n n = digits.length\n perms = Array.new\n i = 0\n n.times do\n perm = Array.new(n, 0)\n perm[0] = digits[i]\n j = 1\n i = j\n (n - j).times do\n perm[j] = digits[i]\n i += 1\n end\n i += 1\n perms << perm\n end\n perms\nend",
"def Lexicographic(myString)\n\n origArray = myString.split(//)\n newArr = origArray.permutation.to_a\n counter = 1\n newArr.each do |x|\n if counter == 1000000\n print counter, \"--> \", x.join, \"\\n\"\n break\n else\n counter = counter + 1\n end\n end\nend",
"def get_signed_permutations(n)\r\n numbers = (-n..n).to_a\r\n numbers.delete(0)\r\n perms = numbers.permutation(n).to_a\r\n perms = perms.select{|item| item.map{|subitem|subitem.abs()}.uniq.length == item.length}\r\n return perms.uniq\r\nend",
"def nth_perm(str, max)\n n = str.length - 1\n return str if n == 0\n i = 0\n fac = fact(n)\n i += 1 while ((i+1)*fac) < max && i < n\n str[i] + nth_perm(str.tr(str[i], ''), max - (i*fac))\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def number_shuffle(number)\n number.to_s.chars.map { |c| c.to_i }.\n \n permutation.to_a.map { |set| set.join }.\n \n map { |str| str.to_i }.sort\n #number.to_s.chars.to_a.permutation.map(&:join).map(&:to_i)\nend",
"def nth_permutation_of( to_permute, desired_permutation )\n if to_permute.length == 1\n to_permute\n else\n first_char = to_permute.delete_at( (desired_permutation - 1) / (to_permute.length - 1).factorial )\n [ first_char, *nth_permutation_of( to_permute, ((desired_permutation) % to_permute.length.factorial) ) ]\n end\nend",
"def lexicograph(n)\n\tputs \"lexicograph(#{n})\"\n\tif n == 0\n\t\treturn [\"0\"]\n\tend\n\tresult = []\n\tprevious_ordering = lexicograph(n-1)\n\t0.upto(n) do |k|\n\t\t# puts \"k: #{k}\"\n\t\tprevious_ordering.each do |perm|\n\t\t\t# puts \"perm: #{perm}\"\n\t\t\tval = perm.clone\n\t\t\t(n-1).downto(k) do |i|\n\t\t\t\t# puts \"i: #{i}\"\n\t\t\t\tval.gsub!(i.to_s, (i+1).to_s)\n\t\t\tend\n\t\t\tresult << k.to_s + val\n\t\tend\n\tend\n\tputs \"returning #{n}\"\n\treturn result\nend",
"def find_mult_3(num)\n nums = num.digits\n i = 1\n array = []\n until i > nums.count\n a = nums.permutation(i).to_a.map{ |num| num.join.to_i }\n b = a.select{|num| num != 0 && num % 3 == 0}\n array << b.uniq\n i += 1\n end\n result = array.flatten.uniq\n return [result.count, result.max]\nend",
"def getPermutations3(s,perm=[])\n subresult = getPermutations2(s[1..3])\n subresult.each do |item|\n perm.push(item.insert(0,s[0]))\n end\n if perm.length >= factorial(s.length)\n return perm\n else\n s = rotateChar(s)\n getPermutations3(s,perm)\n end\nend",
"def get_partial_permutations(n,k)\r\n result = 1\r\n while (k > 0)\r\n result *= n\r\n n -= 1\r\n k -= 1\r\n end\r\n return (result % 1000000)\r\nend",
"def next_bigger_num(num)\n return -1 if num if num.digits.all? {|digit| digit == num[0]}\n return -1 if num.digits.sort! {|a,b| b <=> a}.join.to_i == num\n \n combinations = num.digits.permutation(num.digits.length).to_a\n \n combinations.map! do |arr|\n arr.join.to_i\n end.sort!\n \n combinations.each.with_index do |number, index|\n return combinations[index + 1] if number == num\n end\n \nend",
"def next_bigger_num(num)\r\n digits = num.digits\r\n sorted_digits = digits.sort { |a, b| b <=> a }\r\n if digits.count(digits[0]) == digits.size || digits.size < 2 || sorted_digits == digits.reverse\r\n return -1\r\n end\r\n \r\n permutation = digits.permutation.to_a.map do |sub_arr|\r\n sub_arr.join('').to_i\r\n end\r\n \r\n sorted_permutation = permutation.sort\r\n \r\n sorted_permutation.each do |current_num|\r\n return current_num if current_num > num\r\n end\r\nend",
"def get_permutation(range, n)\r\n range.to_a.permutation.lazy.drop(n-1).first.join.to_i\r\nend",
"def generate_sequence()\n (0..9).to_a.permutation(4).to_a #all permutations, 4 digits long\nend",
"def get_permutations(n)\r\n return (1..n).to_a.permutation.to_a\r\nend",
"def prmutation(num)\n factrl(num)\nend",
"def lowest_number(number_list)\n number_list.map(&:to_s)\n .permutation\n .map(&:join)\n .map(&:to_i)\n .min\nend",
"def max_rotation(nums)\n digits = nums.digits.reverse\n n = 0\n digits.size.times do\n rotated_num = digits[n..-1].shift\n digits.delete_at(n)\n digits = digits.push(rotated_num)\n n += 1\n end\n digits.join.to_i\nend",
"def permutations(perms, digits)\n\tcounts = Array.new(digits.size, 0)\n\t\nend",
"def cp1\n\tnumPerm = []\n\tpermPrime = true\n\ttotal = 0;\n\t100.upto(200) do |x|\n\t\t#if (x % 1000 == 0) then p x end\n\t\tif(isPrime(x) == false) then next end\n\t\tnumPer = splitNumberifOdd(x)\n\t\tif(numPer == false) then next end\n\t\tnumPer = numPer.permutation().to_a\n\t\tnumPer = numPer.map {|y| y.join.to_i}\n\t\tpermPrime = true\n\t\tnumPer.each do |perm|\n\t\t\t#printf \"checking %s \\n\", perm\n\t\t\tif(isPrime(perm) == false) then permPrime = false; printf \"x %d- failed %d \\n\",x, perm; break end\n\t\tend\n\t\t#p permPrime\n\t\tif (permPrime == true) then total = total + 1; p x end\n\tend\n\ttotal + 13\nend",
"def num_creator_2()\n\tlist_of_pandigs = [1,21,321,4321,54321,654321,7654321,87654321,987654321]\n\tlist_of_all_permutations = []\n\n\tlist_of_pandigs.each do |pandig|\n\t\ttemp_list = []\n\t\tpandig.to_s.each_char do |char|\n\t\t\ttemp_list << char.to_i\n\t\t\tlist_of_all_permutations << temp_list.permutation(temp_list.count).to_a\n\t\tend\n\tend\n\tclean_list = []\n\n\tlist_of_all_permutations.each do |perm|\n\t\tperm.each do |perm2|\n\t\t\t# if is_pandigital(perm2, pandigidictcreator()) == true\n\t\t\t\tclean_list << perm2.join()\n\t\t\t# end\n\t\tend\n\t\t# p perm\n\tend\n\treturn clean_list\nend",
"def letter_combinations(digits)\n dictionary = {\n '1' => [],\n '2' => ['a', 'b', 'c'],\n '3' => ['d', 'e', 'f'],\n '4' => ['g', 'h', 'i'],\n '5' => ['j', 'k', 'l'],\n '6' => ['m', 'n', 'o'],\n '7' => ['p', 'q', 'r', 's'],\n '8' => ['t', 'u', 'v'],\n '9' => ['w', 'x', 'y', 'z']\n }\n\n res = [[]]\n digits.split(\"\").each do |num|\n ltrs = dictionary[num]\n res = permute(res, ltrs)\n end\n\n new_res = []\n res.each { |bucket| new_res << bucket.join(\"\") }\n new_res \nend",
"def p1\n perm \" 1 2 4 3 4 3 5 6 \"\nend",
"def permutation_number\n number = 0\n unused = Array.new(@@size, true)\n (1..@@size).each do |i|\n l = 1\n j = 1\n while j != @state_array[i - 1] do\n l += 1 if unused[j - 1]\n j += 1\n end\n number += (l - 1) * (@@size - i).factorial\n unused[@state_array[i - 1] - 1] = false\n end\n return number\n end",
"def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end",
"def permutations(string)\n perms = []\n combos = string.split('').permutation.to_a.map { |combo| combo.join('') }\n combos.each { |combo| perms << combo if !perms.include?(combo) }\n perms\nend",
"def number_shuffle(number)\n no_of_combinations = number.to_s.size == 3 ? 6 : 24\n digits = number.to_s.split(//)\n combinations = []\n combinations << digits.shuffle.join.to_i while combinations.uniq.size!=no_of_combinations\n combinations.uniq.sort\nend",
"def permutations(string)\n string.chars.permutation(string.length).map(&:join).uniq\nend",
"def prime_checker(num)\n digits = num.to_s.chars\n permutations = digits.permutation(digits.size).map { |n| n.join.to_i }.uniq\n # permutations.reject! { |num| num.to_s.size < digits.size }\n permutations.each do |permutation|\n return 1 if prime?(permutation)\n end\n 0\nend",
"def number_shuffle(number)\n no_of_combinations = number.to_s.size == 3 ? 6 : 24\n digits = number.to_s.split(//)\n combinations = []\n combinations << digits.shuffle.join.to_i while \n combinations.uniq.size!=no_of_combinations\n combinations.uniq.sort\nend",
"def permsol(str)\n str.chars.permutation.to_a.map(&:join).uniq \nend",
"def number_shuffle(number)\n number.to_s.split('').permutation.to_a.map{|x| x.join('').to_i}\nend",
"def getPermutations2(s,perm=[])\n substring = s[1..2]\n perm.push(s[0] + substring)\n perm.push(s[0] + substring.reverse)\n if perm.length >= factorial(s.length)\n return perm\n else\n s = rotateChar(s)\n getPermutations2(s,perm)\n end\nend",
"def palin_perm(str)\n # remove unnecessary spaces\n str.delete!(' ')\n\n # create hash[char] = count\n hash = Hash[\n str.downcase\n .split('')\n .group_by { |c| c }\n .map { |k, v| [k, v.size] }\n ]\n\n # Set limit for odd characters based on str length\n odd_test = str.length.odd? ? 2 : 1\n\n # Test that odd characters in str do not exceed limit\n hash.values.select(&:odd?).length < odd_test\nend",
"def number_shuffle(number)\n digits = number.to_s.split(//).uniq\n factorial = (1..digits.length).inject(:*) || 1\n\n res = []\n res << digits.shuffle.join.to_i while res.uniq.size != factorial\n\n res.uniq.sort\nend",
"def pythagoreans (n)\n return (1..n).to_a.permutation(3).to_a.select { |a,b,c| a**2 + b**2 == c**2 }.each(&:sort!).uniq\nend",
"def number_shuffle(number)\n nums = \"#{number}\".split('')\n unique_nums = []\n (1..nums.length).inject(:*).times do\n loop do\n break if !unique_nums.include?(nums.shuffle!.join.to_i)\n end\n unique_nums << nums.join.to_i\n end\n return unique_nums.sort\nend",
"def permutations(sequence)\n return sequence if sequence.empty?\n\n ch = sequence.delete_at(0)\n underlying = Set.new([ch])\n sequence.each do |ch|\n new_set = Set.new\n underlying.each do |permutation|\n (0..permutation.length).each do |idx|\n new_set.add(permutation.dup.insert(idx, ch))\n end\n end\n underlying = new_set\n end\n underlying.each\nend",
"def q(a);a.permutation;end",
"def next_smaller(n)\n result = n.digits.permutation.select { |p| p.join.to_i < n && p.first != 0 }\n result.empty? ? -1 : result.last.join.to_i\nend",
"def get_pandigitals\n return (0..9).to_a.permutation.map(&:join)\nend",
"def permutations(str)\n permutation(str.chars)\nend",
"def palindrome_permutation(str)\n\nend",
"def permutations(string)\n string.chars.permutation(string.length).to_a.map { |arr| arr.join }.uniq\nend",
"def solve\n max = nil\n\n # Start with the longest possible and work down. \n 9.downto( 1 ) do |i|\n max = Array.new( i ) {|j| 1 + j}.permutation.to_a.map! {|j| j.join.to_i}.select {|j| j.prime? }.max\n break if max\n end\n \n max\n end",
"def kaprekar n\n k = max_permutation(n) - min_permutation(n)\n if k == n then k else kaprekar k end\nend",
"def permutations(string)\n permute(string, 0, string.length)\nend",
"def pandigital_prime\n pandigitals = []\n [4,3,2,1].permutation{|p| pandigitals << p.join.to_i}\n [7,6,5,4,3,2,1].permutation{|p| pandigitals << p.join.to_i}\n pandigitals.sort!.reverse!\n\n pandigitals.each{|number| return number if is_prime?(number)}\nend",
"def permuted_multiples(range)\r\n (1..Float::INFINITY).lazy.each do |n|\r\n return n if range.map { |x| n*x }.all? do |x|\r\n x.digits.sort == n.digits.sort\r\n end\r\n end\r\nend",
"def permutations(arr)\n return [arr] if arr.length <= 1\n\n first = arr.shift\n perms = permutations(arr)\n total_perms = []\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_perms << perm[0...i] + [first] + perm[i..-1]\n end\n end\n\n total_perms.sort\nend",
"def number_shuffle(number)\n no_of_combinations = number.to_s.size == 3 ? 6 : 24\n digits = number.to_s.split(//)\n combinations = []\n combinations << digits.shuffle.join.to_i while\n combinations.uniq.size!=no_of_combinations\n combinations.uniq.sort\n\n end",
"def permutations\n return [self] if length == 1\n\n orders = []\n positions = (0...length).to_a\n\n # Finding the permutations with a basic array of digits\n positions.each do |position|\n (positions - [position]).permutations.each do |permutation|\n orders << permutation.unshift(position)\n end\n end\n\n # We subsitute in our original elements. This prevents duplicate\n # elements from causing problems, and allows the [3,3] example to work.\n orders.map { |order| order.map { |index| self[index] } }\n end",
"def permutations(string)\n string.chars.permutation.to_a.map(&:join).uniq\nend",
"def permutation(string)\n return [string] if string.size < 2\n char = string[0]\n total_perms = []\n perms = permutation(string[1..-1])\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_perms << perm[0...i] + char + perm[i..-1]\n end\n end\n\n total_perms\nend",
"def permutation(string)\n return [string] if string.size < 2\n char = string[0]\n perms = permutation(string[1..-1])\n result = []\n perms.each do |perm|\n result << char + perm\n (1..perm.length-1).each do |i|\n result << perm[0..i-1] + char + perm[i..-1]\n end\n result << perm + char\n end\n result.uniq\nend",
"def permutations(arr)\n return [arr] if arr.length == 1\n results = []\n arr.each_with_index do |num, idx|\n rest_of_arr = arr[0...idx] + arr[(idx + 1)..-1]\n permutations(rest_of_arr).each do |permutation|\n results << [num] + permutation\n end\n end\n results\nend",
"def permutations(a, i)\n if i == a.size \n puts to_decimal(a)\n gets\n return\n end\n\n for j in i..a.size-1\n a[j], a[i] = a[i], a[j]\n permutations(a, i + 1)\n a[j], a[i] = a[i], a[j]\n end\nend",
"def listPosition\n word = gets.chomp\n sorted_char_arr = word.chars.sort\n abc_rank = 1\n \n word.chars.each do |c|\n # Count of minimum alphabetically smaller permutations at given position including transposed non-unique letters\n smaller_perms = sorted_char_arr.find_index(c) * (sorted_char_arr.length - 1).safe_factorial\n \n # Remove non-unique permutations\n unique_smaller_perms = smaller_perms / sorted_char_arr.uniq.map { |d| sorted_char_arr.count(d).safe_factorial }.reduce(:*)\n \n abc_rank += unique_smaller_perms\n sorted_char_arr.delete_at(sorted_char_arr.index(c) || sorted_char_arr.length)\n end\n puts abc_rank\nend",
"def PrimeChecker(num)\n num = num.to_s.split('')\n perm = num.permutation(num.size).to_a\n perm.each do |p|\n return 1 if is_prime?(p.join.to_i) \n end\n return 0\nend",
"def permutations(sequence)\n return sequence if sequence.empty?\n ch = sequence.delete_at(0)\n underlying = Set.new([ch])\n sequence.each do |ch|\n new_set = Set.new\n underlying.each do |permutation|\n (0..permutation.length).each do |idx|\n new_set.add(permutation.dup.insert(idx, ch))\n end\n end\n underlying = new_set\n end\n underlying.each\n end",
"def permutations(str)\nend",
"def permutations(array)\n results = []\n\n 1000.times do \n premutation = array.shuffle\n results << array << premutation\n end\n\n results.uniq.sort\nend",
"def uniq_permutations_count(slots_count, nums_count)\n uniq_perms_count = factorial(nums_count)/factorial(nums_count - slots_count)\n uniq_perms_count/factorial(slots_count)\nend",
"def permutations(string)\nend",
"def max_rotation(num)\n arr = num.digits.reverse\n 0.upto(num.digits.size - 1) do |idx|\n arr << arr.delete_at(idx)\n end\n arr.join.to_i\nend",
"def permute(nums, solution = [], results = []\n return results << solution.clone if solution.size == nums.size\n\n nums.each do |num|\n next if solution.include?(num)\n\n solution << num\n permute(nums, solution, results)\n solution.pop\n end\n results\nend",
"def nth_permutation(n, elements)\n # Boundary condition\n return elements[0] if elements.length == 1\n # Recur\n row_step = factorial(elements.length - 1)\n element = elements[n.fdiv(row_step).truncate % elements.length]\n remaining_elements = elements - [element]\n return [element, nth_permutation(n % row_step, remaining_elements)].flatten\nend",
"def next_permutation(nums)\n i, j = nums.size - 2, nums.size - 1\n i -= 1 while i >= 0 && nums[i] >= nums[i + 1]\n if i >= 0\n j -= 1 while nums[j] <= nums[i]\n nums[i], nums[j] = nums[j], nums[i]\n end\n nums[i + 1..-1] = nums[i + 1..-1].reverse\n nums\nend",
"def is_permutation_of(check_num, original_num)\r\n\tcheck_array = check_num.to_s.split('').sort\r\n\torig_array = original_num.to_s.split('').sort\r\n\treturn (check_array.join(',') == orig_array.join(','))\r\nend",
"def permutation_size(word)\n\t\tn=word.size\n\t\tr=0\n\t\twhile r<=n\n\t\t\tn.factorial/(n-r).factorial\n\t\t\tr+=1\n\t\tend\n\tend",
"def max_rotation(num)\n digits = num.to_s.chars\n\n (digits.length - 1).times do |idx|\n digits << digits.delete_at(idx)\n end\n\n digits.join.to_i\nend",
"def permute(list)\n if (list.length <= 1)\n return [list]\n end\n permutations = []\n count = 1\n list.each do |item|\n sublist_permutations = permute(list - [item])\n sublist_permutations.each do |permutation|\n permutation.unshift(item)\n permutations << permutation\n #puts \"Permutations : #{permutations.join(', ')}\"\n #puts \"permutation lists: #{permutations.each {permutation.join(', ')}}\"\n end\n end\n return permutations\nend",
"def perm(nums, i, result)\n return result << nums.dup if i == nums.size\n\n (i...nums.size).each do |j|\n nums[i], nums[j] = nums[j], nums[i]\n perm(nums, i + 1, result)\n nums[i], nums[j] = nums[j], nums[i]\n end\nend",
"def max_rotation(num)\n arr = num.to_s.split(\"\")\n first_rotation = arr[1..-1] + [arr[0]]\n result = first_rotation\n if arr.size == 1\n return num\n elsif arr.size == 2\n return first_rotation.join.to_i\n else\n rotation_times = first_rotation.size - 2\n\n 1.upto(rotation_times) do |i|\n rotating_digit = result.delete_at(i)\n result.push(rotating_digit)\n end\n end\n return result.join.to_i\nend",
"def str_perm_efficient(string, k, n)\n if k == n\n puts string\n else\n for i in k..n\n string[i], string[k] = string[k], string[i] # fixing one element\n str_perm_efficient(string, k+1, n) # calling perm on remaining string\n string[k], string[i] = string[i], string[k] # Swap back the previously swapped elements\n end\n end\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 permutations(n,k)\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"def max_rotation(num)\n arr = num.digits.reverse\n arrdup = arr.dup # this code works without reduces whats deleted/pushed in.\n arrdup.each_with_index do |_, idx|\n arr << arr.delete_at(idx) \n end\n arr.join.to_i\nend",
"def permutations(n,k)\n binding.pry\n return 1 if k==0\n return n if k==1\n return factorial(n) if k==n\n (((n-k+1)..n).inject(1) {|ac,v| ac * v})\n #factorial(x).quo(factorial(x-n))\n end",
"def permutation(str, n = str.length)\n if n == 1\n puts str\n else\n n.times do |i|\n str[i], str[n - 1] = str[n - 1], str[i] # swap str[i] with str[n-1]\n permutation(str, n - 1)\n str[i], str[n - 1] = str[n - 1], str[i]\n end\n end\nend",
"def solution(digits)\n digits.chars.each_cons(5).max_by(&:itself).join.to_i\nend",
"def largest_palindrome_product\n # palindromes = palindromes.reverse\n integer = 999\n n = 0\n while palindromes.reverse[n] % integer != 0\n while palindromes.reverse[n] % integer != 0 && integer > 99\n integer -= 1 \n end\n n += 1\n end\n palindromes.reverse[n]\nend",
"def count_perms( digits, zeroOk = false )\n dups = (0..9).map {|i| digits.count( i )}.select {|j| 0 < j}.reduce( :* )\n\n if zeroOk || 0 != digits[0]\n # Leading zeros ok or none present, so just count unique permutations.\n return digits.length.fact / dups\n elsif 0 == digits[1]\n # Two zeros present, but not allowed up front.\n return ((digits.length - 1).fact * (digits.length - 2)) / dups\n else\n # One zero present, but not allowed up front.\n return ((digits.length - 1).fact * (digits.length - 1)) / dups\n end\n end",
"def generate(n=3, black_list=[])\n (0..9).to_a.\n repeated_permutation(n).\n select { |xs| valid?(xs, black_list) }.\n map(&:join).\n map(&:to_i)\nend"
] | [
"0.78991705",
"0.788584",
"0.7527743",
"0.75146693",
"0.73972195",
"0.7318816",
"0.72107565",
"0.7191309",
"0.71533126",
"0.71504533",
"0.7063112",
"0.70089173",
"0.70088434",
"0.6856708",
"0.68285215",
"0.6803354",
"0.6779732",
"0.6748386",
"0.67239904",
"0.67181057",
"0.6669737",
"0.6669586",
"0.665933",
"0.6657953",
"0.6625078",
"0.6595462",
"0.65840477",
"0.6560376",
"0.6559363",
"0.6532963",
"0.65130985",
"0.6471421",
"0.6407177",
"0.63597775",
"0.63372594",
"0.63326097",
"0.6326009",
"0.63048583",
"0.6298801",
"0.62536746",
"0.6252384",
"0.6247128",
"0.6214779",
"0.62087697",
"0.62059045",
"0.619923",
"0.6194593",
"0.61901826",
"0.6185518",
"0.61844605",
"0.6183693",
"0.6178384",
"0.61741316",
"0.615983",
"0.6154883",
"0.61476034",
"0.61385185",
"0.6133463",
"0.61275786",
"0.6120032",
"0.61100036",
"0.6102883",
"0.60874176",
"0.6082245",
"0.6066676",
"0.60659397",
"0.6051387",
"0.6045086",
"0.6036842",
"0.6016279",
"0.60142064",
"0.6005087",
"0.60039663",
"0.5991405",
"0.59892726",
"0.5980786",
"0.5980681",
"0.59804934",
"0.59753114",
"0.59669316",
"0.5935311",
"0.59351903",
"0.59298587",
"0.59271383",
"0.5916054",
"0.59071064",
"0.5902204",
"0.58955675",
"0.58939326",
"0.5888293",
"0.58871484",
"0.5886881",
"0.5884548",
"0.5874911",
"0.5868232",
"0.5862645",
"0.5848268",
"0.58415943",
"0.5837818",
"0.5836831",
"0.5823132"
] | 0.0 | -1 |
load the workflow view | def show
name = params[:name]
action = params[:id] ? "show" : "index"
action = params[:view] if params[:view].present?
@page = ("Workflows::#{name.to_s.capitalize}::#{action.capitalize}").constantize.new(params, { user: current_user, cookies: cookies })
render(html: @page.item.display) and return if params[:view].present?
render :template => "#{name}/#{action}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end",
"def show\n workflow_steps = WorkflowStep.where(\n repository: params[:repo],\n druid: params[:druid],\n workflow: params[:workflow]\n ).order(:workflow, created_at: :asc)\n @workflow = Workflow.new(name: params[:workflow], repository: params[:repo], druid: params[:druid], steps: workflow_steps)\n end",
"def show\n find_workflow\n comments_data(@workflow)\n revisions_data\n jobs_sync\n analyses = workflow_analyses(@workflow, :desc)\n @workflow.current_user = current_user\n\n render json:\n @workflow, adapter: :json,\n meta: {\n spec: @workflow.spec,\n apps: @workflow.apps,\n revisions: @revisions,\n executions: analyses[:analyses_jobs],\n batches: analyses[:batch_hash],\n challenges: @assignable_challenges,\n comments: @comments,\n links: meta_links(@workflow),\n }\n end",
"def set_workflow\n @workflow = Workflow.find(params[:id])\n end",
"def show\n @skip_flash_messages_in_header = true # we will handle flash messages in the 'workflows' layout\n respond_to do |format|\n format.html { render layout: 'workflows' }\n format.json\n format.json_api { render json: @workflow }\n end\n end",
"def set_workflow\n\t\t@workflow = Workflow.find(params[:id])\n\tend",
"def set_workflow\n @workflow = Workflow.find(params[:id])\n end",
"def set_workflow\n @workflow = Workflow.find(params[:id])\n end",
"def set_workflow\n @workflow = Workflow.find(params[:id])\n end",
"def show\n @workflow_task = WorkflowTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end",
"def workflow\n raise \"Could not read workflow from #{@osw_abs_path}\" if @workflow.nil?\n\n @workflow\n end",
"def workflow\n raise \"Could not read workflow from #{@osw_abs_path}\" if @workflow.nil?\n\n @workflow\n end",
"def set_workflow\n @workflow = Workflow.find(params[:id])\n end",
"def show\n @workflow = Workflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workflow }\n end\n end",
"def show\n @workflow = Workflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workflow }\n end\n end",
"def show\n @workflow = Workflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workflow }\n end\n end",
"def show\n @workflow = Workflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workflow }\n end\n end",
"def workflow\n end",
"def new\n @workflow_task = WorkflowTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end",
"def new\n @workflow = Workflow.new\n\n @rscript_rundir = \"#{Rails.root}/tmp/run/\"\n @rscript_outdir = \"#{Rails.root}/tmp/out/\"\n @rscript_path = \"#{Rails.root}/script/\"\n\n #Remove the previous run/out files\n FileUtils.rm(\"#{@rscript_rundir}/biome.json\", force: true)\n FileUtils.rm(\"#{@rscript_rundir}/multisite_config.xml\", force: true)\n FileUtils.rm(\"#{@rscript_outdir}/ghgv.json\", force: true)\n FileUtils.rm(\"#{@rscript_outdir}/ghgv.csv\", force: true)\n FileUtils.rm(\"#{@rscript_outdir}/output.svg\", force: true)\n\n\n\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n @ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/default_ecosystems.json\" , \"r\" ).read )\n @name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n @ecosystem = @ecosystems[0]\n\n# This is where I'll open the Priors from the DB\n# @priors = Prior.all\n# A prior will have a number of variables\n# One of those variables can belong to a given citation\n\n# A PFT would be akin to an ecosystem\n#render :partial => \"my_partial\", :locals => {:player => Player.new}\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workflow }\n end\n end",
"def load_workflow_state\n @workflow_state if instance_variable_defined? :@workflow_state\n end",
"def set_workflow\n @workflow = Workflow.friendly.find(params[:id])\n end",
"def show\n @workflow_task_type = WorkflowTaskType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow_task_type }\n end\n end",
"def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end",
"def new\n @workflow = Workflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def new\n @workflow_task_type = WorkflowTaskType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task_type }\n end\n end",
"def index\n @workflows = Workflow.all\n end",
"def load_workflows(project_key)\n project = Project.find_by key: project_key\n\n workflows_path = Rails.root.join('project', project_key, 'workflows', '*.json')\n puts \"Workflows: Loading workflows from #{workflows_path}\"\n\n Dir.glob(workflows_path).each do |workflow_hash_path|\n content = File.read(workflow_hash_path) # .gsub(/\\n/, '')\n begin\n next if content == ''\n\n workflow_hash = JSON.parse content\n workflow_hash.deep_symbolize_keys!\n\n puts \" Loading '#{workflow_hash[:name]}' workflow\"\n\n # workflow_hash[:project] = project\n\n tasks = workflow_hash.delete :tasks\n if tasks.is_a? Hash\n tasks = tasks.inject([]) do |a, (task_key, task_config)|\n task_config[:key] = task_key.to_s\n # Remove any config params not officially declared as fields of WorkflowTask:\n task_config = task_config.inject({}) { |h, (k,v)| h[k] = v if WorkflowTask.fields.keys.include?(k.to_s); h }\n\n # Rewrite pick-one-* tool configs to be structured the same per https://github.com/zooniverse/scribeAPI/issues/241\n # .. Just until project owners update their own configs\n task_config[:tool_config] = translate_pick_one_tool_config task_config\n\n a << task_config\n end\n end\n workflow_hash[:tasks] = tasks\n\n workflow_hash = load_help_text workflow_hash, project_key\n\n workflow = project.workflows.find_or_create_by name: workflow_hash[:name]\n workflow.update_attributes workflow_hash\n puts \" Loaded #{workflow.tasks.count} task(s)\"\n\n if workflow.generates_subjects && ! workflow.generates_subjects_for\n puts \" WARN: #{workflow.name} generates subjects, but generates_subjects_for not set\"\n end\n end\n end\n\n # Order workflows such that each appears before any workflows it generates subjects for\n project.workflows.each do |w|\n w.update_attribute :order, project.workflows.size - num_downstream_workflows(w) - 1\n end\n\n\n puts \" WARN: No mark workflow found\" if project.workflows.find_by(name: 'mark').nil?\n end",
"def show()\n view.show\n end",
"def workflow\n @workflow ||= Workflow.find(self.workflow_id)\n end",
"def show\n authorize @activity\n @teacher_mode = boolean_param(:teacher_mode) || @activity.teacher_only\n respond_to do |format|\n format.html {\n if params['print']\n render :print, :layout => \"layouts/print\"\n end\n }\n format.run_html { render :show, :layout => \"layouts/run\" }\n format.jnlp {\n render :partial => 'shared/installer', :locals => { :runnable => @activity, :teacher_mode => @teacher_mode }\n }\n format.config { render :partial => 'shared/show', :locals => { :runnable => @activity, :teacher_mode => @teacher_mode, :session_id => (params[:session] || request.env[\"rack.session.options\"][:id]) } }\n format.dynamic_otml {\n learner = (params[:learner_id] ? Portal::Learner.find(params[:learner_id]) : nil)\n if learner && learner.bundle_logger.in_progress_bundle\n launch_event = Dataservice::LaunchProcessEvent.create(\n :event_type => Dataservice::LaunchProcessEvent::TYPES[:activity_otml_requested],\n :event_details => \"Activity content loaded. Activity should now be running...\",\n :bundle_content => learner.bundle_logger.in_progress_bundle\n )\n end\n render :partial => 'shared/show', :locals => {:runnable => @activity, :teacher_mode => @teacher_mode}\n }\n format.otml { render :layout => 'layouts/activity' } # activity.otml.haml\n format.xml { render :xml => @activity }\n format.json { render :json => @activity }\n format.pdf {render :layout => false }\n end\n end",
"def show\n @workflow = Workflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow }\n format.csv { render :csv => @workflow }\n format.json { render :json => @workflow }\n end\n end",
"def view()\n @view\n end",
"def load_view\n\n @fiscal_years = (current_fiscal_year_year..current_fiscal_year_year + 49).map{ |y| [fiscal_year(y), y] }\n render params[:view]\n\n end",
"def new\n @workflow = Workflow.new\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n @ecosystems = JSON.parse( File.open( \"#{Rails.root}/data/default_ecosystems.json\" , \"r\" ).read )\n @name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n @ecosystem = @ecosystems[0]\n\n# This is where I'll open the Priors from the DB \n# @priors = Prior.all\n# A prior will have a number of variables\n# One of those variables can belong to a given citation\n\n# A PFT would be akin to an ecosystem \n#render :partial => \"my_partial\", :locals => {:player => Player.new}\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workflow }\n end\n end",
"def index\n @workflow_transitions = WorkflowTransition.all\n end",
"def set_workflow_transition\n @workflow_transition = WorkflowTransition.find(params[:id])\n end",
"def new\n @workflow = Workflow.new\n\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n @ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/default_ecosystems.json\" , \"r\" ).read )\n @name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n @ecosystem = @ecosystems[0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workflow }\n end\n end",
"def load_workflow_definition(workflow_definition)\n if find_workflow_definition(workflow_definition.name, workflow_definition.version)\n #logger.warn(\"already defined workflow_definition #{workflow_definition.name} v#{workflow_definition.version} in store\")\n return\n end\n workflow_def = WorkflowDefinition.new\n workflow_def.name = workflow_definition.name\n workflow_def.version = workflow_definition.version\n workflow_def.document_cls = workflow_definition.document_cls\n\n workflow_def.save!\n\n workflow_definition.nodes.each do |node|\n workflow_step_definition = WorkflowStepDefinition.new\n workflow_step_definition.name = node.nodename\n workflow_step_definition.participant_definition = node.participant_definition\n workflow_step_definition.condition = node.condition\n workflow_step_definition.nodetype = node.nodetype\n\n workflow_step_definition.workflow_definition = workflow_def\n workflow_step_definition.save!\n #attach some information to memory node\n class << node\n attr_accessor :workflow_step_definition_id\n end\n node.workflow_step_definition_id = workflow_step_definition.id\n\n\n end\n workflow_definition.nodes.each do |node|\n node.transitions.each do |transition|\n transition_definition = WorkflowTransitionDefinition.new\n transition_definition.name = transition.name\n\n #puts node.inspect\n #puts transition_definition.inspect\n transition_definition.to_step_id = transition.to.workflow_step_definition_id\n transition_definition.workflow_step_definition_id = node.workflow_step_definition_id\n transition_definition.save!\n end\n end\n\n end",
"def new\n authorize! :create_task_list, @active_project\n \n @task_list = @active_project.task_lists.build()\n \n begin\n @task_list.milestone = @active_project.milestones.find(params[:milestone_id])\n @task_list.is_private = @task_list.milestone.is_private\n rescue ActiveRecord::RecordNotFound\n @task_list.milestone_id = 0\n end\n \n respond_to do |format|\n format.html # new.html.erb\n \n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n form_tag task_lists_path \n error_messages_for :task_list \n t('name') \n text_field 'task_list', 'name', :id => 'taskListFormName', :class => 'long' \n t('priority') \n text_field 'task_list', 'priority', :id => 'taskListPriority', :class => 'long' \n t('description') \n text_area 'task_list', 'description', :id => 'taskListFormDescription', :class => 'short', :rows => 10, :cols => 40 \n t('milestone') \n select 'task_list', 'milestone_id', select_milestone_options(@active_project), {}, {:class => 'select_milestone', :id => 'taskListFormMilestone'} \n if @logged_user.member_of_owner? \n t('is_private_list') \n t('is_private_list_info') \n yesno_toggle 'task_list', 'is_private', :id => 'taskListFormIsPrivate', :class => 'yes_no' \n end \n t('tags') \n text_field 'task_list', 'tags', :id => 'taskListFormTags', :class => 'long' \nt('tags_info') \n \n t('add_task_list') \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n }\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n form_tag task_lists_path \n error_messages_for :task_list \n t('name') \n text_field 'task_list', 'name', :id => 'taskListFormName', :class => 'long' \n t('priority') \n text_field 'task_list', 'priority', :id => 'taskListPriority', :class => 'long' \n t('description') \n text_area 'task_list', 'description', :id => 'taskListFormDescription', :class => 'short', :rows => 10, :cols => 40 \n t('milestone') \n select 'task_list', 'milestone_id', select_milestone_options(@active_project), {}, {:class => 'select_milestone', :id => 'taskListFormMilestone'} \n if @logged_user.member_of_owner? \n t('is_private_list') \n t('is_private_list_info') \n yesno_toggle 'task_list', 'is_private', :id => 'taskListFormIsPrivate', :class => 'yes_no' \n end \n t('tags') \n text_field 'task_list', 'tags', :id => 'taskListFormTags', :class => 'long' \nt('tags_info') \n \n t('add_task_list') \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n\n end",
"def show\n setup_download_list\n render partial: \"browse_#{view_type}\"\n end",
"def set_view\n @view = View.find(params[:id])\n end",
"def show\n set_task_for_show\n render 'tasks/index'\n end",
"def new\n @presentation = current_church.presentations.build\n @presentation.load_template(current_church)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presentation }\n end\n end",
"def load\r\n \r\n end",
"def view\n JenkinsPipelineBuilder::View.new(self)\n end",
"def show()\n @view__.show\n self\n end",
"def set_project_type_workflow\n @project_type_workflow = ProjectTypeWorkflow.find(params[:id])\n end",
"def load_workflow_definition(workflow_definition)\n if find_workflow_definition(workflow_definition.name, workflow_definition.version)\n Merb.logger.warn(\"already defined workflow_definition #{workflow_definition.name} v#{workflow_definition.version} in store\")\n return\n end\n workflow_def = WorkflowDefinition.new\n workflow_def.name = workflow_definition.name\n workflow_def.version = workflow_definition.version\n\n workflow_def.save!\n\n workflow_definition.nodes.each do |node|\n workflow_step_definition = WorkflowStepDefinition.new\n workflow_step_definition.name = node.nodename\n workflow_step_definition.participant_definition = node.participant_definition\n workflow_step_definition.condition = node.condition\n workflow_step_definition.workflow_definition = workflow_def\n workflow_step_definition.save!\n #attach some information to memory node\n class << node\n attr_accessor :workflow_step_definition_id\n end\n node.workflow_step_definition_id = workflow_step_definition.id\n\n\n end\n workflow_definition.nodes.each do |node|\n node.transitions.each do |transition|\n transition_definition = WorkflowTransitionDefinition.new\n transition_definition.name = transition.name\n transition_definition.to_step_id = transition.to.workflow_step_definition_id\n transition_definition.workflow_step_definition_id = node.workflow_step_definition_id\n transition_definition.save!\n end\n end\n \n end",
"def index\n\t\t@workflow = current_user.setting.workflow\n\t\tredirect_to new_workflow_path and return if current_user.setting.workflow.blank?\n\tend",
"def show\n # render :layout => 'presentation'\n end",
"def index\n @project_type_workflows = ProjectTypeWorkflow.all\n end",
"def view_process_framework\r\n @gantt = Redmine::Helpers::Gantt.new(params)\r\n @gantt.project = @project\r\n retrieve_query\r\n @query.group_by = nil\r\n @gantt.query = @query if @query.valid?\r\n respond_to do |format|\r\n format.html \r\n format.xml { render :xml => @gantt}\r\n end\r\n end",
"def show\n id = params[:id]\n init_core_tl_display_vars()\n get_timeline_data_for_display(id)\n \n @local_page_title = @timeline.title\n if @timeline.desc.present?\n @local_page_desc = @timeline.desc\n else\n @local_page_desc = @timeline.title\n end \n \n @complete_page_url = \"#{request.protocol}#{request.host_with_port}#{request.fullpath}\"\n logger.debug(\"Complete page path: \" + @complete_page_url)\n \n @tl_container_page_path = timeline_path(@timeline)\n if signed_in?\n if !current_user.nil?\n # remember query key in session. We'll need if user edits/delets event\n #session[:qkey] = query_key\n \n # Remember listviewurl , we need it in edit func.\n if @viewstyle == 'list'\n tmp_list_url = generate_list_view_url(nil,@tlid, @fromdate, @todate, @fullscr== 'true'?true:false, @events_on_a_page, @tl_container_page_path)\n session[:listviewurl] = tmp_list_url\n end\n end\n end\n record_activity(\"t=#{@timeline.title}\")\n\n if @fullscr == \"true\"\n render :template => \"timelines/tl-fullscr\", :formats => [:html], :handlers => :haml,\n :layout => \"tl\"\n elsif @embeddedview == \"true\"\n #\n #Preview case is also covered here.\n #\n render :template => \"events/tl\", :formats => [:html], :handlers => :haml,\n :layout => \"tl\"\n else\n # Normal timeline page rendering with default layout etc.\n # ...\n end\n end",
"def load\n self.class.load self # pass the loading off to the class\n end",
"def load_haml(modelname, filename)\n @modelname = modelname\n @filename = filename\n $filename = filename\n $is_private = false\n $is_protected = false\n $form_target = nil # TODO\n\n $log.debug \"load haml: #{modelname} #{filename}\"\n # Model name, action\n if filename =~ /views\\/(\\w+)\\/(\\w+).haml/\n # app/views/HOGE/FOO.haml\n @model = Regexp.last_match[1].singularize\n @action = Regexp.last_match[2]\n @format = 'html' # TODO\n $log.debug \"load() HAML #{@model} #{@action} #{@format}\"\n elsif filename =~ /views\\/(\\w+)\\/(\\w+)\\/(\\w+).haml/\n # app/views/HOGE/HOGE/FOO.haml\n @model = Regexp.last_match[1].singularize + ':' + Regexp.last_match[2].singularize\n @action = Regexp.last_match[3]\n @format = 'html' # TODO\n $log.debug \"load() HAML #{@model} #{@action} #{@format}\"\n elsif filename =~ /views\\/(\\w+)\\/(\\w+).(\\w+).haml/\n # app/views/HOGE/XXX.html.haml\n @model = Regexp.last_match[1].singularize\n @action = Regexp.last_match[2]\n @format = Regexp.last_match[3]\n $log.debug \"load() HAML #{@model} #{@action} #{@format} #{filename}\"\n elsif filename =~ /views\\/(\\w+)\\/(\\w+)\\/(\\w+).(\\w+).haml/\n # app/views/HOGE/HOGE/FOO.html.haml\n @model = Regexp.last_match[1] + ':' + Regexp.last_match[2].singularize\n @action = Regexp.last_match[3]\n @format = Regexp.last_match[4]\n $log.debug \"load() HAML #{@model} #{@action} #{@format}\"\n else\n $log.info \"load() HAML unknown action filename=#{filename}\"\n end\n\n if @format != 'html'\n @id = @model + '_' + @action + '_' + @format\n n = @model + \"#\" + @action + \"#\" + @format\n else\n @id = @model + '_' + @action\n n = @model + \"#\" + @action\n end\n\n # new View state\n add_state('view', n, @filename)\n $block_var = []\n\n # HAML -> Ruby -> AST\n haml_code = File.read(@filename)\n ruby_code = conv_haml2ruby(haml_code)\n\n s = Ripper.sexp(ruby_code)\n if s.nil?\n $log.error \"HAML no code #{@filename}\"\n fail \"TODO:\"\n else\n parse_sexp(0, s)\n end\n end",
"def index\n @active_workflow_steps = ActiveWorkflowStep.all\n end",
"def show\n @poll_workflow_state = PollWorkflowState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll_workflow_state }\n end\n end",
"def view\n\n @view_only = true\n\n wid = params[:id]\n\n return error_wi_not_found \\\n unless OpenWFE::Extras::Workitem.exists?(wid)\n\n load_workitem wid\n\n render :template => \"workitem/edit\"\n end",
"def show\n render :layout => \"presentation\"\n end",
"def show\n @work_flow = WorkFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @work_flow }\n end\n end",
"def load\n @load_controller = @controller\n end",
"def new\n @workflow = Workflow.new\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n @ecosystems = JSON.parse( File.open( \"#{Rails.root}/data/default_ecosystems.json\" , \"r\" ).read )\n @ecosystem = @ecosystems[0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workflow }\n end\n end",
"def load_view options\n options ||= {}\n options = options[:fancygrid] || options\n options = options[self.name] || options\n self.view = Fancygrid::View.new(options)\n \n # reorder current leafs\n new_leafs = self.leafs\n self.leafs = []\n new_leafs.each do |leaf|\n insert_node(leaf)\n end\n end",
"def view relpath\n (folder_views + relpath).deserb(self)\n end",
"def init_views\n @actions = @actions.nil? ? [] : @actions\n @tabs = @tabs.nil? ? [] : @tabs\n end",
"def load(modelname, filename)\n @modelname = modelname\n @filename = filename\n $filename = filename\n $is_private = false\n $is_protected = false\n $form_target = nil # TODO\n\n $log.debug \"load : #{modelname} #{filename}\"\n # Model name, action\n if filename =~ /views\\/(\\w+)\\/(\\w+).erb/\n # app/views/HOGE/FOO.erb\n # app/views/catalog/sms.erb\n @model = Regexp.last_match[1].singularize\n @action = Regexp.last_match[2]\n @format = 'html' # TODO\n elsif filename =~ /views\\/(\\w+)\\/(\\w+)\\/(\\w+).erb/\n # app/views/HOGE/HOGE/FOO.erb\n @model = Regexp.last_match[1].singularize + ':' + Regexp.last_match[2].singularize\n @action = Regexp.last_match[3]\n @format = 'html' # TODO\n elsif filename =~ /views\\/(\\w+)\\/(\\w+).(\\w+).erb/\n # app/views/line_items/_line_item.text.erb\n @model = Regexp.last_match[1].singularize\n @action = Regexp.last_match[2]\n @format = Regexp.last_match[3]\n elsif filename =~ /views\\/(\\w+)\\/(\\w+)\\/(\\w+).(\\w+).erb/\n # app/views/HOGE/HOGE/FOO.text.erb\n @model = Regexp.last_match[1] + ':' + Regexp.last_match[2].singularize\n @action = Regexp.last_match[3]\n @format = Regexp.last_match[4]\n else\n $log.error \"load(), unknown action filename=#{filename}\"\n end\n\n if @format != 'html'\n @id = @model + '_' + @action + '_' + @format\n n = @model + \"#\" + @action + \"#\" + @format\n else\n @id = @model + '_' + @action\n n = @model + \"#\" + @action\n end\n\n # new View state\n s = add_state('view', n, @filename)\n $block_var = []\n\n # ERB -> Ruby\n @erb = File.read(@filename)\n @ruby = Erb::Stripper.new.to_ruby(@erb)\n # Ruby -> AST\n $log.debug \"Ruby -> AST\"\n s = Ripper.sexp(@ruby)\n\n $log.debug \"AST -> Model\"\n parse_sexp(0, s)\n\n # DEBUG\n $log.debug \"GUARD #{$state.filename}\"\n pp $conditions if $debug\n end",
"def create_analysis_views\n puts \"====================\"\n puts \"creating analysis views for #{self.name}\"\n puts \"====================\"\n\n run_analysis_views\n\n puts \"> done\"\n puts \"====================\"\n end",
"def new\n load_dependents\n @training_calendar = TrainingCalendar.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @training_calendar }\n end\n end",
"def load_task\n @task = Task.find(params[:id])\n end",
"def workflow\r\n if @openstudio_2\r\n super\r\n else\r\n @workflow\r\n end\r\n end",
"def new\n @work_flow = WorkFlow.new\n @work_flow.doc_types=\"0\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_flow }\n format.js { render \"basic_setting/new\",:locals=>{:resource=>@work_flow }}\n end\n end",
"def load\n end",
"def load\n end",
"def load\n end",
"def show\n @lab_book_snapshot = Embeddable::LabBookSnapshot.find(params[:id])\n if request.xhr?\n render :partial => 'show', :locals => { :lab_book_snapshot => @lab_book_snapshot }\n else\n respond_to do |format|\n format.html # show.html.haml\n format.otml { render :layout => \"layouts/embeddable/lab_book_snapshot\" } # lab_book_snapshot.otml.haml\n format.jnlp { render :partial => 'shared/installer', :locals => { :runnable => @lab_book_snapshot } }\n format.config { render :partial => 'shared/show', :locals => { :runnable => @lab_book_snapshot, :session_id => (params[:session] || request.env[\"rack.session.options\"][:id]) } }\n format.dynamic_otml { render :partial => 'shared/show', :locals => {:runnable => @lab_book_snapshot } }\n format.xml { render :lab_book_snapshot => @lab_book_snapshot }\n end\n end\n end",
"def read_index\n all_tasks = @model.read\n @view.show_index(all_tasks)\n\tend",
"def view\n @_view\n end",
"def show\n id = params[:id]\n init_core_tl_display_vars()\n get_timeline_data_for_display(id)\n @local_page_title = @tlentry.title\n @complete_page_url = \"#{request.protocol}#{request.host_with_port}#{request.fullpath}\"\n logger.debug(\"Complete page path: \" + @complete_page_url)\n \n @tl_container_page_path = timeline_path(@tlentry)\n if signed_in?\n if !current_user.nil?\n # remember query key in session. We'll need if user edits/delets event\n #session[:qkey] = query_key\n \n # Remember listviewurl , we need it in edit func.\n if @viewstyle == 'list'\n tmp_list_url = generate_list_view_url(nil,@tlid, @fromdate, @todate, @fullscr== 'true'?true:false, @events_on_a_page, @tl_container_page_path)\n session[:listviewurl] = tmp_list_url\n end\n end\n end\n \n if @fullscr == \"true\"\n render :template => \"timelines/tl-fullscr\", :formats => [:html], :handlers => :haml,\n :layout => \"tl\"\n end \n end",
"def build\n view\n self\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def current_view\n return @current_view if @current_view\n\n Chef::Log.debug \"Load #{new_resource} view information\"\n\n get_view_as_json =\n <<-GROOVY\n import hudson.model.*\n import jenkins.model.*\n view_name = '#{new_resource.name}'\n jenkins = Jenkins.instance\n\n def view_variables = new groovy.json.JsonBuilder()\n view_variables {}\n\n // Output view as JSON, easily parse-able by ruby\n view = jenkins.getView(view_name)\n if (view) {\n view_variables {\n name view_name\n jobs view.getItems().collect { it.name }\n }\n }\n\n println view_variables.toString()\n GROOVY\n\n response = executor.groovy!(get_view_as_json)\n return if response.nil?\n\n Chef::Log.debug \"Parse #{new_resource} as JSON\"\n @current_view = JSON.parse(response, object_class: Mash)\n @current_view\n end",
"def load\n end",
"def show\n @lab_flow = LabFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_flow }\n end\n end",
"def load\n end",
"def load\n end",
"def load!\n # TODO Don't load a module that's already loaded\n\n # Load the main file\n fname = path(\"#{name}.rb\")\n require fname unless fname.nil?\n\n # Load the basic things usually autoloaded.\n Dir[\"#{@path}/{init,models,routes,helpers}/*.rb\"].each { |f| require f }\n\n # Ensure public/ works\n public_path = path(:public)\n Main.add_public(public_path) unless public_path.nil?\n\n # Add the view path, if it has\n if path(:views)\n paths = [path(:views)]\n paths += Main.multi_views if Main.respond_to?(:multi_views)\n Main.set :multi_views, paths\n end\n end",
"def index\n @workflow_types = WorkflowType.all\n end",
"def initialize(view)\n @view = view\n end",
"def loadView\n self.view = MainView.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end",
"def show\n @task = Task.find(params[:id])\n render :show, :layout => 'sidebar'\n end",
"def set_workflow_status\n @workflow_status = WorkflowStatus.find(params[:id])\n end",
"def display_tasks\n # get the array from the repo\n tasks = @repo.all\n # display all the tasks\n @view.display_tasks(tasks)\n end",
"def create\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n my_wf_folder = WorkflowsHelper.get_my_wf_folder(@login_user.id)\n\n tmpl_item = Item.find(params[:select_workflow])\n\n item = tmpl_item.copy(@login_user.id, my_wf_folder.id)\n\n attrs = ActionController::Parameters.new({title: tmpl_item.title + t('msg.colon') + User.get_name(@login_user.id), public: false})\n item.update_attributes(attrs.permit(Item::PERMIT_BASE))\n\n item.workflow.update_attribute(:status, Workflow::STATUS_NOT_ISSUED)\n\n sql = WorkflowsHelper.get_list_sql(@login_user.id, my_wf_folder.id)\n @workflows = Workflow.find_by_sql(sql)\n\n render(:partial => 'ajax_workflow', :layout => false)\n\n rescue => evar\n Log.add_error(request, evar)\n render(:partial => 'ajax_workflow', :layout => false)\n end",
"def view\n end",
"def schedule_view\n\t\t# render the partial page with js to show the schedule view\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def load_tasks\n end",
"def show\n begin\n @task_list = @active_project.task_lists.find(params[:id])\n rescue\n return error_status(true, :invalid_task_list)\n end\n \n authorize! :show, @task_list\n\n respond_to do |format|\n format.html {\n index_lists(@logged_user.member_of_owner?)\n }\n \n format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n render :partial => 'show', :object => @task_list, :locals => {:on_list_page => true} \n \n \n \n \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n }\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n form_authenticity_token \n unless @active_project.nil? \n h @active_project.name \n h page_title \n h Company.owner.name \n else \n h page_title \n h Company.owner.name \n end \n stylesheet_link_tag 'project_website' \n additional_stylesheets.each do |ss| \n stylesheet_link_tag ss \n end unless additional_stylesheets.nil? \n javascript_include_tag 'application.js' \n javascript_tag \"var PROJECT_ID = #{@active_project.id}; var LOGGED_USER_ID=#{@logged_user.id};\" \n unless @active_project.is_active? \n t('project_locked_header') \n if can?(:change_status, @active_project) \n link_to t('mark_project_as_active'), open_project_path(:id => @active_project.id), :method => :put, :confirm => t('mark_project_as_active_confirmation') \n end \n end \n h @active_project.name \n if user.is_anonymous? \n t('welcome_anonymous') \n link_to(t('login'), logout_path) \n else \n t('welcome_back', :user => h(user.display_name)).html_safe \n link_to t('logout'), logout_path, :confirm => t('are_you_sure_logout') \n end \n @running_times.empty? ? 'none' : 'block' \n t('running_times', :count => @running_times.size) \n render_icon 'bullet_drop_down', '', :id => 'running_times', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n unless user.is_anonymous? \n link_to t('account'), @logged_user \n render_icon 'bullet_drop_down', '', :id => 'account_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless projects.blank? \n link_to t('projects'), :controller => 'dashboard', :action => 'my_projects' \n render_icon 'bullet_drop_down', '', :id => 'projects_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n if user.is_admin \n link_to t('administration'), :controller => 'administration' \n render_icon 'bullet_drop_down', '', :id => 'administration_more', :class => 'PopupMenuWidgetAttachTo', :title => 'Enable javascript' \n end \n unless user.is_anonymous? \n t('account') \n link_to t('edit_profile'), edit_user_path(:id => user.id) \n link_to t('update_avatar'), avatar_user_path(:id => user.id) \n t('userbox_more') \n link_to t('my_projects'), :controller => 'dashboard', :action => 'my_projects' \n link_to t('my_tasks'), :controller => 'dashboard', :action => 'my_tasks' \n end \n unless projects.blank? \n t('projects') \n projects.each do |project| \n link_to h(project.name), project_path(:id => project.id) \n end \n end \n if user.is_admin \n t('administration') \n link_to t('company'), Company.owner \n link_to t('members'), companies_path \n link_to t('projects'), projects_path \n end \n listed.id \n link_to h(listed.name), listed.object_url \n link_to render_icon('stop', t('stop_time')), stop_time_path(:active_project => listed.project_id , :id => listed.id), :class => 'blank stopTime' \n \n \n unless tabs.nil? \n current_tab = self.current_tab \n tabs.each do |item| \n \"item_#{item[:id]}\" \n 'class=\"active\"'.html_safe if item[:id] == current_tab \n item[:url] \n t(item[:id]) \n end \n end \n \n unless crumbs.nil? \n crumbs.each do |crumb| \n if crumb[:url] \n crumb[:url] \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n else \n crumb[:title].is_a?(Symbol) ? t(crumb[:title]) : h(crumb[:title]) \n end \n end \n end \n \n if Rails.configuration.search_enabled \n form_tag search_project_path(:id => @active_project.id) \n\n @search_field_default_value = t('search_box_default')\n @last_search ||= @search_field_default_value\n @search_field_attrs = {\n :onfocus => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\",\n :onblur => \"if (event.target.value == '#{@search_field_default_value}') event.target.value=''\"\n }\n\n text_field_tag 'search_id', (h @last_search), @search_field_attrs \n t('go') \n end \n if flash[:message] \n flash[:error] ? 'error' : 'success' \n flash[:error] ? 'flash_error' : 'flash_success' \n h flash[:message] \n end \n h page_title \n if @private_object \n image_path('icons/private.gif') \n end \n @content_for_sidebar.nil? ? '' : 'class=\\'sidebar\\'' \n page_actions.each do |action| \n action[:url] \n action[:ajax] ? 'class=\"ajax_action\"' : 'class=\"action\"' \n action[:title] \n t(action[:title]) \n end \n \n render :partial => 'show', :object => @task_list, :locals => {:on_list_page => true} \n \n \n \n \n unless @content_for_sidebar.nil? \n render :partial => @content_for_sidebar \n end \n if not Company.owner.homepage.nil? \n Company.owner.homepage \n Company.owner.name \n else \n Company.owner.name \n end \n product_signature \n \n\nend\n\n end",
"def show\n @tasks = @list.tasks\n # Setting a layout different from the default\n render layout: 'application'\n end",
"def load_views!\n new = YAML.load ERB.new(\n Pathname.new(__FILE__).dirname.join('..', 'config', 'views.yml').read\n ).result\n\n id = new['_id']\n old = database.get id\n\n if old['version'].to_i < new['version'].to_i\n log \"Upgrading Design Document #{id} to v#{new['version']}\"\n database.delete_doc old\n database.save_doc new\n end\n\n rescue RestClient::ResourceNotFound\n log \"Creating Design Document #{id} v#{new['version']}\"\n database.save_doc new\n end"
] | [
"0.7102376",
"0.63925046",
"0.6367075",
"0.61744845",
"0.6164956",
"0.61139506",
"0.60870904",
"0.60870904",
"0.60870904",
"0.6032993",
"0.6004404",
"0.60043406",
"0.6003554",
"0.59932077",
"0.59932077",
"0.59932077",
"0.59932077",
"0.5955843",
"0.592802",
"0.5923831",
"0.5912135",
"0.59090656",
"0.58948886",
"0.58509934",
"0.57681394",
"0.5709117",
"0.57054615",
"0.5698098",
"0.5660765",
"0.5625428",
"0.56084573",
"0.56017673",
"0.55949223",
"0.55760914",
"0.55491287",
"0.5531349",
"0.55269665",
"0.55268633",
"0.55218375",
"0.5518542",
"0.55130583",
"0.5503068",
"0.5502114",
"0.5488359",
"0.5479622",
"0.54744345",
"0.54631084",
"0.5459262",
"0.5450935",
"0.54508907",
"0.5444223",
"0.54292583",
"0.5426727",
"0.5419286",
"0.54176325",
"0.54163855",
"0.5415973",
"0.5414613",
"0.54054147",
"0.54050624",
"0.5404912",
"0.53916895",
"0.5386962",
"0.5375551",
"0.5373619",
"0.5373479",
"0.5370614",
"0.53693324",
"0.5368681",
"0.53682464",
"0.5365109",
"0.53585285",
"0.53500456",
"0.53500456",
"0.53500456",
"0.53477055",
"0.5342954",
"0.5337533",
"0.5331549",
"0.5327907",
"0.53108054",
"0.53097343",
"0.5308388",
"0.5299617",
"0.5290376",
"0.5290376",
"0.5286138",
"0.5278369",
"0.5273414",
"0.52691376",
"0.5249631",
"0.524034",
"0.52401334",
"0.52394205",
"0.5237783",
"0.5236849",
"0.52356833",
"0.52336955",
"0.5232658",
"0.52254164"
] | 0.65805703 | 1 |
GET /evolutions/1 GET /evolutions/1.json | def show
@evolution = Evolution.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @devolutions = Devolution.all\n end",
"def evolution_request(species, name)\n\t\tevolution_request = HTTParty.get(\"http://pokeapi.co/api/v2/evolution-chain/#{species.evolution_id}\")\n\t\tevolutions = PokeapiEvolutions.new(evolution_request, name)\n\t\treturn evolutions\n\tend",
"def show\n @version = Version.find(params[:id])\n @versionconfig= @version.version_configurations.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end",
"def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end",
"def index\n @pokemon_evolutions = PokemonEvolution.all\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @especy }\n end\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def show\n @video_gallery = VideoGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video_gallery }\n end\n end",
"def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end",
"def show\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy }\n end\n end",
"def show\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_type_extra_spec }\n end\n end",
"def index\n @especie = Especie.find(params[:especie_id])\n @especie_imagens = EspecieImagem.find(@especie.especie_imagens)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @especie_imagens }\n end\n end",
"def index\n @web_car_galleries = WebCarGallery.all\n\n render json: @web_car_galleries\n end",
"def show\n @edition_type = EditionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edition_type }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @supervisions }\n end\n end",
"def show\n @version = Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end",
"def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end",
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def show\n render json: @elector\n end",
"def show\n @dream = Dream.find()\n\n respond_to do |format|\n format.json { render json: @dream.video_properties }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def show\n @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_version }\n end\n end",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end",
"def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @rpm = Rpm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rpm }\n end\n end",
"def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end",
"def show\n \n @collage = Collage.find(params[:id])\n\n respond_to do |format|\n format.html { render action: \"show\", layout: 'coollage' }\n format.json { render json: @collage }\n end\n end",
"def show\n render json: @web_car_gallery\n end",
"def show\n @volantino = Volantino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volantino }\n end\n end",
"def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end",
"def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def index\n @api_versions = ApiVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end",
"def show\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voxel }\n end\n end",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @virus = Virus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus }\n end\n end",
"def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\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 @episodes = Episode.all\n\n render json: @episodes\n end",
"def show\n @egallery = Egallery.find(params[:id])\n @egalleryps = Egalleryp.all(:conditions => {:egallery_id => params[:id]})\n# return render :text => \"podaję parametry -> #{params.to_yaml}\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @egallery }\n end\n end",
"def show\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @color_saturation }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def show\n\t\t@recipe = Recipe.find(params[:id])\n\t\tif @recipe \n\t\t\trender json: @recipe.to_json(:include => [:inventories])\n\t\telse\n\t\t\trender status: 400, nothing: true\n\t\tend\n\tend",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def index\n @orientations = Orientation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orientations }\n end\n end",
"def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\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, :includes => [:thumbnail, :pictures, :videos, :documents] }\n end\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end",
"def index\n @efforts = Effort.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @efforts }\n end\n end",
"def show\n @admin_version = Admin::Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_version }\n end\n end",
"def index\n @admin_versions = Admin::Version.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_versions }\n end\n end",
"def show\n @ope_kind = OpeKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ope_kind }\n end\n end",
"def show\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specification }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def index\n @verticals = Vertical.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verticals }\n end\n end",
"def show\n @gallery = Gallery.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end",
"def show\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_gallery }\n end\n end",
"def show\n @escala = Escala.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @escala }\n end\n end",
"def show\n @article = Article.where(:id => params[:id]).first\n redirect_to articles_path and return unless @article\n\n if @article and params[:v]\n @version = Version.find params[:v]\n @article = @version.reify\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 show\n render json: Festival.build_for(params[:id]).to_json\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def show\n @energy_level = EnergyLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @energy_level }\n end\n end",
"def show\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etsy }\n end\n end",
"def show\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enterprise }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n render json: @thumb\n end",
"def show\n @volume_type = VolumeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_type }\n end\n end",
"def show\n @os_release = OsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_release }\n end\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def show\n @equipment = Equipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end",
"def show\n @variant = Variant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variant }\n end\n end",
"def show\n @variant = Variant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variant }\n end\n end",
"def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def show\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konfig }\n end\n end",
"def show\n @fileversion = Fileversion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fileversion }\n end\n end",
"def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end",
"def show\n @vet_lab_type = VetLabType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet_lab_type }\n end\n end"
] | [
"0.6348234",
"0.6341934",
"0.62985355",
"0.6251146",
"0.60362124",
"0.60007274",
"0.59500164",
"0.59396225",
"0.5922972",
"0.5891881",
"0.5885376",
"0.5884324",
"0.5884324",
"0.5884324",
"0.58804417",
"0.5861999",
"0.5842792",
"0.58417",
"0.58361787",
"0.5817218",
"0.58170485",
"0.58128834",
"0.58115095",
"0.58114743",
"0.58092046",
"0.58087575",
"0.58032906",
"0.5787421",
"0.5787116",
"0.5771728",
"0.5771728",
"0.57702494",
"0.576716",
"0.5759039",
"0.5756574",
"0.5755178",
"0.57476014",
"0.57433075",
"0.57325333",
"0.5727015",
"0.57231456",
"0.5716831",
"0.5715273",
"0.57097185",
"0.57083553",
"0.5698901",
"0.5694151",
"0.5688319",
"0.56810707",
"0.56644124",
"0.56635123",
"0.5659325",
"0.5658013",
"0.56540024",
"0.5644222",
"0.5642208",
"0.56264246",
"0.56250817",
"0.56240034",
"0.5616751",
"0.5616679",
"0.56140995",
"0.5612241",
"0.56104517",
"0.5608271",
"0.56074613",
"0.56062347",
"0.55972415",
"0.55959153",
"0.55953777",
"0.559263",
"0.5592203",
"0.5590981",
"0.5590659",
"0.55905545",
"0.5590469",
"0.5590234",
"0.5589811",
"0.55895114",
"0.55884475",
"0.5587961",
"0.55875033",
"0.5586347",
"0.5584482",
"0.5584482",
"0.5580844",
"0.5580319",
"0.55789566",
"0.5578313",
"0.5576802",
"0.55750555",
"0.55750555",
"0.5574812",
"0.5572504",
"0.5571539",
"0.55691147",
"0.5567703",
"0.556466",
"0.5560995",
"0.5558012"
] | 0.6410378 | 0 |
Reescreve o to_s da classe String (Polimorfismo) | def to_s
puts "#{@autor}, #{@numero_paginas}, #{@isbn}, #{@valor}, #{@categoria}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string\n s = ''\n reconstruir(s)\n s\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s\n str\n end",
"def to_str() end",
"def to_str() end",
"def to_s\n string.to_s\n end",
"def to_s\n string\n end",
"def to_s\n @string.to_s\n end",
"def to_s(*) end",
"def to_s(*) end",
"def to_s(*) end",
"def to_str\n to_s\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_str; end",
"def to_s\n @str\n end",
"def to_s\n @str\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n to_text\n end",
"def to_s\n\t\t\t@string\n\t\tend",
"def to_str\n end",
"def to_str\n end",
"def to_s\n @str\n end",
"def to_str\n to_s\n end"
] | [
"0.80489784",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.80455995",
"0.8041498",
"0.8019701",
"0.8019701",
"0.79887336",
"0.7976107",
"0.793396",
"0.79317003",
"0.79317003",
"0.79317003",
"0.79238176",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7822105",
"0.7818397",
"0.7818397",
"0.7818397",
"0.7818397",
"0.7818397",
"0.7818397",
"0.7818397",
"0.7818397",
"0.7818397",
"0.78082883",
"0.78082883",
"0.7765245",
"0.7765245",
"0.7765245",
"0.7765245",
"0.77610284",
"0.77565",
"0.7740596",
"0.7740596",
"0.7732139",
"0.7673128"
] | 0.0 | -1 |
If you wish override this method or use it in block form to add a notifier, callback routine or webhook, whenever a new record is added. | def on_add(xmlpath, id)
yield(xmlpath, id) if block_given?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_notification; end",
"def on_create(&block)\n @on_create_hook = block\n self\n end",
"def on_add(&block)\n @add_proc = block\n end",
"def action_add\n notifying_block do\n create_config\n end\n end",
"def notifier; end",
"def notifier; end",
"def notify_after_create\n NotifyJob.perform('create', self) if web_hook_actions.include? :create\n end",
"def after_create_save(record); end",
"def on_add(clicker)\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notification_on_create\n create_notification(:create)\n end",
"def on_create(&block)\n @callbacks[:new_file_created] = block\n\n # @callbacks(:new_file_created) = block\n end",
"def create\n super\n # slack通知\n c = Payment.create_customer(resource.email, resource.name)\n resource.update(pay_customer_id: c.id)\n notifier = Slack::Notifier.new(Rails.application.config.slack_webhook_url)\n notifier.ping(\"新しく管理人が登録されました!\")\n end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def when_created(&block)\n if self.new_record?\n after_create(&block)\n else\n block.call(self)\n end\n end",
"def add_callback(type, options, &block); end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def add_reminder; end",
"def send_email_changed_notification; end",
"def insert_callback(&block)\n @callbacks << block\n end",
"def add_observer(&block)\n super(Observer.new(block))\n end",
"def add_callback(&block)\n @blocks << block\n end",
"def after_create; end",
"def create_listener\n return unless self.controller_name == \"registrations\"\n @listener = Listener.new\n @listener.save\n end",
"def callback(&block)\n @callbacks << block\n end",
"def after_invite_new_user(invite)\n end",
"def before_create\n @added = true\n super\n 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 send_email_changed_notification?; end",
"def after_create(obj); end",
"def create(*)\n super.tap do\n __debug_sim('USER initiates submission of new entries.')\n end\n end",
"def on_job_created(&block)\n @listeners[:job_created] << block\n end",
"def new_message\n end",
"def onmessage(&blk); super; end",
"def method_added(*) end",
"def on_notification(&block)\n @callback = block\n end",
"def prepend_notification_builder\n self.class._notification_builders.keys.each do |_callback|\n class_eval %{\n def _#{_callback}_create_notification\n self.class._notification_builders['#{_callback}'.to_sym].each do |nb|\n self.notification_builder_context= nb\n self.notification_builder_context.record= self\n _create_notification\n end\n end\n }\n end\n self.class._notification_builders.each do |_callback, nbs|\n nbs.each{|nb| nb.set_callbacks(self) }\n end\n end",
"def callbacks; end",
"def callbacks; end",
"def notifications\n end",
"def send_on_create_instructions\n send_create_instructions\n end",
"def on_slack_event(name, &block)\n self.low_level_callbacks << [name, block]\n end",
"def after_create_cb\n Rails.logger.warn \"after_create_cb #{self}\"\n end",
"def method_added(name); end",
"def method_added(name); end",
"def after_add_callback(unused_submission)\n end",
"def create\n run_callbacks :create do\n true\n end\n end",
"def add_basic_callback(handle=nil, &block)\n add_block_callback(HookR::BasicCallback, handle, &block)\n end",
"def notify_post\n raise \"not yet implemented\"\n end",
"def subscribe_request_hook(name = SecureRandom.hex.to_sym, &block)\n EasyPost::Hooks.subscribe(:request, name, block)\n end",
"def on_new_actuator &block\n\t\t\t@on_new_actuator = block\n\t\tend",
"def with_add_callbacks(document, already_related)\n execute_callback :before_add, document unless already_related\n yield\n execute_callback :after_add, document unless already_related\n end",
"def add_message_handler(&block)\n @message_handlers << block\n end",
"def new_record_notification(record)\n @record = record\n @phase = Phase.find(record.phase_id)\n @goal = Goal.find(@phase.goal_id)\n @user = User.find(@goal.user_id)\n\n mail to: @user.email, subject: \"Don't Break The Streak!\"\n end",
"def add_record(channel_name, identifier)\n raise NotImplementedError\n end",
"def add_to_hash &block\n @hash_making_callbacks << block\n end",
"def before_create_save(record); end",
"def add_custom_handlers\n # Set up hooks\n @irc.on_msg self.method(:_in_msg)\n @irc.on_act self.method(:_in_act)\n @irc.on_invite self.method(:_in_invited)\n @irc.on_kick self.method(:_in_kick)\n @irc.saying_join self.method(:_out_join)\n end",
"def on_new_investigation; end",
"def on_new_investigation; end",
"def on_new_investigation; end",
"def did_attach() end",
"def on_build(&block)\n @build_callbacks << block\n end",
"def add_listener(obj)\n @listeners << obj\n obj.class.extend Anise::Annotation # give it the ability to sync\n obj.respond :added, self\n end",
"def after_registration\n send_pending_messages\n end",
"def on_add(*attributes, &block)\n on_update(*attributes.push([nil, NotNil]), &block)\n end",
"def after_create_hook\n execute_hooks_for(:after, :create)\n end",
"def send_notification\n\n\n end",
"def after_create(&block)\n DSL.new(@employee, :after_create, &block)\n end",
"def add_internal_callback(handle=nil, &block)\n add_block_callback(Hookr::InternalCallback, handle, &block)\n end",
"def on_invite(&block)\n @on_invite_block = block\n end",
"def on_feedback(&block)\n self.feedback_callback = block\n end",
"def callback\n\n end",
"def hook(&block)\n @hooks << block\n end",
"def async_notify_on_creation\n Delayed::Job.enqueue(\n NewPostingNotifier.new(self.id,\"New Posting by #{self.user.nickname}: #{self.title}\", ADMIN_EMAIL_ADDRESS),\n { :run_at => Time.now()+(CONSTANTS['delay_new_posting_notifications'].to_i).seconds }\n )\n end",
"def add_notifier(notifier)\n @notifiers << notifier\n end",
"def before_recorded\n end",
"def new_feedback\n\n end",
"def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n fetch_or_create_hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle, block)\n end\n end",
"def after_recorded\n end",
"def after_form_update(options)\n main_id = find_or_add_main(options)\n # If the person was new, add contact and note\n if options[:was_new]\n new_contact = Contact.create(:person_id => options[:record].id,\n :contact_category => ContactCategory.where(:email => true).first,\n :data => \"#{record.bulogin}@bu.edu\")\n end\n trigger :display_form, {:pid => options[:record].id, :id => main_id}\n super(options)\n end",
"def callback\n\tend",
"def after_created; end",
"def register_webhook\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(\"#{self.add_on.jive_url}/api/core/v3/webhooks\")\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\t#http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest[\"Authorization\"] = \"Bearer #{self.oauth_token.access_token}\"\n\n\t\t\t\t\tbody = {\n\t\t\t\t\t\t\"callback\" => self.callback,\n\t\t\t\t\t\t\"object\" => self.object,\n\t\t\t\t\t}\n\t\t\t\t\tbody[\"events\"] = self.events if !self.events.to_s.empty?\n\n\t\t\t\t\trequest.body = body.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Need 2XX status code\n\t\t\t\t\tif !response.code.to_i.between?(200, 299)\n\t\t\t\t\t\terrors[:base] << \"#{request.inspect} => #{response.body}\"\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\tjson_body = JSON.parse(response.body)\n\n\t\t\t\t\tself.webhook_id = json_body[\"id\"]\n\n\t\t\t\t\ttrue\n\t\t\t\tend",
"def notify(&block)\n @notify_blocks << block\n end",
"def on_extended_data( &block )\n @on_extended_data = block\n end",
"def set_message_handler(&block); end",
"def enter_created; end",
"def after_save(record)\n \n end",
"def add_internal_callback(handle=nil, &block)\n add_block_callback(HookR::InternalCallback, handle, &block)\n end",
"def reminder_sent\n end",
"def after_update_save(record); end",
"def save(*)\n super.tap { |result| send_pending_email if result }\n end",
"def new_record?; end",
"def new_record?; end",
"def save(*)\n call_hooks 'save' do\n # Existing object implies update in place\n action = 'add'\n set_auto_date_field 'created_at'\n if @new_record\n do_insert\n else\n do_update\n set_auto_date_field 'updated_at'\n action = 'update'\n end\n @new_record = false\n @dirty = false\n self.class.issue_notification(self, :action => action)\n end\n end",
"def callback\n end",
"def listener; end",
"def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend",
"def register_one(owner, event, priority, &block); end"
] | [
"0.6626915",
"0.65061176",
"0.64741826",
"0.64502454",
"0.62697786",
"0.62697786",
"0.6259186",
"0.62253284",
"0.618931",
"0.6101302",
"0.6089297",
"0.60891974",
"0.60859466",
"0.6040443",
"0.6040443",
"0.6016452",
"0.59876955",
"0.5972888",
"0.59559053",
"0.5929862",
"0.589899",
"0.5898581",
"0.5880289",
"0.5873444",
"0.587127",
"0.5857054",
"0.5836184",
"0.5830223",
"0.5805639",
"0.5794637",
"0.5789427",
"0.5787615",
"0.5778303",
"0.5771293",
"0.57703906",
"0.57631826",
"0.57591754",
"0.5747723",
"0.57349795",
"0.57349795",
"0.5732472",
"0.5704487",
"0.5698582",
"0.56931424",
"0.56925666",
"0.56925666",
"0.5672947",
"0.5671011",
"0.5660019",
"0.5656508",
"0.5655603",
"0.56543124",
"0.56520873",
"0.56430745",
"0.5642958",
"0.5631734",
"0.5612602",
"0.56116444",
"0.5598364",
"0.55935884",
"0.55935884",
"0.55935884",
"0.5580354",
"0.5575247",
"0.55751956",
"0.5567497",
"0.55664676",
"0.5558919",
"0.55471736",
"0.5546435",
"0.55427235",
"0.5526693",
"0.5518166",
"0.5510414",
"0.55071473",
"0.5503695",
"0.5501357",
"0.54976374",
"0.5493472",
"0.54891247",
"0.5487684",
"0.54874676",
"0.5485006",
"0.54830676",
"0.5479222",
"0.54760444",
"0.5474236",
"0.54654855",
"0.5451465",
"0.54471487",
"0.54433966",
"0.5441139",
"0.54393387",
"0.5434093",
"0.5429268",
"0.5429268",
"0.5424625",
"0.5423008",
"0.5420628",
"0.5420037",
"0.5417188"
] | 0.0 | -1 |
configures the target page (using a Dynarex document) for a new day | def new_day()
puts 'inside new_day' if @debug
@archive_path = Time.now.strftime("%Y/%b/%-d").downcase
@indexpath = File.join(@filepath, @archive_path, 'index.xml')
FileX.mkdir_p File.dirname(@indexpath)
if FileX.exists? @indexpath then
@dx = Dynarex.new @indexpath
else
puts 'creating a new dx file' if @debug
@dx = Dynarex.new @schema, debug: @debug
@dx.order = 'descending'
@dx.default_key = @default_key
@dx.xslt = @dx_xslt
@dx.title = @title
@dx.identifier = @identifier
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to_date_link(user)\n\t\tdynamic_range\n\t\t@base_path = root_path+\"users/#{user.id}/scrapbook/#{@destination}\"\n\tend",
"def set_page\n end",
"def setPageTimer\n\t\t@pageTimer= Time.now.to_i+ @pageTimeOut\n\t\treturn OK\n\tend",
"def twenty_pct_release_date=(rd=Time.now)\n update_values([:twenty_pct_release_date] => rd.beginning_of_day.utc.xmlschema)\n content_will_change!\n end",
"def on_new_day(filepath, urlpath)\n\n px = create_tags_seealso(@todays_filepath) \n \n return unless File.exists? filepath\n\n # opens the master file for all the liveblog tags\n # e.g. jamesrobertson.eu/liveblog/dxtags.xml\n dxt = DynarexTags.new(@parent_filepath, tagfile_xslt: @tag_xsltpath)\n \n dxt.generate(filepath) do |section|\n\n title = section.x.lines.first\n\n title.scan(/\\B#(\\w+)(?=\\s|$)/).map do |x|\n \n hashtag = x.first\n [hashtag, title.sub(/#\\s+/,''), @urlbase + urlpath + '#' + hashtag]\n end\n\n end \n \n return unless @todays_filepath\n \n end",
"def go_to_today\n frm.button(:value=>\"Go to Today\").click\n Calendar.new(@browser)\n end",
"def req_design_doc_refresh\n @design_doc_fresh = { }\n end",
"def place_ad_for_today\n copy_image\n update_page_heading\n end",
"def next\n return nil if next_page.nil? || next_page.empty?\n params = prepare_params(next_page)\n client = Singleplatform.new(\n client_id: ENV['SINGLEPLATFORM_CLIENT_ID'],\n client_secret: ENV['SINGLEPLATFORM_CLIENT_SECRET']\n )\n new_page = client.public_send(\n origin.to_sym,\n params.delete('date').first, params\n )\n refresh(new_page)\n end",
"def scrape(options = nil)\n @max_blog_entries = options[:max_blog_entries] if options != nil\n @completed = false\n \n #TODO: pw should be optional\n page = login #if @pw != nil #only do the login thing if you have pw\n page =goto_weblog(page)\n \n #create new xml document from template\n #at some point in future, you want to pass in non-default options here\n create_new_xml_document\n \n scrape_1_page(page)\n next_link = page.links.reject{|i| i.to_s != \"Next 5 >>\" }\n while next_link.size == 1 and @completed != true do\n sleep(1)\n p \"clicking on next link: #{next_link[0].uri.to_s}\"\n page = @agent.click(next_link[0])\n scrape_1_page(page)\n \n #now update the next_link\n next_link = page.links.reject{|i| i.to_s != \"Next 5 >>\" }\n end\n \n #dump @doc out as the output\n file = File.new(\"wordpress.#{Time.now.strftime(\"%Y-%m-%d\")}.xml\", \"w+\")\n file.puts( @doc.inner_html )\n file.close\n \n @doc\n end",
"def create_new_xml_blog( body, time )\n p \"new xml doc created for time=#{time}\"\n \n #this is our template for a an individual entry in the blog import file\n item_template = <<-eos\n<item>\n<title>xxx</title>\n<link>xxx</link>\n<pubDate>xxx</pubDate>\n<dc:creator><![CDATA[xxx]]></dc:creator>\n\n\t\t<category><![CDATA[Uncategorized]]></category>\n\n\t\t<category domain=\"category\" nicename=\"uncategorized\"><![CDATA[Uncategorized]]></category>\n\n<guid isPermaLink=\"false\">xxx</guid>\n<description></description>\n<content:encoded><![CDATA[xxx]]></content:encoded>\n<excerpt:encoded><![CDATA[]]></excerpt:encoded>\n<wp:post_id>xxx</wp:post_id>\n<wp:post_date>xxx</wp:post_date>\n<wp:post_date_gmt>xxx</wp:post_date_gmt>\n<wp:comment_status>closed</wp:comment_status>\n<wp:ping_status>closed</wp:ping_status>\n<wp:post_name>xxx</wp:post_name>\n<wp:status>publish</wp:status>\n<wp:post_parent>0</wp:post_parent>\n<wp:menu_order>0</wp:menu_order>\n<wp:post_type>post</wp:post_type>\n<wp:post_password></wp:post_password>\n</item>\n\n eos\n \n doc = Hpricot.XML(item_template)\n \n #xanga names entries on date, so we will do same\n doc.search(\"title\")[0].inner_html = \"#{time.gsub(\" +0000\",\"\")}\"\n #link is constructed as follows: [base_blog_url]/[YYYY]/[MM]/[DD]/[title.downcase]\n #for dates, this looks like: [base_blog_url]/[YYYY]/[MM]/[DD]/tue-10-mar-2009-001259-0000/, for example\n doc.search(\"link\")[0].inner_html = \"#{@options[:base_blog_url]}/#{Time.now.strftime(\"%Y\")}/#{Time.now.strftime(\"%m\")}/#{Time.now.strftime(\"%d\")}/#{time.downcase.gsub(\",\", \"\").gsub(\":\",\"\").gsub(\" +\",\"-\").gsub(\" \",\"-\")}/\"\n \n #pubDate is 'time' passed in\n doc.search(\"pubDate\")[0].inner_html = \"#{time}\"\n #the creator is the username that gets credit for the posting i guess\n doc.search(\"dc:creator\")[0].inner_html = \"<![CDATA[#{@options[:creator]}]]>\"\n #guid is, as far as i can tell follows base_blog_url/?p=N format, where N=sequence of blog \n doc.search(\"guid\")[0].inner_html = \"#{@options[:base_blog_url]}/?p=#{@curr_blog_entries}\"\n #content:encoded is the blog body passed here\n doc.search(\"content:encoded\")[0].inner_html = \"<![CDATA[#{body}]]>\"\n #wp:post_id is as far as i can tell, just the sequential ordering of imported entries \n doc.search(\"wp:post_id\")[0].inner_html = \"#{@curr_blog_entries}\"\n\n #I've a conflict with my Time class; so I have to hack around, so sorry\n #input: time formatted as Tue, 10 Mar 2009 00:12:59 +0000\n #output: 2009-03-10 00:12:59, for example\n def convert_to_wp_post_date(time)\n ret = time.split(\" \")\n month_value = { 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' =>10, 'NOV' =>11, 'DEC' =>12 }\n ret[2] = month_value[ ret[2].upcase ] \n ret[2] = \"0\" + ret[2].to_s if ret[2].to_s.size == 1 #we want month padded to 2 digits\n ret[1] = \"0\" + ret[1].to_s if ret[1].to_s.size == 1 #we want day padded to 2 digits\n \n \"#{ret[3]}-#{ret[2]}-#{ret[1]} #{ret[4]}\"\n end\n \n #wp:post_date /wp:post_date_gmt is yet another format for the time field passed in\n #it looks like: 2009-03-10 00:12:59, for example\n doc.search(\"wp:post_date\")[0].inner_html = \"#{convert_to_wp_post_date(time)}\"\n doc.search(\"wp:post_date_gmt\")[0].inner_html = \"#{convert_to_wp_post_date(time)}\"\n #wp:post_name with xanga, it is same asthe last part of the link tag\n doc.search(\"wp:post_name\")[0].inner_html = \"#{time.downcase.gsub(\",\", \"\").gsub(\":\",\"\").gsub(\" +\",\"-\").gsub(\" \",\"-\")}\"\n\n doc\n end",
"def action_daily\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end",
"def show\n if params[:opt] == \"copy\"\n target_date = Date.today\n\n @stay_night.CopyWholeDay(target_date)\n\n redirect_to stay_nights_url\n end \n end",
"def release_date=(rd=Time.now)\n\t\tupdate_values([:release_date] => rd.beginning_of_day.utc.xmlschema)\n self.content=self.ng_xml.to_s\n end",
"def auto\n redirect_to report_url(Report.key_for_area(Current.setting.area))\n end",
"def adjust_current_date\n session[:date] = Date.today\n return true\n end",
"def testem_page\n testem_fields(\n \"#{Prawn::DATADIR}/images/reports/CEM2030-2012_Page_01.pdf\"\n # \"#{Rails.root}/app/assets/images/reports/testem_fields.pdf\"\n # \"#{Rails.root}/app/assets/pdfs/testem.png\"\n )\n start_new_page\n end",
"def page_load=(seconds); end",
"def set_page_data\n @page_title = \"Dragos | My Portfolio\"\n @seo_keywords = \"Dragos Portfolio\"\n end",
"def after_create(article)\n #expire_public_page(params[:article], params[:group])\n '/etc/cron.hourly/railsfix'\n end",
"def set_cur_day(dd)\n\t$cur_day = dd\nend",
"def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. render 404 error\n return dc_render_404('Site!') if @site.nil?\n dc_set_options(@site.settings)\n# HOMEPAGE. When no parameters is set\n params[:path] = @site.homepage_link if params[:id].nil? and params[:path].nil?\n# Search for page \n pageclass = @site.page_table.classify.constantize\n if params[:id]\n @page = pageclass.find_by(subject_link: params[:id])\n elsif params[:path]\n# path may point direct to page's subject_link\n @page = pageclass.find_by(subject_link: params[:path])\n end\n# if @page is not found render 404 error\n return dc_render_404('Page!') unless @page\n dc_set_options @page.params\n# find design if defined. Otherwise design MUST be declared in site\n if @page.dc_design_id\n @design = DcDesign.find(@page.dc_design_id)\n return dc_render_404('Design!') unless @design\n end\n# Add to edit menu\n if session[:edit_mode] > 0\n session[:site_id] = @site.id\n session[:site_page_table] = @site.page_table\n session[:page_id] = @page.id\n end\n# perform check every hour. Perhaps if user has rights changes\n session[:last_check] ||= Time.now\n if (session[:last_check] - Time.now) > 3600\n # perform checks\n # TO BE DONE\n \n # update time\n session[:last_check] = Time.now\n end \n @page_title = @page.subject.empty? ? @site.page_title : @page.subject\n get_design_and_render @design\nend",
"def parse_dailydev_page\n start = Time.now\n items = @page.search('.ddinfo')\n if items.any?\n items.each do |item|\n desc = item.search('.foot').empty\n desc = item.inner_text.strip\n link_el = item.search('a').select { |item| /\\/deviation\\// === item.attributes['href'] }.first\n link = link_el.attributes['href']\n title = link_el.inner_text\n @daily_data << { :title => title, :desc => desc, :link => link }\n end\n end\n Time.now - start\n end",
"def front_office_home_page\n @last_page = FrontOfficeHomePage.new\n end",
"def on_start_document() end",
"def create_default_estimated_date\n Date.today + 7\n end",
"def set_defaults\n\t\tself.start_date ||= (Date.today - 6.days)\n\tend",
"def after_update(article)\n #expire_public_page(params[:article], params[:group])\n '/etc/cron.hourly/railsfix'\n end",
"def set_default_publication_date\r\n update_attribute(:publish_at, created_at) if publish_at.nil?\r\n end",
"def index\n @title = 'RMSidewinders v3.0'\n @css = 'sidewinders.css'\n @next_event = Event.find_next_event\n @utc_date = Event.next_utc_date\n @next_event_partial\n \n if @next_event\n @next_event_partial = 'nexteventbanner'\n case @next_event.evtrack\n when \"HPR\"\n @weather_page = \"hpr_weather.html\" \n when \"PPIR\"\n @weather_page = \"ppir_weather.html\" \n when \"LaJunta\"\n @weather_page = \"laj_weather.html\" \n when \"PMP\"\n @weather_page = \"pmp_weather.html\"\n when \"MPH\"\n @weather_page = \"mph_weather.html\"\n when \"Sandia\"\n @weather_page = \"sandia_weather.html\"\n when \"MMP\"\n @weather_page = \"mmp_weather.html\"\n when \"Road America\"\n @weather_page = \"roadamerica_weather.html\"\n else\n @weather_page = \"hpr_weather.html\"\n end\n \n case @next_event.evhostreg\n when \"COR\"\n @host_image = 'cor_logo.png'\n when \"CDR\"\n @host_image = 'cdr_logo.png'\n else\n @host_image = 'alt_logo.png'\n end\n else\n @next_event_partial = 'noeventbanner'\n end\n end",
"def mercury_update\n campaign = Campaign.find(params[:id])\n document_name = request.referer.split('/').last\n document = {\n :body => params[:content][:page_content][:value],\n :path => 'documents/' + document_name,\n :format => 'html',\n :locale => 'en',\n :handler => 'erb',\n :partial => 'false',\n :campaign_id => campaign.id\n }\n edited_document = SqlTemplate.find_or_create_by(campaign_id: campaign_id)\n edited_document.update(document)\n render text: \"\"\n end",
"def set_new_day\n @new_day = NewDay.find(params[:id])\n end",
"def today\n frm.button(:value=>\"Today\").click\n Calendar.new(@browser)\n end",
"def date_and_time(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Date and Time\" page.\n begin\n @ff.link(:text, 'Date and Time').click\n self.msg(rule_name, :info, 'Date and Time', 'Reached page \\'Date and Time\\'.')\n rescue\n self.msg(rule_name, :error, 'Date and Time', 'Did not reach \\'Date and Time\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'date_and_time','Some key NOT found.')\n return\n end\n \n # Clock Set Add by Robin 2009.4.17\n if info.has_key?('action') \n case info['action']\n when 'Clock SET'\n @ff.link(:text, 'Clock Set').click\n # hour\n if info.key?('hour') \n @ff.text_field(:name, 'hour').value=(info['hour'])\n self.msg(rule_name, :info, 'date_and_time()->hour', 'hour= '+info['hour'])\n else\n self.msg(rule_name, :info, 'date_and_time()->hour', 'No hour key found')\n end\n # minute\n if info.key?('minute') \n @ff.text_field(:name, 'min').value=(info['minute'])\n self.msg(rule_name, :info, 'date_and_time()->minute', 'minute= '+info['minute'])\n else\n self.msg(rule_name, :info, 'date_and_time()->minute', 'No minute key found')\n end\n # sec\n if info.key?('sec') \n @ff.text_field(:name, 'sec').value=(info['sec'])\n self.msg(rule_name, :info, 'date_and_time()->sec', 'sec= '+info['sec'])\n else\n self.msg(rule_name, :info, 'date_and_time()->sec', 'No sec key found')\n end\n # year\n if info.key?('year')\n @ff.select_list(:id, 'year').select_value(info['year']) \n self.msg(rule_name, :info, 'date_and_time()->year', \"year = \"+info['year'])\n else\n self.msg(rule_name, :info, 'date_and_time()->year', 'year undefined')\n end\n # month\n if info.key?('month')\n case info['month']\n when 'Jan'\n @ff.select_list(:id, 'month').select_value('0') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Feb'\n @ff.select_list(:id, 'month').select_value('1') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Mar'\n @ff.select_list(:id, 'month').select_value('2') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Apr'\n @ff.select_list(:id, 'month').select_value('3') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'May'\n @ff.select_list(:id, 'month').select_value('4') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Jun'\n @ff.select_list(:id, 'month').select_value('5') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Jul'\n @ff.select_list(:id, 'month').select_value('6') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Aug'\n @ff.select_list(:id, 'month').select_value('7') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Sep'\n @ff.select_list(:id, 'month').select_value('8') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Oct'\n @ff.select_list(:id, 'month').select_value('9') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Nov'\n @ff.select_list(:id, 'month').select_value('10') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Dec'\n @ff.select_list(:id, 'month').select_value('11') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n else\n self.msg(rule_name, :info, 'date_and_time()->month', 'month undefined')\n end\n end\n # day\n if info.key?('day')\n @ff.select_list(:id, 'day').select_value(info['day']) \n self.msg(rule_name, :info, 'date_and_time()->day', \"day = \"+info['day'])\n else\n self.msg(rule_name, :info, 'date_and_time()->day', 'day undefined')\n end\n # click 'Apply' button to complete setup\n @ff.link(:text, 'Apply').click\n\tif not @ff.text.include?('Input Errors') then\n\t self.msg(rule_name,:info,'Set Time','SUCCESS')\n else\n\t @ff.tables.each do |t|\n\t\tif ( (t.text.include? 'value') and (not t.text.include? 'Input Errors')) then\n\t\t t.each do |row|\n\t\t\tif row.text.include? 'value' then\n\t\t\t self.msg(rule_name,:error,row[1].to_s.gsub(':',''),row[2]);\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n end\n\treturn\n else\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'action\\'.')\n return \n end # end of case \n end # end of if \n \n # \"Time Zone\"\n if info.has_key?('Time Zone')\n \n case info['Time Zone']\n \n when 'Other'\n \n # Set \"Other\"\n @ff.select_list(:name,'time_zone').select_value(\"\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone'])\n \n when 'Alaska_Time'\n \n # Set \"Alaska_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Alaska_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone'])\n \n when 'Central_Time'\n \n # Set \"Central_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Central_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Eastern_Time'\n \n # Set \"Eastern_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Eastern_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Greenwich_Mean_Time'\n \n # Set \"Greenwich_Mean_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Greenwich_Mean_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Hawaii_Time'\n \n # Set \"Hawaii_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Hawaii_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Mountain_Time'\n \n # Set \"Mountain_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Mountain_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Pacific_Time'\n \n # Set \"Pacific_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Pacific_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Time Zone\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"GMT Offset\"\n if info.has_key?('GMT Offset')\n \n # Is there?\n if not @ff.text.include?'GMT Offset'\n # Error here.\n self.msg(rule_name,:error,'Date and Time','No option \\'GMT Offset\\'.')\n return\n end\n \n # Set \"GMT Offset\"\n @ff.text_field(:name,'gmt_offset').set(info['GMT Offset'])\n self.msg(rule_name,:info,'GMT Offset',info['GMT Offset'])\n \n end\n \n # \"Daylight Enable\"\n if info.has_key?('Daylight Enable')\n \n case info['Daylight Enable']\n \n when 'on'\n \n # Set \"Daylight Enable\"\n @ff.checkbox(:name,'is_dl_sav').set\n self.msg(rule_name,:info,'Daylight Enable',info['Daylight Enable'])\n \n when 'off'\n \n # Clear \"Daylight Enable\"\n @ff.checkbox(:name,'is_dl_sav').clear\n self.msg(rule_name,:info,'Daylight Enable',info['Daylight Enable'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'date_and_time','Did NOT find the value in \\'Daylight Enable\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Start Month\"\n if info.has_key?('Start Month')\n \n case info['Start Month']\n \n when 'Jan'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"0\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Feb'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"1\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Mar'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"2\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Apr'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"3\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'May'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"4\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Jun'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"5\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Jul'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"6\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Aug'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"7\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Sep'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"8\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Oct'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"9\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Nov'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"10\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Dec'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"11\")\n self.msg(rule_name,:info,'Start Month',info['Start Month']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Start Month\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Start Date\"\n if info.has_key?('Start Date')\n \n case info['Start Date']\n \n when '1'\n @ff.select_list(:name,'dst_day_start').select_value(\"1\")\n when '2'\n @ff.select_list(:name,'dst_day_start').select_value(\"2\")\n when '3'\n @ff.select_list(:name,'dst_day_start').select_value(\"3\")\n when '4'\n @ff.select_list(:name,'dst_day_start').select_value(\"4\")\n when '5'\n @ff.select_list(:name,'dst_day_start').select_value(\"5\")\n when '6'\n @ff.select_list(:name,'dst_day_start').select_value(\"6\")\n when '7'\n @ff.select_list(:name,'dst_day_start').select_value(\"7\")\n when '8'\n @ff.select_list(:name,'dst_day_start').select_value(\"8\")\n when '9'\n @ff.select_list(:name,'dst_day_start').select_value(\"9\")\n when '10'\n @ff.select_list(:name,'dst_day_start').select_value(\"10\")\n when '11'\n @ff.select_list(:name,'dst_day_start').select_value(\"11\")\n when '12'\n @ff.select_list(:name,'dst_day_start').select_value(\"12\")\n when '13'\n @ff.select_list(:name,'dst_day_start').select_value(\"13\")\n when '14'\n @ff.select_list(:name,'dst_day_start').select_value(\"14\")\n when '15'\n @ff.select_list(:name,'dst_day_start').select_value(\"15\")\n when '16'\n @ff.select_list(:name,'dst_day_start').select_value(\"16\")\n when '17'\n @ff.select_list(:name,'dst_day_start').select_value(\"17\")\n when '18'\n @ff.select_list(:name,'dst_day_start').select_value(\"18\")\n when '19'\n @ff.select_list(:name,'dst_day_start').select_value(\"19\")\n when '20'\n @ff.select_list(:name,'dst_day_start').select_value(\"20\")\n when '21'\n @ff.select_list(:name,'dst_day_start').select_value(\"21\")\n when '22'\n @ff.select_list(:name,'dst_day_start').select_value(\"22\")\n when '23'\n @ff.select_list(:name,'dst_day_start').select_value(\"23\")\n when '24'\n @ff.select_list(:name,'dst_day_start').select_value(\"24\")\n when '25'\n @ff.select_list(:name,'dst_day_start').select_value(\"25\")\n when '26'\n @ff.select_list(:name,'dst_day_start').select_value(\"26\")\n when '27'\n @ff.select_list(:name,'dst_day_start').select_value(\"27\") \n when '28'\n @ff.select_list(:name,'dst_day_start').select_value(\"28\")\n when '29'\n @ff.select_list(:name,'dst_day_start').select_value(\"29\")\n when '30'\n @ff.select_list(:name,'dst_day_start').select_value(\"30\")\n when '31'\n @ff.select_list(:name,'dst_day_start').select_value(\"31\") \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Start Date\\'.')\n return\n \n end # end of case\n \n self.msg(rule_name,:info,'Start Date',info['Start Date'])\n \n end # end of if \n\n # \"Start Hour\"\n if info.has_key?('Start Hour')\n \n # Set\n @ff.text_field(:name,'dst_hour_start').set(info['Start Hour'])\n self.msg(rule_name,:info,'Start Hour',info['Start Hour'])\n \n end \n \n # \"Start Minute\"\n if info.has_key?('Start Minute')\n \n # Set\n @ff.text_field(:name,'dst_min_start').set(info['Start Minute'])\n self.msg(rule_name,:info,'Start Minute',info['Start Minute'])\n \n end \n \n # \"End Month\"\n if info.has_key?('End Month')\n \n case info['End Month']\n \n when 'Jan'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"0\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Feb'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"1\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Mar'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"2\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Apr'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"3\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'May'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"4\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Jun'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"5\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Jul'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"6\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Aug'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"7\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Sep'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"8\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Oct'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"9\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Nov'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"10\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Dec'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"11\")\n self.msg(rule_name,:info,'End Month',info['End Month']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'End Month\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"End Date\"\n if info.has_key?('End Date')\n \n case info['End Date']\n \n when '1'\n @ff.select_list(:name,'dst_day_end').select_value(\"1\")\n when '2'\n @ff.select_list(:name,'dst_day_end').select_value(\"2\")\n when '3'\n @ff.select_list(:name,'dst_day_end').select_value(\"3\")\n when '4'\n @ff.select_list(:name,'dst_day_end').select_value(\"4\")\n when '5'\n @ff.select_list(:name,'dst_day_end').select_value(\"5\")\n when '6'\n @ff.select_list(:name,'dst_day_end').select_value(\"6\")\n when '7'\n @ff.select_list(:name,'dst_day_end').select_value(\"7\")\n when '8'\n @ff.select_list(:name,'dst_day_end').select_value(\"8\")\n when '9'\n @ff.select_list(:name,'dst_day_end').select_value(\"9\")\n when '10'\n @ff.select_list(:name,'dst_day_end').select_value(\"10\")\n when '11'\n @ff.select_list(:name,'dst_day_end').select_value(\"11\")\n when '12'\n @ff.select_list(:name,'dst_day_end').select_value(\"12\")\n when '13'\n @ff.select_list(:name,'dst_day_end').select_value(\"13\")\n when '14'\n @ff.select_list(:name,'dst_day_end').select_value(\"14\")\n when '15'\n @ff.select_list(:name,'dst_day_end').select_value(\"15\")\n when '16'\n @ff.select_list(:name,'dst_day_end').select_value(\"16\")\n when '17'\n @ff.select_list(:name,'dst_day_end').select_value(\"17\")\n when '18'\n @ff.select_list(:name,'dst_day_end').select_value(\"18\")\n when '19'\n @ff.select_list(:name,'dst_day_end').select_value(\"19\")\n when '20'\n @ff.select_list(:name,'dst_day_end').select_value(\"20\")\n when '21'\n @ff.select_list(:name,'dst_day_end').select_value(\"21\")\n when '22'\n @ff.select_list(:name,'dst_day_end').select_value(\"22\")\n when '23'\n @ff.select_list(:name,'dst_day_end').select_value(\"23\")\n when '24'\n @ff.select_list(:name,'dst_day_end').select_value(\"24\")\n when '25'\n @ff.select_list(:name,'dst_day_end').select_value(\"25\")\n when '26'\n @ff.select_list(:name,'dst_day_end').select_value(\"26\")\n when '27'\n @ff.select_list(:name,'dst_day_end').select_value(\"27\") \n when '28'\n @ff.select_list(:name,'dst_day_end').select_value(\"28\")\n when '29'\n @ff.select_list(:name,'dst_day_end').select_value(\"29\")\n when '30'\n @ff.select_list(:name,'dst_day_end').select_value(\"30\")\n when '31'\n @ff.select_list(:name,'dst_day_end').select_value(\"31\") \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'End Date\\'.')\n return\n \n end # end of case\n \n self.msg(rule_name,:info,'End Date',info['End Date'])\n \n end # end of if \n\n # \"End Hour\"\n if info.has_key?('End Hour')\n \n # Set\n @ff.text_field(:name,'dst_hour_end').set(info['End Hour'])\n self.msg(rule_name,:info,'End Hour',info['End Hour'])\n \n end \n \n # \"End Minute\"\n if info.has_key?('End Minute')\n \n # Set\n @ff.text_field(:name,'dst_min_end').set(info['End Minute'])\n self.msg(rule_name,:info,'End Minute',info['End Minute'])\n \n end \n \n # \"Offset\"\n if info.has_key?('Offset')\n \n # Set\n @ff.text_field(:name,'dst_offset').set(info['Offset'])\n self.msg(rule_name,:info,'Offset',info['Offset'])\n \n end \n \n # \"Automatic Enabled\"\n if info.has_key?('Automatic Enabled')\n \n case info['Automatic Enabled']\n \n when 'on'\n \n # Set \"Automatic Enabled\"\n @ff.checkbox(:name,'is_tod_enabled').set\n self.msg(rule_name,:info,'Automatic Enabled',info['Automatic Enabled'])\n \n when 'off'\n \n # Clear \"Automatic Enabled\"\n @ff.checkbox(:name,'is_tod_enabled').clear\n self.msg(rule_name,:info,'Automatic Enabled',info['Automatic Enabled'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Automatic Enabled\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Time Of Day\"\n if info.has_key?('Time Of Day')\n \n case info['Time Of Day']\n \n when 'on'\n \n # Set \"Time Of Day\"\n @ff.radio(:id,'tod_prot_type_1').set\n self.msg(rule_name,:info,'Time Of Day',info['Time Of Day'])\n \n when 'off'\n \n # Clear \"Time Of Day\"\n @ff.radio(:id,'tod_prot_type_1').clear\n self.msg(rule_name,:info,'Time Of Day',info['Time Of Day'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Time Of Day\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Network Time Protocol\"\n if info.has_key?('Network Time Protocol')\n \n case info['Network Time Protocol']\n \n when 'on'\n \n # Set \"Network Time Protocol\"\n @ff.radio(:id,'tod_prot_type_2').set\n self.msg(rule_name,:info,'Network Time Protocol',info['Network Time Protocol'])\n \n when 'off'\n \n # Clear \"Network Time Protocol\"\n @ff.radio(:id,'tod_prot_type_2').clear\n self.msg(rule_name,:info,'Network Time Protocol',info['Network Time Protocol'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Network Time Protocol\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Update Every\"\n if info.has_key?('Update Every')\n \n #\n @ff.text_field(:name,'tod_update_period').set(info['Update Every'])\n self.msg(rule_name,:info,'Update Every',info['Update Every'])\n \n end \n \n # \"Sync Now\"\n if info.has_key?('Sync Now')\n \n case info['Sync Now']\n \n when 'on'\n \n # Set \"Sync Now\"\n @ff.link(:text,'Sync Now').click\n @ff.wait\n self.msg(rule_name,:info,'Sync Now',info['Sync Now'])\n \n when 'off'\n \n # Clear \"Sync Now\"\n # Do nothing here.\n self.msg(rule_name,:info,'Sync Now',info['Sync Now'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Sync Now\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n if info.has_key?('Remove Time Server')\n\t@ff.links.each do |l|\n\t if ( l.href.to_s.include? 'remove_time_server') then\n\t\t@ff.link(:href,l.href.to_s).click\n\t end\n\tend\n end\n if info.has_key?('Add Time Server')\n\t@ff.link(:href,'javascript:mimic_button(\\'add_time_server: ...\\', 1)').click\n\t@ff.text_field(:name,'tod_server').value = info['Add Time Server']\n\t@ff.link(:text,'Apply').click\n end\n \n if info.has_key?('Add Multi Time Servers')\n \tfor i in 0...info['Add Multi Time Servers'].to_i\n\t @ff.link(:href,'javascript:mimic_button(\\'add_time_server: ...\\', 1)').click\n\t @ff.text_field(:name,'tod_server').value = \"ntp.testurl\" + i.to_s + \".com\"\n\t @ff.link(:text,'Apply').click\n\tend\n end\n\n \n if info.has_key?('Read Sync Status')\n\t@ff.tables.each do |t|\n\t if ( (t.text.include? 'Status') and (t.text.include? 'Time Server') and (t.row_count > 5)) then\n\t\tt.each do |row|\n\t\t if row.text.include? 'Status' then\n\t\t\tself.msg(rule_name,:info,row[1].to_s.gsub(':',''),row[2])\t\n\t\t end\n\t\tend\n\t end\n\tend\n end\n\n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Output the result\n if not @ff.text.include?('Input Errors') then\n\tself.msg(rule_name,:info,'Date and Time','SUCCESS')\n else\n\t@ff.tables.each do |t|\n\t if ( (t.text.include? 'value') and (not t.text.include? 'Input Errors')) then\n\t\tt.each do |row|\n\t\t if row.text.include? 'value' then\n\t\t\tself.msg(rule_name,:error,row[1].to_s.gsub(':',''),row[2])\n\t\t end\n\t\tend\n\t end\n\tend\n end\n \n end",
"def set_next_run\n self.next_run_at = calc_next_run_at_date\n end",
"def template_page(site); end",
"def touch_pages\n pages.update_all updated_at: Time.now\n end",
"def new_doc\n @doc_content = \"\"\n @doc_start_page = nil\n @pages_in_doc = 0\n end",
"def set_initial_next_run\n self.next_run_at = Time.zone.now if self.next_run_at.nil?\n end",
"def set_initial_next_run\n self.next_run_at = Time.zone.now if self.next_run_at.nil?\n end",
"def log_page(page)\n time = Time.now\n content = page.output.gsub /::time::/ do\n \"<time datetime='#{time.utc.iso8601}'>#{time.localtime.strftime('%Y-%m-%d %H:%M:%s')}</time>\"\n end\n \n file = page.destination page.site.config['destination']\n File.open(file, 'w') { |f| f.write content }\n end",
"def homepage\n @name ='khaled'\n @day =Time.now.strftime(\"%A\")\n end",
"def meta_refresh; end",
"def test02_homepage_event_module\n\t\t#define current date and time\n\t\t@c_month_full = Time.now.strftime(\"%B\").to_i #The full month name (January)\n\t\t@c_month = Time.now.strftime(\"%m\").to_i #01-12\n\t\t@c_day = Time.now.strftime(\"%d\").to_i #01-31\n\t\t@c_year = Time.now.strftime(\"%Y\").to_i #2013\n\t\t@c_hour = Time.now.strftime(\"%H\").to_i #00-23\n\t\t@am_pm = \"\"\n\t\t\n\t\t#add one hour to current time\n\t\t@n_hour = @c_hour +1\n\n\t\t@day_zero = \"\"\n\t\t#add a zero to day if needed\n\t\tif @c_day < 10\n \t\t\t@day_zero = \"0\"\n\t\tend\n\t\t#calculate AM or PM\n\t\tif @n_hour > 11\n\t\t\t@am_pm = \"PM\"\n\t\telse\n\t\t\t@am_pm = \"AM\"\t\n\t\tend\n\t\t#change PM time to 01-11\n\t\tif @n_hour > 12\n\t\t\t@n_hour = @n_hour - 12\n\t\tend\n\t\t#if AM && 00 then change hour to 12\n\t\tif @n_hour == 0 && @am_pm == \"AM\"\n\t\t\t@n_hour = 12\n\t\tend\n\t\t\n\t\tlogin $user_1_email, $master_password\n\t\tsleep 3\n\t\t$browser.goto($patch_flatiron_event_new)\n\t\n\t\t$post_event_title.when_present.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{@c_year}-#{@c_month}-#{@day_zero}#{@c_day}\") \n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"#{@n_hour}:00 #{@am_pm}\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n \t\t$post_add_media_article.when_present.click\n\t\tfile_upload \"DungenessSpitVideo.mov\"\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\t\n\t\tassert $post_new_post.exists?\n\t\t\n\t\t#go back to homepage\n\t\t$browser.goto($patch)\n\t\t#verify event exists with correct information\n\t\tsleep 3\n\t\t$browser.text.include? \"Event #{random}\"\n\t\t$browser.text.include? \"Location #{random}\"\n\t\t$browser.text.include? \"#{@c_month_full} #{@c_day}, #{@c_year}, #{@n_hour}:00 #{@am_pm}\"\n\tend",
"def set_next_run\n self.next_run_at = Time.zone.now unless self.next_run_at\n end",
"def new\n @page_title = \"Archives Report Setup\"\n @reservation = Reservation.new :startdate => currentDate.beginning_of_year, :enddate => currentDate.beginning_of_month\n end",
"def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end",
"def next\n frm.button(:name=>\"eventSubmit_doNext\").click\n Calendar.new(@browser)\n end",
"def adicionar_data\n self.date = Date.today\n end",
"def set_daily_step\n @daily_step = DailyStep.find(params[:id])\n end",
"def est05_toggle_dates #needs more debugging\n\t\t$browser.goto($patch_event_landing)\n\t\t\n\t\tcurrent_day = Time.now.strftime(\"%w\").to_i #grab day of the week as a number, 0 = Sunday\n puts current_day\n\t sleep 3\n\t\t$events_day_5.click #toggle date to fifth entry\n\t\tsleep 3\n\t\t@end_date = $events_date_header.text #grab date displayed on the header \n puts @end_date\n\t\t#parse out day of the week and convert to number\n\t\tnew_date = Date.parse(@end_date.split(\",\").first.to_s).strftime(\"%w\").to_i \n\t\tputs new_date\n\t\tassert current_day <= new_date #compare current day number to toggled date number\n\n\tend",
"def set_page\n @page = Page.find_by_permalink!(params[:id])#.split(\"/\").last)\n end",
"def on_start_document\n end",
"def masterfile_defaults\n {'date_end' => Date.new(2090,1,1), 'inv_code' => 'UL'}\n end",
"def regenerate_pdf(sender)\n write_to_ly_file\n run_lilypond_task(sender)\n reload_pdf\n end",
"def setup\n host = request.env['HTTP_HOST']\n @license = nil\n @min_date = DateTime.now - 7\n @max_date = DateTime.now + 1\n date_series \n @app_name = session[:app_name]\n true \n end",
"def update_dc(date)\n release_date = date\n publisher = Publisher.find_or_create_by_name(\"DC\")\n \n while release_date <= date + 4.months do\n log(\"retrieving dc data for #{release_date.strftime('%Y%m%d')}\")\n doc = Hpricot(open(\"#{URL_DC}?dat=#{release_date.strftime('%Y%m%d')}\"))\n books = doc/\"a[@href*='\\?cm\\=']\"\n books = books.each { |book| fetch_title_dc(publisher, book.innerHTML.strip, \"#{URL_DC}#{book.attributes['href']}\") }\n release_date += 1.month # dc listings by month\n end\n end",
"def setup\n @page = pages(:homepage)\n end",
"def set_resources\n set_site\n set_page\n\n build_current_page_state if action_name != 'new'\n end",
"def set_defaults_for(project)\n if self.can_generate_from_scheulde_for(project)\n project_entries = project.entries.start_date_ordered\n \n @start_date = project_entries.first.start_date\n @end_date = project_entries.last.end_date\n @end_date = @start_date + 1.month if (@start_date + 1.month) > @end_date # Always make sure there is at least a full month apart\n \n @frequency = '0'\n end\n end",
"def scrape_details(new_page, new_date)\n# Pick out xpaths for data\n council_reference = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[3]/td[2]/*\").text\n address = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[4]/td[2]/*\").text\n type = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[1]/td[2]/*\").text\n description = \"#{new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[1]/td/div/table[2]/tr[2]/td[2]/*\").text} (#{type})\"\n info_url = new_page.at(\"/html/body/form/div/table[2]/tr/td/div/table[2]/tr[4]/td/div/table[2]/tr/td[2]/a\").attribute(\"href\").to_s\n\n# prep dates\n date_received = new_date.to_s\n on_notice_from = new_date.to_s\n on_notice_to = (new_date+14).to_s\n \n record = {\n 'council_reference' => council_reference,\n 'address' => address,\n 'description' => description,\n 'info_url' => info_url,\n 'date_received' => date_received,\n 'on_notice_from' => on_notice_from,\n 'on_notice_to' => on_notice_to,\n 'date_scraped' => @date_scraped,\n 'comment_url' => @comment_url,\n }\n# puts \"\\n :: RECORD :: \\n#{record}\"\n if (ScraperWiki.select(\"* from data where `council_reference`='#{record['council_reference']}'\").empty? rescue true)\n puts \"Storing \" + record['council_reference']\n ScraperWiki.save_sqlite(['council_reference'], record)\n else\n puts \"Skipping already saved record \" + record['council_reference']\n end\nend",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def edit_carbonXML(carbon_home,url_port,url_contextRoot,contextRoot) \n\tFile.open(File.join(carbon_home , 'conf','carbon.xml')) do |config_file|\n\t\t# Open the document and edit the port (carbon.xml)\n\t\tconfig = Document.new(config_file)\n\t\tif !url_port.eql? \"\"\n\t\t\tconfig.root.elements['ServerURL'].text = 'https://localhost:' + url_port + url_contextRoot + '/services/'\n\t\tend\t\t\n\t\t\tconfig.root.elements['WebContextRoot'].text = contextRoot\n\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_carbon.xml'), 'w') do |result|\n\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','carbon.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_carbon.xml'),File.join(carbon_home , 'conf','carbon.xml') )\n\n\nend",
"def set_resource_content\n @page = Page.available.homepage.first!\n end",
"def docs_redirect(path, page_title)\n meta_redirect(URI.join(settings.docs_url, path), page_title)\nend",
"def update_page\n if Input.trigger?(Key_nextpage)\n next_page\n elsif Input.trigger?(Key_lastpage) && @page_index > 0\n last_page\n end\n end",
"def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_template => \"reports/report.pdf.erb\", \n :render_options => {\n :header_right => 'Page [page] of [toPage]',\n :grayscale => true,\n :page_size => 'Letter'} \n } \n @page = \"<html><head><head><body><b>Hello</b> World</body></html>\" \n \n TooRendermonkey.configure = {\n :uri => \"http://localhost:4567/generate\",\n :api_key => \"835a3161dc4e71b\",\n :hash_key => \"sQQTe93eWcpV4Gr5HDjKUh8vu2aNDOvn3+suH1Tc4P4=\"\n } \n end",
"def set_date(default_date)\n @default_date = default_date\n end",
"def default_page\n\t\t\t\tDir.chdir File.join(self.source, @site_name)\n\t\t\t\tFile.open Settings::PAGES_TEMPLATE + '/page.md', 'r' do |file|\n\n\t\t\t\t\tfront_matter = {\n\t\t\t\t\t\t'title' => 'Home Page',\n\t\t\t\t\t\t'date' => Time.now.strftime(\"%Y-%m-%d\"),\n\t\t\t\t\t\t'author' => 'Your Name',\n\t\t\t\t\t\t'template' => 'page'\n\t\t\t\t\t}\n\n\t\t\t\t\tcontents = Liquid::Template.parse(file.read).render front_matter \n\t\t\t\t\tFile.open(File.join(\"pages\", \"index.md\"), \"w\") do |f|\n\t\t\t\t\t\tf.write contents\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tFileUtils.mkdir_p(File.join(self.source, @site_name, \"media/images\", \"index\"))\n\t\t\tend",
"def activate\n admin.page.edit.add('extended_metadata', 'edit_dates')\n end",
"def new_with_defaults\n page = new\n end",
"def scrape\n setup_capybara\n log_in\n\n FileUtils.mkdir_p(@folder)\n filename = \"#{@folder}/endesa_#{month}_#{@year}.pdf\"\n document.save(filename)\n filename\n end",
"def atest_ID_25891_scheduled_posts_01\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n sleep 5\n scheduledPostCount = count_scheduled_current\n if (scheduledPostCount < 5)\n i=1\n while i < 3\n $browser.goto($patch_note)\n $post_pick_group.when_present().click\n $group_select.when_present().select(\"Sports\")\n $post_compose_note.wait_until_present()\n $browser.link(:text, \"Basketball\").when_present().click\n $post_compose_note.when_present().set(\"Note field populated by automated test.\")\n $advanced_options.when_present().click\n currentTime = Time.now() + 2\n currentDate = currentTime.strftime(\"%Y-%m-%d\")\n $post_advanced_calendar.when_present().set(\"#{currentDate}\")\n $post_advanced_time.when_present().set(\"11:00 PM\")\n sleep 3\n $browser.link(:text => /11:00/).click\n $profile_schedule.when_present().fire_event(\"onclick\")\n sleep 3\n i = i+1\n end\n end\n end",
"def export_date_override\n return nil unless ENV.key?('EXPORT_DATE_OVERRIDE')\n\n today = Date.today\n days_ago = (0..30).find do | days_ago |\n exists_export? date: today-days_ago\n end.to_i\n\n days_ago -= 1 unless days_ago.zero?\n ( today - days_ago ).strftime( DATE_FORMAT )\n end",
"def before_create\n self.scraped_at ||= DateTime.now\n super\n end",
"def return_days=(days)\n \tself.return_date = Date.today + days.to_i\n end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def load_views!\n new = YAML.load ERB.new(\n Pathname.new(__FILE__).dirname.join('..', 'config', 'views.yml').read\n ).result\n\n id = new['_id']\n old = database.get id\n\n if old['version'].to_i < new['version'].to_i\n log \"Upgrading Design Document #{id} to v#{new['version']}\"\n database.delete_doc old\n database.save_doc new\n end\n\n rescue RestClient::ResourceNotFound\n log \"Creating Design Document #{id} v#{new['version']}\"\n database.save_doc new\n end",
"def set_page\n @articlespage = 'active'\n end",
"def assign_current_document!\n payload[\"site\"].current_document = document\n end",
"def set_resource\n @page = current_site.pages.available.homepage.first!\n end",
"def actualizar_fecha(comprobante)\n #Actualizar fecha del nodo Fecha\n node = comprobante.xpath('//@Fecha')[0]\n fecha = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n node.content = fecha\n comprobante\nend",
"def show\n redirect_to(\"http://www.tuanao.com/today\")\n end",
"def set_date\n gon.published_at = @story.published_at.strftime('%m/%d/%Y %H:%M') if !@story.published_at.nil?\n end",
"def page_at=(setting)\n @page_at = setting == :auto ? output_rows - 2 : setting\n end",
"def perform()\n @date = Date.today\n download\n end",
"def assign_current_document!; end"
] | [
"0.5742993",
"0.57319957",
"0.5424249",
"0.5418482",
"0.5353863",
"0.52722067",
"0.52563167",
"0.52300715",
"0.5229549",
"0.52201146",
"0.52026075",
"0.520027",
"0.5166835",
"0.51458937",
"0.51351106",
"0.5115724",
"0.5098779",
"0.5086328",
"0.5086247",
"0.5069055",
"0.50669146",
"0.5059916",
"0.504731",
"0.50298846",
"0.50286",
"0.5027352",
"0.502325",
"0.50151443",
"0.50103056",
"0.49979982",
"0.4992247",
"0.49857134",
"0.49802718",
"0.49749714",
"0.49720863",
"0.4935577",
"0.4930673",
"0.4922322",
"0.49028575",
"0.49028575",
"0.49007103",
"0.48984417",
"0.48924205",
"0.48851964",
"0.48697868",
"0.48652014",
"0.4863702",
"0.48572248",
"0.48411655",
"0.48280743",
"0.4819245",
"0.48189816",
"0.4813372",
"0.48025978",
"0.47995114",
"0.47933134",
"0.4776625",
"0.4775987",
"0.47726473",
"0.4771369",
"0.47701624",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47693005",
"0.47684872",
"0.4763836",
"0.47616512",
"0.4760967",
"0.47552174",
"0.47545764",
"0.4752501",
"0.47505465",
"0.47440434",
"0.4741783",
"0.47415844",
"0.47393808",
"0.47385257",
"0.4736142",
"0.4736138",
"0.4736138",
"0.4736138",
"0.47350597",
"0.47329226",
"0.47311866",
"0.472721",
"0.47234473",
"0.47233394",
"0.4722991",
"0.47225887",
"0.4717222",
"0.47120318"
] | 0.6240864 | 0 |
will return the length of the picked word | def pick_mystery_word
@picked_word = self.dict.sample
self.picked_word.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_length\n @word.length\n end",
"def word_length\n\t\t@ans_word.length\n\tend",
"def pick_secret_word\n\t\t@secret_word.length\n\tend",
"def count_chars word3\n word3.length\nend",
"def count_chars word\n word.length\nend",
"def count_chars word\n word.length\nend",
"def count_chars word\n word.length\nend",
"def count_chars word\n word.length\nend",
"def word_lengths(str)\nend",
"def word_number\n text.split.size\n end",
"def length\n @words.length\n end",
"def length\n @words.length\n end",
"def count_chars(word)\n word.length\nend",
"def count_chars(word)\n word.length\nend",
"def count_chars(word)\n word.length\nend",
"def count_chars(word)\n word.length\nend",
"def pick_word_length\n puts 'What length of a word would you like?'\n self.word_length = gets.chomp.to_i\n end",
"def word_count\n @tried_solutions.length\n end",
"def count_letters_in_word(word)\n return word.length\n end",
"def pick_word\n print \"Think of a word for the computer to guess. How many letters does your word have? \"\n @word_length = Integer(gets.chomp)\n end",
"def word_count\n return words.size\n end",
"def word_count\n words.size\n end",
"def word_count\n words.size\n end",
"def get_score_for_word(word)\n word.length >= 3 ? word.length : 0\n end",
"def show_word_length\n @word_lth = @str.length.to_i\n p \"-\" * @word_lth\n end",
"def length\n words.reject { |w| w.rel == 'punct' }.length\n end",
"def pick_secret_word\n\t\t@secret_word = @dictionary.sample.chomp.downcase\n\t\t@secret_word.length\n\tend",
"def word_counter(string)\n new_string = string.split\n return new_string.length\nend",
"def max_word_length(words)\n max_length = 0\n words.each do |word|\n word_length = word.entry.length\n max_length = word_length if max_length < word_length\n end\n max_length\nend",
"def size\n @words.size\n end",
"def word_lengths(sentence)\n # Write your code here\nend",
"def count_letters(word)\r\n\r\n end",
"def count_chars\n puts \"Please write word or multiple words:\"\n words = gets.chomp\n\n num_chars = words.gsub(/\\s+/,'').length\n # for a simple input like this one could use\n # num_chars = words.delete(' ').length but delete must\n # use a string and not a regex\n puts \"There are #{num_chars} characters in \\\"#{words}\\\".\"\nend",
"def word_counter (string)\n array = string.split\n array.length\nend",
"def get_points(word)\n return nil unless submit_word word\n\n word.length\n end",
"def word_counter(string)\n array = string.downcase.split(\" \")\n word_count = array.count\n the_count = array.count(\"the\")\n\n # option 1 for getting longest work\n # longest_word = \"\"\n # array.each do |x|\n # longest_word = x if longest_word.length < x.length\n # end\n\n # option 2 for getting longest word\n longest_word = array.max_by { |x| x.length }\n\n puts \"The number of words is #{word_count}, the longest word is #{longest_word}, and 'the' is used #{the_count} times.\"\nend",
"def num_chars\n @name.split('').count\n end",
"def num_words(size)\n total = 0\n @word_list.each{ |word| total += 1 if word.size == size }\n total\n end",
"def num_words\n @words.length\n end",
"def word_lengths(words)\n words.split(' ').map { |word| \"#{word} #{word.size}\" }\nend",
"def length\n text.length\n end",
"def long_word_count(text)\n text.split.select {|word| word.length > 7}.count\nend",
"def word_counter(sentence)\n return sentence.split(' ').length #makes it an array, .length counts items\nend",
"def count\n @letters.length\n end",
"def long_word_count(text)\n \nend",
"def long_word_count(text)\n count = 0\n text.split(\" \").each do |element|\n if element.split(\"\").length > 7\n count += 1\n end\n end\n return count\n \nend",
"def word_lengths(words)\n words.split.map { |word| \"#{word} #{word.size}\" }\nend",
"def number_of_words(input, mode = T.unsafe(nil)); end",
"def length_finder(words)\n lengths = {}\n words.each do |word|\n lengths[word] = word.length\n end\n lengths.values\nend",
"def word_counter\n \"This is a string\".split.size\nend",
"def receive_secret_length\n puts \"How long is your word?\"\n word_length = gets.chomp.to_i\n dictionary.select! { |dictionary_word| dictionary_word.length == word_length }\n nil\n end",
"def count\n @words.length\n end",
"def longest(str)\n count = 0\n str.split(\" \").each {|word| count = word.length if word.length > count}\n p count\nend",
"def number_of_characters\n @text.length\n end",
"def numWords\n @words\n end",
"def word_count\n @@word_count\n end",
"def WordCount(str)\n\n arr=str.split\n return arr.length\nend",
"def long_word_count(text)\n #\n # your code goes here\n #\n counter = 0\n text.split.each do |word|\n counter += 1 if word.length > 7\n end\n\n counter\nend",
"def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend",
"def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend",
"def tell_secret_word_length\n @secret_word = @dictionary.sample\n @secret_word.length\n end",
"def word_sizes(string)\n clean_string = string.gsub(/[^a-zA-Z]/, \" \")\n \n clean_string.split.map { |word| word.size }.tally\n \nend",
"def lengths\n words = gets.chop\n length = []\n words.each { |a| length << a.length}\n length\n end",
"def word_length(string)\n result = []\n string.split.each do |word|\n #result << word + ' ' + word.length.to_s\n result << \"#{word} #{word.length}\"\n end\n result\nend",
"def is_length(word)\n\t\tword.length == WORD_LENGTH\n\tend",
"def word_lengths(string)\nstring.split.map{|e| e + ' ' + e.size.to_s}\nend",
"def character_count(words)\n words = words.split(' ')\n words.reduce(0) { |sum, val| sum + val.length }\nend",
"def long_word_count(text)\n text.split.count do |word|\n word.length > 7\n end\nend",
"def phrase_length(user_phrase)\n puts \"Your phrase is \" + user_phrase.length.to_s + \" characters long\"\nend",
"def str_count(word, letter)\n p word.count(letter)\nend",
"def WordCount(str)\n\n # code goes here\n return str.split(\" \").length # .split.count, split(‘ ’).size\n \nend",
"def length\n @poss.length\n end",
"def word_lengths(phrase)\n words_array = phrase.split\n words_array.map do |word|\n word = \"#{word} #{word.size}\"\n end\nend",
"def length (string)\n string.length\nend",
"def word_sizes(string)\n string.split.map { |word| word.size }.tally\nend",
"def get_length(str)\n @str.length.to_i\n end",
"def num_chars\n @text.length\n end",
"def nr_of_words\n html_remove.split.size\n end",
"def word_count\n weighted(:count, :word).to_i\n end",
"def letter_counts(word)\nend",
"def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n str.split.map { |element| element.size }.tally\nend",
"def word_lengths(str)\n str.split.map{ |word| word + \" \" + word.size.to_s}\nend",
"def words_of_same_length(word)\n\treturn $words[word.length]\nend",
"def calculate_limit(word)\n @guess_limit = (word.length * 2)\nend",
"def word_sizes(string)\n string.split.map do |word|\n word.size\n end.tally\n \nend",
"def get_word_value(word)\n word_value = word.length == 4 ? 1 : word.length\n if pangram?(word)\n word_value += 7\n end\n word_value\n end",
"def word_number_length(number)\n\treturn wordify(number).delete(' ').length\nend",
"def total_words\n words.size\n end",
"def word_lengths(string)\n string.split.map {|word| word + \" \" + word.size.to_s}\nend",
"def count_words_in(the_string)\n the_words = the_string.split\n the_words.size\nend",
"def word_lengths(str)\n words = str.split\n word_sizes = []\n words.each do |word|\n word_sizes << \"#{word} #{word.size}\"\n end\n \n word_sizes\nend",
"def word_count(text, len)\r\n words, strays = text.length.divmod(len)\r\n words += 1 if strays > 0\r\n pad = \"X\" * (len - strays)\r\n return [words, pad]\r\n end",
"def word_count(string)\n string_arr = string.split \n string_arr.size \nend",
"def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend",
"def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend",
"def length\n @chars.length\n end",
"def char_word_counter(sentence)\n words_array = sentence.split(' ')\n how_many_words = words_array.length\n how_many_chars = sentence.gsub(/\\s+/, \"\").length\n\n \"This sentence has #{how_many_words} words & #{how_many_chars} characters\"\nend",
"def word_lengths(string)\n string.split(\" \").map do |word|\n size = word.length \n word + \" #{size}\"\n end \nend",
"def calc_characters(string)\n words = string.split\n chars = 0\n words.each { |word| chars += word.size }\n chars\nend",
"def length()\n return @letter_bag.length\n end"
] | [
"0.80507606",
"0.7831307",
"0.770098",
"0.76787126",
"0.75193274",
"0.75193274",
"0.75193274",
"0.75193274",
"0.7516375",
"0.7478823",
"0.7358308",
"0.7358308",
"0.73345184",
"0.73345184",
"0.73345184",
"0.73345184",
"0.72843176",
"0.7255777",
"0.722342",
"0.7199076",
"0.71592265",
"0.7114407",
"0.7114407",
"0.710734",
"0.7062182",
"0.7039136",
"0.70362246",
"0.70024765",
"0.69736904",
"0.69568974",
"0.69357765",
"0.6935489",
"0.6896733",
"0.6895332",
"0.68777734",
"0.6867504",
"0.68643385",
"0.68616986",
"0.6861428",
"0.6847905",
"0.68378204",
"0.6829294",
"0.6812845",
"0.6805983",
"0.68007326",
"0.67981696",
"0.6792041",
"0.67847383",
"0.6780422",
"0.6766101",
"0.67642456",
"0.67545366",
"0.6739977",
"0.6722948",
"0.6711087",
"0.6698972",
"0.66896576",
"0.66754085",
"0.66678154",
"0.66587585",
"0.6657424",
"0.6652587",
"0.66401416",
"0.6635855",
"0.66219056",
"0.6620793",
"0.6618485",
"0.6618464",
"0.661088",
"0.66095656",
"0.6601008",
"0.6591823",
"0.65916175",
"0.6587161",
"0.6585281",
"0.6585228",
"0.6573138",
"0.6572539",
"0.6564028",
"0.65636873",
"0.6560252",
"0.65504694",
"0.6550091",
"0.65485346",
"0.65442187",
"0.6542629",
"0.65423435",
"0.6540307",
"0.65328526",
"0.6531595",
"0.6531581",
"0.6529994",
"0.6528828",
"0.6527613",
"0.6527576",
"0.65274304",
"0.6525148",
"0.6520018",
"0.65171534",
"0.65169364"
] | 0.71159375 | 21 |
guesses random word of appropriate length | def guess_word(word_length)
self.sample(dict.select { |word| word.length == word_length } )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick_mystery_word\n @picked_word = self.dict.sample\n self.picked_word.length\n end",
"def pick_secret_word\n\t\t@secret_word = @dictionary.sample.chomp.downcase\n\t\t@secret_word.length\n\tend",
"def get_word(difficulty)\n WORDS.select{|word| word.length == difficulty}.sample\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\n rand(36**length).to_s(36)\nend",
"def random_word(length = 5)\r\n rand(36**length).to_s(36)\r\nend",
"def pick_random_word(dictionary)\n random_num = rand(dictionary.length)\n dictionary[random_num]\n end",
"def random_word(lexicon)\n lexicon[rand(lexicon.length)] \n end",
"def words(length)\n WORDS.sample(length)\nend",
"def random_word\n\t\tnumber = rand(@modified_dictionary.length)\n\t\t@modified_dictionary[number]\n\tend",
"def get_random_word(dictionary, min_length, max_length)\n random_word = nil\n loop do\n random_index = rand(dictionary.length)\n random_word = dictionary[random_index]\n break if not random_word.nil? and\n (min_length..max_length).cover? random_word.length\n end\n return random_word\n end",
"def new_word\n\t\tdictionary = File.open(\"5desk.txt\", \"r\").readlines\n\t\tbegin \n\t\t\t@the_word = dictionary[rand(0..dictionary.length)]\n\t\tend while @the_word.length >= 12 || @the_word.length <=5\n\t\t@the_word\n\tend",
"def selectWord\n\twords = [\n\t\t\"anvil\",\n\t\t\"black\",\n\t\t\"break\",\n\t\t\"clear\",\n\t\t\"doubt\",\n\t\t\"exist\",\n\t\t\"first\",\n\t\t\"girth\",\n\t\t\"heart\",\n\t\t\"icons\",\n\t\t\"joker\",\n\t\t\"loath\",\n\t\t\"mirth\",\n\t\t\"notch\",\n\t\t\"overt\",\n\t\t\"print\",\n\t\t\"qualm\",\n\t\t\"react\",\n\t\t\"solid\",\n\t\t\"trick\",\n\t\t\"until\",\n\t\t\"viola\",\n\t\t\"water\",\n\t\t\"young\",\n\t\t\"zebra\"\n\t]\n\treturn words[Random.rand(words.length)]\nend",
"def choose_word\n @word = @lines[rand(0..(@lines.length - 1))].chomp\n choose_word if @word.length < 5 || @word.length > 12\n end",
"def get_random_word(words)\n # rand method with an integer argument (the length of words) get a new integer between 0 & the length of words\n return words[rand(words.count)]\n end",
"def get_random_word\r\n @word_list.sample\r\n end",
"def pick_dictionary_word(options={})\n min_length = (options[:exact] || options[:min] || 1).to_i\n max_length = (options[:exact] || options[:max] || 5).to_i\n \n language = (options[:language] || @@default_language).to_s\n validate_language(language)\n \n dictionary = options[:dictionary] || @@dictionaries[language] ||= load_dictionary(language)\n validate_dictionary(dictionary)\n \n sized_words = dictionary.select do |word|\n min_length <= word.length && word.length <= max_length\n end\n if !sized_words.empty?\n return sized_words[rand(sized_words.length)] \n else\n # TODO: How should an empty sized_words be handled?\n return \"\"\n end\n end",
"def tell_secret_word_length\n @secret_word = @dictionary.sample\n @secret_word.length\n end",
"def random_word\n words = @dictionary.dictionary.keys\n words[rand(words.length)]\n end",
"def pick_secret_word\n @word = dictionary.sample\n word\n end",
"def pick_random_word\n random_word = @words.sample.gsub!(/\\s+/, \"\")\n end",
"def choose_word\n word_index = 0\n loop{\n word_index = rand(@text_file.length.to_i)\n if @text_file[word_index].length.to_i > 4 && @text_file[word_index].length.to_i < 12\n break\n end\n }\n @word = @text_file[word_index]\n end",
"def word_picker\n dictionary = File.readlines('lib/5desk.txt')\n word = dictionary.sample(1)[0].chomp.downcase\n word = dictionary.sample(1)[0].chomp.downcase until word.length.between?(5, 12)\n word\n end",
"def random_word\n\t\tLEGAL_WORDS.sample # Gets random element from array\n\tend",
"def random_word\n word = WORDS[rand(WORDS.length)]\n word == \"\" ? random_word : word\nend",
"def random_word\n open('/usr/share/dict/words').read.split(/\\n/).sample\n end",
"def set_word\n dic = File.read(\"dic.txt\").downcase.split\n dic.reject! {|word| word.length<5 || word.length>12}\n word = dic.sample\n end",
"def get_word(dictionary)\n word = dictionary[rand(dictionary.length)]\n # Ensure that the word is between 5 and 12 letters long.\n if word.length.between?(5,12)\n return word.downcase.strip\n else\n get_word(dictionary)\n end\n end",
"def gensecretword\r\n\t\t \trand_index = rand(@wordtable.length)\r\n\t\t \t@secret_clue = @descr[rand_index]\r\n\t\t \t@num_words = @wordtable[rand_index].split(\" \").length\r\n\t\t return @wordtable[rand_index].upcase\r\n\t\t end",
"def word\n options = []\n case @theme\n when \"default\"\n options = [\"cast\", \"puppy\", \"pineapple\", \"bananas\"]\n @word_to_guess = options.sample\n when \"food\"\n options = [\"mango\", \"papaya\", \"guava\", \"apples\", \"lychee\"]\n @word_to_guess = options.sample\n when \"hacker\"\n options = [\"bandwidth\", \"synthesize\", \"bypass\", \"cyberpunk\", \"firewall\"]\n @word_to_guess = options.sample\n when \"game of thrones\"\n options = [\"stark\", \"lannister\", \"arya\", \"hodor\", \"meereen\"]\n @word_to_guess = options.sample\n when \"lord of the rings\"\n options = [\"lothorien\", \"galadriel\", \"frodo\", \"bombadil\", \"goldberry\"]\n @word_to_guess = options.sample\n end\n end",
"def pick_a_word(length)\n #remove sandwich code and change into map after it gets working\n words = get_words.split(\" \")\n filtered_wrds_by_length = []\n \n words.each do |wrd| #or select method\n if wrd.size == length.to_i\n filtered_wrds_by_length << wrd\n end\n end\n\n chosen_word = filtered_wrds_by_length.sample\n\nend",
"def rand_text_english(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_english(length, bad)\n end\n end",
"def choose_word\n @words = read_words unless @words\n return @words [rand @words.size]\nend",
"def random_word\n wordpair = nil\n File.foreach(\"wordlist\").each_with_index do |line, number|\n wordpair = line if rand < 1.0/(number+1)\n end\n word = Word.new(wordpair.split(':')[0], wordpair.split(':')[1])\n return word\n end",
"def initialize()\n @word = get_random_word\n @guesses = ''\n @wrong_guesses = ''\n end",
"def scramble_words(chars = WordChars)\n\t\tgsub(/(#{chars})(#{chars}+)(?=#{chars})/) { $1 + $2.randomize }\n\tend",
"def random_word\n letters = ('a'..'z').to_a\n word = []\n length = (rand 15) + 1\n \n length.times do\n word << letters[rand(25)] \n end\n\n word.join ''\nend",
"def random_word(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n word = LiterateRandomizer.word\n @last_words = [] if @last_words.nil?\n word = LiterateRandomizer.word while @last_words.include?(word)\n @last_words.prepend_capped(word, 5)\n msg.reply(word)\n end",
"def choose_code_word\n dictionary = []\n File.readlines(\"word_list.txt\").each do |word|\n if word.length > 4 && word.length < 13\n dictionary.push(word.strip.downcase)\n end\n end\n @code_word = dictionary[rand(dictionary.length)]\n end",
"def get_word\n dictionary_file = '5desk.txt'\n dictionary = File.readlines(dictionary_file)\n until @secret_word.length > 5 && @secret_word.length < 12\n @secret_word = dictionary.sample.rstrip.downcase\n end\n @secret_word\n end",
"def random_word\n @words.fetch(rand(@words.length)).chomp\n end",
"def select_word\r\n\t\t@answer = @words[rand(27)]\r\n\r\n\r\n\t\t# this would be a list of hashes\r\n\t\t@question = \"\"\r\n \t@tempque=\"\"\r\n\t\tfor x in 0..@answer.length\r\n\r\n\t\t\t@question=@question+\"#\"\r\n \t\t@tempque=@tempque+\"#\"\r\n\t\tend\r\n\t\treturn @answer\r\n\r\n\tend",
"def chooseRandomWord() \n @randomWord = @wordsList[rand(0..@wordsList.size)]\n @randomWord.downcase\n \n #adding \"_\" to the letters array to display during the game\n randomWordSize = @randomWord.size - 1\n (1..randomWordSize).each do |i| \n @lettersDisplayArr.push(\" _ \")\n \n end\n beginGame()\n end",
"def word\n i = rand(78)\n if i <= 2\n \"ie\"\n elsif i <= 3\n \"au\"\n elsif i < 10\n v + c\n elsif i < 17\n c + v\n elsif i < 25\n v + c + v\n elsif i < 33\n c + v + c\n elsif i < 43\n v + c + v + c\n elsif i < 53\n c + v + c + v\n elsif i < 68\n v + c + v + c + v\n elsif i < 71\n c + v + c + v + c\n elsif i < 74\n v + c + v + c + v + c\n elsif i < 76\n c + v + c + v + c + v\n elsif i < 77\n v + c + v + c + v + c + v\n elsif i <= 78\n c + v + c + v + c + v + c\n end\nend",
"def pick_secret_word\n\t\t@secret_word.length\n\tend",
"def get_word\n word = @word_list[rand(@word_list.length)]\n @word = word.gsub(/\\s+/, \"\").downcase\n end",
"def get_word\r\n\t # Variable initialization\r\n\t wordArray = []\r\n\t count = 0\r\n\t random_int = 0\r\n\t \r\n\t # Stores each word that is on a new line into an array\r\n\t f = File.open(\"5desk.txt\", \"r\")\r\n\t f.each_line{ |line| wordArray << line }\r\n\t f.close\r\n\t \r\n\t # Selects the random word between the desired length of between 5 and 12 characters. \r\n\t # Note that this includes an extra delimiter at the end of each word\r\n\t until wordArray[random_int].length > 5 && wordArray[random_int].length < 14 do\r\n\t random_int = Random.new.rand(0..61405)\r\n\t end\r\n\t wordArray[random_int].chomp!\r\n\tend",
"def a_word\n return @random_word\n end",
"def sentence_length\n Random.rand(9)+3\nend",
"def make_word\n @secret_word = File.readlines('dictionary.txt').sample.chomp.downcase.split('')\n @working_word = Array.new(@secret_word.length) { \"_\" }\n end",
"def dictionary_word\n dict = File.readlines(\"./data/5desk.txt\")\n word = dict[rand(dict.length)].strip while word.nil? || word.length <= 5 || word.length >= 12\n word\n end",
"def word_generator\ntotal_words = []\nFile.open(\"5desk.txt\", \"r\") do |f|\n f.each_line do |line|\n total_words << line \n end\n end\nwords_count = 61407\nrandom_number = rand(0...words_count)\nrandom_word = total_words[random_number]\n# random_word if random_word.length >= 5\nend",
"def select_word\n uri = URI('https://random-word-api.herokuapp.com/word?number=5')\n words = Net::HTTP.get(uri) \n words = words.delete(\"[\").delete(\"]\").delete(\"\\\"\")\n words = words.split(\",\")\n index = rand(words.count - 1)\n return words[index]\n end",
"def get_word\n words = File.readlines(\"lib/5desk.txt\")\n words.each { |word| word.chomp! }\n words_list = words.select { |word| word.length.between?(5, 12)}\n\n words_list.sample.downcase.split(\"\")\n end",
"def assignWord(level)\n if level == \"1\"\n begin\n @assignedword = Faker::Hipster.word\n end until @assignedword.length <= 6\n # infinte loop if database without words > 8 letters\n elsif level == \"2\"\n begin\n @assignedword = Faker::Hipster.word\n end until @assignedword.length > 6 && @assignedword.length <= 10\n elsif level == \"3\"\n begin\n @assignedword = Faker::Hipster.word\n end until @assignedword.length > 10\n end\n return @assignedword\n end",
"def utter_randomly\n length = Utterance::MinLength +\n rand(Utterance::MaxLength - Utterance::MinLength)\n (0...length).map{ Alphabet.sample }.join\n end",
"def load_secret_word\n @secret_word = File.readlines('5desk.txt').sample.downcase.strip\n until @secret_word.length > 5 && @secret_word.length < 12\n puts \"Choosing secret word...\"\n @secret_word = File.readlines('5desk.txt').sample.downcase.strip\n end\n @secret_display = %{#{\"_\" * @secret_word.length}} # change this to update based on previous guesses\n end",
"def mutate_spelling\n spelling_changes = rand(@options[:spelling_mutations]+1)\n spelling_changes.times{ self[rand(size)] = random_char }\n self\n end",
"def guessed_word()\r\n\t\tresult = ''\r\n\r\n\t\t# TODO: fill in method body\r\n\t\t\r\n\t\treturn result\r\n\tend",
"def prepare( word, m, chainlen, simto )\n xchain = m.bot.set.logic.maxchainlength\n nchain = m.bot.set.logic.minchainlength\n wid = -1\n oword = word\n \n # Rope our chain length into whatever config has it set as\n if not chainlen.is_a? Integer or chainlen <= 0\n chainlen = Random.new.rand nchain..xchain\n elsif chainlen > xchain\n chainlen = xchain\n elsif chainlen < nchain\n chainlen = nchain\n end\n\n if simto\n word = \"%#{word}%\"\n wid = m.getFirst_i_rand \"id\", \"words WHERE word SIMILAR TO ?\", word\n else\n wid = m.getFirst_i_rand \"id\", \"words WHERE word ILIKE ?\", word\n end\n \n if wid == nil or wid <= 0\n m.reply \"I don't know the word: \\\"#{oword}\\\"\"\n end\n\n return wid, chainlen\n end",
"def guesses_allowed\n\t\tif @word.length > 12 \n\t\t\t 8\n\t\telsif @word.length <= 12 && @word.length > 8\n\t\t\t 5\n\t\telse\n\t\t\t 4\n\t\tend\t\t\t\n\tend",
"def choose_word\n input = File.open(\"words.txt\", 'r')\n words = []\n input.readlines.each do |line|\n words.push(line.strip().downcase)\n end\n input.close()\n words[rand(words.length)]\n end",
"def generate\n while chars_left > 0\n word << sample_syllable\n normalize! if normalize\n end\n return @word.capitalize\n ensure\n cleanup!\n end",
"def make_word(key)\n num_sylls = rand(self.minsyll..self.maxsyll)\n word = ''\n keys = []\n\n # If a key is defined, then select one of the syllables\n # to have a morpheme of that type.\n keys[rand(num_sylls)] = key\n num_sylls.times { |i| word << get_morpheme(keys[i]) }\n\n word\n end",
"def guess(word_pattern, possible_words)\n all_words = possible_words.flatten\n guess = $avail_letters.sort_by {|c|\n all_words.select{|w|w.index c}.length}.last\n $avail_letters -= [guess]\n $guess = guess\nend",
"def new_game\n dictonary = File.new('dictonary.txt', 'r')\n cleaned_dictonary = dictonary.readlines(chomp: true).select { |word| word.length >= 5 && word.length <= 12 }\n dictonary.close\n word = cleaned_dictonary.sample\n set_up_game(word, '_' * word.length)\n end",
"def guess(word_pattern, possible_words)\r\n all_words = possible_words.flatten\r\n guess = $avail_letters.sort_by {|c|\r\n all_words.select{|w|w.index c}.length}.last\r\n $avail_letters -= [guess]\r\n $guess = guess\r\nend",
"def get_new_word(level)\n\t\n\tdict_array_details = array_sort(level)\n\n\tsorted_dict_array = dict_array_details[0]\n\tsorted_dict_lengths = dict_array_details[1]\n\n\tif sorted_dict_lengths[\"end_\" + level.to_s] == nil\n\t message = \"Could not find a #{level} letter word. Try again!\"\n\telse\n \t len = sorted_dict_lengths[\"end_\" + level.to_s] - sorted_dict_lengths[\"start_\" + level.to_s] + 1\n\t offset = sorted_dict_lengths[\"start_\" + level.to_s]\n\n\t no = offset + rand(len)\n\t $word = sorted_dict_array[no].split(\"\")\n\t puts \"Debug: WORD is #{$word.join(\"\").to_s}\"\n\n\t $word.length.times do |i|\n\t \t $guessed_word[i] = \"_\"\n end\t\n $is_get_level = false\n message = \"Word has #{level} letters!\"\n \tend\t\nend",
"def word_to_guess (user_word)\n\t\tuser_word.downcase!\n\t\t@number_guess = user_word.length\n\t\t@answer_word = user_word.split(\"\")\n\tend",
"def word_selector\n\t\t@game_word = @word.sample\n\tend",
"def select_word\n words = File.readlines(\"5desk.txt\").select { |word| word.length.between?(5, 12) }\n words[rand(words.length)].strip\n end",
"def get_the_word\n words = File.readlines(\"5desk.txt\")\n words = words.map do |word|\n word.strip\n end\n words = words.select do |word|\n (word.length > 4) && (word.length < 13)\n end\n words.sample.upcase.split(\"\")\n end",
"def pick_secret_word\n\t\tFile.read(\"5desk.txt\").lines.select {|word| (4..9).cover?(word.size)}.sample.strip\n\tend",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def get_random_word(filename)\n dictFile = File.open filename\n words = dictFile.readlines.reduce([]) do |words, word|\n if word.strip!.length >= 8\n words << word\n end\n words\n end\n words[(rand words.length)]\nend",
"def initialize word \n @word = word\n @guesses = ''\n @wrong_guesses = ''\n end",
"def rand_text_highascii(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_highascii(length, bad)\n end\n end",
"def guess word\n return 1 if word.length == 1\n word = word.downcase.delete(\"'\")\n\n syllables = word.scan(/[aeiouy]+/).length\n\n # special cases\n for pat in SubSyl\n syllables -= 1 if pat.match(word)\n end\n for pat in AddSyl\n syllables += 1 if pat.match(word)\n end\n\n syllables = 1 if syllables < 1 # no vowels?\n syllables\n end",
"def random_capitalized_word\n attempts = 0\n # If you don't find a capitalized word after 15 attempts, just use\n # a lowercase word as there may be no capitals in the dicationary.\n until attempts > 15\n attempts += 1\n words = @dictionary.dictionary.keys\n random_choice = words[rand(words.length)]\n if random_choice[0] =~ /[A-Z]/\n return random_choice\n end\n end\n random_word\n end",
"def get_word(word)\n chosen = \"\"\n\n if !@graph.words[word].nil? then\n \n # sum up all values in our word to get range\n total = 0\n @graph.words[word].map { |k,v| total += v }\n\n # grab some random val from said range\n sel = rand(total)\n\n # return the first word that has a\n # weight greater than our 'random number'\n # ensure we remove the weight from random\n # on each iteration\n @graph.words[word].each do |k,v|\n\n if v > sel then\n chosen = k\n break\n end\n\n sel -= v\n\n end\n\n return chosen\n end\n\n end",
"def word_status\n\t\t@ans_word.length.times do\n\t\t\t@guess << \"_\"\n\t\tend\n\t\tputs \"Guesser, your secret word has #{@ans_word.length} characters: #{@guess*\"\"}\"\n\tend",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def get_word\n @word_to_guess.join\n end",
"def typoglycemiaWord(input)\n if input.length <= 3\n input\n end\n letters = input.chars\n last = letters.pop\n first = letters.shift\n letters.shuffle!\n letters << first\n letters.rotate!(-1)\n letters << last\n letters.join\nend",
"def get_word_from_dictionary(filename)\n words = File.readlines(filename, chomp: true) # read in dictionary\n # get only valid length words\n valid_words = words.select do |word|\n word.length >= 5 && word.length <= 12\n end\n # choose a random valid_word\n valid_words.sample\n end",
"def select_word(words)\n word_selected = words[rand(words.length)].strip\n word_selected\n end",
"def weighted_random(lastword)\n # If word has no words in its dictionary (last word in source text file)\n # have it pick a random word to display instead.\n @dictionary.dictionary.fetch(lastword, NULL_OBJECT).sample\n end",
"def zh_lorem_words(total, replacement = nil)\n s = []\n while (s.length < total)\n x = random_one(SENTENCES[ rand(3) ])\n s << random_one(x.split(//u)[0..-2])\n end\n return s.join(\"\")\n end",
"def select_word\r\n\r\n #Define an array of 40 words from which the game will randomly select\r\n words = [\"W I N D O W\", \"S T A T I O N\", \"H A M B U R G E R\",\r\n \"E X P R E S S I O N\", \"W A L L E T\", \"C A M E R A\",\r\n \"A I R P L A N E\", \"C A N D L E\", \"C O M P U T E R\",\r\n \"P I C T U R E\", \"F R A M E\", \"S H E L F\", \"B O W L I N G\",\r\n \"P O L I T E\", \"S T A T E M E N T\", \"N E G A T I V E\",\r\n \"M E T H O D\", \"F I S H I N G\", \"C O M P E N S A T E\",\r\n \"H A P P Y\", \"F O O T B A L L\", \"S A N D W I C H\",\r\n \"I L L U S I O N\", \"S K E L E T O N\", \"S P A G H E T T I\",\r\n \"P H O T O G R A P H\", \"P U R I F Y\", \"O T O M A N\",\r\n \"I N C E N S E\", \"S T A I R C A S E\", \"C O L O S S E U M\",\r\n \"H O N E Y\", \"S C U L P T U R E\", \"M E A T L O A F\",\r\n \"M O T O R C Y C L E\", \"R E V O L U T I O N\", \"B L A N K E T\",\r\n \"S L A U G H T E R\", \"K I T T E N\", \"S T A M P E D E\"]\r\n\r\n #Generate and return a random number between 0 and 39\r\n randomNo = rand(39)\r\n\r\n #Return a randomly selected word to the calling statement\r\n return words[randomNo]\r\n\r\n end",
"def guess\n\t\tcollect_words_of_length\n\t\tputs \"Already guessed letters by computer: #{@guessed_letters}\"\n\t\t@guessing_letter = nil\n\t\twhile @guessing_letter == nil || invalid?(@guessing_letter)\n\t\t\t@guessing_letter = guessing_letter\n\t\tend\n\t\t@guessed_letters << @guessing_letter\n\t\t@guessing_letter\n\tend",
"def draw_word\n @words.sample(random: Ibsenphrase::Random.prng)\n end",
"def rand_text_alphanumeric(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_alphanumeric(length, bad)\n end\n end",
"def play_new_game\n #get new code word\n @word_master.choose_code_word\n @code_word = @word_master.code_word\n @good_guesses = Array.new(@code_word.length, '_ ')\n #tells you rules\n puts \"Try to figure out the word. If you guess 6 wrong letters, you lose!\"\n #starts playing\n game_loop\n end",
"def new_game\n dictionary = File.readlines(\"assets/5desk.txt\").map {|word| word.chomp}\n dictionary.select! {|word| word.length >= 5 && word.length <= 12}\n @chosen_word = dictionary[(dictionary.size * rand).floor]\n\n puts \"A word has been chosen that is #{@chosen_word.length} letters long.\"\n puts \"You may guess the letters in that word one letter at a time,\"\n puts \"or you may guess the whole word, but a man's life \\\"hangs\\\" in\"\n puts \"the balance. So be careful not to make too many wrong guesses,\"\n puts \"because once his whole body and both of his eyes have been\"\n puts \"drawn, he's dead and you lose!\"\n puts \"\\n\"\n\n @word_guess = WordGuess.new(@chosen_word)\n @dead_man = DeadMan.new\n\n round\n end",
"def pick_word\n @dictionary = File.readlines('dictionary.txt').map(&:chomp)\n @computer_word = @dictionary.sample\n end",
"def randomWord(smallest, largest)\n\t\tlist = to_a(smallest,largest)\n\t\tnumber = rand(list.size) + 1\n\t\tlist[number].downcase.chomp\n\tend",
"def lose_word\n if self.text.split.length > 1\n prev_line = self.text.split\n prev_line.delete_at(rand(prev_line.length))\n self.text = prev_line.join(\" \")\n self.save\n end\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end"
] | [
"0.7428584",
"0.7291276",
"0.72800356",
"0.724955",
"0.724955",
"0.724955",
"0.724955",
"0.7227071",
"0.7218384",
"0.721788",
"0.71920466",
"0.7160873",
"0.71190596",
"0.7070547",
"0.70439917",
"0.70407236",
"0.7022391",
"0.70084393",
"0.7008256",
"0.6977465",
"0.6966264",
"0.69585323",
"0.69543415",
"0.6952923",
"0.69011575",
"0.68954515",
"0.6895287",
"0.6892952",
"0.68748325",
"0.68689287",
"0.6867196",
"0.6859948",
"0.6850733",
"0.6831884",
"0.6829984",
"0.68260705",
"0.6816252",
"0.6799557",
"0.6799097",
"0.6798778",
"0.67574275",
"0.67519855",
"0.6733497",
"0.67271984",
"0.6717185",
"0.67048013",
"0.66977125",
"0.6693788",
"0.66860074",
"0.66784596",
"0.6671368",
"0.66606724",
"0.66517943",
"0.6651589",
"0.66254526",
"0.6625399",
"0.6605419",
"0.6604455",
"0.6589694",
"0.6571075",
"0.65675604",
"0.6564634",
"0.65544593",
"0.65474796",
"0.6538414",
"0.6526916",
"0.652681",
"0.65181696",
"0.6517859",
"0.6516173",
"0.65102595",
"0.6508941",
"0.6505561",
"0.64990926",
"0.64966184",
"0.6482635",
"0.6477508",
"0.64522105",
"0.6440219",
"0.64339733",
"0.6429092",
"0.6413352",
"0.64039797",
"0.6389667",
"0.6383667",
"0.6375154",
"0.6368629",
"0.6367945",
"0.6365502",
"0.63652796",
"0.63616484",
"0.63514143",
"0.63404197",
"0.6333161",
"0.6328186",
"0.6324679",
"0.6304727",
"0.63046265",
"0.6300506",
"0.6299466"
] | 0.80783665 | 0 |
GET /congresos/1 GET /congresos/1.json | def show
@congreso = Congreso.find(params[:id])
@datos_lucrativos = false
@datos_lucrativos = true if @congreso.talleres.where("precio > 0").count > 0 || @congreso.precio > 0
respond_to do |format|
format.html # show.html.erb
format.json { render json: @congreso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @congressos = Congresso.all\n end",
"def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end",
"def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end",
"def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\n end\n end",
"def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end",
"def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end",
"def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end",
"def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end",
"def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def index\n @servico_pacotes = Servico::Pacote.all\n end",
"def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end",
"def index\n @cegresos = Cegreso.all\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\r\n @consejeros = Consejero.all\r\n end",
"def index\n if params[:categoria_producto]\n render json: Producto.find(params[:producto_id]).categorias\n else\n\t\t @categorias = Categoria.all\n render json: @categorias\n end\n\tend",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def index\n @content_item_condos = ContentItemCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_item_condos }\n end\n end",
"def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end",
"def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def index\n @concursos = Concurso.all.paginate(:page => params[:page], :per_page => 20)\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end",
"def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end",
"def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end",
"def index\n @contas = Conta.where(nil) #Inicia Escopo\n @contas = @contas.conta_numero(params[:contaNumero]) if params[:contaNumero].present?\n @contas = @contas.conta_descricao(params[:contaDescricao]) if params[:contaDescricao].present?\n @contas = @contas.agencia_numero(params[:agenciaNumero]) if params[:agenciaNumero].present?\n @contas = @contas.banco_id(params[:bancoId]) if params[:bancoId].present?\n\n @contas = @contas.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json: {contas: @contas.as_json(:include => [:banco], methods: [:conta, :agencia, :saldo]), total: @contas.total_entries}}\n end\n end",
"def index\n @convidados = Convidado.all\n end",
"def info\n CouchRest.get \"#{@uri}/\"\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\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 @prueba_jsons = PruebaJson.all\n end",
"def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end",
"def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def index\n @apoios = Apoio.all\n end",
"def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end",
"def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end",
"def index\n @consorciots = Consorciot.all\n end",
"def activos\n render :json => Producto.activo.all\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @copenometros = Copenometro.all\n end",
"def index\n @articulocomps = Articulocomp.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @articulocomps }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def show\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sistema }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\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 @proyecto_imagen = ProyectoImagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proyecto_imagen }\n end\n end",
"def show\n @content_condo = ContentCondo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_condo }\n end\n end",
"def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end",
"def show\n @comprobante = Comprobante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comprobante }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @contato_produtos = ContatoProduto.all.sort! { |a,b| b.id <=> a.id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contato_produtos }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end",
"def index\n @mixproductos = Mixproducto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mixproductos }\n end\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end",
"def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def index\n @proyectos = Proyecto.all\n end",
"def index\n @proyectos = Proyecto.all\n end"
] | [
"0.6697806",
"0.65125185",
"0.64398843",
"0.63595873",
"0.62354386",
"0.6121831",
"0.61186135",
"0.6047988",
"0.6042519",
"0.5993772",
"0.5972588",
"0.5969116",
"0.5951245",
"0.594815",
"0.58813465",
"0.5852067",
"0.58420634",
"0.5840006",
"0.5830641",
"0.58245087",
"0.58184",
"0.5812163",
"0.5806652",
"0.58030677",
"0.5801266",
"0.57861584",
"0.5774787",
"0.5751222",
"0.57510126",
"0.57506096",
"0.5750234",
"0.574613",
"0.5743754",
"0.5738626",
"0.5735368",
"0.57279325",
"0.5726958",
"0.5714216",
"0.5708345",
"0.5703824",
"0.56882304",
"0.56874245",
"0.56778336",
"0.56711745",
"0.5663759",
"0.5661732",
"0.5660898",
"0.56606525",
"0.56519985",
"0.56519985",
"0.5643424",
"0.56346947",
"0.56342393",
"0.5632766",
"0.5616362",
"0.5608635",
"0.5608137",
"0.56053185",
"0.55959743",
"0.55959743",
"0.5594911",
"0.5591798",
"0.55916214",
"0.55916214",
"0.55907923",
"0.5588295",
"0.55775404",
"0.5576479",
"0.55761814",
"0.55761814",
"0.5575818",
"0.5575553",
"0.55730903",
"0.5571766",
"0.5571636",
"0.55673224",
"0.55666023",
"0.5563473",
"0.5563473",
"0.5562041",
"0.5560831",
"0.5557352",
"0.55539036",
"0.5552054",
"0.5549942",
"0.55488014",
"0.55443096",
"0.5537373",
"0.5535814",
"0.5530572",
"0.5527015",
"0.5524445",
"0.5521661",
"0.5518371",
"0.5518099",
"0.5511402",
"0.55079406",
"0.55039835",
"0.55001044",
"0.5495394",
"0.5495394"
] | 0.0 | -1 |
GET /congresos/new GET /congresos/new.json | def new
@congreso = Congreso.new
@campos = Campo.all
respond_to do |format|
format.html # new.html.erb
format.json { render json: @congreso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @concurso = Concurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concurso }\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end",
"def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @cso = Cso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cso }\n end\n end",
"def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\n end\n end",
"def new\n @sistema = Sistema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sistema }\n end\n end",
"def new\n @comentario = Comentario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentario }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end",
"def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @contrato }\n end\n end",
"def new\n @comisaria = Comisaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comisaria }\n end\n end",
"def create\n @concurso = Concurso.new(params[:concurso])\n\n respond_to do |format|\n if @concurso.save\n format.html { redirect_to @concurso, notice: 'Concurso criado com sucesso.' }\n format.json { render json: @concurso, status: :created, location: @concurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cuerpo = Cuerpo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuerpo }\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 @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contacter }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def new\n @producto = Producto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producto }\n end\n end",
"def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end",
"def new\n @coisa = Coisa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @coisa }\n end\n end",
"def new\n @persona_tipo = PersonaTipo.new\n if current_user.is_admin?\n @congresos = Congreso.all(:order => \"nombre\")\n else\n @congresos = current_user.congresos(:order => \"nombre\")\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona_tipo }\n end\n end",
"def new\n @database = Database.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @database }\n end\n end",
"def new\n @projeto = Projeto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projeto }\n end\n end",
"def new\n @database = Database.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=> @database }\n end\n end",
"def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def new\n @proyect = Proyect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proyect }\n end\n end",
"def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end",
"def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end",
"def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end",
"def new\n @cont = Cont.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cont }\n end\n end",
"def new\n @comprobante = Comprobante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comprobante }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\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\n @reconocimiento = Reconocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @reconocimiento }\n end\n end",
"def new\n @competicao = Competicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competicao }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end",
"def new\n @carrera = Carrera.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carrera }\n end\n end",
"def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end",
"def new\n @vocacionada = Vocacionada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocacionada }\n end\n end",
"def new\n @caballo = Caballo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caballo }\n end\n end",
"def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @contum = Contum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contum }\n end\n end",
"def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def new\n\tadd_breadcrumb \"Nueva configuración\", :new_configuracion_path\n @configuracion = Configuracion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @configuracion }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socio }\n end\n end",
"def create\n @curso = Curso.new(params[:curso])\n\n respond_to do |format|\n if @curso.save\n format.html { redirect_to(:back) }\n format.json { render json: @curso, status: :created, location: @curso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\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 @conn = current_user.conns.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conn }\n end\n end",
"def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def new\n @coordinador = Coordinador.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coordinador }\n end\n end",
"def new\n @plannegocio = Plannegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plannegocio }\n end\n end",
"def new\n @conductor = Conductor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conductor }\n end\n end",
"def new\n @conductor = Conductor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conductor }\n end\n end",
"def new\n @cooperativa = Cooperativa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cooperativa }\n end\n end",
"def new\n puts params\n @pagamento = Pagamento.new\n @pagamento.os_id = params[:os_id] unless params[:os_id].nil?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pagamento }\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\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 @libros = Libro.find(params[:libro_id])\n @cuenta = Cuenta.find(params[:cuenta_id])\n @compra = @cuenta.compras.new(:libro => @libros, :fecha_compra => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compra }\n end\n end",
"def new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end",
"def new\n @custo = Custo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @custo }\n end\n end",
"def new\n @heroku = Heroku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heroku }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def create\n @concurso = Concurso.new(concurso_params)\n\n respond_to do |format|\n if @concurso.save\n format.html { redirect_to @concurso, notice: 'Concurso ha sido creado correctamente.' }\n format.json { render :show, status: :created, location: @concurso }\n else\n format.html { render :new }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @registro_bovino = RegistroBovino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registro_bovino }\n end\n end",
"def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def new\n DebugLog(params.inspect)\n @lancamentorapido = Lancamentorapido.new\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lancamentorapido }\n end\n end",
"def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def new\n @posto = Posto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posto }\n end\n end",
"def new\n @content_condo = ContentCondo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_condo }\n end\n end",
"def new\n @registro_record = RegistroRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registro_record }\n end\n end",
"def new\n @tipo_usuario = TipoUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.html { redirect_to @curso, notice: 'Curso foi criado(a) com sucesso.' }\n format.json { render action: 'show', status: :created, location: @curso }\n else\n format.html { render action: 'new' }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @activo = Activo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activo }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @socio }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n @categorias_tipo = CatTipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorias_tipo }\n end\n end"
] | [
"0.74713045",
"0.70107067",
"0.6976883",
"0.6945237",
"0.69343054",
"0.69343054",
"0.6914303",
"0.68775076",
"0.6869421",
"0.68637633",
"0.6854113",
"0.68336725",
"0.68263036",
"0.6813396",
"0.6809358",
"0.678931",
"0.67794216",
"0.6778932",
"0.6757828",
"0.67484754",
"0.67470795",
"0.67440265",
"0.67411983",
"0.67377377",
"0.6736715",
"0.6732186",
"0.6731176",
"0.6730367",
"0.6722446",
"0.6722075",
"0.6716661",
"0.6715236",
"0.67040616",
"0.6703042",
"0.6693241",
"0.66919714",
"0.66912866",
"0.66830325",
"0.66828585",
"0.6677517",
"0.6677517",
"0.6676266",
"0.66716206",
"0.6670824",
"0.66668993",
"0.66623956",
"0.6660386",
"0.6652742",
"0.66497165",
"0.6648549",
"0.66458434",
"0.6638892",
"0.66327965",
"0.66319364",
"0.6630653",
"0.6618185",
"0.6617868",
"0.66118705",
"0.66085565",
"0.66085565",
"0.66085565",
"0.66085565",
"0.66085565",
"0.6608311",
"0.66011274",
"0.65944046",
"0.6593408",
"0.6593354",
"0.6593278",
"0.6590015",
"0.6590015",
"0.6583668",
"0.65816474",
"0.65789586",
"0.6577366",
"0.6576052",
"0.6573366",
"0.65732837",
"0.6572721",
"0.65713656",
"0.6568486",
"0.6566324",
"0.656128",
"0.65574473",
"0.6556967",
"0.6556952",
"0.65549386",
"0.6554664",
"0.6552136",
"0.6551677",
"0.65459275",
"0.6539568",
"0.65355384",
"0.6535096",
"0.653477",
"0.6532501",
"0.65306824",
"0.65245694",
"0.6521731",
"0.6519595"
] | 0.7000083 | 2 |
POST /congresos POST /congresos.json | def create
@congreso = Congreso.new(params[:congreso])
@congreso.user_id = current_user.id
respond_to do |format|
if @congreso.save
crear_campos_congreso(params, @congreso.id)
CongresosUser.create(:user_id => current_user.id, :congreso_id => @congreso.id)
format.html { redirect_to @congreso, notice: 'Congreso registrado correctamente.' }
format.json { render json: @congreso, status: :created, location: @congreso }
else
@campos = Campo.all
format.html { render action: "new" }
format.json { render json: @congreso.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @concurso = Concurso.new(params[:concurso])\n\n respond_to do |format|\n if @concurso.save\n format.html { redirect_to @concurso, notice: 'Concurso criado com sucesso.' }\n format.json { render json: @concurso, status: :created, location: @concurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cegreso = Cegreso.new(cegreso_params)\n\n respond_to do |format|\n if @cegreso.save\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully created.' }\n format.json { render :show, status: :created, location: @cegreso }\n else\n format.html { render :new }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @concurso = Concurso.new(concurso_params)\n\n respond_to do |format|\n if @concurso.save\n format.html { redirect_to @concurso, notice: 'Concurso ha sido creado correctamente.' }\n format.json { render :show, status: :created, location: @concurso }\n else\n format.html { render :new }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consumo = Consumo.new(consumo_params)\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo, notice: 'Consumo was successfully created.' }\n format.json { render :show, status: :created, location: @consumo }\n else\n format.html { render :new }\n format.json { render json: @consumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def congresso_params\n params.require(:congresso).permit(:nome, :local, :dataRealizacao, :editora, :tema)\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @convidado = Convidado.new(convidado_params)\n\n respond_to do |format|\n if @convidado.save\n format.html { redirect_to @convidado, notice: 'Convidado was successfully created.' }\n format.json { render :show, status: :created, location: @convidado }\n else\n format.html { render :new }\n format.json { render json: @convidado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_comunicacao = TipoComunicacao.new(tipo_comunicacao_params)\n\n respond_to do |format|\n if @tipo_comunicacao.save\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_comunicacao }\n else\n format.html { render :new }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @opcao = Opcao.new(opcao_params)\n\n respond_to do |format|\n if @opcao.save\n format.html { redirect_to @opcao, notice: 'Opção criada com sucesso!' }\n format.json { render :show, status: :created, location: @opcao }\n else\n format.html { render :new }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consumo = Consumo.new(params[:consumo])\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo adicionado com sucesso.' }\n format.json { render :json => @consumo, :status => :created, :location => @consumo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.json { render json: \"Curso Creado\", status: :created }\n else\n format.json { render json: @curso.errors}\n end\n end\n end",
"def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @administracao_concurso = Administracao::Concurso.new(administracao_concurso_params)\n\n respond_to do |format|\n if @administracao_concurso.save\n format.html { redirect_to @administracao_concurso, notice: 'Concurso was successfully created.' }\n format.json { render :show, status: :created, location: @administracao_concurso }\n else\n format.html { render :new }\n format.json { render json: @administracao_concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_pacote = Servico::Pacote.new(servico_pacote_params)\n\n respond_to do |format|\n if @servico_pacote.save\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_pacote }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cooperativa = Cooperativa.new(params[:cooperativa])\n\n respond_to do |format|\n if @cooperativa.save\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @cooperativa, :status => :created, :location => @cooperativa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cooperativa.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 create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cotizacione_params\n params.require(:cotizacione).permit(:token, :paqueteria, :producto, :precio)\n end",
"def create\n @troca_produto = TrocaProduto.new(troca_produto_params)\n\n respond_to do |format|\n if @troca_produto.save\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully created.\" }\n format.json { render :show, status: :created, location: @troca_produto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def consorciot_params\n params.require(:consorciot).permit(:nombre, :abrebiatura, :telefono)\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 @copropietario = Copropietario.new(copropietario_params)\n\n respond_to do |format|\n if @copropietario.save\n format.html { redirect_to @copropietario, notice: 'Copropietario was successfully created.' }\n format.json { render :show, status: :created, location: @copropietario }\n else\n format.html { render :new }\n format.json { render json: @copropietario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @processo = Processo.new(processo_params)\n\n if @processo.save\n render json: @processo, status: :created, location: @processo\n else\n render json: @processo.errors, status: :unprocessable_entity\n end\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def caixa_params\n params.require(:caixa).permit(:data, :responsavel, :status)\n end",
"def caso_params\n params.require(:caso).permit(:radicado, :nombreimplicado, :tribunal, :estado, :estado, :tribunalquecomunica, :sala, :tipodecision, :segundainstancia, :magistradoponente, :radicado, :nombreyaliaspost, :bloque, :lugardeinfluencia, :lugarexpedicion, :fechaexpedicion, :estadoprovidencia, :secomunico, :fechacomunicacion, :delimitaciondeapartados, :ordenexhorto, :recomendaciones, :direcciongrupo, :tiempodeterminado)\n end",
"def create\n @ocupacion = Ocupacion.new(ocupacion_params)\n\n respond_to do |format|\n if @ocupacion.save\n format.html { redirect_to @ocupacion, notice: 'Ocupacion was successfully created.' }\n format.json { render :show, status: :created, location: @ocupacion }\n else\n format.html { render :new }\n format.json { render json: @ocupacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contador_params\n params.require(:contador).permit(:contC, :contPg)\n end",
"def postulacion_params\n params.require(:postulacion).permit(:aceptado, :proyecto_id, :usuario_id)\n end",
"def consejero_params\r\n params.require(:consejero).permit(:nombre)\r\n end",
"def servico_pacote_params\n params.require(:servico_pacote).permit(:dataInicio, :dataRetorno, :destino, :localSaida, :nomeTrans, :veiculo, :cnpjTrans, :precoTrans, :nomeHotel, :cnpjHotel, :descHotel, :descQuarto, :precoHotel, :descPacote, :precoPacote, :status)\n end",
"def create\n @prod_coti = ProdCoti.new(prod_coti_params)\n\n respond_to do |format|\n if @prod_coti.save\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }\n format.json { render :show, status: :created, location: @prod_coti }\n else\n format.html { render :new }\n format.json { render json: @prod_coti.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 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_orcamento\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to edit_produto_path(@produto), notice: '' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end",
"def create\n @contato = Contato.new(contato_params)\n\n respond_to do |format|\n if @contato.save\n format.html { redirect_to @contato, flash: { success: 'Contato was successfully created.' } }\n format.json { render :show, status: :created, location: @contato }\n else\n format.html { render :new }\n format.json { render json: @contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def caso_params\n params.require(:caso).permit(:fecha, :titulo,\n :caso_presponsable_attributes => [\n :id, :id_presponsable, :otro, :_destroy\n ]\n )\n end",
"def contato_params\n params.require(:contato).permit(:nome, :email, :idade, :estado_id, :cargo)\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reconocimiento = Reconocimiento.new(params[:reconocimiento])\n\n respond_to do |format|\n if @reconocimiento.save\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully created.' }\n format.json { render :json => @reconocimiento, :status => :created, :location => @reconocimiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create\n @pessoacondominio = Pessoacondominio.new(pessoacondominio_params)\n\n respond_to do |format|\n if @pessoacondominio.save\n format.html { redirect_to @pessoacondominio, notice: 'Pessoa cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @pessoacondominio }\n else\n format.html { render :new }\n format.json { render json: @pessoacondominio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end",
"def contato_params\n params.require(:contato).permit(:nome, :cargo, :telefone, :celular, :email, :facebook, :linkedin, :googleplus, :cliente_potencial_id)\n end",
"def concurso_params\n params.require(:concurso).permit(:nombre, :banner, :url, :fechaini, :fechafin, :premio, :administrador_id)\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\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 megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format.json { render :show, status: :created, location: @ccosto }\n else\n format.html { render :new }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capitulo = Capitulo.new(capitulo_params)\n\n respond_to do |format|\n if @capitulo.save\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully created.' }\n format.json { render :show, status: :created, location: @capitulo }\n else\n format.html { render :new }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.create(produto_params)\n respond_with @produto\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: \"Proyecto was successfully created.\" }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usercondominio = Usercondominio.new(usercondominio_params)\n\n respond_to do |format|\n if @usercondominio.save\n format.html { redirect_to @usercondominio, notice: 'Usercondominio was successfully created.' }\n format.json { render :show, status: :created, location: @usercondominio }\n else\n format.html { render :new }\n format.json { render json: @usercondominio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @condicao_pagamento = CondicaoPagamento.new(condicao_pagamento_params)\n\n respond_to do |format|\n if @condicao_pagamento.save\n format.html { redirect_to @condicao_pagamento, notice: 'Condicao pagamento was successfully created.' }\n format.json { render :show, status: :created, location: @condicao_pagamento }\n else\n format.html { render :new }\n format.json { render json: @condicao_pagamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anteproyecto_observacion = AnteproyectoObservacion.new(anteproyecto_observacion_params)\n\n respond_to do |format|\n if @anteproyecto_observacion.save\n format.html { redirect_to @anteproyecto_observacion, notice: 'Anteproyecto observacion was successfully created.' }\n format.json { render :show, status: :created, location: @anteproyecto_observacion }\n else\n format.html { render :new }\n format.json { render json: @anteproyecto_observacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto programa se creó exitosamente.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @objeto = Carpeta.new(carpeta_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @productonegocio = Productonegocio.new(params[:productonegocio])\n\n respond_to do |format|\n if @productonegocio.save\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully created.' }\n format.json { render json: @productonegocio, status: :created, location: @productonegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def compra_params\n params.require(:compra).permit(:producto, :p_compra, :p_venta, :cantidad)\n end",
"def create\n @colegio = Colegio.new(params[:colegio])\n\n respond_to do |format|\n if @colegio.save\n format.html { redirect_to @colegio, notice: 'El colegio fue creado satisfactoriamente.' }\n format.json { render json: @colegio, status: :created, location: @colegio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ocs_generada = OcsGenerada.new(ocs_generada_params)\n\n respond_to do |format|\n if @ocs_generada.save\n format.html { redirect_to @ocs_generada, notice: 'Ocs generada was successfully created.' }\n format.json { render :show, status: :created, location: @ocs_generada }\n else\n format.html { render :new }\n format.json { render json: @ocs_generada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tapioca = Tapioca.new(tapioca_params)\n\n respond_to do |format|\n if @tapioca.save\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tapioca }\n else\n format.html { render action: 'new' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n retorno = {erro: \"107\", body: \" \"}\n @usuario = Usuario.new(valid_request?)\n @usuario.status = 1\n if @usuario.mac.blank? \n @usuario.nivel = \"usuario_adm\"\n @usuario.status = 0\n usuario = Usuario.select(:mac).where(\"nivel = 1\").last\n @usuario.mac = (usuario.mac.to_i + 1).to_s\n end\n\n if @usuario.valid?\n if @usuario.save\n retorno = {erro: \"000\", body: {usuario_id: @usuario.id, usuario_nome: @usuario.nome, status: true}}\n end\n end\n #verifica erros na inserção no banco\n if @usuario.errors.any?\n retorno = Usuario.verifica_erro(@usuario.errors.messages)\n end\n render json: retorno.to_json\n end",
"def conta_params\n params.require(:conta).permit(:correntista_id, :flag_ativo, :created_at, :updated_at, :saldo, :saldoProvisorio)\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def convidado_params\n params.require(:convidado).permit(:nome, :nome_no_convite, :conjuge, :endereco, :bairro, :cidade, :descricao)\n end",
"def crediario_params\n params.require(:crediario).permit(:client_id, :amount, :emission, :maturity, :doc_number, :printed, :status)\n end",
"def create\n @daw_curso_comunicado = DawCursoComunicado.new(daw_curso_comunicado_params)\n\n respond_to do |format|\n if @daw_curso_comunicado.save\n format.html { redirect_to @daw_curso_comunicado, notice: 'Daw curso comunicado was successfully created.' }\n format.json { render :show, status: :created, location: @daw_curso_comunicado }\n else\n format.html { render :new }\n format.json { render json: @daw_curso_comunicado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cio = Cio.new(cio_params)\n\n respond_to do |format|\n if @cio.save\n format.html { redirect_to @cio, notice: 'Cio cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @cio }\n else\n format.html { render :new }\n format.json { render json: @cio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def egreso_params\n params.require(:egreso).permit(:estado, :monto, :fecha, :concepto)\n end",
"def posto_params\n params.require(:posto).permit(:codigo, :tipo, :kms_total, :kms_usado, :status)\n end",
"def ganho_params\n params.require(:ganho).permit(:nome, :valor_ganho, :status)\n end",
"def create\n @contatos_cliente = ContatosCliente.new(contatos_cliente_params)\n\n respond_to do |format|\n if @contatos_cliente.save\n format.html { redirect_to @contatos_cliente, notice: 'Contatos cliente was successfully created.' }\n format.json { render :show, status: :created, location: @contatos_cliente }\n else\n format.html { render :new }\n format.json { render json: @contatos_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @regraponto = Regraponto.new(regraponto_params)\n\n respond_to do |format|\n if @regraponto.save\n format.html { redirect_to @regraponto, notice: 'Regraponto was successfully created.' }\n format.json { render :show, status: :created, location: @regraponto }\n else\n format.html { render :new }\n format.json { render json: @regraponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persona_tipo = PersonaTipo.new(params[:persona_tipo])\n\n respond_to do |format|\n if @persona_tipo.save\n format.html { redirect_to @persona_tipo, notice: 'Tipo de Participante registrado correctamente.' }\n format.json { render json: @congreso, status: :created, location: @persona_tipo }\n else\n if current_user.is_admin?\n @congresos = Congreso.all(:order => \"nombre\")\n else\n @congresos = current_user.congresos(:order => \"nombre\")\n end\n format.html { render action: \"new\" }\n format.json { render json: @persona_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cargo = Cargo.new(cargo_params)\n if @cargo.save\n render json: @cargo\n else\n render json: @cargo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @produto = Produto.new(params[:produto])\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @soatseguro = Soatseguro.new(soatseguro_params)\n\n respond_to do |format|\n if @soatseguro.save\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully created.' }\n format.json { render :show, status: :created, location: @soatseguro }\n else\n format.html { render :new }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @caixa = Produto.new(produto_params)\n @caixa.user = current_user\n\n respond_to do |format|\n if @caixa.save\n format.html { redirect_to @caixa, notice: 'Caixa was successfully created.' }\n format.json { render :show, status: :created, location: @caixa }\n else\n format.html { render :new }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso was successfully created.' }\n format.json { render :show, status: :created, location: @caso }\n else\n format.html { render :new }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_compra = TipoCompra.new(tipo_compra_params)\n\n respond_to do |format|\n if @tipo_compra.save\n format.html { redirect_to @tipo_compra, notice: 'Tipo compra was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_compra }\n else\n format.html { render :new }\n format.json { render json: @tipo_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servicio = Servicio.new(params[:servicio])\n\n respond_to do |format|\n if @servicio.save\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully created.' }\n format.json { render :json => @servicio, :status => :created, :location => @servicio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contato = Contato.new(contato_params)\n\n respond_to do |format|\n if @contato.save\n format.html { redirect_to @contato, notice: 'Contato was successfully created.' }\n format.json { render :show, status: :created, location: @contato }\n else\n format.html { render :new }\n format.json { render json: @contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content_condo = ContentCondo.new(params[:content_condo])\n\n respond_to do |format|\n if @content_condo.save\n format.html { redirect_to @content_condo, notice: 'Content condo was successfully created.' }\n format.json { render json: @content_condo, status: :created, location: @content_condo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_condo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario = Usuario.new(usuario_params)\n\n if @usuario.save\n render json: @usuario, status: :created, location: @usuario\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.62635475",
"0.5906436",
"0.58704984",
"0.5831011",
"0.5774856",
"0.57726395",
"0.5721691",
"0.5716602",
"0.5667895",
"0.5661955",
"0.56610394",
"0.56305397",
"0.560854",
"0.5562463",
"0.55603874",
"0.55582553",
"0.55535257",
"0.5546197",
"0.5546114",
"0.55394244",
"0.5535278",
"0.5533485",
"0.553336",
"0.55261594",
"0.55233926",
"0.5520411",
"0.5520107",
"0.5505",
"0.54954875",
"0.5486708",
"0.5478109",
"0.5477129",
"0.5470576",
"0.54697245",
"0.5458632",
"0.5458548",
"0.54544795",
"0.54461354",
"0.54418725",
"0.5438413",
"0.5435063",
"0.54295355",
"0.54289246",
"0.5428363",
"0.5421049",
"0.54114646",
"0.5410681",
"0.5404106",
"0.5402608",
"0.5398155",
"0.53979987",
"0.5397912",
"0.5390694",
"0.5388101",
"0.5387632",
"0.53875107",
"0.53821486",
"0.53786904",
"0.53779805",
"0.53740036",
"0.5372417",
"0.5367455",
"0.5363592",
"0.5363314",
"0.5360973",
"0.53597516",
"0.5358189",
"0.53580755",
"0.5358072",
"0.53579026",
"0.53576994",
"0.53572124",
"0.53523505",
"0.5352078",
"0.5348676",
"0.5348676",
"0.5348676",
"0.5348676",
"0.53486747",
"0.53485405",
"0.5341641",
"0.5338493",
"0.53344554",
"0.53319144",
"0.53281474",
"0.53254396",
"0.53209895",
"0.5320531",
"0.53198034",
"0.5316956",
"0.53116655",
"0.5307671",
"0.53049964",
"0.53015035",
"0.53011805",
"0.5300788",
"0.529968",
"0.5298716",
"0.52938175",
"0.52910435"
] | 0.57969195 | 4 |
PUT /congresos/1 PUT /congresos/1.json | def update
@congreso = Congreso.find(params[:id])
@datos_lucrativos = false
@datos_lucrativos = true if @congreso.talleres.where("precio > 0").count > 0 || @congreso.precio > 0
if params[:congreso][:pago] == "1" or @datos_lucrativos
@congreso.personas_confirmadas.each do |persona|
persona.update_attribute("pago", false)
end
else
@congreso.personas_sin_confirmar.each do |persona|
persona.update_attribute("pago", true)
end
end
respond_to do |format|
if @congreso.update_attributes(params[:congreso])
format.html do
eliminar_campos_anteriores(params[:id])
crear_campos_congreso(params, params[:id])
redirect_to @congreso, notice: 'Congreso actualizado correctamente.'
end
format.json { head :ok }
else
@campos = Campo.all
format.html { render action: "edit" }
format.json { render json: @congreso.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def putFactura(oc)\n\n facturax= JSON.parse(HTTP.headers(:\"Content-Type\" => \"application/json\").put(\"http://\"+ $url +\"/facturas/\", :json => {:oc => oc}).to_s, :symbolize_names => true)\n return facturax\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def put(*args)\n request :put, *args\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update\n respond_to do |format|\n if @congresso.update(congresso_params)\n format.html { redirect_to @congresso, notice: 'Congresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @congresso }\n else\n format.html { render :edit }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def put!\n request! :put\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def put(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 couchdb_put(urn, host = '127.0.0.1', options = @@default_options)\n query_couchdb(urn, 'PUT', host, options)\n end",
"def update\n respond_to do |format|\n if @cegreso.update(cegreso_params)\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully updated.' }\n format.json { render :show, status: :ok, location: @cegreso }\n else\n format.html { render :edit }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @consorciot.update(consorciot_params)\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully updated.' }\n format.json { render :show, status: :ok, location: @consorciot }\n else\n format.html { render :edit }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n if @concurso.update_attributes(params[:concurso])\n format.html { redirect_to @concurso, notice: 'Concurso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\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 put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\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 manage_convenios(resource)\n resource ||= JSON.parse(resource.to_json)\n resource.each do |_key, value|\n\n @cliente_convenio = self.cliente_convenios.find_by(id: value[\"cliente_convenio_id\"].to_i) if value[\"cliente_convenio_id\"].present?\n if value['option']==\"edit\" and !@cliente_convenio.nil?\n @cliente_convenio.update_attributes(convenio_id: value[\"convenio_id\"],\n status_convenio: value[\"status_convenio\"],\n validade_carteira: value[\"validade_carteira\"],\n matricula: value[\"matricula\"],\n produto: value[\"produto\"],\n titular: value[\"titular\"],\n plano: value[\"plano\"],\n via: value[\"via\"],\n observacoes: value[\"observacoes\"],\n utilizando_agora: value[\"utilizando_agora\"])\n else\n @cliente_convenio = self.cliente_convenios.build(convenio_id: value[\"convenio_id\"].to_i,\n status_convenio: value[\"status_convenio\"],\n validade_carteira: value[\"validade_carteira\"],\n matricula: value[\"matricula\"],\n produto: value[\"produto\"],\n titular: value[\"titular\"],\n plano: value[\"plano\"],\n via: value[\"via\"],\n observacoes: value[\"observacoes\"],\n utilizando_agora: value[\"utilizando_agora\"])\n @cliente_convenio.save!\n end\n end\n end",
"def update\n respond_to do |format|\n if @congress.update(congress_params)\n format.html { redirect_to @congress, notice: 'Congress was successfully updated.' }\n format.json { render :show, status: :ok, location: @congress }\n else\n format.html { render :edit }\n format.json { render json: @congress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\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 respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def crud_put(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n put '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n # Must Exist\n return 404 unless service.exists_by_primary_key?(params[primary_key_name.to_sym])\n\n # Get The Data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid Update?\n return 422 unless service.valid_update?(data)\n\n # Do Update\n record = service.update_by_primary_key(params[primary_key_name.to_sym],data)\n\n # Other Error\n return 500 if record.nil?\n\n # Return new Region\n JSON.fast_generate record\n end\n end",
"def set_congresso\n @congresso = Congresso.find(params[:id])\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def save(request)\n raise ArgumentError, \"PUT does not accept options\" unless request.options.empty?\n update(request) || create(request)\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def create_method\n :put_json\n end",
"def update\n respond_to do |format|\n if @capitulo.update(capitulo_params)\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully updated.' }\n format.json { render :show, status: :ok, location: @capitulo }\n else\n format.html { render :edit }\n format.json { render json: @capitulo.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 respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @produto.update(produto_params)\n respond_with @produto\n end",
"def update\n respond_to do |format|\n if @consumo.update(consumo_params)\n format.html { redirect_to @consumo, notice: 'Consumo was successfully updated.' }\n format.json { render :show, status: :ok, location: @consumo }\n else\n format.html { render :edit }\n format.json { render json: @consumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to @curso, notice: 'Curso was successfully updated.' }\n format.json { render :show, status: :ok, location: @curso }\n else\n format.html { render :edit }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\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 @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n if @gasto.update_attributes(params[:gasto])\n format.html { redirect_to @gasto, notice: 'Gasto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @processo = Processo.find(params[:id])\n\n if @processo.update(processo_params)\n head :no_content\n else\n render json: @processo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @cooperativa = Cooperativa.find(params[:id])\n\n respond_to do |format|\n if @cooperativa.update_attributes(params[:cooperativa])\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @concurso.update(concurso_params)\n format.html { redirect_to @concurso, notice: 'Concurso ha sido actualizado correctamente..' }\n format.json { render :show, status: :ok, location: @concurso }\n else\n format.html { render :edit }\n format.json { render json: @concurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_tenant_circles_to_an_aos_version_box(args = {}) \n body_put(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args[:array_of_ids])\nend",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.json { render json: \"Curso Actualizado\", status: :ok, location: @curso }\n else\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"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 update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def connections_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_put\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\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(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_put. Result: #{result.inspect}\"\n end\n return result\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end",
"def update\n respond_to do |format|\n if @copenometro.update(copenometro_params)\n format.html { redirect_to @copenometro, notice: 'Copenometro was successfully updated.' }\n format.json { render :show, status: :ok, location: @copenometro }\n else\n format.html { render :edit }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(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_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, body_params = {})\n debug_log \"PUT #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\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 put(path, data=nil)\n request(:put, path, data)\n end",
"def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @alumnos_x_curso = AlumnosXCurso.find(params[:id])\n\n respond_to do |format|\n if @alumnos_x_curso.update_attributes(params[:alumnos_x_curso])\n format.html { redirect_to @alumnos_x_curso, notice: 'Alumnos x curso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alumnos_x_curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n execute(:put, *args)\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 @distro = Distro.find(params[:id])\n\n respond_to do |format|\n if @distro.update_attributes(params[:distro])\n format.html { redirect_to @distro, notice: 'Distro was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @distro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to @curso, notice: 'Curso foi atualizado(a) com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @curso.update(curso_params)\n format.html { redirect_to cursos_path, notice: 'Curso atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @curso }\n else\n format.html { render :edit }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n if @distro.update_attributes(params[:distro])\n format.html { redirect_to @distro, notice: 'Distro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @distro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, data={})\n request(:put, path, data)\n end",
"def put(*args, &block)\n self.client.put *args\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def index(obj_or_request)\n request = get_request(obj_or_request)\n Connection.new.put request if request.body\n end",
"def put(path, options={})\n send_request 'put', path, options\n end",
"def update\n respond_to do |format|\n if @tipo_comunicacao.update(tipo_comunicacao_params)\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_comunicacao }\n else\n format.html { render :edit }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6241737",
"0.5864449",
"0.58027565",
"0.57813084",
"0.56874776",
"0.5687088",
"0.5673597",
"0.5670666",
"0.56420213",
"0.56092703",
"0.55706835",
"0.5558271",
"0.5552865",
"0.5534795",
"0.55268055",
"0.5517727",
"0.54068106",
"0.5404271",
"0.54041106",
"0.5396221",
"0.53590095",
"0.53552824",
"0.535063",
"0.535063",
"0.5341647",
"0.534029",
"0.5327858",
"0.5318254",
"0.52889866",
"0.5288975",
"0.528833",
"0.52824605",
"0.52770615",
"0.5269063",
"0.52616566",
"0.5239743",
"0.523114",
"0.52289975",
"0.52207726",
"0.52207726",
"0.52115124",
"0.521087",
"0.5209301",
"0.52087665",
"0.52030843",
"0.5196237",
"0.5195521",
"0.51950383",
"0.51950383",
"0.51950383",
"0.5192087",
"0.51877916",
"0.5186958",
"0.5186399",
"0.51821464",
"0.51802313",
"0.51799077",
"0.5179199",
"0.51786596",
"0.5177775",
"0.5167838",
"0.5167541",
"0.5162959",
"0.51589906",
"0.51514006",
"0.5151211",
"0.5149847",
"0.5137647",
"0.5134784",
"0.5131221",
"0.5131221",
"0.5131221",
"0.5131221",
"0.5131221",
"0.5131221",
"0.5131221",
"0.5131221",
"0.5130076",
"0.5129713",
"0.51257265",
"0.5118966",
"0.5118",
"0.5115657",
"0.5114812",
"0.51138157",
"0.51125723",
"0.51125723",
"0.51115346",
"0.51077205",
"0.5097309",
"0.5096936",
"0.5093735",
"0.50935334",
"0.5084913",
"0.5082656",
"0.5081651",
"0.508007",
"0.5079911",
"0.50753814",
"0.50705385",
"0.50703585"
] | 0.0 | -1 |
DELETE /congresos/1 DELETE /congresos/1.json | def destroy
@congreso = Congreso.find(params[:id])
if congreso_propio?(@congreso) or current_user.is_admin?
@congreso.destroy
respond_to do |format|
format.html { redirect_to congresos_url }
format.json { head :ok }
end
else
flash[:notice] = "Solo puedes eliminar tus propios congresos"
redirect_to congresos_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend",
"def destroy\n @congresso.destroy\n respond_to do |format|\n format.html { redirect_to congressos_url, notice: 'Congresso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concurso = Concurso.find(params[:id])\n @concurso.destroy\n\n respond_to do |format|\n format.html { redirect_to concursos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def 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 destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_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 start { |connection| connection.request http :Delete }\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 @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @content_condo = ContentCondo.find(params[:id])\n @content_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_condos_url }\n format.json { head :no_content }\n end\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 cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete_one()\n #connect to db\n db = PG.connect({ dbname: \"bounty_hunters\", host: \"localhost\" })\n #write SQL statement string\n sql = \"DELETE FROM bounties WHERE id = $1\"\n #make values array - in this case it only needs one value\n values = [@id]\n #prepare statemnt\n db.prepare(\"delete_one\", sql)\n #run prepared statement\n db.exec_prepared(\"delete_one\", values)\n #close db link\n db.close()\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete()\n\n db = PG.connect({dbname: \"pizza_shop\", host: \"localhost\"})\n sql = \"DELETE FROM pizza_orders WHERE id = $1\"\n values = [@id]\n db.prepare(\"Delete\", sql)\n db.exec_prepared(\"Delete\", values)\n db.close\n\n end",
"def destroy\n @congress.destroy\n respond_to do |format|\n format.html { redirect_to congresses_url, notice: 'Congress was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @consorciot.destroy\n respond_to do |format|\n format.html { redirect_to consorciots_url, notice: 'Consorciot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_item_condo = ContentItemCondo.find(params[:id])\n @content_item_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_item_condos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concedente.destroy\n respond_to do |format|\n format.html { redirect_to concedentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administracao_concurso.destroy\n respond_to do |format|\n format.html { redirect_to administracao_concursos_url, notice: 'Concurso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\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 delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"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 @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(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @pg_first.destroy\n respond_to do |format|\n format.html { redirect_to pg_firsts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to do |format|\n format.html { redirect_to conta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_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 @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to consejeros_url, notice: 'El nombre del consejero se eliminó corrctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end",
"def destroy\n @database.destroy\n respond_to do |format|\n format.html { redirect_to databases_url, notice: 'La base de données à bien été supprimée.' }\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 delete()\n db = PG.connect({ dbname: 'Music_Collection', host: 'localhost'})\n sql = \n \"\n DELETE FROM Music_Collection where id = #{@id};\n \"\n db.exec(sql)\n db.close()\nend",
"def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def delete_db_post\n # Tell the user\n puts \"> Tar bort aliaset från databasen\".green\n\n # Connect to the database\n conn = PG.connect( dbname: DB_DATABASE_NAME, user: DB_USER, password: DB_PASSWORD )\n\n # Delete the account\n res = conn.exec \"DELETE FROM #{DB_ALIAS_TABLE} WHERE address = '#{$alias}' AND userid = '#{$email}'\" unless $simulate\n\n # Close the connection\n conn.close\nend",
"def delete(*args)\n execute(:delete, *args)\n end",
"def delete(path)\n make_call(mk_conn(path), :delete)\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cegreso.destroy\n respond_to do |format|\n format.html { redirect_to cegresos_url, notice: 'Cegreso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @centro_costo.destroy\n respond_to do |format|\n format.html { redirect_to centro_costos_url, notice: 'Centro de Costo eliminado' }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def destroy\n @database.destroy\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @contador.destroy\n respond_to do |format|\n format.html { redirect_to contadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sistemas_consejero.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sistemas_consejeros_url, notice: 'El nombre del consejero de ingeniería de sistemas se eliminó correctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capitulo.destroy\n respond_to do |format|\n format.html { redirect_to capitulos_url, notice: 'Capitulo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fale_conosco.destroy\n respond_to do |format|\n format.html { redirect_to fale_conoscos_url, notice: 'Fale conosco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.html { redirect_to cursos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @core_status_desembaraco = Core::StatusDesembaraco.find(params[:id])\n @core_status_desembaraco.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_desembaracos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @opcao.destroy\n respond_to do |format|\n format.html { redirect_to opcaos_url, notice: 'Opção Apagada com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concedente = Concedente.find(params[:id])\n @concedente.destroy\n\n respond_to do |format|\n format.html { redirect_to concedentes_url }\n format.json { head :no_content }\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 @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\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 @contato_produto = ContatoProduto.find(params[:id])\n @contato_produto.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_contato_produtos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administracao_combustivel.destroy\n respond_to do |format|\n format.html { redirect_to administracao_combustiveis_url, notice: 'Combustivel foi removido do sistema.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @giro_comercial.destroy\n respond_to do |format|\n format.html { redirect_to giro_comercials_url, notice: 'Giro comercial fue exitosamente destruido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n administradorId = @concurso.administrador_id\n @concurso.destroy\n respond_to do |format|\n format.html { redirect_to '/administradors/'+administradorId.to_s, notice: 'El concurso fue eliminado' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7012341",
"0.68018055",
"0.6784304",
"0.66289306",
"0.6596985",
"0.65949535",
"0.6539506",
"0.6537963",
"0.65371597",
"0.65371597",
"0.65371597",
"0.65371597",
"0.6535508",
"0.65319735",
"0.6487854",
"0.6480932",
"0.6403726",
"0.6401367",
"0.6372781",
"0.6365964",
"0.63621515",
"0.6361281",
"0.63523877",
"0.6343938",
"0.6335695",
"0.6332451",
"0.63153285",
"0.63025266",
"0.6300433",
"0.6290756",
"0.62893504",
"0.62837267",
"0.6282995",
"0.6282397",
"0.627515",
"0.6255197",
"0.6253223",
"0.6247802",
"0.6247294",
"0.62467027",
"0.6241609",
"0.62402254",
"0.6239179",
"0.62391347",
"0.6233953",
"0.6231368",
"0.6228503",
"0.62249476",
"0.6220195",
"0.6213865",
"0.62100226",
"0.6208388",
"0.6203923",
"0.619824",
"0.61914754",
"0.6191414",
"0.61867607",
"0.61864513",
"0.61864513",
"0.61861765",
"0.6185917",
"0.6184893",
"0.61846197",
"0.6175133",
"0.6171382",
"0.61681616",
"0.6167285",
"0.6166446",
"0.6163336",
"0.6157486",
"0.61507463",
"0.6150626",
"0.6150155",
"0.61494046",
"0.6146949",
"0.6138856",
"0.6135867",
"0.6133053",
"0.6132088",
"0.61295897",
"0.61270756",
"0.61265093",
"0.61256605",
"0.6124054",
"0.61240095",
"0.6120219",
"0.61201906",
"0.61188036",
"0.6113896",
"0.611373",
"0.6112786",
"0.61123997",
"0.6107727",
"0.6105842",
"0.61053133",
"0.61041534",
"0.6102994",
"0.60994977",
"0.609848",
"0.6096792"
] | 0.64494455 | 16 |
The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers: maxSequence [2, 1, 3, 4, 1, 2, 1, 5, 4] should be 6: [4, 1, 2, 1] Easy case is when the list is made up of only positive numbers and the maximum sum is the sum of the whole array. If the list is made up of only negative numbers, return 0 instead. Empty list is considered to have zero greatest sum. Note that the empty list or array is also a valid sublist/subarray. My solution | def max_sequence(arr)
return arr.first if arr.size == 1
return 0 if arr.all? { |num| num < 0 } || arr.empty?
current_sum = arr.first
maximum = arr.first
arr[1..-1].each do |num|
current_sum = 0 if current_sum < 0
current_sum += num
maximum = current_sum if current_sum > maximum
end
maximum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_sequence(arr)\r\n return 0 if arr.all? { |el| el < 0 }\r\n return arr.sum if arr.all? { |el| el > 0 }\r\n return 0 if arr.empty?\r\n \r\n sub_arrs = []\r\n (0...arr.size).each do |start_index|\r\n # p \"start #{start_index}\"\r\n (1..arr.size - start_index).each do |length|\r\n # p \"length #{length}\"\r\n sub_arrs << arr[start_index, length]\r\n end\r\n end\r\n sub_arrs.map do |sub_arr|\r\n sub_arr.sum\r\n end.max\r\nend",
"def maxSubArray(a)\n return nil if a.empty?\n curr_sum = a[0]\n max_sum = a[0]\n (1...a.length).each do |i| \n if curr_sum <= 0\n curr_sum = a[i]\n else\n curr_sum += a[i]\n end\n max_sum = curr_sum if max_sum < curr_sum\n end\n max_sum\nend",
"def max_sub_array(array)\n max_sum = current_val = array[0]\n array.each_with_index do |num, i|\n if (i > 0)\n sum = current_val + num\n if (sum > num)\n current_val = sum\n else\n current_val = num\n end\n if current_val > max_sum\n max_sum = current_val\n end\n end\n end\n max_sum\nend",
"def max_sub_array(nums)\n current_sum = nil\n max_sum = nil\n \n nums.each do |n|\n if current_sum.nil?\n current_sum = n\n elsif current_sum + n < n\n current_sum = n\n else\n current_sum = current_sum + n\n end\n max_sum = current_sum if max_sum.nil? || current_sum > max_sum\n end\n max_sum\nend",
"def maxSubArraySum(a)\n maxint =(2**(0.size * 8 -2) -1)\n msf = -maxint - 1\n max_end = 0\n \n for i in (0..a.length-1)\n max_end = max_end + a[i] \n if (msf < max_end)\n msf = max_end\n end\n \n if (max_end < 0) \n max_end = 0 \n end\n end\n return msf\nend",
"def max_sub_array(arr)\n current_sum = arr[0]\n max_sum = current_sum\n\n arr[1..-1].each do |num|\n current_sum = [num, current_sum + num].max\n max_sum = [max_sum, current_sum].max\n end\n\n return max_sum\nend",
"def max_sequence(arr)\n puts arr\n index = 0\n numIndexes = 0\n highestSum = arr.min\n \n length = arr.count\n \n highestNum = arr.max\n\n if arr != [] && highestNum < 0 \n return 0\n elsif arr == []\n return 0\n end\n \n arr.map.with_index do |n,i|\n\n for c in 0..i\n \n sum = arr.slice(c,length-i).inject(:+)\n\n if sum > highestSum\n highestSum = sum\n index = i\n numIndexes = length-i\n end\n \n end\n \n end\n \n highestSum\n \nend",
"def max_sum_of_subarray(arr)\n current_max = global_max = arr.first\n array_size = arr.size\n\n (1..(array_size-1)).each do |i|\n current_max = [arr[i], current_max + arr[i]].max\n\n if current_max > global_max\n global_max = current_max\n end\n end\n\n global_max\nend",
"def maximum_value_contiguous_subsequence(array)\n len = array.length\n return array.max if all_negatives?(array)\n\n max = array[0]\n for i in (0...len)\n current_sum = 0\n for j in (i...len)\n current_sum += array[j]\n max = maximum(max, current_sum)\n end\n end\n max\nend",
"def max_subarray_sum(array)\n new_sum = max = array[0]\n (1...array.length).each do |i|\n new_sum = find_max(new_sum + array[i], array[i])\n max = find_max(max, new_sum)\n end\n return max\nend",
"def max_sequence(arr)\r\n sums = [arr.first]\r\n\r\n arr.each_with_index do |num, num_i|\r\n (num...arr.size).each do |i|\r\n sums << arr[num_i..i].sum\r\n end\r\n end\r\n\r\n arr.empty? ? 0 : sums.max\r\nend",
"def largest_contiguous_subsum_good(arr) \n last_max = arr.first\n current_max = 0\n arr.each do |num|\n temp_sum = current_max + num\n if temp_sum < 0\n last_max = current_max if temp_sum > last_max\n else\n if temp_sum > last_max\n last_max = temp_sum\n end\n end\n if num > temp_sum\n current_max = num\n else\n current_max = temp_sum\n end\n end\n last_max\nend",
"def maximum_value_contiguous_subsequence_3(array)\n len = array.length\n max, current_sum = array[0], array[0]\n\n for i in (1...len)\n current_sum = maximum(array[i], array[i] + current_sum)\n max = maximum(max, current_sum)\n end\n max\nend",
"def max_sequence(arr)\n return 0 if arr.empty? || arr.all?(&:negative?)\n\n result = []\n 1.upto(arr.size) { |n| result << arr.each_cons(n).map(&:sum).max }\n result.max\nend",
"def max_sub_array3(nums)\n max_sum = nums[0]\n\n (1...nums.size).each do |i|\n # nums[i] 记录到该位置时,可能获得的最大和\n # 如果前面的一个是正的,那么就加上\n # 如果前面的是付的,那么就保留当前值\n nums[i] += nums[i - 1] if nums[i - 1] > 0\n max_sum = [nums[i], max_sum].max\n end\n p nums\n p nums.max\n max_sum\nend",
"def max_subarray arr\n neg = []\n pos = []\n \n arr.each do |x|\n x < 0 ? neg << x : pos << x\n end\n \n sum = pos.reduce(:+)\n final = []\n \n if pos.empty?\n final << neg.max\n final << neg.max \n elsif neg.empty? || neg.size == 1\n final << sum\n final << sum\n else\n final << sum + neg.max\n final << sum\n end \n \n puts final.join(' ')\nend",
"def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend",
"def max_sub_array(numbers)\n max = numbers[0]\n\n (1...numbers.size).each do |idx|\n current_sum = numbers[idx] + numbers[idx - 1]\n numbers[idx] = current_sum if current_sum > numbers[idx]\n max = numbers[idx] if numbers[idx] > max\n end\n\n max\nend",
"def largest_contiguous_subsum(arr)\n current_sum = arr.first \n max_sum = arr.first \n (0...arr.length-1).each do |i|\n if current_sum < 0 \n current_sum = [current_sum, arr[i+1]].max\n max_sum = current_sum\n else \n current_sum += arr[i+1]\n max_sum = [current_sum, max_sum].max\n end \n end \n max_sum\nend",
"def largest_contiguous_subsum2(array)\n #all negative numbers\n if array.none? {|el| el > 0 }\n max = array.first\n array.each do |el1|\n next if max == el1\n if el1 > max\n max = el1\n end\n end\n max\n end\n\n current_sum = 0\n max_sum = 0\n\n array.each do |num|\n current_sum += num\n max_sum = current_sum if current_sum > max_sum\n if current_sum < 0\n current_sum = 0\n next\n current_sum += num\n max_sum = current_sum if current_sum > max_sum\n end\n\n end\n max_sum\n\nend",
"def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend",
"def max_sequence(arr)\n sum = 0\n \n arr.each_with_index do |ele, i| \n l = arr.length\n\n while l >= i\n sub_arr = arr[i..l]\n sum = sub_arr.sum if sub_arr.sum > sum\n l -= 1\n end \n end\n \n sum\nend",
"def best_largest_contiguous_subsum(arr)\n return arr.max if arr.max < 0\n largest = 0\n current = 0\n\n\n (0..(arr.length-1)).each do |idx1|\n if current + arr[idx1] < 0\n current = arr[idx1]\n else\n current += arr[idx1]\n end\n\n largest = current if current > largest\n end\n largest\nend",
"def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend",
"def maximum_sum_subarray(nums)\n highest_seen = nums[0]\n lowest_seen = nums[0]\n highest_curr = nums[0]\n lowest_curr = nums[0]\n\n nums[1..-1].each do |num|\n temp = highest_curr\n highest_curr = [num, highest_curr + num, lowest_curr + num].max\n lowest_curr = [num, temp + num, lowest_curr + num].min\n\n highest_seen = [highest_seen, highest_curr].max\n lowest_seen = [lowest_seen, lowest_curr].max\n end\n highest_seen\nend",
"def largest_contiguous_subsum(array)\r\n max = array.first \r\n current_sum = 0\r\n array.each do |ele|\r\n current_sum += ele\r\n max = current_sum if current_sum > max\r\n current_sum = 0 if current_sum < 0\r\n end\r\n max\r\nend",
"def maxSubSeq(sq)\n if sq.length == 0 || sq.length == 1 \n return 0\n else\n sums = []\n for value in sq\n sums.push(sumSeq(value))\n end \n \n return maxValue(sums)\n end\n end",
"def largest_contiguous_subsum(list)\n max_sum = list[0]\n\ttemp_sum = list[0]\n\tdebugger\n #0(n) #note: only n^2 if nested\n \n return list.max if list.all? { |ele| ele < 0 } \n #need to add O(1) return case\n # Write a new function using O(n) time with O(1) memory. Keep a running tally of the largest sum.\n\n list_2 = list.drop(1)\n list_2.each do |ele|\n\t\ttemp_sum = [ele, temp_sum + ele].max #O(1) operation, should refactor \n #temp_sum = ele = 4, temp_sum = 1+3, [4, 8].max\n # [3, -7]\n #[3, 5 + 3] = > 3, 8 = > 8 max = 5\n #[-7, 8 - 7] => 1, 1 = > 1 max = 8\n max_sum = temp_sum if temp_sum > max_sum\n\tend\n\t\n\tmax_sum\nend",
"def largest_contiguous_subsum(list) \n subs = []\n\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n sub = list[i..j]\n subs << sub\n end\n end\n \n max = nil\n\n subs.each do |sub|\n sum = sub.sum \n if max == nil || sum > max\n max = sum\n end\n end\n max\nend",
"def largest_sub_sum_linear(arr)\n largest = arr.first\n current = arr.first\n\n return arr.max if arr.all? { |num| num < 0 }\n i = 1\n\n while i < arr.length\n current = 0 if current < 0\n current += arr[i]\n largest = current if current > largest\n i+=1\n end\n\n largest\n end",
"def largest_contiguous_subsum(array)\n sub_arrays = []\n (0...array.length).each do |i|\n (0...array.length).each do |x|\n sub_arrays << array[i..x] unless array[i..x].empty?\n end\n end\n p sub_arrays.length\n max_array = sub_arrays.max_by { |sub| sub.sum }\n max_array.sum\n\nend",
"def max_sequence(arr)\n sum = arr.first ? arr.first : 0\n\n arr.each do |num|\n sum_to_here = [(num), (sum_to_here + num)].max\n sum = [sum, sum_to_here].max\n end\n\n sum\nend",
"def largest_contiguous_subsum(array)\n sub_arrs = []\n array.each_index do |ind1|\n array[ind1..-1].each_index do |ind2|\n sub_arrs.push(array[ind1..ind2+ind1])\n end\n end\n max_sum = sub_arrs.first.sum\n sub_arrs.each {|sub| max_sum = sub.sum if sub.sum >= max_sum }\n return max_sum\nend",
"def maximum_sub_array2(arr)\n current = []\n max_sum = cur_sum = 0\n max = (0...arr.size).inject([]) do |max, i|\n current << arr[i]\n cur_sum += arr[i]\n if cur_sum > max_sum\n max << i\n max_sum = cur_sum\n end\n max\n end\n arr[max[0]..max[-1]]\nend",
"def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend",
"def max_subsection_sum(arr)\n current_sum = 0\n greatest_sum = 0\n\n arr.each_with_index do |num, idx|\n if current_sum + num < 0\n current_sum = 0\n else\n current_sum += num\n greatest_sum = current_sum if current_sum > greatest_sum\n end\n end\n greatest_sum\nend",
"def better_largest_contiguous_subsum(list)\n current_largest_sum = 0\n current_sum = 0\n return list.max if list.all? {|ele| ele < 0}\n\n (0...list.length).each do |i |\n # debugger\n #add current element to current sum\n current_sum += list[i]\n\n #if current sum is less than 0 ignore it and reset to move on to next number\n if ( current_sum < 0 ) \n current_sum = 0\n end \n # if current sum is greater than our current largest sum, we want to keep it\n if current_sum > current_largest_sum\n current_largest_sum = current_sum\n end\n end\n current_largest_sum\nend",
"def max_subarray(numbers)\n max_current = 0\n max_end = 0\n\n for i in 0..numbers.length\n max_end += numbers[i].to_i\n\n if max_end < 0\n max_end = 0\n end\n\n if max_current < max_end\n max_current = max_end\n end\n end\n\n max_current\n end",
"def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend",
"def largest_contiguous_subsum_2(arr)\n (1...arr.length).each do |i|\n if arr[i] + arr[i - 1] > 0\n arr[i] = arr[i] + arr[i - 1]\n elsif arr[i] < 0 && arr[i-1] < 0\n arr[i] = [arr[i-1], arr[i]].max\n else\n arr[i] = 0\n end\n end\n\n arr.max\nend",
"def largest_contigous_subsum_ii(list)\n current_sum = list.first\n max = list.first\n (1..-1).each do |i|\n current_sum += list[i]\n current_sum = 0 if current_sum < 0\n max = current_sum if max < current_sum\n end\n current_sum\nend",
"def max_sub_array(nums)\n return if nums.empty?\n\n max_so_far = Array.new(nums.length)\n max_so_far[0] = nums[0]\n\n (1...nums.length).each do |i|\n max_so_far[i] = [nums[i], nums[i] + max_so_far[i-1]].max\n end\n\n return max_so_far.max\nend",
"def largest_contiguous_subsum(arr)\n max = arr[0]\n current = 0\n (0...arr.length).each do |i|\n current += arr[i]\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend",
"def largest_contiguous_subsum(arr)\n max = arr.first\n arr.each_index do |idx1|\n (idx1+1..arr.length).each do |idx2|\n sub_arr = arr[idx1...idx2]\n sum = sub_arr.reduce(:+)\n max = sum if max < sum \n end\n\n end\n max\nend",
"def max_sub_array(nums)\n max_sum = nums[0]\n\n for i in (0...nums.length) do\n sum_so_far = 0\n for j in (i...nums.length) do\n sum_so_far += nums[j]\n max_sum = [sum_so_far, max_sum].max\n end\n end\n\n return max_sum\nend",
"def largest_contiguous_subsum(list)\n max_sum = list.first\n current_sum = list.first\n \n (1...list.length).each do |i| \n current_sum = 0 if current_sum < 0 \n current_sum += list[i]\n max_sum = current_sum if current_sum > max_sum\n end\n max_sum\nend",
"def largest_contiguous_subsum(arr)\n max_sum = arr.first\n\n (0...arr.length).each do |start|\n (start...arr.length).each do |ending|\n sum = arr[start..ending].sum\n max_sum = sum if sum > max_sum\n end\n end\n\n max_sum\nend",
"def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend",
"def max_sub_array(nums)\n return 0 if nums.nil? \n return nil if nums.empty?\n \n max_so_far = nums[0]\n max_for_sub_array = 0\n\n nums.each do |num|\n max_for_sub_array = max_for_sub_array + num\n if num > max_for_sub_array\n max_for_sub_array = num\n end\n if max_for_sub_array > max_so_far\n max_so_far = max_for_sub_array\n end\n end\n return max_so_far\n\nend",
"def largest_contiguous_subsum(arr)\n largest = current = arr.first\n \n return arr.max if arr.all? { |num| num < 0 }\n\n arr.drop(1).each do |num|\n current = 0 if current < 0\n current += num\n largest = current if current > largest \n end\n\n largest\nend",
"def max_sub_array\n (0...self.size).inject([self.first]) do |max_sub,i|\n (i...self.size).each do |j|\n if max_sub.int_sum < self[i..j].int_sum\n max_sub = self[i..j]\n end\n end\n max_sub\n end\n end",
"def largest_cont_subsum_slow(list) # n = list.length\n subarrs = find_subarrays(list) # n^2 runtime\n largest = subarrs[0].sum\n \n subarrs.each do |subarr| # n^2 length subarrs\n largest = [largest, subarr.sum].max # constant\n end\n\n return largest\n # n^2 overall\nend",
"def max_subarray_v2(numbers)\n max = numbers[0].to_i\n max_current = numbers[0].to_i\n\n for i in 1..numbers.length\n max_current = [numbers[i].to_i, max_current + numbers[i].to_i].max\n max = [max, max_current].max\n end\n\n max\n end",
"def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend",
"def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend",
"def largest_contiguous_subsum(arr)\n largest = arr.first\n current_sum = arr.first\n i = 1\n while i < arr.length\n if arr[i] < 0\n largest = current_sum if current_sum > largest\n largest = arr[i] if arr[i] > largest\n if current_sum + arr[i] > 0\n current_sum += arr[i]\n else\n current_sum = 0 unless current_sum < 0\n end\n else\n current_sum += arr[i]\n end\n i+=1\n end\n largest = current_sum if current_sum > largest\n largest\nend",
"def largest_contiguous_subsum(list)\n largest_sum = 0\n current_sum = list[0]\n (1...list.length).each do |i|\n current_sum = 0 if current_sum < 0 #we need to reset current sum if we hit a negative number\n current_sum += list[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend",
"def largest_contiguous_subsum2(arr)\n max = arr[0]\n current = arr[0]\n arr.drop(1).each do |num|\n current += num\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend",
"def largest_subsum_p2(arr)\n max_sum = 0\n arr.each do |el|\n temp = max_sum + el\n temp = 0 if temp < 0\n max_sum = temp if temp > max_sum\n end\n\n if max_sum == 0\n # all the nums are negative\n max_sum = arr[0]\n arr.each do |el|\n max_sum = el if el > max_sum\n end\n end\n\n max_sum\nend",
"def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend",
"def largest_continous_subsum\n largest = 0\n subsets = []\n\n i = 0\n while i < self.length\n j = i\n while j < self.length\n subsets << self[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |pair|\n if largest < pair.reduce(:+)\n largest = pair.reduce(:+)\n end\n end\n largest\n\n end",
"def largest_continguous_subsum(arr)\n largest_sum = arr.first\n current_sum = arr.first\n \n (1...arr.length).each do |i|\n current_sum += arr[i]\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend",
"def max_sub_array(nums)\n return 0 if nums.empty?\n return nums[0] if nums.size == 1\n dp = [0] * nums.size\n dp[0] = nums[0]\n max = dp[0]\n \n for i in 1...nums.size do\n dp[i] = nums[i] + (dp[i - 1] > 0 ? dp[i - 1] : 0)\n max = [max, dp[i]].max\n end\n max\nend",
"def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend",
"def largest_contiguous_subsum(list)\n # O(N*M) ==> Time\n # O(N*M) ==> Space\n sub_arrs = sub_arrays_of(list) # O(N^3)\n sums = []\n sub_arrs.each do |sub_arr| ## O(N*M)\n sums << sub_arr.sum\n end\n # Get the max of the sums array\n sums.max # O(N)\nend",
"def opt_max_sum(arr)\n result = -1000\n (0...arr.length).each do |start|\n sum = 0\n (1..arr.length).each do |size|\n if start + size > arr.length\n break\n end\n sum += arr[start + size - 1]\n if sum > result\n result = sum\n end\n end\n end\n return result\nend",
"def max_sub_array2(nums)\n ans = nums[0]\n\n (1..nums.size).each do |size|\n nums.each_cons(size) do |a|\n ans = [ans, a.sum].max\n end\n end\n\n ans\nend",
"def maximum_subarray(arr)\n max_arr = []\n max_sum = 0\n curr = []\n curr_sum = 0\n i = 0\n while i < arr.size\n if curr_sum < 0\n curr_sum = 0\n curr = []\n end\n \n curr << arr[i]\n curr_sum += arr[i]\n\n if curr_sum > max_sum \n max_sum = curr_sum\n first = curr.first\n last = curr.last\n max_arr = curr.dup\n p max_arr\n end\n i += 1\n end\n \n max_arr\nend",
"def maximum_value_contiguous_subsequence_dp(array)\n len = array.length\n result = [array[0]]\n\n for i in (1...len)\n result[i] = maximum(array[i], array[i] + result[-1])\n end\n\n result.max\nend",
"def largest_contiguous_subsum_1(list)\n subs = []\n (0...list.length).each do |idx| #O(n)\n (idx...list.length).each do |idx_2| #O(n)\n subs << list[idx..idx_2] #O(n)\n end\n end\n max = list.first\n subs.each do |subarr|\n if subarr.sum > max\n max = subarr.sum\n end\n end\n max\nend",
"def sub_sum_improved(array)\n max = array[0]\n current_sum = array[0]\n i = 0\n (1...array.length).each do |i|\n max = [array[i], array[i] + max].max\n current_sum = [current_sum, max].max\n end\n current_sum\n end",
"def max_sub_array(nums)\n return 0 if nums == nil\n return nil if nums.empty?\n \n max_by_here = nums[0]\n max_so_far = nums[0]\n \n nums.each_with_index do |num, index|\n unless index == 0\n if max_so_far < 0\n if num > max_so_far\n max_so_far = num\n end\n else\n max_by_here += num\n \n if max_by_here < 0\n max_by_here = 0\n elsif max_by_here > max_so_far\n max_so_far = max_by_here\n end\n end\n end\n end\n \n return max_so_far\nend",
"def phase_2_largest_contiguous_sum(arr)\n\n return [[]] if arr.empty?\n subs = arr.take(arr.count-1).phase_2_largest_contiguous_sum\n subs.concat(subs.map {|sub| sub + [last]})\n\n largest_sum = subs.first.sum \n\n subs.each do |sub|\n current_sum = sub.sum \n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n\n largest_sum\n\nend",
"def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend",
"def largest_sub_sum1 #0(n^2)\n result = []\n (0...self.length).each do |idx1|\n (idx1...self.length).each do |idx2|\n subarray_result = self[idx1..idx2]\n result << subarray_result\n end\n end\n\n largest_sum = result[0][0]\n result.each do |arr|\n largest_sum = arr.sum if arr.sum > largest_sum\n end\n largest_sum\n end",
"def largest_sub_sum(array)\n subsets = []\n i = 0\n while i < array.length\n j = i\n while j < array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n result = nil\n subsets.map {|subset| subset.inject(:+)}.each do |sum|\n result = sum if result.nil? || result < sum\n end\n result\nend",
"def largest_cont_sum(array)\n return nil if array.empty?\n \n max_sum = 0\n current_max_sum = 0\n\n array.each do |number|\n current_max_sum = [current_max_sum + number, number].max\n max_sum = [current_max_sum, max_sum].max\n end\n\n max_sum\nend",
"def largest_continuous_subsum(list)\n curr_sum = 0\n max_sum = list.first\n list.each do |el|\n curr_sum += el\n if curr_sum > max_sum\n max_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n end\n max_sum\nend",
"def largest_contiguous_subsum(list) # O(n^2)\n subs_sums = []\n\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n subs_sums << list[i..j]\n end\n end\n\n highest_array_sum = nil\n subs_sums.each do |array|\n array_sum = array.reduce(:+)\n if highest_array_sum == nil || array_sum > highest_array_sum\n highest_array_sum = array_sum\n end\n end\n\n highest_array_sum\nend",
"def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend",
"def largest_contiguous_subsum_fast(array)\n curr_sum = array.first\n largest_sum = array.first\n\n return array.max if array.all?{|val| val < 0} # O(n)\n\n array.drop(1).each_with_index do |val, i|\n if val > 0 # add val to curr_sum and largest_sum if it's positive\n curr_sum += val\n largest_sum = curr_sum\n elsif val < 0\n temp_sum = curr_sum + val\n\n if val + curr_sum > 0\n curr_sum += val\n elsif array[i + 1] + temp_sum < array[i + 1]\n curr_sum = 0\n largest_sum = array[i + 1]\n else\n largest_sum = temp_sum + array[i + 1]\n end\n end\n\n end\n largest_sum\nend",
"def max_sub_array(nums)\n dp = [nums.first]\n max = dp[0]\n\n (1...nums.length).each do |i|\n prev_max = dp[i - 1] > 0 ? dp[i - 1] : 0\n dp[i] = nums[i] + prev_max\n max = [max, dp[i]].max\n end\n\n max\nend",
"def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend",
"def largest_contiguous_subsum_v2(list)\n largest_sum = list.first\n sum = list.first # but the first element can be a negative number\n\n (1...list.length).each do |i|\n # a negative number + a postive number always less than pos number on its own\n sum = 0 if sum < 0 # if we add to a negative sum, then result is less than pos number on its own\n sum += list[i]\n largest_sum = sum if largest_sum < sum\n end\n\n largest_sum\nend",
"def better_largest_sub_sum(array)\n largest_sum = 0\n current_sum = 0\n array.each_with_index do |el, idx|\n current_sum += el\n current_sum = 0 if current_sum < 0\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend",
"def largest_contiguous_subsum2(array)\n # return [list[0]] if list.count == 1\n #\n # start_num = list.shift\n # large_sum = start_num\n #\n # other_list = list.dup\n #\n # idx = 0\n # while idx < list.count\n # sum = list[0..idx].inject(:+)\n # if large_sum < start_num + sum\n # large_sum = start_num + sum\n # end\n # idx += 1\n # end\n #\n # [large_sum] + largest_contiguous_subsum2(other_list)\n\n largest = nil\n current = 0\n\n array.each do |el|\n current += el\n if largest.nil? || current > largest\n largest = current\n end\n current = 0 if current < 0\n end\n\n largest\n\nend",
"def largest_contiguous_subsum2(array)\r\n largest = array[0]\r\n current_sum = array[0]\r\n\r\n (1...array.length).each do |i|\r\n current_sum = 0 if current_sum < 0\r\n num = array[i]\r\n current_sum += num\r\n if current_sum > largest\r\n largest = current_sum\r\n end\r\n end\r\n\r\n largest\r\nend",
"def largest_contiguous_subsum(arr)\n \n curr_sum = arr.first\n largest_sum = arr.first\n (1...arr.length).each do |i| \n if curr_sum < 0\n curr_sum = 0 #reset\n end\n\n curr_sum += arr[i] \n \n if curr_sum > largest_sum \n largest_sum = curr_sum\n end\n end\n largest_sum\nend",
"def largest_contiguous_subsum(arr)\n sums = []\n\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n sums << arr[idx1..idx2].sum\n end\n end\n\n sums.max\nend",
"def largest_contiguous_subsum1(array)\r\n subset = []\r\n array.each_index do |i| # make subets, store into 'subset' array\r\n (i...array.length).each do |j| # o(n^2)\r\n subset << array[i..j] # o(n^3) cause slicing\r\n end\r\n end\r\n\r\n subset_sum = []\r\n subset.each do |ele|\r\n subset_sum << ele.sum\r\n end\r\n subset_sum.max\r\nend",
"def largest_contiguous_subsum2(array)\n largest_sum = array.first\n current_sum = array.first\n\n (1..array.length-1).each do |i|\n current_sum = 0 if current_sum < 0\n current_sum += array[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\n \nend",
"def largest_contig_subsum(nums)\n max = nil\n nums.each_with_index do |num, i|\n j = i\n while j < nums.length\n if !max || nums[i..j].sum > max\n max = nums[i..j].sum\n end\n j += 1\n end\n end\n max\nend",
"def max_sequence(arr)\n return 0 if arr.empty?\n\n max_ending_here = max_so_far = 0\n \n arr.each do |n|\n max_ending_here = [n, max_ending_here + n].max\n max_so_far = [max_so_far, max_ending_here].max\n end\n \n max_so_far\nend",
"def largest_contiguous_subsum(list)\n max = nil\n subarrays = []\n\n list.each_with_index do |el1, idx1|\n (idx1...list.length).each do |idx2|\n subarrays << list[idx1..idx2]\n end\n end\n\n sums = []\n subarrays.each do |array|\n sums << array.inject(:+)\n end\n\n sums.max\nend",
"def largest_sub_sum(array) #technically I believe this is a n^3 operation since you are first doing a n^2 with the nested loop and then multiplying by n at the end (the map/ another loop) -- hence the n^3\n answer_subs = []\n\n (0...array.length).each do |i|\n ((i + 1)...array.length).each do |j|\n answer_subs << [array[i]]\n answer_subs << [array[j]]\n answer_subs << array[i..j] #should have every combo in subs now\n end\n end\n answer_subs.sort.uniq.map{|sub| sub.reduce(:+)}.max\n # .map {|sub| sub.reduce(:+)}.max # should 1) reduce(:+)/ add up every element in each array. The map returns the array and then max returns the max number\nend",
"def largest_contiguous_subsum1(list)\n greatest_sum = -1.0/0.0\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n greatest_sum = list[i..j].sum if greatest_sum < list[i..j].sum\n end\n end\n greatest_sum\nend",
"def largest_contiguous_subsum(array)\n sub_arrays = []\n i = 1\n until i == array.length + 1\n array.each_cons(i) do |sub|\n sub_arrays << sub\n end\n i += 1\n end\n sub_arrays.map {|sub| sub.reduce(:+)}.max\nend",
"def subsum_fast(arr)\n max_subsum = arr.first\n last = nil\n\n arr.all? { |n| return arr.max if n < 1 }\n arr[1..-1].each do |n|\n if last\n if last < 0\n last = n\n elsif last > 0\n last = last + n\n end\n\n if last > max_subsum\n max_subsum = last\n last = nil\n end\n\n else\n checking = max_subsum + n\n if checking >= max_subsum\n max_subsum = checking\n elsif checking != 0\n last = checking\n end\n end\n end\n\n max_subsum\nend",
"def largest_contiguous_subsum(array)\n previous_sum = 0\n current_sum = 0\n array.each_with_index do |el, i|\n\n current_sum = previous_sum + el\n if previous_sum < 0\n if el < previous_sum\n current_sum = previous_sum\n else\n current_sum = el\n end\n end\n\n previous_sum = current_sum\n end\n\n current_sum\nend",
"def better_largest_contiguous_subsum(arr)\n largest_sum = 0\n current_sum = 0\n i = 0\n while i < arr.length\n if arr[i] + current_sum >= 0\n current_sum += arr[i]\n else\n current_sum = 0\n end \n largest_sum = current_sum if current_sum > largest_sum \n i += 1\n end\n largest_sum\n end"
] | [
"0.83495635",
"0.8146975",
"0.81459254",
"0.8106213",
"0.81001323",
"0.8093179",
"0.8089693",
"0.8069191",
"0.80396765",
"0.80394524",
"0.8032638",
"0.8007893",
"0.797759",
"0.79606885",
"0.79575217",
"0.7911105",
"0.79095554",
"0.78898185",
"0.7887423",
"0.7880399",
"0.7878127",
"0.7872704",
"0.78588796",
"0.7830744",
"0.78062946",
"0.7806089",
"0.77971995",
"0.7793926",
"0.77865964",
"0.7784118",
"0.77829045",
"0.77685815",
"0.7766416",
"0.7764288",
"0.7756331",
"0.77328676",
"0.7725792",
"0.772408",
"0.7723431",
"0.7715583",
"0.7711661",
"0.7706548",
"0.7703087",
"0.770042",
"0.76941144",
"0.7689431",
"0.768057",
"0.76756376",
"0.7674942",
"0.7665823",
"0.7643273",
"0.7622088",
"0.75981855",
"0.75932807",
"0.758985",
"0.7581457",
"0.75669324",
"0.75661725",
"0.7561322",
"0.7559206",
"0.7552528",
"0.7551578",
"0.7550605",
"0.75426215",
"0.7541386",
"0.75385135",
"0.753776",
"0.7531232",
"0.7527967",
"0.7517379",
"0.75141925",
"0.75061893",
"0.7495063",
"0.74902993",
"0.7484392",
"0.7478913",
"0.7467445",
"0.74662894",
"0.746325",
"0.7458637",
"0.7456546",
"0.74541044",
"0.74449277",
"0.7444373",
"0.74434334",
"0.7424137",
"0.7423314",
"0.7409531",
"0.7406108",
"0.7404992",
"0.7398675",
"0.7396972",
"0.7395278",
"0.7391057",
"0.73886025",
"0.73876345",
"0.7383496",
"0.73814136",
"0.7379831",
"0.7378999"
] | 0.79979557 | 12 |
Another solution provided by another Codewars user | def max_sequence(arr)
sum = arr.first ? arr.first : 0
arr.each do |num|
sum_to_here = [(num), (sum_to_here + num)].max
sum = [sum, sum_to_here].max
end
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def anchored; end",
"def probers; end",
"def schubert; end",
"def formation; end",
"def suivre; end",
"def terpene; end",
"def intensifier; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def stderrs; end",
"def berlioz; end",
"def original_result; end",
"def villian; end",
"def offences_by; end",
"def identify; end",
"def weber; end",
"def jack_handey; end",
"def same; end",
"def rassoc(p0) end",
"def silly_adjective; end",
"def transformations; end",
"def verdi; end",
"def transform; end",
"def beautify; end",
"def beautify; end",
"def spice; end",
"def romeo_and_juliet; end",
"def celebration; end",
"def malts; end",
"def schumann; end",
"def ismn; end",
"def isolated; end",
"def isolated; end",
"def king_richard_iii; end",
"def ibu; end",
"def too_complex; end",
"def bs; end",
"def original; end",
"def trd; end",
"def gounod; end",
"def operations; end",
"def operations; end",
"def hiss; end",
"def internship_passed; end",
"def buzzword; end",
"def buzzword; end",
"def custom; end",
"def custom; end",
"def who_we_are\r\n end",
"def herald; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def leeway; end",
"def leeway; end",
"def generate_comprehensive\n\n end",
"def rest_positionals; end",
"def transforms; end",
"def greibach_normal_form\n raise NotImplementedError\n end",
"def wrapper; end",
"def nonstriker_perimartium(pronunciation_crotched)\n end",
"def implementation; end",
"def implementation; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def method_731(base); end",
"def escaper; end",
"def appraisals; end",
"def appraisals; end",
"def invention; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def strain; end",
"def refutal()\n end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def blg; end",
"def mitch_hedberg; end",
"def diff2; end",
"def offences_by=(_arg0); end",
"def alternatives; end",
"def tiny; end",
"def diff1; end",
"def sharp; accidental; end",
"def with_repl_like_sigint; 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"
] | [
"0.6335019",
"0.6029032",
"0.5975171",
"0.5794461",
"0.57909715",
"0.5684158",
"0.5682504",
"0.56194514",
"0.5576231",
"0.5576231",
"0.5576231",
"0.5576231",
"0.5521634",
"0.55044806",
"0.54941624",
"0.5480229",
"0.5457288",
"0.5390539",
"0.5378593",
"0.536802",
"0.5358155",
"0.535493",
"0.53117406",
"0.5309084",
"0.530271",
"0.5295832",
"0.52699125",
"0.52699125",
"0.5256584",
"0.5254641",
"0.5254425",
"0.52231497",
"0.52017397",
"0.5197283",
"0.51954466",
"0.51954466",
"0.5177529",
"0.5167958",
"0.5157593",
"0.5154396",
"0.51493937",
"0.5142143",
"0.5107927",
"0.5103997",
"0.5103997",
"0.51003534",
"0.509797",
"0.5094901",
"0.5094901",
"0.50890857",
"0.50890857",
"0.5085493",
"0.5073932",
"0.50495493",
"0.50495493",
"0.50495493",
"0.5045012",
"0.5045012",
"0.504254",
"0.50425154",
"0.5038181",
"0.50368494",
"0.5028651",
"0.50254035",
"0.50184005",
"0.50184005",
"0.50148624",
"0.50148624",
"0.5011418",
"0.5006054",
"0.5005276",
"0.5005276",
"0.50036263",
"0.50032336",
"0.50032336",
"0.50032336",
"0.50032336",
"0.50032336",
"0.4996687",
"0.49893132",
"0.49781635",
"0.49781635",
"0.49781635",
"0.49781635",
"0.49608585",
"0.49519616",
"0.49480224",
"0.49459076",
"0.49448165",
"0.4936828",
"0.49365622",
"0.49314904",
"0.49307987",
"0.49280682",
"0.49280682",
"0.49280682",
"0.49280682",
"0.49280682",
"0.49280682",
"0.49280682",
"0.49280682"
] | 0.0 | -1 |
recursive using splat operator: | def zip(*arrs)
return [] if arrs.any?(&:empty?)
[arrs.map(&:first)] + zip(arrs.first.drop(1), arrs.last.drop(1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def __splat(x) end",
"def xargs *args\r\n m = args.shift\r\n args.slice!(-1).each {|a|\r\n method(m).call(*(args + [a]))\r\n }\r\nend",
"def [](*args)\n\t\t\tdont_splat=false #determines whether to splat or not if there is only a single result\n\t\t\targs.collect! do |arg|\n\t\t\t\tif arg.kind_of? Range\n\t\t\t\t\targ=arg.to_a\n\t\t\t\t\tdont_splat=true\n\t\t\t\tend\n\t\t\t\targ\n\t\t\tend\n\t\t\targs.flatten!\n dont_splat=true if args.size > 1\n result=@children.values_at(*args).compact\n\t\t\tif result.size==1 && dont_splat==true\n\t\t\t\treturn result\n\t\t\telse\n\t\t\t\treturn *result\n\t\t\tend\n end",
"def roster_splat(*players)\n # Gets treated as an array\n puts players\nend",
"def flatten!() end",
"def combinations(*args)\n # initialize an array for the result\n array_new = []\n # combine the last two arguments (arrays)\n args[-2].each do |y|\n args[-1].each do |z|\n array_new.push(([y, z]).flatten)\n end\n end\n # get rid or last two arguments (arrays) that were combined above\n args.pop(2)\n # add the combined array (of last two elements) to args\n args.push(array_new)\n # if there are still more arguments to process call this function recursively\n if args.length > 1\n array_new = combinations(*args)\n end\n return array_new\nend",
"def concat(*args)\n args.flatten\nend",
"def zip(*rest) end",
"def multiple(*nums)\n nums.inject(:*)\nend",
"def inject_deep_flat(list, remaining_path, multiplicity)\n return inject_deep(list, remaining_path) if multiplicity == 0\n\n flat_input = list.flat_map { |v| v.nil? ? [] : v }\n flat_output = inject_deep_flat(flat_input, remaining_path, multiplicity - 1)\n item_index = -1\n list.map { |v| v&.map { flat_output[item_index += 1] } }\n end",
"def varargs(arg1, *rest)\n \"arg1=#{arg1}. rest=#{rest.inspect}\"\nend",
"def p(*rest) end",
"def union(*arrys)\n\n united = []\n \n # For each argument passed, push it into a new flattened array\n # that is one dimensional. Making use of implied returns.\n arrys.each {|arg| united.push(arg) }.flatten\n\nend",
"def combine(*args)\n if args.all? {|x| x.is_a? Array}\n para = args.shift\n args.each do |x|\n para = para.product(x)\n end\n para.map {|x| x.flatten(1)}\n else\n raise ArgumentError, 'All arguments must be Array'\n end\n end",
"def expand\n map { |p| p&.flatten || p }.flatten\n end",
"def my_flatten(arr, flattened_arr = [])\nend",
"def flatten(*args)\n new_array = []\n self.each do |v|\n if v.is_a?(Array)\n new_array.push( *(v.flatten(*args)) )\n else\n new_array << v\n end\n end\n new_array\n end",
"def flatten() end",
"def not_just_splat(x, *args, y)\n puts x\n puts y\n puts args.inspect\nend",
"def mutliplied(array)\nend",
"def arglist\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n self[3..-1].unshift :arglist\n when :super, :zsuper\n if self[1]\n self[1..-1].unshift :arglist\n else\n Sexp.new(:arglist)\n end\n end\n end",
"def process_arglist(exp)\n return '' if exp.empty?\n return process_array(exp)\n end",
"def my_controlled_flatten(n=1)\n #here\n return self if n < 1\n\n results = []\n self.each do |el|\n if el.class == Array\n #here\n results += el.my_controlled_flatten(n-1)\n else\n results << el\n end\n end\n\n results\n\n end",
"def recursive_iterate( arr, indent=0 )\n\n # remove the first element from the array and print it\n # - if there are any elements left in the array\n # call ourselves again with the shorter array\n\n # first = arr.shift # mutates the arg (a)\n\n # first = arr.first\n # rest = arr[1..-1]\n\n first, *rest = arr # JS: const [first, ...rest] = arr;\n\n spaces = \" \" * indent\n\n puts \"#{ spaces } recursive_iterate( #{ arr.to_s })\"\n puts \"#{ spaces } first: #{ first }\"\n puts \"#{ spaces } rest: #{ rest.to_s }\"\n # puts first\n\n if rest.any?\n recursive_iterate( rest, indent+1 )\n end\n\n puts \"#{ spaces } --- returning from recursive_iterate( #{ arr.to_s} ), first: #{ first }\"\n\nend",
"def deep_merge!(*args)\n replace deep_merge(*args)\n end",
"def my_flatten_recursive \n results = []\n self.my_each do |ele|\n if ele.is_a? Array \n results.concat(ele.my_flatten_recursive)\n else \n results<< ele\n end\n end\n results\n\n end",
"def c(*list)\n list\nend",
"def add_to_array(var1, *others)\n\tcurrent_arr = [var1, *others]\n\tcurrent_arr = current_arr.flatten\n\tp current_arr\nend",
"def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend",
"def *\n push pop * pop\n end",
"def fun3(*a)\n a.inject(1, :*)\nend",
"def permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\nend",
"def lambdacall_args(sexp)\n__args_index(car(sexp)) + lambdacall_index(cadr(sexp), [])\n end",
"def flatten\n bind(&:itself)\n end",
"def arglist (sexp, level)\n code, work = '', []\n\n until sexp.empty?\n splat = sexp.first.first == :splat\n arg = process sexp.shift, :expression\n\n if splat\n if work.empty?\n if code.empty?\n code += (arg[0] == \"[\" ? arg : \"#{arg}#{mid_to_jsid :to_a}()\")\n else\n code += \".concat(#{arg})\"\n end\n else\n join = \"[#{work.join ', '}]\"\n code += (code.empty? ? join : \".concat(#{join})\")\n code += \".concat(#{arg})\"\n end\n\n work = []\n else\n work.push arg\n end\n end\n\n unless work.empty?\n join = work.join ', '\n code += (code.empty? ? join : \".concat([#{work}])\")\n end\n\n code\n end",
"def call(*args)\n left = root.call(*args)\n\n right = nodes.map { |node|\n response =\n if node.lazy?\n node.call(args.first, left)\n else\n node.call(left)\n end\n\n if node.one? && !node.graph?\n [response]\n else\n response\n end\n }\n\n if one?\n [[left], right]\n else\n [left, right]\n end\n end",
"def rec_r(depth, arr)\n return arr if depth == 0\n\n rec_r(depth-1, arr.map do |v|\n ['a', 'b', 'c'].map do |chr|\n v + chr\n end\n end.flatten)\nend",
"def parse_splat_args\n unless self.empty?\n args = self#.flatten\n case args.size\n when 1\n return args.first # if there was only one arg passed, return just that, without the array\n when 0\n return nil # if no args were passed return nil\n else\n return args # else return the array back, cause chances are that's what they passed you!\n end\n end\n end",
"def process_arglist exp\n exp = exp.dup\n exp.shift\n exp.map! do |e|\n process e\n end\n\n exp.unshift :arglist\n end",
"def generic_method(a, b, c, *d)\n p [a, b, c]\n p d\nend",
"def squeeze!(*rest) end",
"def recurse_proc(result, &proc)\n case result\n when Array\n result.each { |x| recurse_proc x, &proc }\n proc.call result\n when Hash\n result.each { |x, y| recurse_proc x, &proc; recurse_proc y, &proc }\n proc.call result\n else\n proc.call result\n end\n end",
"def flatten!\n # buggerit\n raise NotImplementedError\n end",
"def all_combinations(first, *rest)\r\n return first if rest == []\r\n rest = all_combinations(*rest)\r\n combs = []\r\n first.each do |v1|\r\n rest.each do |v2|\r\n combs << v1 + v2\r\n end\r\n end\r\n combs\r\nend",
"def my_flatten(final_arr = []) \n self.my_each do |el|\n debugger\n if el.class == Integer\n final_arr << el\n else\n el.my_flatten(final_arr)\n end\n end\n result\n end",
"def multi_dimensional_sum(array)\n\n puts \"With the built-in flatten method:\"\n puts array.flatten.inject { |acc, num| acc + num }\n\n puts \"With my flatten method:\"\n puts my_flatten(array).inject { |acc, num| acc + num}\n\n return \"----\"\n\nend",
"def splat(*numeros)\n\tnumeros.max #devuelve el maximo de muchos parametros, los almacena en un arreglo\nend",
"def lcts(array)\nend",
"def permute(nums)\n result = []\n permute_helper(nums, [], result)\n result\nend",
"def variadic_method(first, *args, last)\n p first\n args.each { |arg| puts arg }\n p last\nend",
"def stack(*args); end",
"def multi_array_op(func, *args)\n elem = args[0]\n if elem.is_a?(Array)\n elem.each_with_index.collect do |_item, index|\n indexed_args = args.collect { |a| a = a.is_a?(Array) ? a : [a]; a[index] }\n multi_array_op(func, *indexed_args)\n end\n else\n func.call(*args)\n end\n end",
"def cart_prod(*args)\n final_output = [[]]\n until args.empty?\n t, final_output = final_output, []\n b, *args = args\n t.each { |a|\n b.each { |n|\n final_output << a + [n]\n }\n }\n end\n final_output\nend",
"def **(p0) end",
"def recurse_proc(result, &proc)\n case result\n when Array\n result.each { |x| recurse_proc x, &proc }\n proc.call result\n when Hash\n result.each do |x, y|\n recurse_proc x, &proc\n recurse_proc y, &proc\n end\n proc.call result\n else\n proc.call result\n end\n end",
"def recursive => nil",
"def subtrair(*args)\n end",
"def one_line_flatten(array, ret = [])\n array.each { |x| x.is_a?(Array) ? one_line_flatten(x, ret) : ret << x }; ret\nend",
"def g *args # accept multiple arguments as an array\n\targs # returns an array\nend",
"def extract_argument_lists(args, splittable_args); end",
"def varargs(arg1, *rest)\n puts \"Got #{arg1} and #{rest.join(', ')}\"\nend",
"def _reduce_556(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend",
"def **(n)\n type_assert(n, Integer)\n ret = []\n if n > 1\n ret = dup\n (n - 1).times {\n temp = []\n ret.each { |x| each { |y| temp << [x,y].flatten } }\n ret = temp\n }\n elsif n == 1\n ret = map { |item| [item] }\n end\n return ret\n end",
"def *(mat)\n end",
"def flat(arr1=[],arr2=[],i=0)\n if i >= arr1.length\n return arr2\n else\n if arr1[i].kind_of?(Array)\n flat(arr1[i],arr2) \n else\n arr2.push(arr1[i])\n end\n return flat(arr1,arr2,i+1)\n end\nend",
"def test_flatten_once\n ary = [1, [2, [3, 4]]]\n flatter_ary = [1, 2, [3, 4]]\n assert_equal flatter_ary, OneLiner.flatten_once(ary)\n end",
"def reverse_with_splat(array)\n new_array = []\n array.size.times do\n *initial, last = array\n new_array << last\n array = initial\n end\n new_array\nend",
"def permute(arr)\n return [array] if array.length <= 1\n\n first = array.shift\n perms = permute(array)\n total_permutations = []\n \n \n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0...i] + [first] + perm[i..-1]\n end\n end\n total_permutations\nend",
"def unshift(*rest) end",
"def my_args(first, *args, last)\n # Use the splat (i.e. *) in front of an \n # argument to take in any number of args\n # into an array (like gather in JS i.e. ...).\n # Unlike gather, it can be placed at the beginning,\n # the middle, or the end of a list of args\n puts(\"first: #{first}\")\n puts(\"args: #{args}\")\n puts(\"last: #{last}\")\nend",
"def permutations(array)\n debugger\n return [array] if array.length <= 1\n # pop off the last element\n first = array.shift\n # make the recursive call\n perms = permutations(array)\n # we will need an array to store all our different permutations\n total_permutations = []\n\n\n # Now we iterate over the result of our recusive call say [[1, 2], [2, 1]]\n # and for each permutation add first into every index. This new subarray\n # gets added to total_permutations.\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_permutations << perm[0 ... i] + [first] + perm[i .. -1]\n end\n end\n total_permutations\nend",
"def _reduce_458(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend",
"def *(arg0)\n end",
"def *(arg0)\n end",
"def _reduce_667(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend",
"def ld(arg0, arg1, *rest)\n end",
"def all(*args); end",
"def using_flatten(arr)\n arr.flatten\nend",
"def _reduce_556(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n\n result\nend",
"def test_flatten_once\n ary = [1, [2, [3, 4]], [5]]\n flatter_ary = [1, 2, [3, 4], 5]\n assert_equal flatter_ary, OneLiner.flatten_once(ary)\n end",
"def []=(p0, *rest) end",
"def []=(p0, *rest) end",
"def arbitrary_params( *args)\n args.each do |arg|\n puts arg\n end\n # other method of iterating through array\n # args.each { |arg| puts arg }\nend",
"def splat(thing)\n (thing.is_a?(Array) ? thing : [thing]).compact\n end",
"def my_method(*x)\n puts \">>>START\"\n x.each { |x| x.call }\n puts \">>>> END\"\nend",
"def call\n @func[*@args]\n end",
"def double_array(array)\n array + array\nend",
"def walk(*args) walk_direction[*args] end",
"def _reduce_682(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend",
"def function(argument1, argument2, *splat)\n puts argument1\n puts argument2\n #Is there a better way to detect an empty splat argument?\n if splat == []\n puts \"empty splat!\"\n else\n #Iterate over a variable number of arguments.\n splat.each { |splat_n| puts splat_n }\n end\nend",
"def using_flatten(array)\n array.flatten\n \nend",
"def apply_to_all(arg)\r\n\treturn lambda{|x| x.map{ |z| arg.call(z)}}\r\nend",
"def permutations(arr)\n return arr if arr.length <= 1\n perm = [arr]\n sub_perm = permutations(arr[1..-1])\n curr_el = arr[0]\n p sub_perm\n p \" sub_perm #{sub_perm} \"\n if sub_perm.length > 1\n\n sub_perm.each do |subArr|\n temp = []\n (0...subArr.length).each do |i|\n temp = subArr[0..i] + [curr_el] + subArr[i + 1..-1]\n end\n perm << temp\n end\n end\n # puts \" sub_perm #{sub_perm} \"\n # sub_perm.each do |subArr|\n # subArr << curr_el\n # perm << subArr\n # end\n # sub_perm << curr_el\n # perm << sub_perm\nend",
"def matrix_addition_reloaded(*matrix) # collapses args into one array - extra outer [] shell \n if matrix_counter(matrix) == false\n return nil\n end\n\n if matrix.length == 1\n return matrix[0]\n end\n\n \n (1...matrix.length).each do |number|\n matrix[0] = matrix_addition(matrix[0], matrix[number])\n end\n\n matrix[0]\nend",
"def clone_args(arg)\n if arg.is_a?(Array)\n arg.map {|sub_arg| clone_args(sub_arg)}\n elsif arg.is_a?(Hash)\n Hash[arg.map {|k, v| [clone_args(k), clone_args(v)]}]\n else\n arg # Some objects (e.g. symbol) can't be dup'd.\n end\n end",
"def deep_dup(arr)\n return [arr] if !arr.is_a?(Array)\n res = []\n arr.each do |a|\n res += deep_dup(a)\n end \n res \nend",
"def _reduce_568(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend",
"def recursive_print(array)\n\nend",
"def _reduce_683(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend",
"def flatten(a, flat=[])\n if a.class != Array\n # base case\n flat << a\n else\n a.each {|v| flatten(v, flat)}\n end\n flat\nend"
] | [
"0.70947117",
"0.68416244",
"0.64176214",
"0.6258929",
"0.61434114",
"0.6136593",
"0.6010784",
"0.5987226",
"0.5986348",
"0.59125274",
"0.58904517",
"0.58672816",
"0.5854529",
"0.5827203",
"0.5824475",
"0.5798848",
"0.5792286",
"0.57868606",
"0.5745624",
"0.57324916",
"0.5722971",
"0.57164526",
"0.5713366",
"0.5708324",
"0.56977147",
"0.56851417",
"0.56654423",
"0.56591743",
"0.5656452",
"0.56547064",
"0.5623356",
"0.5610706",
"0.560799",
"0.5601913",
"0.56007904",
"0.5596795",
"0.5593931",
"0.55903083",
"0.5586341",
"0.5584749",
"0.55780023",
"0.557611",
"0.5575614",
"0.5575296",
"0.5575272",
"0.5572876",
"0.55634964",
"0.5559496",
"0.5558857",
"0.5556442",
"0.55470294",
"0.55470246",
"0.55442595",
"0.5539963",
"0.55354285",
"0.5519581",
"0.5514207",
"0.5510096",
"0.5504375",
"0.5485855",
"0.5479923",
"0.5477789",
"0.546864",
"0.5465005",
"0.54631776",
"0.5445911",
"0.5445423",
"0.54402715",
"0.5439729",
"0.543744",
"0.54280394",
"0.54263836",
"0.54262674",
"0.54236865",
"0.54236865",
"0.5393729",
"0.53920597",
"0.5391947",
"0.53905076",
"0.5383664",
"0.5383451",
"0.5381104",
"0.5381104",
"0.537977",
"0.53785294",
"0.53777385",
"0.5377224",
"0.53765595",
"0.5373033",
"0.5368302",
"0.53677195",
"0.5365085",
"0.5363941",
"0.53625",
"0.5361327",
"0.53565663",
"0.53558767",
"0.535515",
"0.53512394",
"0.53470534",
"0.5346933"
] | 0.0 | -1 |
def zip(arrs) arrs.transpose end using Enumerablereduce: | def zip(arr1, arr2)
arr1.each_with_index.reduce([]) { |result, (el, idx)| result << [el, arr2[idx]] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zip(*rest) end",
"def my_zip(*arrs)\n zipped = []\n self.each_with_index do |ele, i|\n sub = [ele]\n arrs.each do |arr|\n sub << arr[i]\n end\n zipped << sub\n end\n zipped\n end",
"def zip(*arrs)\n return [] if arrs.any?(&:empty?)\n [arrs.map(&:first)] + zip(arrs.first.drop(1), arrs.last.drop(1))\nend",
"def paralell_array(*enums)\n zip(*enums)\n end",
"def zip(*enums)\r\n r = block_given? ? nil : []\r\n len = enums.collect { |x| x.size }.max\r\n len.times do |i|\r\n val = enums.collect { |x| x[i] }\r\n if block_given?\r\n yield val\r\n else\r\n r << val\r\n end\r\n end\r\n r\r\nend",
"def my_zip(*given_arrays)\n result = []\n\n self.each_with_index do |el, idx|\n internal_array = [el]\n given_arrays.each { |given_array| internal_array << given_array[idx] }\n result << internal_array\n end\n\n result\n end",
"def zip(*arr)\n (0...arr[0].length).map do |i|\n arr.map {|arr| arr[i]}\n end\nend",
"def zip(first, second)\n first.zip(second)\nend",
"def zip(array1, array2)\n iterations = array1.size\n results = []\n iterations.times do |index|\n results << [array1[index], array2[index]]\n end\n results\nend",
"def zip(array1, array2)\n results = []\n array1.each_with_index do |current_element, current_index|\n results << [current_element, array2[current_index]]\n end\n results\nend",
"def zip(first, second)\n first.zip(second).flatten\nend",
"def zip first, second\n first.zip(second).flatten()\nend",
"def zip(ar1, ar2)\n zip_rec = ->(ar1, ar2, result) do\n case [ar1, ar2]\n when [[], []]\n result\n else\n zip_rec.(ar1[1..-1], ar2[1..-1], result << [ar1[0], ar2[0]])\n end\n end\n zip_rec.(ar1, ar2, [])\nend",
"def zip(*args)\n \n multi = Array.new(args[0].length) {[]}\n\n (0...args.length).each do |i|\n (0...args[0].length).each do |j|\n multi[j] << args[i][j]\n end\n end\n multi\nend",
"def zip(arr_1, arr_2)\n new_arr = []\n arr_1.size.times do |i|\n new_arr << [arr_1[i], arr_2[i]]\n end\n new_arr\nend",
"def zip(arr1, arr2)\n arr1.each_with_index.with_object([]) do |(el, i), z|\n z << [el, arr2[i]]\n end\nend",
"def ltranspose()\n Enumerator.new do |out|\n catch(:nothing_to_do) do\n # If any Enumerable is empty, then yield nothing\n enums = self.lmap{|e| e.ensure_enum}.\n touch{|e| throw :nothing_to_do if e.empty?}.\n to_a\n \n loop do\n out.yield enums.map{|e| e.next}\n end\n end\n end\n end",
"def custom_zip (arr1, arr2)\n final = []\n arr1.each_with_index do |item, index|\n final << [item, arr2[index]]\n end\n final\nend",
"def custom_zip(arr1, arr2)\n result = []\n arr1.each_with_index do |item, index|\n result << [arr1[index], arr2[index]]\n end\n result\nend",
"def my_zip(*arr)\n answer = Array.new([])\n each_with_index do |item, index|\n answer[index] = [item]\n arr.each do |elem|\n answer[index] << elem[index]\n end\n end\n answer\n end",
"def interzip(array1, array2)\n array1.zip(array2).flatten\nend",
"def zip(arr1, arr2)\n arr1.each_with_index.with_object([]) do |(el, idx), arr|\n arr << [el, arr2[idx]]\n end\nend",
"def custom_zip(arr1, arr2)\n final = []\n arr1.each_with_index do |value, index|\n final << [value, arr2[index]]\n end\n final\nend",
"def lecturer_zip(arr1,arr2)\n final = []\n arr1.each_with_index { |value, index| final << [value, arr2[index]] }\n final\nend",
"def my_zip(*args)\n zipped = Array.new(self.length) {[]}\n\n self.each_with_index { |el, i_arr| zipped[i_arr] << el}\n args.each_with_index do |arg, i_arg|\n (zipped.length).times {|i_arg_el| zipped[i_arg_el] << arg[i_arg_el]}\n end\n zipped\n end",
"def zip_with(a, b, &op)\n result = []\n a.zip(b){ |aa,bb| result << op.call(aa,bb)}\n result\nend",
"def zip(arr1, arr2)\n Array.new(arr1.size) do |idx|\n [arr1[idx], arr2[idx]]\n end\nend",
"def zip(arr1, arr2)\n zipped = []\n arr1.each_with_index do |el, i|\n zipped << [el, arr2[i]]\n end\n zipped\nend",
"def zip( *other_arrays, & block )\n\n load_parent_state\n \n return super\n \n end",
"def zip(arr1, arr2)\n zipped = []\n arr1.each_with_index { |ele, ind| zipped << [ele, arr2[ind]] }\n zipped\nend",
"def zipper(arr1, arr2)\n arr1.map.with_index { |val, idx| [val] << arr2[idx] }\nend",
"def my_zip(*arrays)\n i = 0\n zipped = []\n while i < self.length\n nest = [self[i]]\n arrays.my_each do |arr|\n if i < arr.length\n nest << arr[i]\n else\n nest << nil\n end\n end\n zipped << nest\n i += 1\n end\n return zipped\n end",
"def zip(*arr)\n new_arr = []\n i = 0\n while i < arr[0].length\n temp = []\n arr.each do |subarray|\n temp << subarray[i]\n end\n new_arr << temp\n i += 1\n end\n new_arr\nend",
"def custom_zip(arr1, arr2)\n final = []\n arr1.each_with_index { |name, index| final << [name, arr2[index]] }\n final\nend",
"def zip(arr1, arr2)\n arr1.map.with_index { |el1, idx| [el1, arr2[idx]] }\nend",
"def pairs\n seq = to_a\n seq.zip([*seq[1..-1], unit.advance(to)])\n end",
"def zip(arr1, arr2)\n index = 0\n zipped = []\n while index < arr1.length\n zipped << [arr1[index], arr2[index]]\n index += 1\n end\n zipped\nend",
"def zip(arr1, arr2)\n result = []\n idx = 0\n loop do\n result << [arr1[idx], arr2[idx]]\n idx += 1\n break if idx == arr1.size\n end\n result\nend",
"def transpose() end",
"def zip(*args, &result_selector)\n args.unshift(self)\n Observable.zip(*args, &result_selector)\n end",
"def zipper(arr1, arr2)\n arr1.map.with_index { |elem, ndx| [elem, arr2[ndx]] }\nend",
"def zip_map(left, right)\n result = Array.new(left.length)\n\n # Hold the current index and increment in each iteration: its faster to\n # do this and prealloate the result array, than to create an empty array\n # and push each result.\n index = -1\n\n left.zip(right) do |l_val, r_val|\n result[index += 1] = yield(l_val, r_val)\n end\n\n result\n end",
"def my_transpose\n\n end",
"def custom_zip(arr1, arr2)\n final=[]\n arr1.each_with_index do |item, index|\n nested_array= []\n arr2.each_with_index do |item2, index2|\n if index == index2\n nested_array << item\n nested_array << item2\n final << nested_array\n end\n end\n end\n final\nend",
"def multiply_list_zip(array1,array2)\n array1.zip(array2).map {|element| element.reduce(:*)}\n # array 1's element would be spread out into three arrays, 3,5 and 7 being the first elements. Zip then iterates through the argument\n # and mergers these elements into array1 one by one. The documentation then states if a block is given it invoked for EACH ARRAY, so in this case\n # the combined arrays we have now created.\nend",
"def zip first, second\n answer = Array.new\n first.each.with_index do |letter, index|\n answer << first[index]\n answer << second[index]\n end\n answer\nend",
"def interleave(a, b)\n a.zip(b).flatten\nend",
"def my_transpose\n ret = []\n i=0\n while i < self.length\n j=0\n ret2 = []\n while j < self[i].length\n ret2 << self[j][i]\n j += 1\n end\n ret << ret2\n i += 1\n end\n ret\n end",
"def interleave(array1, array2)\n p array1.zip(array2).flatten\nend",
"def transpose; end",
"def array_align (arr, *data)\n arr.zip(*data)\nend",
"def zany_zip(*args)\n length = args.map(&:length).max\n multi = Array.new(length) {[]}\n\n (0...args.length).each do |i|\n (0...length).each do |j|\n if j >= args[i].length\n multi[j] << nil\n else\n multi[j] << args[i][j]\n end\n end\n end\n multi\nend",
"def interleave(ary1, ary2)\n ary1.zip(ary2).flatten\nend",
"def interleave(a1, a2)\n # new_array = []\n # index = 0\n # while index < a1.size\n # new_array.push(a1[index])\n # new_array.push(a2[index])\n # index += 1\n # end\n # new_array\n # LS solution\n # result = []\n # array1.each_with_index do |element, index|\n # result << element << array2[index]\n # end\n # result\n a1.zip(a2).flatten\nend",
"def zip(*lists)\n length = nil\n values = []\n lists.each do |list|\n array = list.to_a\n values << array.dup\n length = length.nil? ? array.length : [length, array.length].min\n end\n values.each do |value|\n value.slice!(length)\n end\n new_list_value = values.first.zip(*values[1..-1])\n list(new_list_value.map {|list| list(list, :space)}, :comma)\n end",
"def my_transpose\n transposed = []\n\n i = 0\n until transposed.length == length\n current = []\n self.each do |arr|\n current << arr[i]\n end\n i += 1\n transposed << current\n end\n\n transposed\n end",
"def alternating_mapper(arr, p1, p2)\n (0...arr.length).map {|i| i.even? ? p1.call(arr[i]) : p2.call(arr[i])}\nend",
"def interleave(arr_1, arr_2)\n arr_1.zip(arr_2).flatten\nend",
"def transpose\n first_row = @list[0]\n other_rows = @list[1..-1]\n @list = first_row.zip(*other_rows)\n self\n end",
"def custom_zip(arr1, arr2)\n new_nested = []\n arr1.each_with_index do | arr1_value, arr1_index |\n arr2.each_with_index do | arr2_value, arr2_index |\n if arr1_index == arr2_index\n arr3 = [arr1[arr1_index], arr2[arr2_index]]\n new_nested << arr3\n end # end of if\n end # end of do (array 2)\n end # end of do (array 1)\n new_nested\nend",
"def zip\n end",
"def transpose\n # So. Pointless. Blerg.\n IterableArray.new(@array.transpose.map do |x|\n IterableArray.new x\n end)\n end",
"def zany_zip(*arr)\n max_length = 0\n arr.each do |x|\n if x.length > max_length\n max_length = x.length\n end\n end\n result = []\n i = 0\n while i < max_length\n temp = []\n arr.each do |subarray|\n temp << subarray[i]\n end\n result << temp\n i += 1\n end\n result\nend",
"def interleave(arr1,arr2)\n arr1.zip(arr2).flatten\nend",
"def my_transpose\n output = Array.new(self.length) {Array.new(self.length)}\n\n self.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n output[col_i][row_i] = self[row_i][col_i]\n end\n end\n output\n end",
"def interleave(array_1, array_2)\n result = []\n # https://ruby-doc.com/core-2.7.2/Enumerator.html#method-i-each_with_index\n array_1.each_with_index do |element, index|\n result << element << array_2[index]\n end\n result\nend",
"def interleave(array_1, array_2)\n results_array = []\n array_1.each_with_index do |elem, index|\n results_array << elem << array_2[index]\n end\n results_array\nend",
"def my_transpose(trans_arr)\n i, j = 0, 1\n array_copy = trans_arr.dup\n (i...trans_arr.length-1).each do |index_one|\n (j...trans_arr.length).each do |index_two|\n array_copy[index_one][index_two], array_copy[index_two][index_one] =\n array_copy[index_two][index_one], array_copy[index_one][index_two]\n end\n end\n array_copy\n end",
"def caterpillar_method\n result=[]\n i=0\n while(i<self.size/2)\n j=i+1\n while (self[j] && (yield self[i],self[j]))\n result<<[self[i],self[j]]\n j+=1\n end\n i+=1\n end\n return result\n end",
"def zip\n end",
"def demux\n x = []\n y = []\n self.each { |inz| raise \"wrong size (!= 2) - #{inz.inspect}\" if inz.size != 2; x << inz[0] ; y << inz[1] }\n [x,y]\n end",
"def interleave(arr1, arr2)\n results = []\n\n arr1.each_with_index do |el, i|\n results << el << arr2[i]\n # results << el << arr2[arr1.index(el)] ## if you wanted to do it without index as block param\n end\n\n results\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def cross_array(*enumerables)\n # return to_a.product(*enumerables.map{|e| e.to_a})\n enumerables.unshift self\n result = [[]]\n while !enumerables.empty?\n t, result = result, []\n b, *enumerables = enumerables\n t.each do |a|\n b.each do |n|\n result << a + [n]\n end\n end\n end\n result\n end",
"def interleave(arr1, arr2)\n index = 0\n results = []\n arr1.size.times do\n results << arr1[index] << arr2[index]\n index += 1\n end\n results\nend",
"def zip_to_length(length, *arrays)\n (0...length).map do |i|\n arrays[-1].map { |array| array[i] }\n end\nend",
"def interleave(arr1, arr2)\n results = []\n arr1.each.with_index do |el,idx|\n results << el << arr2[idx]\n end\n results\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def map2(arr)\n result = []\n each arr do |x|\n results << yield(x)\n end\n results\nend",
"def interleave a,b\n arr1 = []\n for i in (0...a.size)\n arr1 << a[i] << b[i]\n end\n arr1\nend",
"def interleave2(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(arr1, arr2)\n return_array = arr1.zip(arr2).flatten\nend",
"def comb_arrays(keys, values)\n combined = keys.zip(values)\n puts combined\nend",
"def interleave(arr1, arr2)\n # new_arr = []\n # arr1.size.times do |count|\n # new_arr << arr1[count] << arr2[count]\n # end\n # new_arr\n\n # using Array#zip and Array#flatten\n arr1.zip(arr2).flatten\nend",
"def interleave2(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def my_transpose\n result = Array.new(length) { Array.new(length) }\n self.each_with_index do |row, r|\n row.each_with_index do |num, c|\n result[r][c] = self[c][r]\n end\n end\n result\n end",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |value, index|\n result << value << array2[index]\n end\n result\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |element, index|\n result << element << array2[index]\n end\n result\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |element, index|\n result << element << array2[index]\n end\n result\nend",
"def zip(*args, &result_selector)\n AnonymousObservable.new do |observer|\n result_selector ||= lambda {|*inner_args| inner_args }\n n = args.length\n\n queues = Array.new(n) {|i| Array.new }\n is_done = Array.new(n, false)\n\n next_action = lambda do |i|\n if queues.all? {|q| q.length > 0 }\n res = queues.map {|q| q.shift }\n begin\n observer.on_next(result_selector.call(*res))\n rescue => e\n observer.on_error e\n break\n end\n end\n if queues.each_with_index.any? { |q, j| q.empty? && is_done[j] }\n observer.on_completed\n end\n end\n\n done = lambda do |i|\n is_done[i] = true\n observer.on_completed if queues[i].empty?\n end\n\n gate = Monitor.new\n\n subscriptions = Array.new(n) do |i|\n sas = SingleAssignmentSubscription.new\n\n sas_obs = Observer.configure do |o|\n o.on_next do |x|\n queues[i].push(x)\n next_action.call i\n end\n\n o.on_error(&observer.method(:on_error))\n\n o.on_completed { done.call i }\n end\n\n sas.subscription = args[i].synchronize(gate).subscribe(sas_obs)\n sas\n end\n\n subscriptions.push(Subscription.create { queues.each {|q| q = [] }})\n\n CompositeSubscription.new subscriptions\n end\n end",
"def custom_zip(arr1, arr2, arr3)\n arr = []\n nest_arr = []\n arr1.each do |i|\n k = [] #initialize a temporary array\n k.push(i) #pushed first val\n k.push(arr2[arr1.index(i)]) #pushed 2nd val\n k.push(arr3[arr1.index(i)]) #pushed 3rd val\n nest_arr = k #assigned to nest_arr\n arr.push(nest_arr) # pushed nest_arr to arr in order to nest in\n end\n\n p arr\nend",
"def my_transpose\n row_length = length\n col_length = first.length\n transposed = Array.new(col_length) { Array.new(row_length) }\n\n (0...row_length).each do |row|\n (0...col_length).each do |col|\n transposed[col][row] = self[row][col]\n end\n end\n transposed\n end",
"def interleave(arr1, arr2)\n arr3 = []\n arr1.each_with_index do |element, idx|\n arr3 << element << arr2[idx]\n end\n arr3\nend"
] | [
"0.7571705",
"0.7415248",
"0.7187294",
"0.7150408",
"0.6961229",
"0.6958176",
"0.68624747",
"0.6765536",
"0.66734755",
"0.6670809",
"0.6627896",
"0.66239977",
"0.65949893",
"0.65732735",
"0.65641654",
"0.64650285",
"0.64628506",
"0.64499116",
"0.6448578",
"0.642767",
"0.64098287",
"0.6373223",
"0.6350622",
"0.63300294",
"0.6324398",
"0.63181776",
"0.6304833",
"0.62841046",
"0.62690765",
"0.6260007",
"0.62560076",
"0.6236145",
"0.61609244",
"0.61593765",
"0.6154656",
"0.6133211",
"0.6081931",
"0.604833",
"0.60374475",
"0.60373354",
"0.6030734",
"0.59953994",
"0.5965158",
"0.5951631",
"0.5939545",
"0.59192216",
"0.5911155",
"0.59083396",
"0.5849937",
"0.58390546",
"0.5833846",
"0.582159",
"0.5790354",
"0.5769181",
"0.5764216",
"0.5756293",
"0.5735723",
"0.5731325",
"0.57129115",
"0.5678165",
"0.56570363",
"0.5643245",
"0.56414896",
"0.5637705",
"0.56163824",
"0.5596772",
"0.5593227",
"0.55852365",
"0.55845666",
"0.5580107",
"0.55722344",
"0.55617297",
"0.55566895",
"0.55566895",
"0.55566895",
"0.55566895",
"0.55566895",
"0.55566895",
"0.5555105",
"0.5553987",
"0.5538484",
"0.55330646",
"0.55256426",
"0.55256426",
"0.55256426",
"0.5523208",
"0.5520432",
"0.5496024",
"0.549526",
"0.549518",
"0.5494259",
"0.5477809",
"0.5476143",
"0.54562163",
"0.54491353",
"0.54491353",
"0.544832",
"0.5437181",
"0.54297185",
"0.5428102"
] | 0.64506775 | 17 |
metodele pot avea semnul intrebarii in nume, si sunt utile pentru teste si booleene | def over_five?(value=nil)
return "Exactly 5" if value.to_i == 5
if value.to_i > 5
return "Over 5"
else
return "Under 5"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cuadrada\n @n==@m\n end",
"def verificaesonitre (primo, secondo, terzo)\n\tesonicomuni=0\n\t#se il secondo e il terzo includono lo stesso esone lo conto come comune\n\tprimo.each do |v|\n\t\tif secondo.include?(v) then\n\t\t\tif terzo.include?(v) then \n\t\t\t\tesonicomuni=esonicomuni+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tprimosecondo=0\n\tprimo.each do |v|\n\t\tif secondo.include?(v) then\n\t\t\tif terzo.include?(v)==false then \n\t\t\t\tprimosecondo=primosecondo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tsecondoterzo=0\n\tsecondo.each do |v|\n\t\tif terzo.include?(v) then\n\t\t\tif primo.include?(v)==false then \n\t\t\t\tsecondoterzo=secondoterzo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tprimoterzo=0\n\tprimo.each do |v|\n\t\tif terzo.include?(v) then\n\t\t\tif secondo.include?(v)==false then \n\t\t\t\tprimoterzo=primoterzo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\t#il numero di esoni totali è così calcolato\n\tesoni=esonicomuni+primosecondo+secondoterzo+primoterzo+(primo.length-esonicomuni-primosecondo-primoterzo)+(secondo.length-esonicomuni-primosecondo-secondoterzo)+(terzo.length-secondoterzo-esonicomuni-primoterzo)\n\treturn esoni\nend",
"def controllaInizio( pippo)\n if INIZIO == 1 && FINE > INIZIO\n return true\n else\n ultimoBook = Book.last\n end \n #ultimoBook = Book.last #<<=== cambiare (commentandola) questa istruzione per il primo ciclo di bidoni\n if INIZIO == ultimoBook.id+1 # 1 <<=== cambiare questa istruzione (mettere: INIZIO == 1) per il primo ciclo di bidoni\n return true\n else\n pippo.scriviRiga(\"Ultimo record in tabella books ha valore: #{ultimoBook.id}\") if INIZIO > 1\n return false\n end\nend",
"def seuil()\n\t\treturn 0\n\tend",
"def suivre; end",
"def ismn; end",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end",
"def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end",
"def mi_carrera\n\n\tend",
"def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"def in_us1?\n self.nro_remision.to_s == \"\"\n end",
"def carne\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\t\tsuma = 0\n\n\t\t[cerdo,cordero,vaca,pollo].each do |i|\n\t\t\tif (@alimentos.find_index { |x| x == i } != nil)\n\t\t\t\tsuma += @gramos[@alimentos.find_index { |x| x == i }].valor\n\t\t\tend\t\t\n\t\tend\n\n\t\treturn suma >= (gramos_total * 0.45)\n\tend",
"def gera_posicao\n r = 0\n i = nil\n while 1\n r = rand(2**30 - 1)\n next if r.zero?\n break unless Eleitor.exists?(r)\n end\n self.numero = r\n end",
"def mambo_no_5; end",
"def test_minimizar\n assert_equal 2,Fraccion.new(1,1).minimizar(@c.num,@c.denom).num\n assert_equal 1,Fraccion.new(1,1).minimizar(@c.num,@c.denom).denom\n end",
"def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |valor_pos| valor_pos.nivel }\r\n \r\n if jugador_actual == 'O'\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.min\r\n #nivels.max\r\n else\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.max\r\n end\r\n end",
"def changerEnRouge\n\t\t@couleur=1\n\tend",
"def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end",
"def somme\n fail \"Doit etre defini dans la sous-classe\"\n end",
"def testLigneContient(a,a2)\n\t\t0.upto(a.size-1) do |x|\n\t\t\tif a[x].couleur != a2[x].couleur && a2[x].couleur != Tuile.getCouleurVide \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn true\n\n\tend",
"def ayarla(toplam)\n if toplam > 0\n return 1\n else\n return 0\n end\n end",
"def test_otro_programa\r\n aspirantesOtro = 6\r\n tot = ReservarOtroPrograma(1)\r\n assert_equal(tot, aspirantesOtro)\r\n end",
"def isImpossible(minben) \r\n \r\n sum_value = @itemValue.inject(0){|sum,item| sum+item} \r\n\r\n if (sum_value < minben) \r\n true\r\n else\r\n false\r\n end\r\n \r\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end",
"def traer_insumo(nombreInsumo, cantidad)\n\t case nombreInsumo\n\t\t when \"cebada\" then \n\t\t\t if (@cebada >= cantidad)\n\t\t\t\t @cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cebada\n\t\t\t\t @cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"arroz_maiz\" then\n\t\t\t if (@arroz_maiz >= cantidad)\n\t\t\t\t @arroz_maiz -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @arroz_maiz\n\t\t\t\t @arroz_maiz = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"levadura\" then\n\t\t\t if (@levadura >= cantidad)\n\t\t\t\t @levadura -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @levadura\n\t\t\t\t @levadura = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"lupulo\" then\n\t\t\t if (@lupulo >= cantidad)\n\t\t\t\t @lupulo -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @lupulo\n\t\t\t\t @lupulo = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_silos_cebada\" then\n\t\t\t if (@producto_silos_cebada >= cantidad)\n\t\t\t\t @producto_silos_cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_silos_cebada\n\t\t\t\t @producto_silos_cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_molino\" then\n\t\t\t if (@producto_molino >= cantidad)\n\t\t\t\t @producto_molino -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_molino\n\t\t\t\t @producto_molino = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_mezcla\" then\n\t\t\t if (@producto_paila_mezcla >= cantidad)\n\t\t\t\t @producto_paila_mezcla -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_mezcla\n\t\t\t\t @producto_paila_mezcla = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_cuba_filtracion\" then\n\t\t\t if (@producto_cuba_filtracion >= cantidad)\n\t\t\t\t @producto_cuba_filtracion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_cuba_filtracion\n\t\t\t\t @producto_cuba_filtracion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_coccion\" then\n\t\t\t if (@producto_paila_coccion >= cantidad)\n\t\t\t\t @producto_paila_coccion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_coccion\n\t\t\t\t @producto_paila_coccion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_preclarificador\" then\n\t\t\t if (@producto_tanque_preclarificador >= cantidad)\n\t\t\t\t @producto_tanque_preclarificador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_preclarificador\n\t\t\t\t @producto_tanque_preclarificador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_enfriador\" then\n\t\t\t if (@producto_enfriador >= cantidad)\n\t\t\t\t @producto_enfriador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_enfriador\n\t\t\t\t @producto_enfriador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tcc\" then\n\t\t\t if (@producto_tcc >= cantidad)\n\t\t\t\t @producto_tcc -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tcc\n\t\t\t\t @producto_tcc = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_filtro_cerveza\" then\n\t\t\t if (@producto_filtro_cerveza >= cantidad)\n\t\t\t\t @producto_filtro_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_filtro_cerveza\n\t\t\t\t @producto_filtro_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_cerveza\" then\n\t\t\t if (@producto_tanque_cerveza >= cantidad)\n\t\t\t\t @producto_tanque_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_cerveza\n\t\t\t\t @producto_tanque_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"cerveza\" then\n\t\t\t if (@cerveza >= cantidad)\n\t\t\t\t @cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cerveza\n\t\t\t\t @cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t end\n\tend",
"def casePasACoteArbre\n\n newStatutVide = StatutVide.new(VIDE)\n newStatutArbre = StatutArbre.new(ARBRE)\n grille=@grille.grille\n\n for i in 0..grille.length-1\n for j in 0..grille.length-1\n ok = true\n if (grille[i][j].statutVisible == newStatutVide)\n\n if (i-1 >= 0 && grille[i-1][j].statut == newStatutArbre) || (j-1 >= 0 && grille[i][j-1].statut == newStatutArbre) || (i+1 <= grille.length-1 && grille[i+1][j].statut == newStatutArbre) || (j+1 <= grille.length-1 && grille[i][j+1].statut == newStatutArbre)\n ok = false\n end\n\n return grille[i][j] if ok\n\n end\n end\n end\n\n return 0\n end",
"def changerEnVide\n\t\t@couleur=-1\n\tend",
"def class_div_note_finale\n if unote_finale > 15\n 'good'\n elsif unote_finale > 10\n 'moyen'\n else\n 'bad'\n end\n end",
"def ContarHijos(menu,padreid)\n @opcionMenus = OpcionMenu.all \n @son=0\n @i=1\n @opcionMenus.each do |arbol| \n \tif arbol.menu_id.to_i==menu.id.to_i and arbol.padre_id.to_i==padreid.to_i\n \t @son=@son+1\n \t @i=@i+1;\n \tend\n end\n return @son \n end",
"def proba(i)\n dé_actuel=rand(1..6)\n #i=0\n #new_var=i\n\nif (dé_actuel == 5) || (dé_actuel == 6)\n i+=1\n puts \"Le dé est tombé sur 5 ou 6, j'avance d'une case.\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\nelsif dé_actuel == 1\n if i == 0\n puts \"Je reste à 0!\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n else\n i-=1\n puts \"Le dé est tombé sur 1, je recule d'une case.\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n end\nelse #(dé_actuel == 2) || (dé_actuel == 3) || (dé_actuel == 4)\n puts \"Le dé est tombé sur 2,3 ou 4, je ne bouge pas!\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n\nend\nend",
"def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend",
"def test_min_dispersa\n\t\tassert_equal(Fraccion.new(66,5), @h3.min, \"Resultado Incorrecto\" )\n\tend",
"def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend",
"def getNbRecompense\n return 0\n end",
"def calculCouleur(cellule,clique)\n #Gestion du clique gauche\n if clique == CLIQUEGAUCHE\n couleur = cellule.clicGauche\n #Gestion duclique droit\n elsif clique == CLIQUEDROIT\n couleur = cellule.clicDroit\n #Aucune gestion pour tout les autres boutons de la souris\n else\n couleur = nil\n puts \"Aucun evenement lié au bouton\"+clique.to_s\n end\n return couleur\n end",
"def test_resta\n \t\tassert_equal(@ma, (@md-@mz)) #densa\n \t\tassert_equal(@a, (@c-@b)) #fraccionales\n\t\tassert_equal(@mp, (@mr-@mq)) #dispersa\n \tend",
"def verdi; end",
"def recuperationNbEtape()\n\t\t@nbEtape=@techniqueObjet.combienEtape()\n\tend",
"def recuperationNbEtape()\n\t\t@nbEtape=@techniqueObjet.combienEtape()\n\tend",
"def zuruecksetzen()\n end",
"def menuValido\r\n if (sexo == \"Hombre\")\r\n return (kcalMenu.round == 3000 && proteinasMenu > 54.0)\r\n else\r\n return (kcalMenu.round == 2300 && proteinasMenu > 41.0)\r\n end\r\n end",
"def ognia(a,b)\n\t\tsystem \"clear\"\n\t\tif @pelna.litera[a][b] == \" X\"\n\t\t\t@pusta.litera[a][b] = \" X\"\n\t\t\tprint \"Trafiony \"\n\t\t\tszukany = (Statek.lista_statkow.select {|x| x if x.sam_statek[0] == [a,b] || x.sam_statek[1] == [a,b] ||\n\t\t\t x.sam_statek[2] == [a,b] || x.sam_statek[3] == [a,b]})[0]\n\t\t\tszukany.sam_statek.delete([a,b])\n\t\t\t\n\t\t\tif szukany.sam_statek.length == 0\n\t\t\t\tputs \"Zatopiony !!!\"\n\t\t\t\tszukany.otoczka.each {|x| pusta.litera[x[0]][x[1]]=\" .\" if x[0] >=0 && x[1] >=0 && x[0] < 10 && x[1] < 10}\n\t\t\t\tStatek.lista_statkow.delete(szukany)\n\t\t\t\tprint \"Zostało Ci jeszcze #{Statek.lista_statkow.count} statków do zatopienia\"\n\t\t\tend\n\t\t\tputs\n\t\t\t\n\t\t\telse \n\t\t\tputs \"Pudło !\"\n\t\t\t@pusta.litera[a][b] = \" .\"\n\t\t\t\n\t\tend\n\t\tif Statek.lista_statkow.count > 0\n\t\t\t@pusta.rysuj \n\t\telse\n\t\t\tsystem \"clear\"\n\t\t\t@pusta.rysuj \n\t\t\tputs \"Koniec GRY !!!\" \n\t\tend\n\tend",
"def validador(clave)\n\tvalida = esClaveValida(clave)\n\tintermedio = segundoDigitoMenor(clave)\n\tif valida == true\n\t\treturn intermedio\n\telsif valida == false\n\t\treturn -1 \n\tend\nend",
"def num_tankoubon; end",
"def celebration; end",
"def test_01_dada_una_caja_de_ahorros_nueva_su_saldo_inicial_debe_ser_0_pesos\n assert_equal 0.pesos, @una_caja_de_ahorros_nueva.saldo\n end",
"def celebrity; end",
"def celebrity; end",
"def aceite\n 'N'\n end",
"def numero_marca(marca)\n case marca.estado\n when \"sm\" then marca.numero_solicitud\n when \"lp\" then marca.numero_publicacion\n when \"lr\" then marca.numero_registro\n when \"sr\" then marca.numero_solicitud_renovacion\n when \"rc\" then marca.numero_renovacion\n else\n marca.numero_solicitud\n end\n end",
"def nbAreteSimple\n nbSimple = 0\n @aretes.each { |x|\n x.estDouble == false ? nbSimple += 1 : false\n }\n return nbSimple\nend",
"def marquer!\n fail \"Doit etre defini dans la sous-classe\"\n end",
"def schumann; end",
"def minen_verteilen\n @minenzahl.times do\n x = rand(@hoehe)\n y = rand(@breite)\n @felder[x][y].mine? ? redo : @felder[x][y].mine_setzen \n end\n end",
"def control_F(dia,mes,anio)\r\n valdio=false\r\n if ((01..31)===dia.to_i)\r\n if((01..12)===mes.to_i)&&(es_valido(mes,dia)||(mes==\"02\"&&dia==\"29\")&& es_bisiesto(anio.to_i))\r\n if ((1000..9999)===anio.to_i)\r\n valido= true\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n return valido\r\nend",
"def excede_control_de_pago_global()\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0 # inicializacionn de variable sumatoria en cero ok\n #La idea aqui es verificar si la sumatoria de posible pago de todas las jugadas de todos los tipos de tickets activos de hoy no excede el limite globar de riesgo del sistema ok\n \n #limite GLOBAL = 1 ADMINISTRATIVO OK Y TIPOJUGADA TAMBIEN MANUAL = GLOBAL OK TED. POPULATE IT IN DATABASE PRODUCTION OK:\n control_monto_max_pago_global = Controldepagogt.where(:tipojugada => \"global\" ).first.limiteglobal.to_i || 1 # setear un valor default ok \n\n t_ids = Ticket.today.where(:activo => \"si\").ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_sumatoria_posible_pago = Jugadalot.where(:ticket_id => t_ids)# postrges casting erro string ok .sum(:posiblepago).to_i\n \n if not @listado_sumatoria_posible_pago.nil?\n @listado_sumatoria_posible_pago.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += jugada.posiblepago.to_i\n end\n \n end\n \n \n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0\n# t.each do |ticket|\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n# end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global.to_i <= control_monto_max_pago_global.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"def sigla; @nome; end",
"def es_valido(mes,dia)\r\n if(mes==\"01\"||mes==\"03\"||mes==\"05\"||mes==\"07\"||mes==\"08\"||mes==\"10\"||mes==\"12\")\r\n return (1..31)===dia.to_i\r\n else\r\n if(mes==\"04\"||mes==\"06\"||mes==\"09\"||mes==\"11\")\r\n return (1..30)===dia.to_i\r\n else\r\n return (1..28)===dia.to_i\r\n end\r\n end\r\nend",
"def peutRetourAvant?()\n return @indiceCoup < @tabCoup.size\n end",
"def RepeticionMarcaCreate(lista_tipos, nombre_tipo)\n val = true\n lista_tipos.each do |tipo|\n if tipo.descrip_tipo == nombre_tipo.upcase\n val = false\n break\n end\n end\n return val\n end",
"def clasificar\n if @sal <= 1\n \"poca\" \n elsif @sal > 1 and @sal <= 2\n \"media\"\n elsif @sal > 2\n \"mucha\"\n end\n end",
"def soma_total\n\n\t\t\n\t\tif janeiro.present?\n\t\t\tjaneiro\n\t\telse\n\t\t\tjaneiro == 0 or unless janeiro.present?\n\t\t\tself.janeiro = 0\n\t\t\tend\n\t\tend\n\t\tif fevereiro.present?\n\t\t\tfevereiro\n\t\telse\n\t\t\tfevereiro == 0 or unless fevereiro.present?\n\t\t\tself.fevereiro = 0\n\t\t\tend\n\t\tend\n\n\n\tif marco.present?\n\t\tmarco\n\telse \n\t\tmarco == 0 or unless marco.present?\n\t\tself.marco = 0\t\n\tend\nend\t\nif abril.present?\n\tabril\nelse abril == 0 or unless abril.present?\n\tself.abril = 0\nend\nend\t\nif maio.present?\n\tmaio\nelse maio == 0 or unless maio.present?\n\tself.maio = 0\nend\nend\t\nif junho.present?\n\tjunho\nelse junho == 0 or unless junho.present?\n\tself.junho = 0\nend\nend\t\nif julho.present?\n\tjulho\nelse julho == 0 or unless julho.present?\n\tself.julho = 0\nend\nend\t\nif agosto.present?\n\tagosto\nelse agosto == 0 or unless agosto.present?\n\tself.agosto = 0\nend\nend\t\nif setembro.present?\n\tsetembro\nelse setembro == 0 or unless setembro.present?\n\tself.setembro = 0\nend\nend\t\nif outubro.present?\n\toutubro\nelse outubro == 0 or unless outubro.present?\n\tself.outubro = 0\nend\nend\t\nif novembro.present?\n\tnovembro\nelse novembro == 0 or unless novembro.present?\n\tself.novembro = 0\nend\nend\t\nif dezembro.present?\n\tdezembro\nelse dezembro == 0 or unless dezembro.present?\n\tself.dezembro = 0\nend\nend\t\n\nif (self.janeiro == 0 and self.fevereiro == 0 and self.marco == 0 and \n\tself.abril == 0 and self.maio == 0 and self.junho == 0 and\t\n\tself.julho == 0 and self.agosto == 0 and self.setembro == 0 and \n\tself.outubro == 0 and self.novembro == 0 and self.dezembro == 0)\n\tself.total = 0\nelse\n\tself.total = (janeiro + fevereiro + marco + abril + \n\tmaio + junho + julho + agosto + setembro + \n\toutubro + novembro + dezembro)\nend\nend",
"def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_anbu = true\n\n for i in 0..3\n val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))\n end\n end",
"def in_peril?; @in_peril; end",
"def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend",
"def lancement(i)\nif i == 10\n puts \"Bravo vous avez gagné la partie!\"\n else\n puts \"Veuillez taper un caractère pour lancer le dé\" \n lancer_de=gets.chomp\n \nif lancer_de.empty?\n puts proba(i)\n else \n puts \"Il faut juste appuyer sur entrée!!!\"\n puts lancement(i)\n #dé_actuel=rand(1..6)\n \nend\nend \nend",
"def Traductor nume\n\nnumero = {}\nnumero[0] = \"Cero\"\nnumero[1] = \"Uno\"\nnumero[2] = \"Dos\"\nnumero[3] = \"Tres\"\nnumero[4] = \"Cuatro\"\nnumero[5] = \"Cinco\"\nnumero[6] = \"Seis\"\nnumero[7] = \"Siete\"\nnumero[8] = \"Ocho\"\nnumero[9] = \"Nueve\"\nnumero[10] = \"Diez\"\n\n\n\nreturn numero[nume.to_i]\n\n\nend",
"def segundoDigitoMenor(clave)\n\tcadena_digito = clave.to_s\n\treturn (cadena_digito[1]).to_i\nend",
"def podeCadastrarNovaTurma\n\n if (current_usuario.usuarioLimitado? && current_usuario.turmas.exists?)\n #se usuario é limitado e ja possui local\n #true -true\n return false\n end\n\n return true\n\n end",
"def test_soma_100_200\n\t\tassert_equal(300, Calculadora.new(100,200).soma)\n\tend",
"def vrat_soucet_vah(jedinec)\n soucet = 0\n citac = 0\n jedinec.each do |prvek| \n if(prvek)then\n soucet += @pole_vah[citac].to_i\n end\n citac +=1\n end\n return soucet\n end",
"def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n Pessoa.find(membros[i]).rank.downcase != 'jounin'\n return false\n end\n end\n\n ((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))\n end",
"def qual_seu_nome(nome)\r\n puts \"Seu nome é: #{nome}\"\r\n end",
"def correcto(num_casilla)\r\n if num_casilla == -1\r\n num_casilla = 0\r\n end\r\n correcto_general = @casillas.length > @num_casilla_carcel && @tiene_juez\r\n correcto_casilla = (num_casilla || num_casilla == 0) && num_casilla < @casillas.length\r\n correcto_general && correcto_casilla\r\n end",
"def test_04_dada_una_caja_de_ahorros_cuyo_saldo_es_200_pesos_si_extraigo_300_pesos_su_saldo_no_debe_variar\n @una_caja_de_ahorros_nueva.depositar 200.pesos\n @una_caja_de_ahorros_nueva.extraer 300.pesos\n assert_equal 200.pesos, @una_caja_de_ahorros_nueva.saldo\n end",
"def metodo_biseccion\n i = 0\n c_ant = 0\n c_act = 0\n\n # Valor inicial de A.\n factor = get_signo(@ecuacion.last.to_i) * -1\n a = ((@ecuacion.last.to_i.abs / @ecuacion.first.to_i.abs) ** (1.0/@grado)).to_i * factor;\n b = obtiene_valor_b(a)\n resultado = false\n\n loop do\n i += 1\n c_ant = c_act\n c_act = (a + b)/2.0\n\n if evaluar_funcion(c_act) >= 0\n a = c_act\n else\n b = c_act\n end\n\n if (c_act - c_ant).abs <= 0.001\n resultado = [c_ant, c_act, i]\n end\n\n break if (c_act - c_ant).abs <= 0.001\n end\n return resultado\n end",
"def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end",
"def issn; end",
"def clean\n puts\"Vous nettoyez votre animal \\n\"\n @mental +=10\n @health +=30\n return 4\n end",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def RepetecionNombreUpdate(lista_marcas, nombre_marca, id_marca)\n val = true\n lista_marcas.each do |marca|\n if marca.descrip_marca == nombre_marca.upcase\n if marca.id.to_i != id_marca.to_i\n val = false\n break\n end\n end\n end\n return val\n end",
"def megahertz? = unit == 'megahertz'",
"def test_m_greater_1\n assert_not_nil \"troubles\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"private\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"oaten\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"orrery\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"crepuscular\" =~ PorterStemmer::Porter1::MGR1\n end",
"def vecesRepiteNumeroEnNumero(numero, subnumero)\n\t cadena = numero.to_s\n contador = 0\n for i in 0..cadena.size\n if subnumero == cadena[i].to_i\n contador = contador + 1\n end\n end\n return contador\nend",
"def status_da_divulgacao(topico)\n end",
"def par?\n cuantos_pares >= 1\n end",
"def cumple_requisitos?\n propietario.hangar.nivel >= 6 && propietario.cuenta.tecnologia_energia.nivel >= 6 && propietario.cuenta.tecnologia_militar.nivel >= 3 && propietario.cuenta.tecnologia_defensa.nivel >= 1 && super\n end",
"def terpene; end",
"def turno_nivel_dificil\n if tem_naipe_da_rodada_ou_trunfo?\n if pontos_da_mesa > 0\n if tem_carta_maior_do_que_a_maior_carta_da_mesa?\n return joga_maior_carta\n end\n end\n end\n joga_menor_carta\n end",
"def huella_carbono\n if geidiario() < 800\n return 1\n end\n if geidiario() > 1200\n return 3\n else\n return 2\n end\n end",
"def check_stock_rango\n c = nueva_cantidad\n unless c < DECIMAL_LIMITE[:superior]\n errors.add(:cantidad, I18n.t('movimiento_mercaderia.detalle_cantidad_stock_superior', limite: DECIMAL_LIMITE[:superior]))\n false\n end\n end",
"def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def joga nome, dificuldade\n\tnumero_secreto = sortea_numero_secreto dificuldade\n\tpontos_ate_agora = 1000\n\tlimite_tentativas = 5\n\tchutes = []\n\ttentativa = 1\n\n\tfor tentativa in 1..limite_tentativas\n\t\t\n\t\tchute = pede_numero_jogador chutes, tentativa,\n\t\t\tlimite_tentativas\n\n\t\tchutes << chute\t\n\t\n\t\tif nome == \"Vinicius\"\n\t\t\tputs \"Acertou em cheio meu camarada.\"\n\t\t\tbreak\n\t\tend\n\n\t\tpontos_a_perder = (chute - numero_secreto).abs / 2.0\n\t\tpontos_ate_agora -= pontos_a_perder\n\n\t\tvitoria = verifica_se_acertou numero_secreto, chute\n\n\t\tbreak if vitoria\n\n\t\tif tentativa == 5\n\t\t\tif perdeu_por_um numero_secreto, chute\n\t\t\t\ttentativa += 1\n\t\t\t\tlimite_tentativas += 1\n\t\t\t\tchute = pede_numero_jogador chutes, tentativa, limite_tentativas\n\t\t\t\tvitoria = verifica_se_acertou numero_secreto, chute\n\t\t\t\tbreak if vitoria\n\t\t\tend\n\t\tend\n\tend\n\n\tputs \"Você ganhou #{pontos_ate_agora} pontos\"\n\tvitoria\nend",
"def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend",
"def submeter(artigo)\n atual = State.new(anterior: self)\n\n #precondicao\n raise \"artigo_ja_submetido\" if atual.submetidos.include? artigo\n\n #liveness\n atual.submetidos << artigo\n\n atual\n end",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def neginv(b) return \"@SP\\nA=M-1\\nM=\"+b+\"M\\n\" end",
"def imprime_dados()\n if @esq==-1 && @dir==-1\n puts 'no folha'\n else\n puts 'no interno ou raiz'\n puts @dir.to_s + '->' + @esq.to_s \n end\n end"
] | [
"0.6641832",
"0.6495455",
"0.6424004",
"0.6386927",
"0.63541365",
"0.63343424",
"0.6143551",
"0.61426187",
"0.6068163",
"0.6068163",
"0.5986444",
"0.5906948",
"0.5846855",
"0.5841875",
"0.58397985",
"0.58326954",
"0.5832222",
"0.582836",
"0.57880646",
"0.5786467",
"0.57599753",
"0.5747949",
"0.5737764",
"0.57287157",
"0.5716076",
"0.5709839",
"0.570522",
"0.5703616",
"0.5682985",
"0.5676114",
"0.5665273",
"0.5656295",
"0.56467944",
"0.5618461",
"0.56149143",
"0.5603768",
"0.5602785",
"0.560267",
"0.5593061",
"0.55929625",
"0.5587567",
"0.5587567",
"0.55821496",
"0.5576483",
"0.5574884",
"0.55646735",
"0.5558571",
"0.5547758",
"0.55446583",
"0.5538839",
"0.5538839",
"0.55367386",
"0.55326796",
"0.5526455",
"0.5521787",
"0.5506841",
"0.5505431",
"0.54942644",
"0.5494025",
"0.54839575",
"0.54832256",
"0.54774374",
"0.5475558",
"0.54751015",
"0.54686666",
"0.54578245",
"0.54508466",
"0.5447443",
"0.5444784",
"0.54422545",
"0.5440237",
"0.5436641",
"0.54328454",
"0.5432162",
"0.5413528",
"0.5408824",
"0.54084873",
"0.5408334",
"0.5392441",
"0.5392324",
"0.5383284",
"0.53826433",
"0.5382129",
"0.5370745",
"0.53670543",
"0.5366619",
"0.536642",
"0.53663164",
"0.536078",
"0.53567064",
"0.5354409",
"0.5353872",
"0.53509694",
"0.5349578",
"0.5349259",
"0.53428966",
"0.53413886",
"0.5340976",
"0.53381443",
"0.53375465",
"0.5337089"
] | 0.0 | -1 |
Example shows touch emulation via mouse (Limited to one finger due to how mouse input works...) This example also works with touch input. | def tick args
drtouch = DRTouch.new
drtouch.init
drtouch.update
args.outputs.background_color = [ 0, 0, 0, 255 ]
args.outputs.primitives << {
x: 320,
y: 16.from_top,
text: "TAP AND MOVE YOUR FINGER OVER THE SCREEN",
size_enum: 6,
r: 255,
g: 255,
b: 255,
a: 255,
}.label
if drtouch.down(0)
pos = drtouch.pos(0)
args.outputs.primitives << {
x: pos.x,
y: pos.y,
w: 50,
h: 50,
r: 34,
g: 155,
b: 255,
a: 255,
}.solid
args.outputs.primitives << {
x: 16,
y: 8.from_top,
text: "x1: #{pos.x}, y1: #{pos.y}",
size_enum: 2,
r: 255,
g: 0,
b: 0,
a: 255
}.label
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emulate_touch_from_mouse_event(type:, x:, y:, button:, timestamp: nil, delta_x: nil, delta_y: nil, modifiers: nil, click_count: nil)\n {\n method: \"Input.emulateTouchFromMouseEvent\",\n params: { type: type, x: x, y: y, button: button, timestamp: timestamp, deltaX: delta_x, deltaY: delta_y, modifiers: modifiers, clickCount: click_count }.compact\n }\n end",
"def mouse_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 11, \"Mouse input: inputs.mouse\")\n\n if inputs.mouse.click # if click has a value and is not nil\n state.last_mouse_click = inputs.mouse.click # coordinates of click are stored\n end\n\n if state.last_mouse_click # if mouse is clicked (has coordinates as value)\n # outputs the time (frame) the click occurred, as well as how many frames have passed since the event\n outputs.labels << small_label(x, 12, \"Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}\")\n # outputs coordinates of click\n outputs.labels << small_label(x, 13, \"Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}\")\n else # otherwise if the mouse has not been clicked\n outputs.labels << small_label(x, 12, \"Mouse click has not occurred yet.\")\n outputs.labels << small_label(x, 13, \"Please click mouse.\")\n end\n end",
"def touch_began(touch); end",
"def tap(x, y)\n # Touches appear to be lost during the first frame after navigation.\n # This waits a frame before sending the tap.\n # @see https://crbug.com/613219\n @_client.command(\n Protocol::Runtime.evaluate(\n expression: 'new Promise(x => requestAnimationFrame(() => requestAnimationFrame(x)))',\n await_promise: true\n )\n ).wait!\n\n touch_points = [{ x: x.round, y: y.round }]\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchStart',\n touch_points: touch_points,\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchEnd',\n touch_points: [],\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n end",
"def mouse_press *args\n\t\t\tevent(:mouse_press, *args)\n\t\tend",
"def touch(arg)\r\n# puts(\"#{TEST_TOUCH} #{arg}\")\r\n sys(\"#{TEST_TOUCH} #{arg}\")\r\n end",
"def mouse_motion *args\n\t\t\tevent(:mouse_motion, nil, *args)\n\t\tend",
"def touchesBegan touches, withEvent: _\n\n end",
"def dispatch_touch_event(type:, touch_points:, modifiers: nil, timestamp: nil)\n {\n method: \"Input.dispatchTouchEvent\",\n params: { type: type, touchPoints: touch_points, modifiers: modifiers, timestamp: timestamp }.compact\n }\n end",
"def mouseX; end",
"def emulate_lowrez_mouse args\n #Declares the mouse as a new entity and sets values for the x and y variables.\n args.state.new_entity_strict(:lowrez_mouse) do |m|\n m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1\n m.y = args.mouse.y.idiv(TINY_SCALE)\n\n #If the mouse is clicked, the click variable stores the mouse click's position.\n #Otherwise, the mouse is not considered to be clicked or down.\n if args.mouse.click\n m.click = [\n args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,\n args.mouse.click.point.y.idiv(TINY_SCALE)\n ]\n m.down = m.click\n else\n m.click = nil\n m.down = nil\n end\n\n #If the mouse is up, the position of the mouse is stored in the up variable.\n #Otherwise, the mouse is not considered to be up.\n if args.mouse.up\n m.up = [\n args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,\n args.mouse.up.point.y.idiv(TINY_SCALE)\n ]\n else\n m.up = nil\n end\n end\nend",
"def touchscreen_tap(selector)\n handle = query_selector selector\n raise \"No node found for selector: #{selector}\" if handle.nil?\n\n handle.tap\n handle.dispose\n nil\n end",
"def touchesBegan(touches, withEvent: event)\n\n #Get Touch coordinates\n touch = touches.anyObject\n point = touch.locationInView(self)\n\n #Check for Validity\n return unless valid_touch_location?(point)\n\n # Act Dependent on mode\n @current_point = point\n case @current_tool\n when :squiggle, :line, :circle\n @points = [@current_point]\n\n when :grab\n case @mode\n when :toys_only, :toy_selected\n touch_begin_toys_only\n when :scene\n touch_begin_scene\n when :create_new_toy\n if @selected.close_enough(@current_point)\n @drag = true\n end\n end\n end\n setNeedsDisplay\n end",
"def mouse_x\n end",
"def dispatch_mouse_event(type:, x:, y:, modifiers: nil, timestamp: nil, button: nil, buttons: nil, click_count: nil, delta_x: nil, delta_y: nil, pointer_type: nil)\n {\n method: \"Input.dispatchMouseEvent\",\n params: { type: type, x: x, y: y, modifiers: modifiers, timestamp: timestamp, button: button, buttons: buttons, clickCount: click_count, deltaX: delta_x, deltaY: delta_y, pointerType: pointer_type }.compact\n }\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def touched_by_mouse?\n\t\t\treturn false if !@shape\n\t\t\treturn SDC.mouse_touching?(@shape)\n\t\tend",
"def clicked(mouse_event)\n end",
"def triple_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.triple_click\n sleep wait\n end",
"def pick_game_element\n @level.add_mouse(@input_controller.mouse_screen_coords)\n end",
"def mouse_pressed(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.notSupported('Use webdriver directly to perform a mouse_pressed event')\nend",
"def touches()\n @view__.touches\n end",
"def check_event_trigger_touch(x, y)\r\n return false\r\n end",
"def set_mouse_position(x, y); end",
"def hello_mousevc\n\t\t\t\tputs Mousevc.art\n\t\t\t\tInput.prompt\n\t\t\tend",
"def mouse_up *args; end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def touch\n @repaint_required = true\n end",
"def tick args\n tick_instructions args, \"Sample app shows how mouse events are registered and how to measure elapsed time.\"\n x = 460\n\n args.outputs.labels << small_label(args, x, 11, \"Mouse input: args.inputs.mouse\")\n\n if args.inputs.mouse.click\n args.state.last_mouse_click = args.inputs.mouse.click\n end\n\n if args.state.last_mouse_click\n click = args.state.last_mouse_click\n args.outputs.labels << small_label(args, x, 12, \"Mouse click happened at: #{click.created_at}\")\n args.outputs.labels << small_label(args, x, 13, \"Mouse clicked #{click.created_at_elapsed} ticks ago\")\n args.outputs.labels << small_label(args, x, 14, \"Mouse click location: #{click.point.x}, #{click.point.y}\")\n else\n args.outputs.labels << small_label(args, x, 12, \"Mouse click has not occurred yet.\")\n args.outputs.labels << small_label(args, x, 13, \"Please click mouse.\")\n end\nend",
"def mouse_in(mouse_event)\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def double_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def check_event_trigger_touch(x, y)\n return false\n end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def mouse\n r = SDL::Mouse.state\n r[1] = h-r[1]\n r\n end",
"def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)\n return false unless @enabled\n\n return mouse_x.between?(@viewport.rect.x, @viewport.rect.x + @viewport.rect.width) &&\n mouse_y.between?(@viewport.rect.y, @viewport.rect.y + @viewport.rect.height)\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def update_basic\n cursor_update\n mouse_cursor\n \n checkLeftClick()\n checkClickHover()\n end",
"def touchesMoved(touches, withEvent: event)\n return unless @valid_start_location\n touch = touches.anyObject\n point = touch.locationInView(self)\n case @current_tool\n when :squiggle\n a = @points[-1]\n b = point\n if (b - a).magnitude > Constants::MAGNITUDE_DISTANCE_BETWEEN_POINTS\n @points << point\n setNeedsDisplay\n end\n when :grab\n case @mode\n when :toys_only, :scene, :toy_selected\n if @delegate.is_a?(ActionAdderViewController)\n @drag = true\n @delegate.close_popover\n end\n touch_move_scene(point)\n else\n @current_point = point\n end\n setNeedsDisplay\n when :line, :circle\n @points[1] = point\n setNeedsDisplay\n end\n end",
"def start(event)\n return stop if IS_TOUCH && `#{event.touches}.length != 1`\n\n off if @pos_method\n\n @position = position(event)\n @target = event.target\n @start_position = @position\n @mouse_is_down = true\n\n @pos_method = @body.on! EVENTS[:move] do |evt| pos(evt) end\n @up_method = @body.on! EVENTS[:up] do |evt| up(evt) end\n\n request_animation_frame do move end\n\n pos(event) if @start_distance == 0\n end",
"def update\n @touch_event_list.each do |touch_event|\n touch_event.getPointerCount.times do |index|\n touch = Touch.new(touch_event. getPointerId(index), touch_event.getX(index), touch_event.getY(index))\n #Check is touch is inside the screen use, otherwise ignore it\n if(touch.x > 0 and touch.x < @max_x and touch.y > 0 and touch.y < @max_y)\n case touch_event.getAction\n when JavaImports::MotionEvent::ACTION_DOWN\n @window.touch_began(touch)\n when JavaImports::MotionEvent::ACTION_MOVE\n @window.touch_moved(touch)\n when JavaImports::MotionEvent::ACTION_UP\n @window.touch_ended(touch)\n end\n end\n end\n end \n \n @key_event_list_down.each do |key_event|\n @window.button_down key_event\n end\n \n @key_event_list_up.each do |key_event|\n @window.button_up key_event\n end \n\n end",
"def mouse_x; mouseX; end",
"def mouse_x; mouseX; end",
"def tap_element element\n tapAction = Appium::TouchAction.new\n tapAction.tap(element: element).perform\n puts \"TAP is Working \\\\o/\"\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def context_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def touch_moved(touch); end",
"def mouseDragged event\n end",
"def pmouseX()\n @view__.pmouseX\n end",
"def mouse_pressed\n flock << Boid.new(mouse_x, mouse_y)\nend",
"def mouseX()\n @view__.mouseX\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def double_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.double_click\n sleep wait\n end",
"def check_event_trigger_touch(x, y)\n result = false\n return result\n end",
"def press(point)\n\t\t\n\tend",
"def on_mouse_move(new_point)\n end",
"def ccTouchBegan(touch, event)\n \n CGPoint location = touch.locationInView(touch.view)\n CGPoint convLoc = director.convertToGL(location)\n \n # If we reached game over, any touch returns to menu\n if isGameOver\n director.replace_scene(MenuScene.scene)\n return true\n end\n\n # If the back button was pressed, we exit\n if CGRectContainsPoint(backButton.boundingBox, convLoc)\n director.replace_scene(MenuScene.node)\n return true\n end\n\n # If we have only 0 or 1 gem in gemsTouched, track\n if gemsTouched.length < 2\n # Check each gem\n gemsInPlay.each do |aGem|\n # If the gem was touched AND the gem is idle,\n # return YES to track the touch\n if aGem.containsTouchLocation(convLoc) &&\n aGem.gemState == kGemIdle\n return true\n end\n end\n end\n\n # If we failed to find any good touch, return\n return false\nend",
"def setup_events\n # When the left mouse button is clicked (as defined below in\n # setup_actors) call the teleport method in @lobo\n @cursor1.on(:click) do |x,y|\n @lobo.teleport(x,y)\n end\n # When the space bar is pressed (see below in setup_actors) call\n # the teleport method in @lobo\n @cursor2.on(:click) do |x,y|\n @lobo.teleport(x,y)\n end\n end",
"def enable_mouse(enable = true)\n\t\trequest = Packet.create_request('stdapi_ui_enable_mouse')\n\n\t\trequest.add_tlv(TLV_TYPE_BOOL, enable)\n\n\t\tresponse = client.send_request(request)\n\n\t\treturn true\n\tend",
"def enable_mouse(enable = true)\n\t\trequest = Packet.create_request('stdapi_ui_enable_mouse')\n\n\t\trequest.add_tlv(TLV_TYPE_BOOL, enable)\n\n\t\tresponse = client.send_request(request)\n\n\t\treturn true\n\tend",
"def getMouseLocation\n def windows\n require \"Win32API\"\n getCursorPos = Win32API.new(\"user32\", \"GetCursorPos\", 'P', 'L')\n # point is a Long,Long-struct\n point = \"\\0\" * 8\n if getCursorPos(point)\n a.unpack('LL')\n else\n [nil,nil]\n end\n end\n\n def linux\n loc_string = `xdotool getmouselocation --shell`[/X=(\\d+)\\nY=(\\d+)/]\n loc_string.lines.map {|s| s[/.=(\\d+)/, 1].to_i}\n end\n\n def osx\n # if we are running in RubyCocoa, we can access objective-c libraries\n require \"osx/cocoa\"\n OSX::NSEvent.mouseLocation.to_a\n rescue LoadError\n # we are not running in ruby cocoa, but it should be preinstalled on every system\n coords = `/usr/bin/ruby -e 'require \"osx/cocoa\"; puts OSX::NSEvent.mouseLocation.to_a'`\n coords.lines.map {|s| s.to_f }\n end\n\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n windows\n when /darwin|mac os/\n osx\n when /linux|solaris|bsd/\n linux\n else\n raise Error, \"unknown os: #{host_os.inspect}\"\n end\nrescue Exception => e\n [nil,nil]\nend",
"def press(point)\n\t\t\t\t\n\t\t\tend",
"def check_event_trigger_touch_front\r\n x2 = $game_map.round_x_with_direction(@x, @direction)\r\n y2 = $game_map.round_y_with_direction(@y, @direction)\r\n check_event_trigger_touch(x2, y2)\r\n end",
"def setMousePosition _args\n \"setMousePosition _args;\" \n end",
"def click_on(id, x, y)\n # Get the position of this window id\n position = get_position(id)\n # Add the [x, y] passed in by get_position to our x and y\n x += position[0]\n y += position[1]\n # Move the mouse to (x, y), then click\n xdotool \"mousemove #{x} #{y}\"\n xdotool \"click 1\"\n # sleep $sleep_time\nend",
"def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end",
"def mouse_pressed\n # Check to see if the mouse was clicked on the box and if so create\n # a real spring and bind the mouse location to the box with a spring\n return unless box.contains(mouse_x, mouse_y)\n\n @spring = spring.bind(mouse_x, mouse_y, box)\nend",
"def mouse?\n instance.options[:mouse]\n end",
"def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)\n coords = @viewport.translate_mouse_coords(mouse_x, mouse_y)\n return coords[0].between?(@x, @x + @width) &&\n coords[1].between?(@y, @y + @height)\n end",
"def point_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 15, \"Click inside the blue box maybe ---->\")\n\n box = [765, 370, 50, 50, 0, 0, 170] # blue box\n outputs.borders << box\n\n if state.last_mouse_click # if the mouse was clicked\n if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box\n outputs.labels << small_label(x, 16, \"Mouse click happened inside the box.\")\n else # otherwise, if mouse was clicked outside the box\n outputs.labels << small_label(x, 16, \"Mouse click happened outside the box.\")\n end\n else # otherwise, if was not clicked at all\n outputs.labels << small_label(x, 16, \"Mouse click has not occurred yet.\") # output if the mouse was not clicked\n end\n\n # border around mouse input demo section\n outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def mouse_pressed\n super\n\n if mouse_button == RIGHT\n @right_mouse_down_x = mouseX\n @right_mouse_down_y = mouseY\n end\n end",
"def tick args\r\n # The addition and subtraction in the first two parameters of the label and solid\r\n # ensure that the outputs don't overlap each other. Try removing them and see what happens.\r\n pos = args.inputs.mouse.position # stores coordinates of mouse's position\r\n args.state.enemies ||= []\r\n cal_enemy args\r\n render_enemies args\r\n click_instruction args\r\n tick_instructions args, \"Mouse Trainning Program\"\r\nend",
"def fire_events_for_mouse_movement\n current_state.each {|cs| cs.fire_events_for_mouse_movement }\n end",
"def press\n\t\t@current_phase = :click\n\t\t\n\t\t\n\t\t# if there has been a mouse event\n\t\tpoint = @mouse_position_callback.call(@current_phase)\n\t\t\n\t\t\n\t\t# store the initial point to be able to trigger mouse drag\n\t\t@origin = point\n\t\t\n\t\t\n\t\t@active_action = @parse_input_callback.call(:click, point)\n\t\t@active_action.press(point)\n\t\t\n\tend",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def create\n @mouse = Mouse.new(params[:mouse])\n\n respond_to do |format|\n if @mouse.save\n format.html { redirect_to @mouse, notice: 'Mouse was successfully created.' }\n format.json { render json: @mouse, status: :created, location: @mouse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mouse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pinch direction, magnification = 1, obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.pinch direction, magnification\n sleep wait\n end",
"def input\n # If the mouse was lifted this tick\n if inputs.mouse.up\n # Set current input to none\n state.user_input = :none\n end\n\n # If the mouse was clicked this tick\n if inputs.mouse.down\n # Determine what the user is editing and edit the state.user_input variable\n determine_input\n end\n\n # Process user input based on user_input variable and current mouse position\n process_input\n end",
"def set_mouse_speed pixels\r\n command 'setMouseSpeed', pixels\r\n end",
"def mouse_pressed(x, y)\n window_point = Geo3d::Vector.new(x,y)\n\n @sphere_point_when[:mouse_down] = window_to_sphere_space(window_point)\n @sphere_point_when[:mouse_draged] = @sphere_point_when[:mouse_down]\n end",
"def set_mouse_factors(factorX, factorY); end",
"def set_mouse_pos _x, _y\n send_cmd(\"set_mouse_pos #{_x} #{_y}\")\n end",
"def update\n super\n # Process mouse operations if mouse is on screen and custom method implemented\n #if $mouse.on_screen? and @active_mod_on\n # if mouse_on_window?\n # Mouse.window_add(self)\n # end\n #end\n end",
"def touch_begin_scene\n # Check to see if the touch is near a toy\n @truly_selected = close_toy(@current_point)\n\n # Check to see if the touch is near a LineStroke\n unless @truly_selected\n @truly_selected = @strokes.reverse.detect { |stroke| stroke.close_to?(@current_point) }\n end\n if @truly_selected\n @selected = @truly_selected\n @trash_button.enabled = true\n end\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def input\n keys = Vedeu::Input::Raw.read\n\n if click?(keys)\n Vedeu::Input::Mouse.click(keys)\n\n else\n keys\n\n end\n end",
"def touchesMoved(touches, withEvent: event)\n\n # We need to ask the touch for his location according\n # to the current view\n pointInView = touches.anyObject.locationInView(self)\n\n\n # If the user is drawing a trace\n unless @current_trace.nil?\n\n # Add the touch point into the array, so it can be\n # drawing later\n @touch_points.addObject(NSValue.valueWithCGPoint(pointInView))\n\n # Evaluate how accurate is the touch in relationship\n # to the trace\n @current_trace.evaluate_point(pointInView)\n\n # Ask for repainting\n self.setNeedsDisplay\n end\n\n end",
"def mouse_pressed\n gol.init\nend",
"def double_click(*args)\n case args.length\n when 1 then click_image(args[0], true)\n when 2 then click_point(args[0], args[1], true)\n else raise ArgumentError\n end\n end",
"def tripleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def perform\n $driver.multi_touch @actions\n end",
"def pay_button_tap(x=nil, y=nil)\n x = 720 if x==nil\n y = 1421 if y==nil\n Appium::Core::TouchAction.new(self).press( x, y).release.perform\n end",
"def hitTest(point, withEvent:event)\n s = super\n if s == self && @userInteractionEnabled == false\n return nil\n end\n s\n end",
"def pointer_down(button = T.unsafe(nil), device: T.unsafe(nil), **opts); end",
"def check_event_trigger_touch(x, y)\n # not started if already running\n return false if $game_system.map_interpreter.running?\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # initialize result\n result = false\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if Cache::TouchTrigger.include?(event.trigger) &&\n event.check_event_trigger_at(x, y)\n # events were started\n result = true\n end}\n # return result\n return result\n end",
"def mouse_y\n end",
"def mouse_clicked\n\t\tputs \"+\"\n\t\tputs \"+\"\n\t\tputs \"+\"\n\t\tputs \"TreeController#mouse_clicked at (#{mouse_x},#{mouse_y})\"\n\t\t\n\t\t# get held and released nodes\n\t\t@hash = @tree.node_controller.mouse_clicked # TODO => update NodeController#mouse_clicked\n\t\t@held = @hash['held']\n\t\t@released = @hash['released']\n\n\t\t# if held is nil\n\t\tif @held.nil? and @released\n\t\t\tputs \"TreeController#mouse_clicked @held: #{@held}, @released: #{@released}\"\n\t\t\t# calculate angle based on remapped north\n\t\t\t@angle_to_write = @tree.branch_controller.angle( @released ) #returns as remapped degrees\n\t\t\t# get matching node to pass to update angle, so it can find the right string positions\n\t\t\t@match = @tree.branch_controller.find_match_of( @released )\n\t\t # update word with angle\n\t\t puts \"TreeController#mouse_clicked: RETURNABLE = \" + @tree.history_controller.returnable.word.to_s\n\t\t @tree.history_controller.add_modification( @tree.word_controller.update_angle( @angle_to_write, @released, @match, @@angle_deg, @tree.history_controller.returnable ) )\n\t\t @tree.word = @tree.history_controller.returnable\n\t\t # set @released to nil so a click elsewhere doesn't F everything up\n\t\t @released = nil\n\t\t puts \"TreeController#mouse_clicked: @released should be nil and it is \" + @released.to_s\n\t\t puts \"TreeController#mouse_clicked: @held should be nil and it is \" + @held.to_s\n\t\t # disintegrate; interpret\n\t\t disintegrate\n\t\t interpret\n\t\tend\n\t\tredraw\n\tend",
"def mouse_down()\n mouse_down_at :center, :center\n end"
] | [
"0.70344335",
"0.66133666",
"0.63074625",
"0.61381793",
"0.60940593",
"0.58070683",
"0.5750648",
"0.5720025",
"0.5717996",
"0.56786686",
"0.5646187",
"0.563888",
"0.5625886",
"0.5617192",
"0.55725396",
"0.5548815",
"0.5545369",
"0.5527475",
"0.5505151",
"0.5497132",
"0.5484873",
"0.5476841",
"0.54722613",
"0.5449512",
"0.54404026",
"0.5431246",
"0.5402084",
"0.5391523",
"0.5389442",
"0.5385573",
"0.5382874",
"0.5374569",
"0.53717226",
"0.5370787",
"0.5369422",
"0.5356004",
"0.531862",
"0.5304728",
"0.5284846",
"0.5275858",
"0.5267566",
"0.52630013",
"0.52630013",
"0.5256793",
"0.5231767",
"0.52307314",
"0.52287626",
"0.52011937",
"0.5159264",
"0.5154059",
"0.5147213",
"0.5135948",
"0.51299584",
"0.5127375",
"0.51268494",
"0.5119531",
"0.5116887",
"0.5114544",
"0.5112961",
"0.51117873",
"0.51117873",
"0.50940704",
"0.5076054",
"0.50734854",
"0.5071611",
"0.5040448",
"0.5040031",
"0.5030929",
"0.5025162",
"0.5015778",
"0.50085163",
"0.5004845",
"0.5003756",
"0.49974364",
"0.4994841",
"0.4994813",
"0.49717575",
"0.49661633",
"0.49599737",
"0.49489975",
"0.49419853",
"0.49397996",
"0.49384266",
"0.49369305",
"0.49129313",
"0.4905322",
"0.4883322",
"0.4865463",
"0.48616648",
"0.48555586",
"0.4848826",
"0.48473427",
"0.48379663",
"0.48357663",
"0.48305795",
"0.48304603",
"0.48203337",
"0.48168665",
"0.48154882",
"0.48141697"
] | 0.5853712 | 5 |
recursively calculates the sum of an array of values | def sum_rec(nums)
return 0 if nums.empty?
nums[0] + sum_rec(nums[1..-1])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_recur(array)\n#for array = []\n return 0 if array == []\n\n first_el = array.shift\n recursive_call = sum_recur(array)\n first_el + recursive_call\n\nend",
"def sum_recur(array)\n #base case\n return 0 if array.empty?\n #iterative step\n array.first + sum_recur(array[1..-1])\nend",
"def sum_recur(array)\n return 0 if array.empty?\n array.pop + sum_recur(array)\nend",
"def sum_recur(array)\n return 0 if array.length <= 0\n array[0] + sum_recur(array[1..-1])\nend",
"def sum_recursion(arr)\n return 0 if arr.empty?\n sum = arr.shift\n sum += sum_of_array(arr)\n # 2 + sum_of_array([3])\n #3 + sum_of_array([])\n\n\nend",
"def sum_array_rec(array_to_sum)\n if(array_to_sum.length > 0)\n sum = array_to_sum[0]\n sum += sum_array_rec(array_to_sum[1..-1])\n else\n 0\n end\nend",
"def sum_recur(array)\n return 0 if array.empty?\n \n array[0] + sum_recur(array[1..-1])\nend",
"def recursive_sum(array)\n return array[0] if array.length == 1\n\n array[0] + recursive_sum(array[1..-1])\nend",
"def recursive_sum(array)\n if array.length == 0\n return 0\n end\n recursive_sum(array[1..-1]) + array.first\nend",
"def sum_recur(array)\n return 0 if array.empty?\n array.first + sum_recur(array.drop(1))\nend",
"def sum_recur(array)\n return 0 if array.empty?\n array.first + sum_recur(array.drop(1))\nend",
"def sum_values(arr)\n arr.inject(:+)\n end",
"def sum_recur(array)\n return 0 if array.empty?\n val = array.last\n val + sum_recur(array.take(array.length - 1))\nend",
"def sum_recur(array)\n sum = 0\n if array.empty?\n 0\n else\n sum = array.first\n sum += sum_recur(array.drop(1))\n sum\n end\nend",
"def sum_array_recur(array)\n return nil if array.empty?\n return array[0] if array.length == 1\n\n array[0] + sum_array_recur(array[1..-1])\nend",
"def sum_of_sums(array)\r\nend",
"def sum_recur(array)\n return array.first if array.length == 1\n array[0] + sum_recur(array[1..-1])\nend",
"def sum(array) \n if array == []\n 0\n else\n array[0] + sum(array[1..-1])\n end\nend",
"def sum_recur(array)\n return 0 if array.empty?\n dup = array.dup\n return dup[0] if dup.length == 1\n sum = dup.pop + sum_recur(dup)\n\nend",
"def sum(values_array)\n values_array.inject(0) { |sum, value| sum += value }\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def sum(arr)\n return 0 if arr.empty?\n el = arr.shift\n total = sum(arr)\n total + el\nend",
"def sum(array)\n\tarray.reduce(:+)\nend",
"def iterative_sum(array)\n sum = 0\n array.each do |ele|\n sum += ele\n end\n sum\nend",
"def sum_recur(array)\n \n if array.empty?\n return 0\n elsif array.length == 1\n return array[0]\n end\n \n return sum_recur(array[0...-1]) + array[-1]\n \n\nend",
"def RecursiveSum(arrayofNumbers) \n \n # Base Case: If the array is empty, return 0. \n \n if arrayofNumbers? \n return 0\n \n # Recursive code: Adding each element to the variable by calling the method. \n \n else\n Sum = arrayofNumbers.pop \n return Sum + RecursiveSum(arrayofNumbers) \n end\nend",
"def sum_arr_rec(arr)\n return 0 if arr.length == 0\n return arr[0] if arr.length == 1\n arr[0] + sum_arr_rec(arr[1..-1])\nend",
"def iterative_sum(array)\n sum = 0\n array.each do |ele|\n sum += ele\n end\n sum\nend",
"def sum_array(array)\n array.sum\nend",
"def sum_array(array)\n array.reduce(:+)\nend",
"def sum(array)\n return 0 if array.empty?\n array.first + sum(array[1..-1])\nend",
"def sum_array(array)\n array.sum\nend",
"def iterative_sum(arr)\n total = 0\n arr.each {|num| total += num}\n return total\nend",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def sum_array_iterative(arr)\n arr.inject(0) {|sum, el| sum + el}\nend",
"def multi_dimensional_sum(arr)\n arr.flatten.sum\nend",
"def multi_dimensional_sum(arr)\n return arr.flatten.sum\nend",
"def sum(array)\n array.sum\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n\n arr.reduce(&:+)\nend",
"def sum_recur(array)\n return array[0] if array.length == 1\n array[0] + sum_recur(array.drop(1))\nend",
"def sum_recur(array)\n return array[0] if array.length == 1\n array[0] + sum_recur(array.drop(1))\nend",
"def sum(array)\n return 0 if array.empty?\n array.inject(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def sum arr\n return 0 if arr.empty?\n arr.inject(:+)\nend",
"def sum(array)\n\treturn array.reduce(:+)\nend",
"def array_sum(array)\r\n array.inject(0, :+)\r\nend",
"def sum_array(arr) \n return 0 if arr.empty?\n return arr.first if arr.length == 1\n sum_array(arr[0...- 1]) + sum_array([arr.last])\nend",
"def total_of_array(array)\n array.inject(&:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\n\nend",
"def sum_array_of_arrays(some_array) \n big_sum = 0 \n \n some_array.each do |x|\n big_sum = big_sum + sum_array(x)\n end\n \n big_sum\n \n end",
"def sum(array)\n array.reduce(0) {|base, ele|\n base+=ele\n }\n end",
"def sum_rec(numbers)\n # base case\n return 0 if numbers.empty?\n # inductive step\n numbers[0] + sum_rec(numbers[1..-1])\nend",
"def sum_of_arr(arr)\n arr.inject(:+)\nend",
"def array_sum(arr)\n if arr.length == 0\n return 0\n end\n arr.reduce(:+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |value|\n sum += value\n end\n sum\nend",
"def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend",
"def sum_depth ( x, weight = 1 )\n sum = 0\n\n x = [ x ] if x.is_a? Integer\n\n x.each do | n |\n if n.is_a? Array\n sum += sum_depth( n, weight + 1 )\n else\n sum += n * weight\n end\n end\n\n return sum\nend",
"def sum(array)\n return array.inject(0, &:+)\nend",
"def sum arr\n sum_array = 0 \n arr.each { |x| sum_array = sum_array + x } \n return sum_array\nend",
"def sum(arr)\n arr.inject(:+)\nend",
"def total(array)\n array.inject(:+)\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def sum_array (arr)\n result = 0\n arr.each do |value|\n result +=value\n end\n result\nend",
"def sum_rec(arr)\n return 0 if arr.empty?\n arr[0] += sum_rec(arr.drop(1))\nend",
"def sum_an_array(arr)\n p arr\n return 0 if arr.empty?\n return arr[0] if arr.length == 1\n # first = arr[0]\n # rest = sum_an_array(arr[1..-1])\n # total = first + rest\n left = arr[0...arr.length/2]\n right = arr[arr.length/2..-1]\n p left\n p right\n left_sum = sum_an_array(left)\n right_sum = sum_an_array(right)\n total = left_sum + right_sum\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def total(arr)\n arr.inject(:+)\nend",
"def total(array)\n\tarray.inject(:+)\nend",
"def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend",
"def total(array)\n sum = array.inject(:+)\n sum\nend",
"def sum_array(array)\n\tarray.inject do |sum, n| sum + n\n\tend\nend",
"def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend",
"def total(array)\n array.sum\nend",
"def sum_rec(num_array)\n return 0 if num_array.empty?\n\n num[0] + sum_rec(num_array.drop(1))\nend",
"def my_sum(arr)\n arr.inject(:+)\nend",
"def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend",
"def sum_array(any_array)\n any_array.inject(:+)\n end",
"def total(array)\n sum = 0\n array.inject(:+)\nend",
"def total(array)\n sum = 0\n array.inject(:+)\nend",
"def sum(in_array)\n return 0 if in_array.length == 0\n return in_array.reduce(:+)\nend",
"def sum(array)\n array.inject(0, :+)\nend",
"def sum_array(numbers)\n return numbers.sum()\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend",
"def sum_array(array)\n\tarray.inject { |sum, n| sum + n }\nend",
"def sum(array)\n array.inject(0){|sum, n| sum + n}\n end",
"def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend",
"def sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def sum(args_arr)\n args_arr.inject(:+)\nend",
"def sum_of_sums(array)\n total = 0\n until array.size == 0\n total += array.reduce(:+)\n array.pop\n end\n total\nend",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def array_sum(arr)\n return arr.reduce(0, :+)\nend"
] | [
"0.7986957",
"0.79828656",
"0.7939578",
"0.7920229",
"0.7911069",
"0.7871189",
"0.78689075",
"0.78400886",
"0.78203493",
"0.7754614",
"0.7750766",
"0.7742184",
"0.77360535",
"0.76485944",
"0.7594101",
"0.75603014",
"0.75281996",
"0.74930584",
"0.74851376",
"0.7479249",
"0.74627393",
"0.74627393",
"0.74544054",
"0.7441975",
"0.7433913",
"0.742491",
"0.7412423",
"0.74110377",
"0.7407892",
"0.7392014",
"0.7388427",
"0.7379992",
"0.7373712",
"0.73696965",
"0.7368922",
"0.7366213",
"0.73659813",
"0.7343552",
"0.7341019",
"0.73296726",
"0.7327695",
"0.7327695",
"0.7326273",
"0.7316833",
"0.7316833",
"0.7316425",
"0.7312143",
"0.72979784",
"0.7296079",
"0.7295325",
"0.72819823",
"0.728112",
"0.72751534",
"0.7274085",
"0.7272598",
"0.726161",
"0.7260505",
"0.7257416",
"0.72489893",
"0.72489893",
"0.72382134",
"0.7235524",
"0.7235232",
"0.7232171",
"0.7224612",
"0.7220092",
"0.7218858",
"0.7218858",
"0.7215022",
"0.7214916",
"0.720887",
"0.72077364",
"0.72077364",
"0.72077364",
"0.7206834",
"0.7206596",
"0.7205494",
"0.720008",
"0.7197761",
"0.71927625",
"0.7189448",
"0.7187657",
"0.71836174",
"0.71835977",
"0.7181084",
"0.71798056",
"0.71798056",
"0.7172716",
"0.71716225",
"0.71712387",
"0.717072",
"0.7169734",
"0.71674186",
"0.71657467",
"0.7165545",
"0.71622",
"0.7161957",
"0.71617115",
"0.7154136",
"0.7148061",
"0.7141258"
] | 0.0 | -1 |
FIXME make work for nested offsets | def [](*args)
case args.size
when 1
index = args[0]
if index.kind_of?(Range)
offset = index.begin
limit = index.end - index.begin
limit += 1 unless index.exclude_end?
self.limit(limit, offset)
else
by_id(ids[index])
end
when 2
offset, limit = args
self.limit(limit, offset)
else
raise ArgumentError.new("wrong number of arguments (#{args.size} for 1 or 2)")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset(*) end",
"def normalize_offset(offset); end",
"def offset; end",
"def offset; end",
"def offset; end",
"def first_offset; end",
"def first_offset; end",
"def current_offset; end",
"def x_offset; end",
"def offset(arg0)\n end",
"def derive_offsets(transitions, offsets); end",
"def derive_offsets(transitions, offsets); end",
"def normalized_offsets\n array = []\n \n if parent\n merges_array = parent.\n child_merges.\n sort_by(&:created_at)\n \n merges_array.each_with_index do |m, i|\n # Setting up the first values \n \n if m.child_offset > 0\n m.child_jingle.offset = m.child_offset\n \n m.child_jingle.absolute_offset = m.child_offset\n \n array << m.child_jingle\n if i > 0\n array.each do |a|\n array.each_with_index do |x,y|\n if a.id == m.child_jingle.id && a.absolute_offset > x.absolute_offset\n #Rails.logger.debug(\"#{a.id} vs. #{m.child_jingle.id} OFFSETS: #{a.absolute_offset} > #{x.absolute_offset}\")\n array.insert(y-1, array.delete_at(-1))\n break\n end\n \n if a.id == m.child_jingle.id && a.absolute_offset < x.absolute_offset\n #Rails.logger.debug(\"#{a.id} vs. #{m.child_jingle.id} OFFSETS: #{a.absolute_offset} < #{x.absolute_offset}\")\n array.insert(y+1, array.delete_at(-1))\n break\n end\n end\n end\n end\n else\n m.child_jingle.offset = 0\n array.unshift(m.child_jingle)\n end\n \n # Sets up the first merge\n if i == 0\n # If the first merge has a parent offset\n if m.parent_offset > 0\n m.parent_jingle.offset = m.parent_offset\n m.parent_jingle.absolute_offset = m.parent_offset\n array << m.parent_jingle\n else\n m.parent_jingle.offset = 0\n m.parent_jingle.absolute_offset = 0\n array.unshift(m.parent_jingle)\n end\n end\n \n if m.parent_offset > 0\n array[1].offset = m.parent_offset\n array.each_with_index do |a,n|\n a.absolute_offset = 0 if a.absolute_offset.nil?\n unless n == 0\n a.absolute_offset += m.parent_offset unless a.id == m.child_jingle.id\n end\n end\n end\n end\n end\n \n array = array.reverse\n \n array.each_with_index do |a,n|\n unless a.offset == 0 # Skip the first track\n Rails.logger.debug(\"MATH: #{a.id} - #{array[n+1].absolute_offset}\")\n a.absolute_offset = 0 if a.absolute_offset.blank? # In case of a nil\n array[n+1].absolute_offset = 0 if array[n+1].absolute_offset.blank? # In case of a nil\n a.offset = (a.absolute_offset - array[n+1].absolute_offset).abs\n end\n end\n #array.each {|a| Rails.logger.debug(\"OFFSET: ID#{a.id} #{a.offset}\")}\n return array\n end",
"def test_small_offset_for_index\n expected = [0x001ac4c3, 0x001bcaab, 0x001a82fe, 0x0003518e]\n 0.upto(3) do |idx|\n assert_equal expected[idx], @index.offset_for_index(idx)\n end\n end",
"def to_offset(text, position); end",
"def _lex_index_offsets; end",
"def _lex_index_offsets; end",
"def _lex_index_offsets; end",
"def _lex_index_offsets; end",
"def limit_and_offset\n r = super\n if r.first == 1\n r\n else\n [1, r[1]]\n end\n end",
"def line_for_offset(offset)\n end",
"def offset_of(member)\n self.class.offset_of(member)\n end",
"def check_offset(*)\n false\n end",
"def y_offset; end",
"def sum_offset\n offset + operand.offset\n end",
"def _lex_index_offsets=(_arg0); end",
"def _lex_index_offsets=(_arg0); end",
"def _lex_index_offsets=(_arg0); end",
"def _lex_index_offsets=(_arg0); end",
"def offsets_to_coordinates(offsets, piece, game)\n board = game.board\n coordinates = []\n current_position_index = coord_to_index(piece, board)\n # if current_position_index.nil?\n # byebug\n # end\n\n offsets.each do |offset|\n adjusted_index = current_position_index + offset\n tile = board.keys[adjusted_index].to_s if adjusted_index.between?(0,63)\n coordinates << tile\n end\n\n if coordinates.length == 1\n return coordinates[0]\n else\n return coordinates.compact\n end\n end",
"def struct_offsets(definition, offset)\n padding = 0\n offsets = []\n definition.each do |mapping|\n key, data_type = mapping\n if sizeof_type(data_type) > padding\n offset = offset + padding\n end\n\n offsets.push(offset)\n\n offset = offset + sizeof_type(data_type)\n padding = calc_padding(offset)\n end\n\n offsets\n end",
"def offset_value #:nodoc:\n start == 0 && !@group.nil? && @group['groups'][0]['doclist']['start'] > 0 ? @group['groups'][0]['doclist']['start'] : start\n end",
"def offset_for (ref)\n @xref[ref.id][ref.gen]\n rescue\n raise InvalidObjectError, \"Object #{ref.id}, Generation #{ref.gen} is invalid\"\n end",
"def index(loc, offset=0) end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def offset\n\t\t\t@position + @offset\n\t\tend",
"def at(p0) end",
"def offset_on_line(offset)\n end",
"def test_big_offset_for_index\n expected = 0x0000bbbb00000000\n assert_equal expected, @index.offset_for_index(8)\n expected = 0x0000ffff00000000\n assert_equal expected, @index.offset_for_index(9)\n end",
"def recompute_offsets()\n @header.resource_index.number_of_records = @records.length\n # @header.resource_index.next_index = 0 # TODO: How is this determined?\n\n curr_offset = PDB::Header.round_byte_length\n\n # Compute length of index...\n unless @index == []\n @index.each do |i|\n curr_offset += i.length()\n end\n end\n\n unless @appinfo.nil?\n @header.appinfo_offset = curr_offset\n curr_offset += @appinfo.length()\n end\n\n unless @sortinfo.nil?\n @header.sortinfo_offset = curr_offset\n curr_offset += @sortinfo.length()\n end\n\n ## And here's the mysterious two-byte filler.\n #curr_offset += 2\n\n unless @index.length == 0\n @index.each do |i|\n rec = @records[i.r_id]\n i.offset = curr_offset\n curr_offset += rec.length\n end\n end\n end",
"def offset()\n @offset__\n end",
"def offset\n 1\n end",
"def offsets\n\t\t\tto_return = {}\n\t\t\tpiece_length = @parent.file_1.piece_length\n\t\t\t@difference_ids.each do |id|\n\t\t\t\tto_return[id] = id * piece_length\n\t\t\tend\n\t\t\treturn to_return\n\t\tend",
"def offsetsList(ast)\n ast.filter(StructOffset).uniq.sort\nend",
"def starting_position; end",
"def pos_on_line(offset)\n end",
"def offset_matches_rule?(offset, rule_offset); end",
"def offset_matches_rule?(offset, rule_offset); end",
"def get_offset\n @offset\n end",
"def pos()\n #This is a stub, used for indexing\n end",
"def shift_output_offsets(delta)\n return if delta == 0\n @data.each do |m|\n break if m.output.start_pos.line > 1\n m.output.start_pos.offset += delta\n m.output.end_pos.offset += delta if m.output.end_pos.line > 1\n end\n end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def to_find_offset\n @offset\n end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def address_container_for_image_offset(img, offset)\n address_containers.select { |ac| \n (ac.image.base_image == img.base_image) && \n (ac.contains_image_offset? offset)\n }.first\n end",
"def index(p0) end",
"def index(p0) end",
"def view_offset\n @position + @view.position\n end",
"def starting_position=(_arg0); end",
"def offset(x, y)\n { :offset => { :x => x, :y => y } }\n end",
"def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end",
"def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end",
"def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end",
"def offset\n operation.offset\n end",
"def buildOffsetsMap(ast, offsetsList)\n offsetsMap = {}\n sizesMap = {}\n astOffsetsList = offsetsList(ast)\n astSizesList = sizesList(ast)\n raise unless astOffsetsList.size + astSizesList.size == offsetsList.size\n offsetsList(ast).each_with_index {\n | structOffset, index |\n offsetsMap[structOffset] = offsetsList.shift\n }\n sizesList(ast).each_with_index {\n | sizeof, index |\n sizesMap[sizeof] = offsetsList.shift\n }\n [offsetsMap, sizesMap]\nend",
"def call(offset = T.unsafe(nil)); end",
"def pos=(pos); end",
"def content_offset(offset, dimension)\n return 0 unless offset >= dimension\n\n offset - dimension\n end",
"def default_offset_amount\n 50\n end",
"def standard_offset\n return @standard_offset\n end",
"def b_offset\n @last_4[1].to_i\n end",
"def location_of(offset, group)\n log_no, log_offset = offset.divmod(group.size)\n block_no, block_offset = (log_offset - LOG_HEADER_SIZE).divmod(LOG_BLOCK_SIZE)\n [log_no, block_no, block_offset]\n end",
"def hash_args\n [@offset_start] + super\n end",
"def byte_offset(loc) loc.y * line_byte_size + loc.x * pixel_byte_size; end",
"def deco_pos; end",
"def get_offset\n if @offset == nil and @rep\n attribs = @rep.get_attributes \"camera\"\n if( attribs )\n eo = attribs[\"eo\"]\n if( eo.kind_of?(Array) and eo.length == 3 )\n @offset = eo\n end\n end\n @offset = false if @offset == nil\n end\n @offset\nend",
"def offset_after_match\n offset + match_length\n end",
"def get_current_offset\n @offset < 0 ? 0 : @offset\n end",
"def local_header_offset; end",
"def pos=(_arg0); end",
"def hash_offset\n super\n end",
"def offset(value)\n using(offset: value)\n end",
"def position=(_arg0); end",
"def offset_index(array, item, offset)\n if idx = array.index(item)\n idx += offset\n if idx >= array.size then idx = idx - array.size\n elsif idx < 0 then idx = array.size + idx\n end\n idx\n else\n 0\n end\n end",
"def get_offset(opts)\n phash = Hash[@processors.map.with_index.to_a]\n if opts[:before]\n offset = phash[Mdoc.get_processor(opts[:before])]\n elsif opts[:after]\n offset = phash[Mdoc.get_processor(opts[:after])] + 1\n end\n offset\n end",
"def pos()\n #This is a stub, used for indexing\n end"
] | [
"0.7270089",
"0.7125723",
"0.70936626",
"0.70936626",
"0.70936626",
"0.7032432",
"0.7032432",
"0.68590117",
"0.6700892",
"0.6677489",
"0.66478765",
"0.66478765",
"0.6264708",
"0.6193879",
"0.61311305",
"0.6130964",
"0.6130964",
"0.6130964",
"0.6130964",
"0.60879034",
"0.6087059",
"0.5967561",
"0.5963489",
"0.5959399",
"0.5950467",
"0.59432983",
"0.59432983",
"0.59432983",
"0.59432983",
"0.59401906",
"0.59314656",
"0.59253204",
"0.5912859",
"0.59027827",
"0.5901303",
"0.5901303",
"0.5901303",
"0.5901303",
"0.5900627",
"0.5894474",
"0.58823735",
"0.58756304",
"0.5857937",
"0.58373785",
"0.5801503",
"0.57763255",
"0.5752596",
"0.5745704",
"0.57417923",
"0.5741328",
"0.5741328",
"0.57344216",
"0.5733284",
"0.57155466",
"0.5705481",
"0.5705481",
"0.5705481",
"0.5705481",
"0.5705481",
"0.5705481",
"0.5705481",
"0.5705481",
"0.5704359",
"0.57008845",
"0.57008845",
"0.57008845",
"0.57008845",
"0.57008845",
"0.57008845",
"0.5666601",
"0.5661533",
"0.5661533",
"0.5659721",
"0.56565225",
"0.5638392",
"0.56298894",
"0.56298894",
"0.56298894",
"0.56238276",
"0.56218725",
"0.5611395",
"0.5608921",
"0.56052047",
"0.5603945",
"0.56037664",
"0.5582487",
"0.5580405",
"0.5569031",
"0.556488",
"0.5557057",
"0.55411804",
"0.55194527",
"0.55049324",
"0.5490057",
"0.54895383",
"0.54605436",
"0.5460024",
"0.545989",
"0.54486877",
"0.54404855",
"0.5433014"
] | 0.0 | -1 |
This method is used above (sixty_four, thirty_two) so we know whether to specify the architecture as part of the path name. | def old_version?
case @node['platform']
when 'ubuntu'
Chef::VersionConstraint.new("< 11.0").include?(@node['platform_version'])
when 'debian'
Chef::VersionConstraint.new("< 7.0").include?(@node['platform_version'])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def architecture # rubocop:disable Lint/DuplicateMethods\n @architecture ||= @name.match(PLATFORM_REGEX)[3]\n end",
"def get_p4_os_directory\n architecture = new_resource.sixty_four ? \"x86_64\" : \"x86\"\n case node[:os]\n when \"linux\"\n os = \"linux26#{architecture}\"\n when \"darwin\"\n os = \"darwin90#{architecture}\"\n when \"windows\"\n architecture = new_resource.sixty_four ? \"x64\" : \"x86\"\n os = \"nt#{architecture}\"\n end\n \"bin.#{os}\"\nend",
"def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end",
"def arch_for_filename(path)\n file = File.basename(path, File.extname(path))\n\n case file\n when /686/, /386/\n '32-bit'\n when /86_64/, /amd64/\n '64-bit'\n else\n parts = file.split('_')\n\n if parts.empty?\n raise \"Could not determine arch for filename `#{file}'!\"\n end\n\n parts.last.capitalize\n end\n end",
"def get_arch\n arch = `uname -m`\n if arch.include?(\"64\")\n return \"64\"\n else\n return \"32\"\n end\nend",
"def arch_lookup(sys_type)\n return \"x86_64\" if sys_type == \"x64-based PC\"\n return \"i386\" if sys_type == \"X86-based PC\"\n\n sys_type\n end",
"def _ARCH; Config._ARCH; end",
"def get_exotic_archname(platform_type)\n case platform_type\n when /aarch64/\n \"ARM\"\n when /ppc64le/\n \"Power\"\n else\n nil\n end\nend",
"def arch\n x86_64? ? \"amd64\" : \"i386\"\n end",
"def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend",
"def arch(internal = false)\n internal ? '64-bit' : 'x86_64'\n end",
"def arch?(what)\n\t\treturn true if (what == ARCH_ANY)\n\n\t\treturn arch.index(what) != nil\n\tend",
"def canonical_arch\n Config::CONFIG['arch'].sub(/[\\.0-9]*$/, '')\n end",
"def target_arch\n (target and target.arch) ? target.arch : (arch == []) ? nil : arch\n end",
"def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (res.body =~ /(i386|x86)/i)\r\n\t\t\tarch = $1\r\n\t\t\tif (arch =~ /i386|x86/i)\r\n\t\t\t\treturn ARCH_X86\r\n\t\t\t\t# TODO, more\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend",
"def architecture\n `uname -m`.strip\n end",
"def architecture\n `uname -m`.strip\n end",
"def architecture\n @architecture ||= `uname -m`\n end",
"def architecture\n return 'x86_64'\n end",
"def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end",
"def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end",
"def arch?(node = __getnode)\n node[\"platform_family\"] == \"arch\"\n end",
"def architecture\n 'x86_64'\n end",
"def architecture\n 'x86_64'\n end",
"def safe_architecture\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end",
"def determine_if_x86_64\n (identify_windows_architecture =~ /64/) == 0\n end",
"def get_arch\n if defined?(@arch) then return @arch else @arch = nil end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n machine = %x{pev -c #{ntdlls.first} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n machine = %x{pev -c #{file} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n arches = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/ARCH/text()')\n arch = arches.first\n if arches.count(arch) == arches.size\n arch = Integer(arch.to_s)\n @arch = '64-bit' if arch == 9\n @arch = '32-bit' if arch == 0\n else\n @arch = '32/64-bit' unless @arch\n end\n rescue Exception => e\n # puts \"error(get_arch): #{e}\"\n end\n end\n @arch\n end",
"def platform_dnlif arch\n @options['advopts'] = @defadvopts.checked?\n # No need to thread - this is simple and fast. just call the {platform}_dnilf\n case arch\n when /\\.exe$/\n dnlif_exe\n when /\\.install$/\n dnlif_linux arch\n when /\\.tgz$/\n dnlif_osx\n else\n alert \"Can't do dnlif #{arch}\"\n end\n end",
"def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end",
"def arch\n if windows? && windows_arch_i386?\n \"i386\"\n elsif solaris?\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n end\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end",
"def name\n @architecture\n end",
"def platform_name; non_framework_platforms.first; end",
"def calculate_doublepulsar_arch(s)\n s == 0 ? ARCH_X86 : ARCH_X64\n end",
"def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end",
"def arch_32_bit; :i386; end",
"def lib_name\n architecture == 'x86_64' || architecture == 'i686' ? 'lib64' : 'lib'\n end",
"def lib_name\n architecture == 'x86_64' || architecture == 'i686' ? 'lib64' : 'lib'\n end",
"def actual_arch\n arch = nil\n\n if explicit_arch.nil? == false\n arch = explicit_arch\n elsif datastore['ARCH']\n arch = datastore['ARCH']\n elsif assoc_exploit\n arch = assoc_exploit.target_arch || ARCH_X86\n end\n\n # If we still have an invalid architecture, then we suck.\n if arch.nil?\n raise NoCompatiblePayloadError, \"An architecture could not be determined by the generic payload\"\n elsif arch.kind_of?(String)\n arch = [ arch ]\n end\n\n return arch\n end",
"def arch\n return `uname -m`.chomp\n end",
"def win_64bit?\n x86_64? && (latest_version? || new_resource.version.split('.').first.to_i >= 42)\nend",
"def architecture\n data[:architecture]\n end",
"def machine_arch(arg = nil)\n set_or_return(:machine_arch, arg, kind_of: String, required: true)\n end",
"def has_pathname_length_limitations?\n # Goddamn, does Windows ever suck. Man.\n os_type =~ /^\\s*windows\\s*$/i\n end",
"def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend",
"def get_ay_fusion_guest_os(options)\n guest_os = \"sles11\"\n if not options['arch'].to_s.match(/i386/) and not options['arch'].to_s.match(/64/)\n guest_os = guest_os+\"-64\"\n end\n return guest_os\nend",
"def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end",
"def platform\n self.class.name.split(\"::\").last.gsub(/(?<=[^A-Z])[A-Z]+/, \"-\\\\0\").downcase\n end",
"def host_os_family; end",
"def host_os; end",
"def host_os; end",
"def Check_OS_Bit()\n\tif File.directory?(\"C:\\\\Program Files (x86)\")\n\t\tputs(\"OS is 64 bit\")\n\t\tos_bit = \"x64\"\n\t\treturn os_bit\n\telse\n\t\tputs(\"OS is 32 bit\")\n\t\tos_bit = \"x86\"\n\t\treturn os_bit\n\tend\nend",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def objdump_arch(arch)\n case arch\n when :amd64 then 'i386:x86-64'\n else arch.to_s\n end\n end",
"def platform_shortname\n if rhel?\n if \"rocky\" == Ohai[\"platform\"]\n \"rocky\"\n else\n \"el\"\n end\n elsif suse?\n \"sles\"\n else\n Ohai[\"platform\"]\n end\n end",
"def name\n RUBY_PLATFORM\n end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend",
"def require_arch(fname)\n arch = Config::CONFIG['arch']\n begin\n path = File.join(\"tmail\", arch, fname)\n require path\n rescue LoadError => e\n # try pre-built Windows binaries\n if arch =~ /mswin/\n require File.join(\"tmail\", 'mswin32', fname)\n else\n raise e\n end\n end\nend",
"def based_on?(parent, child)\n parent = Wow::Package::Target.new(parent) if parent.is_a? Symbol\n child = Wow::Package::Target.new(child) if child.is_a? Symbol\n platform_based_on?(parent, child) && architecture_base_on?(parent, child)\n end",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def make_universal(file_path, this_arch, other_arch)\n other_arch_file = file_path.sub(this_arch, other_arch) # create file path for other architecture...\n universal_file = file_path.sub(this_arch, 'universal') # ...and universal architecture\n run_cmd \"lipo #{file_path} #{other_arch_file} -create -output #{universal_file}\"\n run_cmd \"lipo -info #{universal_file}\"\n end",
"def agent_unpack_path\n architecture == 'x86_64' || architecture == 'i686' ? 'linux-x86-64/agent' : 'linux-x86-32/agent'\n end",
"def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end",
"def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end",
"def ios? ; RUBY_PLATFORM =~ /arm-darwin/i end",
"def only_on(*architectures)\n architectures = architectures.map do |name|\n if name.respond_to?(:to_str)\n [name]\n else name\n end\n end\n\n os_names, os_versions = Autoproj.workspace.operating_system\n matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }\n if matching_archs.empty?\n return\n elsif matching_archs.none? { |arch| !arch[1] || os_versions.include?(arch[1].downcase) }\n return\n end\n\n yield\nend",
"def supported_archs\n @supported_archs ||= Dir.glob(File.join(__dir__, 'consts', 'sys_nr', '*.rb'))\n .map { |f| File.basename(f, '.rb').to_sym }\n .sort\n end",
"def for(platform)\n case platform.to_s\n when 'amazon' then for_amazon\n when 'core_api' then for_core\n end\n end",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def p4_platform_label\n case RbConfig::CONFIG[\"target_os\"].downcase\n when /nt|mswin|mingw|cygwin|msys/\n # Ruby on windows is only MinGW via Rubyinstaller.org, though this may\n # not work on all rubies.\n # There are too many permutations of Windows p4api, to automate.\n raise 'Automatic fetching of p4api from perforce FTP is not supported on Windows'\n when /darwin19|darwin[2-9][0-9]/\n \"macosx1015#{p4_cpu(:darwin)}\"\n when /darwin/ \n \"darwin90#{p4_cpu(:darwin)}\"\n when /solaris/\n \"solaris10#{p4_cpu(:solaris)}\"\n when /linux/\n \"linux26#{p4_cpu(:linux)}\" \n end\nend",
"def arch_specific_objdump(arch)\n {\n aarch64: 'aarch64-linux-gnu-objdump',\n amd64: 'x86_64-linux-gnu-objdump',\n i386: 'i686-linux-gnu-objdump'\n }[arch]\n end",
"def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend",
"def platform_shortname\n if platform_family == 'rhel'\n 'el'\n else\n platform\n end\n end",
"def cow_to_codename_arch(cow)\n /^base-(.*)-(.*)\\.cow$/.match(cow).captures\n end",
"def architecture(file)\n return :invalid unless File.exist?(file)\n\n f = File.open(file)\n str = ELFTools::ELFFile.new(f).machine\n {\n 'Advanced Micro Devices X86-64' => :amd64,\n 'Intel 80386' => :i386,\n 'ARM' => :arm,\n 'AArch64' => :aarch64,\n 'MIPS R3000' => :mips\n }[str] || :unknown\n rescue ELFTools::ELFError # not a valid ELF\n :invalid\n ensure\n f&.close\n end",
"def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end",
"def executable_prefix(specifier = nil)\n raise Exceptions::NotImplementedError, self.class.to_s + \" not implemented\" if specifier.nil?\n [ModelDirectory, specifier].join(\"/\")\n end",
"def prefix\n (platform_family?('windows') ? 'C:/Chef/' : '/etc/chef/')\nend",
"def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend",
"def os_other\n\t\t\t\t\tnot_os_osx.not_os_linux.not_os_netbsd.not_os_freebsd.not_os_cisco.not_os_vxworks.not_os_vmware_esx.not_os_windows.not_os_aix\n\t\t\t\tend",
"def name\n @name ||= if !OS.windows? && ruby?\n MRI\n elsif ruby? && engine? && engine == 'rbx'\n Rubinius\n elsif ruby? && engine? && engine == 'maglev'\n MagLev\n elsif engine? && engine == 'jruby'\n JRuby\n end\n end",
"def is_exe? filename,system_config,platform\n obj,lib,exe=*system_config.extensions(platform)\n return filename.end_with?(exe)\n end",
"def determine_os\n @os = \"linux\"\n end",
"def determine_os\n @os = 'linux'\n end",
"def objdump_arch_supported?(bin, arch)\n return false if bin.nil?\n\n arch = objdump_arch(arch)\n `#{::Shellwords.join([bin, '--help'])}`.lines.any? { |c| c.split.include?(arch) }\n end",
"def os_name # rubocop:disable Lint/DuplicateMethods\n @os_name ||= @name.match(PLATFORM_REGEX)[1]\n end",
"def platform?(what)\n\t\t(platform & what).empty? == false\n\tend",
"def supported_platform?\n linux? || darwin?\n end",
"def initialize(path,platform,archs=[])\n super(path)\n\n @platform = platform.to_s\n @archs = archs.map { |name| name.to_s }\n end",
"def bad_xcode_select_path?\n folder == \"/\"\n end",
"def is_a_program( s )\n case ARCH\n when 'w32'\n nil\n else\n ( system \"which #{s} >/dev/null 2>&1\" ) ? 1 : nil\n end\nend",
"def make_carthage_build_path(name, platform)\n return \"Carthage/Build/#{platform}/#{name}\"\nend",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def installable_platform?\n # BACKCOMPAT If the file is coming out of a specified file, then we\n # ignore the platform. This code can be removed in RG 3.0.\n return true if @source.kind_of? Gem::Source::SpecificFile\n\n super\n end",
"def target_platform\n (target and target.platform) ? target.platform : platform\n end",
"def is_module_arch?(mod)\n mod_arch = mod.target.arch || mod.arch\n mod_arch.include? session.arch\n end",
"def looks_like_rackspace? \n has_rackspace_mac?\nend",
"def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend",
"def arch\n @header.arch\n end"
] | [
"0.7343044",
"0.68008155",
"0.6767918",
"0.6751836",
"0.6549634",
"0.64888793",
"0.6461936",
"0.64119744",
"0.63984734",
"0.6347267",
"0.63118386",
"0.6305536",
"0.6275302",
"0.62577486",
"0.62538505",
"0.624295",
"0.624295",
"0.6235481",
"0.6222411",
"0.6207273",
"0.6184887",
"0.6178931",
"0.6175227",
"0.6175227",
"0.6156934",
"0.61344177",
"0.6122205",
"0.61148006",
"0.60953426",
"0.6080814",
"0.60491186",
"0.6048186",
"0.60421646",
"0.6015552",
"0.6011063",
"0.6007442",
"0.6006497",
"0.5996931",
"0.5981986",
"0.5887952",
"0.586687",
"0.5853631",
"0.5794969",
"0.57828164",
"0.57717985",
"0.5751008",
"0.57313925",
"0.5719889",
"0.5708588",
"0.5708588",
"0.57050204",
"0.57000226",
"0.57000226",
"0.5699116",
"0.5695842",
"0.5688241",
"0.5680438",
"0.56755894",
"0.56310725",
"0.5625079",
"0.56057763",
"0.560267",
"0.56017905",
"0.56015366",
"0.56015366",
"0.55867654",
"0.5583603",
"0.5580095",
"0.5579633",
"0.55785173",
"0.5574638",
"0.5568943",
"0.5566252",
"0.5556442",
"0.5548122",
"0.5524333",
"0.55230725",
"0.5507271",
"0.5505081",
"0.5487754",
"0.5475547",
"0.5475006",
"0.5459636",
"0.544818",
"0.5446423",
"0.5441846",
"0.5436994",
"0.54367036",
"0.54364026",
"0.5430628",
"0.5417015",
"0.54085994",
"0.5396377",
"0.53895324",
"0.53895324",
"0.53882146",
"0.53875035",
"0.5387147",
"0.5377738",
"0.5372387",
"0.5370702"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_club_info
@club_info = ClubInfo.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 set_actions\n actions :all\n end",
"def define_action_helpers?; 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 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 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 before_action \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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 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 my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; 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 duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def club_info_params
params.require(:club_info).permit(:club_id, :date, :males, :females, :lowerage, :upperage, :disability, :ethnicity, :mentalhealth, :depravation, :drugsandabs, :neets, :volnum, :volhours, :volachievetraining)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] | [
"0.7123669",
"0.7054077",
"0.69472784",
"0.6902165",
"0.6736001",
"0.671985",
"0.6687218",
"0.6676269",
"0.66602534",
"0.6556639",
"0.6527985",
"0.645892",
"0.645072",
"0.64494324",
"0.6445436",
"0.64350927",
"0.6415061",
"0.6415061",
"0.6393001",
"0.6378958",
"0.6378958",
"0.63741165",
"0.636044",
"0.63547933",
"0.6285727",
"0.6278816",
"0.6246161",
"0.6227885",
"0.6225383",
"0.622309",
"0.62118614",
"0.6209478",
"0.6176166",
"0.6172476",
"0.6169111",
"0.6158942",
"0.6143792",
"0.6136175",
"0.6123085",
"0.6108703",
"0.6100308",
"0.60760003",
"0.6054003",
"0.60426265",
"0.6036683",
"0.6029898",
"0.6020772",
"0.6020169",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.60176134",
"0.6006716",
"0.6003403",
"0.6001569",
"0.5995689",
"0.5994206",
"0.599406",
"0.5985532",
"0.59828365",
"0.5977637",
"0.59767246",
"0.5970349",
"0.59662646",
"0.5966073",
"0.5966073",
"0.5957612",
"0.5951802",
"0.5950822",
"0.59498274",
"0.5942674",
"0.59319496",
"0.5931201",
"0.59265846",
"0.59238476",
"0.5918484",
"0.59172106",
"0.59133804",
"0.59125537",
"0.59080327",
"0.59065026",
"0.5906122",
"0.59027356",
"0.59009796",
"0.589672",
"0.5895543",
"0.5893694"
] | 0.0 | -1 |
=begin 1. Print a welcome message < 2. Print a promp for p/r/s < 3. Get user input < 4. Have program randomly choose p/r/s < 5. Do comparison between user input and computer input 6. Tell what each chose. 7. Tell result (paper wraps rock, etc) 8. Tell who wins/loses 9. Ask to play again =end | def play_again()
puts "Do you want to play again? (yes, no)"
play_again = gets.chomp.downcase
if play_again == "yes"
play_game()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paper_scissors_rock\n clear_screen\n draw_shovel_line\n\tputs \"\\n Play with the Sphinx's stomach to get out!\\n\"\n sleep(1)\n\tresult = rand(3).floor\n\task_user \"\\n What have you got?:\" , \" \\n\\n 1| for paper \\u{1F4C3}\\n 2| for scissors \\u{2702}\\n 3| for rock \\u{270A}\\n\\n\"\n\tsleep(0.5)\n puts \" \\u{1F449}\"\n choice = gets.chomp.to_i\n\n\tif choice == result\n\t\tsay \"\\nIt's a tie!\\n\"\n sleep(1.5)\n\t\tpaper_scissors_rock\n\telsif choice < result\n\t\tsay \"\\nSorry, you lost\\n Try again!\"\n sleep(1.5)\n\t\tpaper_scissors_rock\n\telsif choice > result\n\t\tputs \"\\n You won! Get out!!!!\\n\"\n sleep(1.5)\n draw_shovel_line\n sleep(1.5)\n\n\tend\nend",
"def play\n # print \"\\n Welcome to the game of Scissors-Paper-Rock\"\n print \"\\n Enter your name: \"\n user_name = gets.chomp\n until @user_score == @score_required || @computer_score == @score_required\n options = ['scissors', 'paper', 'rock']\n \n print \"\\nHi #{user_name}, please select 's' for scissors, 'p' for paper or 'r' for rock. \"\n \n # Display user selection:\n selected_options = gets.chomp\n \n puts \"User has selected #{user_choice}.\"\n # p user_choice\n\n # display the computer's randomised selection:\n # options = ['s', 'p', 'r']\n @computer_choice = options.sample\n # p computer_choice\n puts \"Computer has selected #{computer_choice}.\"\n\n result()\n end\n \n return @user_score > @computer_score ? (puts \"Game over! you won!\"): (puts \"Game over! Computer won!\")\n \n end",
"def introduction\n system 'clear'\n prompt(\"Each match is 5 rounds. First to 5 wins!\")\n prompt(\"Who is going first? Player or Computer? (p or c)\")\nend",
"def play_game\n display_header\n user = collect_and_validate_input \"Choose a Play (R/P/S)\", :play\n computer = %w(R P S).sample\n \n # determine who won this round\n display_header\n string = case user\n when computer\n \"It's a TIE!!!\"\n when \"P\"\n computer == \"R\" ? \"Paper covers rock! YOU WIN!\" : \"Scissors cut paper! Computer Wins!\"\n when \"R\"\n computer == \"S\" ? \"Rock breaks scissors! YOU WIN!\" : \"Paper covers Rock! Computer Wins!\"\n when \"S\"\n computer == \"P\" ? \"Scissors cut paper! YOU WIN!\" : \"Rock breaks scissors! Computer Wins!\"\n end\n puts string\n \n # ask the user if they wish to play again\n again = (collect_and_validate_input \"Would you like to go again? (Y/N)\", :again).upcase\n again == \"Y\" ? play_game : (puts \"Thanks for playing!\")\nend",
"def play_a_game\n\t#PLAYER 1 choses a valid selection of r,p,s\n\tprint \"\\nPLAYER 1, please select the corresponding number for your choice:\\n1 rock\\n2 paper\\n3 scissors\\n\\n\"\n\tchoice = gets.chomp\n\tvalidate_rps_choice(choice)\n\tplayer_1_choice = choice\n\n\tputs \"-------------------------------------------------\"\n\tprint \"\\nPLAYER 2, please select the corresponding number for your choice:\\n1 rock\\n2 paper\\n3 scissors\\n\\n\"\n\t\t#PLAYER 2 choses a valid selection of r,p,s\n\tchoice = gets.chomp\n\tvalidate_rps_choice(choice)\n\tplayer_2_choice = choice\n\n\tputs lets_see_who_wins(player_1_choice, player_2_choice)\n\nend",
"def play\n title\n divider\n puts \"Choose 'Rock', 'Paper', or 'Scissors'\"\n input = gets.strip\n input_downcase(input)\n if valid_selection?\n computer_selection\n won\n else\n play\n end\n end",
"def won\n divider\n if @input == @comp\n puts \"You picked #{@input}. Computer picked #{@comp}.\"\n puts \"\n ╦┌┬┐┌─┐ ┌─┐ ┌┬┐┬┌─┐ \n ║ │ └─┐ ├─┤ │ │├┤ \n ╩ ┴ └─┘ ┴ ┴ ┴ ┴└─┘o\"\n divider2\n puts \"Current Score: [User] #{@u_score} *** [Computer] #{@c_score}\" \n play_again\n elsif @input == \"rock\" && @comp == \"scissors\" || @input == \"paper\" && @comp == \"rock\" || @input == \"scissors\" && @comp == \"paper\"\n @u_score += 1\n puts \"You picked #{@input}. Computer picked #{@comp}.\"\n puts \"\n ╦ ╦┌─┐┬ ┬ ┬ ┬┬┌┐┌┬\n ╚╦╝│ ││ │ ││││││││\n ╩ └─┘└─┘ └┴┘┴┘└┘o\"\n divider2\n puts \"Current Score: [User] #{@u_score} *** [Computer] #{@c_score}\"\n play_again\n elsif \n @c_score += 1\n @input == \"rock\" && @comp == \"paper\" || @input == \"paper\" && @comp == \"scissors\" || @input == \"scissors\" && @comp == \"rock\"\n puts \"You picked #{@input}. Computer picked #{@comp}.\"\n puts \"\n ╦ ╦╔═╗╦ ╦ ╦ ╔═╗╔═╗╔═╗┬┬┬\n ╚╦╝║ ║║ ║ ║ ║ ║╚═╗║╣ │││\n ╩ ╚═╝╚═╝ ╩═╝╚═╝╚═╝╚═╝ooo\"\n divider2\n puts \"Current Score: [User] #{@u_score} /// [Computer] #{@c_score}\"\n play_again\n else\n puts \"You dun fucked up, I'm not even telling you the score because I don't even know how you got here bro\"\n play_again\n end\n end",
"def start_game\n\nai = ['R','P','S'].sample\n\nprompt(\"Choose paper(p), rock(r) or scissor(s)\")\nhuman = gets.chomp.upcase\n\n case\n when human == \"P\" && ai == \"P\"\n prompt(\"You chose Paper and I chose Paper: Tie\")\n when human == \"R\" && ai == \"R\"\n prompt(\"You chose Rock and I chose Rock: Tie\")\n when human == \"S\" && ai == \"S\"\n prompt(\"You chose Scissors and I chose Scissors: Tie\")\n when human == \"P\" && ai == \"R\"\n prompt(\"You chose paper and I chose Rock, you win!\")\n when human == \"R\" && ai == \"S\"\n prompt(\"You chose Rock and I chose Scissors, You win!\")\n when human == \"S\" && ai == \"P\"\n prompt(\"You chose Scissors and I chose Paper, You win!\")\n when human == \"P\" && ai == \"R\"\n prompt(\"You chose Paper and I chose Rock, You win! \")\n when human == \"S\" && ai == \"R\"\n prompt(\"You chose Scissors and I chose Rock, I win!\")\n when human == \"P\" && ai == \"S\"\n prompt(\"You chose Paper and I chose Scissors, I win\")\n when human == \"R\" && ai == \"P\"\n prompt(\"You chose Rock and I chose Paper, I win!\")\n end\nend",
"def rps\n c = ['r','p','s'].sample\n puts \"choose r, p or s\"\n u = gets\n puts \"comp chose #{c}\"\n if u==c \n puts \"you tie \"\n elsif u==\"r\"&&c==\"p\"||u==\"p\"&&c==\"s\"||u==\"s\"&&c==\"r\"\n puts 'you lose'\n else \n puts \"you win\"\n \n end\n end",
"def game \n loop do\n puts \"r for rock\"\n puts \"s for scissors\"\n puts \"p for paper\\n\"\n print \"\\nEnter one of the above to play: \"\n\n computer = \"rsp\"[rand(3)].chr\n player = $stdin.gets.chomp.downcase\n\n case [player, computer]\n when ['p','r'], ['s','p'], ['r','s']\n \tputs \"\\n\\nYou Win!\"\n when ['r','r'], ['p','p'], ['s','s']\n \tputs \"\\n\\nYou tied!\"\n else puts \"\\n\\nYou LOSE!\"\n end\n\n puts \"The computer choose: #{computer}\"\n\n puts \"Type 'yes' to continue playing.\"\n\n input = $stdin.gets.chomp.downcase \n break unless input == \"yes\"\n # use following condition if you want to enable the user to press <Enter> to conitnue\n # break unless input == \"/n\"\nend\nend",
"def menu\n puts \"Select An Option \\n1) Rock \\n2) paper \\n3) Scissors\"\n u = gets.strip.to_i\n c = rand(1..3)\n\n if u == c\n puts \"tie\"\n elsif u == 1 && c == 3 || u == 2 && c == 1 || u == 3 && c == 2\n puts \"You win!\"\n else\n puts \"You lose!\"\n end\nend",
"def rock_battle\n if computer_rand == \"p\"\n puts \"Paper beats rock.\"\n puts \"The computer won.\"\n elsif computer_rand == \"s\"\n puts \"Rock beats scissors.\"\n puts \"You won!\"\n end\nend",
"def rock_paper_scissors_game\n \n # Creates What hand (rock, paper, scissors) that the cpu uses\n def cpu_answer\n cpu_answer = rand(3)\n if cpu_answer == 0\n cpu_answer = 'Rock'\n elsif cpu_answer == 1\n cpu_answer = 'Paper'\n elsif cpu_answer == 2\n cpu_answer = 'Scissors'\n end\n end\n\n # Compares your hand and computers hand to see who won or tied\n # if tied will run the program again\n def winner(answer, computers_answer)\n if (answer.downcase == 'rock') && (computers_answer.downcase == 'paper')\n puts 'YOU LOSE'\n elsif (answer.downcase == 'paper') && (computers_answer.downcase == 'rock')\n puts 'WINNER'\n elsif (answer.downcase == 'paper') && (computers_answer.downcase == 'scissors')\n puts 'You Lose'\n elsif (answer.downcase == 'scissors') && (computers_answer.downcase == 'paper')\n puts 'WINNER'\n elsif (answer.downcase == 'scissors') && (computers_answer.downcase == 'rock')\n puts 'You Lose'\n elsif (answer.downcase == 'rock') && (computers_answer.downcase == 'scissors')\n puts 'Winner'\n else\n puts 'You both tied. Go again.'\n rock_paper_scissors_game\n exit\n end\n end\n \n # Asks if you want to play again after a winner is decided\n def play_again(play_again_response)\n while play_again_response.downcase != 'no'\n puts 'Do you want to play another round of Rock, Paper, Scissors? Yes or No?'\n play_again_response = gets.chomp\n if play_again_response.downcase == 'yes'\n puts \"OK! Lets play again!\"\n rock_paper_scissors_game\n exit\n elsif play_again_response.downcase == 'no'\n else\n puts 'You enetered '+play_again_response.capitalize+' which isnt Yes or No. Please type Yes or No if you want to play again.'\n play_again_response = gets.chomp\n end\n end\n end\n\n puts 'Rock, Paper, Scissors, Shoot!!!'\n puts 'What do you choose, Rock, Paper, or Scissors?'\n answer = gets.chomp\n\n # Gets what the user is picking for his hand (rock, paper, or scissors)\n while answer != nil\n if (answer.downcase == 'rock') || (answer.downcase == 'paper') || (answer.downcase == 'scissors')\n break\n else\n puts 'You entered '+answer.capitalize+' which isn\\'t one of the following words, Scissors, Paper, or Rock. Please try again.'\n answer = gets.chomp\n end\n end\n\n computers_answer = cpu_answer\n puts 'You chose '+answer.capitalize+' and the computer chose '+computers_answer+'!'\n winner(answer, computers_answer)\n play_again('yes')\nend",
"def user_input\n puts \"Let's play rock, paper, scissors\"\n gets.chomp\nend",
"def new_game\n puts \"Let's rochambeau!\"\n puts \"Use 'r' to choose rock, 'p' to choose paper, and 's' to choose scissors.\"\n puts \"Ready? (press any key)\"\n gets\n end",
"def game_start\n computer_choice = get_random_choice\n puts(\"Welcome to rock, paper, scissors, lizard, spock game\")\n puts(\"Please enter your choice\")\n \n # a user has 3 chances for an invalid input\n is_valid = false\n user_choice = gets.chomp\n user_choice = user_choice.downcase\n for i in 0..1\n if (!is_valid_input(user_choice))\n puts(\"Invalid input, please enter one of: rock, paper, scissors, lizard, spock\")\n user_choice = gets.chomp\n user_choice = user_choice.downcase\n else\n is_valid = true\n break\n end\n end\n\n if !is_valid\n puts(\"You've entered an invalid choice for three times, game over\")\n else\n match_status = computer_choice.is_defeat(user_choice)\n case match_status\n when 0\n puts(\"DRAW\")\n puts(\"your choice: \" + user_choice )\n puts(\"computer choice: \" + computer_choice.get_name)\n when -1 # computer lose\n puts(\"You WIN!\" )\n puts(\"your choice: \" + user_choice )\n puts(\"computer choice: \" + computer_choice.get_name)\n puts(announce_winner(user_choice, computer_choice.get_name))\n when 1 # computer win\n puts (\"You LOSE :(\")\n puts(\"your choice: \" + user_choice )\n puts(\"computer choice: \" + computer_choice.get_name)\n puts(announce_winner(computer_choice.get_name, user_choice))\n end\n end\n end",
"def intro\n puts \"|====================================|\"\n puts \"| WELCOME TO ROCK PAPER SCISSORS! |\" \n puts \"|====================================|\"\n puts \"| Choose your throw. Enter: R / P / S|\"\n puts \"| R (Rock) |\"\n puts \"| P (Paper) |\"\n puts \"| S (Scissors) |\"\n puts \"|------------------------------------|\"\n end",
"def user_choose_rps\n\tputs \"Enter rock, paper or scissors:\"\n user = gets.chomp\n user\nend",
"def run\n player1 = Player.new(\"You\")\n player2 = Player.new(\"Computer\")\n rps = RockPaperScissors.new\n\t\tbegin\n\t\t\tputs \"---------Play Rock Paper Scissors!----------------\"\n\n\t\t\tplayer1.choose_by_input\n\t\t\tplayer2.choose_by_rand\n\n\t\t\tputs \"#{player1.name} picked #{player1.gesture}, and #{player2.name} picked #{player2.gesture}\"\n\n\t\t\trps.arbitrate(player1, player2)\n\n\t\t\tputs \"Do you want to play again? (Y/N)\"\n\t\t\tplay=gets.chomp.downcase\n\t\t\tplay = ( play =='y') ? TRUE: FALSE\n\n\t\tend while play==TRUE\n\tend",
"def check_who_win(user_input, computer_input)\n if user_input == computer_input\n 'Haha! It is draw! You can try again!'\n elsif user_input == 'R'\n if computer_input == 'S'\n 'Wow! Rock smashes Scissors! You Win!'\n elsif computer_input == 'P'\n 'Oh! Paper covers Rock! You Lose!'\n end\n elsif user_input == 'P'\n if computer_input == 'R'\n 'Wow! Paper covers Rock! You Win!'\n elsif computer_input == 'S'\n 'Oh! scissors cuts Paper! You Lose!'\n end\n elsif user_input == 'S'\n if computer_input == 'P'\n 'Wow! Scissors cuts Paper! You Win!'\n elsif computer_input == 'R'\n 'Oh! Rock smashes Scissors! You Lose!'\n end\n end\nend",
"def comp_choose_rps\n\trand_num = rand(3) \n\tif rand_num == 1 \n\t \"rock\"\n\telsif rand_num == 2 \n\t \"paper\"\n\telse \n\t \"scissors\"\n\tend\nend",
"def display_what_beats_what\n if human.choice == 'rock' && computer.choice == 'scissors' ||\n human.choice == 'scissors' && computer.choice == 'rock'\n puts 'Rock crushes scissors!'\n elsif human.choice == 'rock' && computer.choice == 'lizard' ||\n human.choice == 'lizard' && computer.choice == 'rock'\n puts 'Rock crushes lizard!'\n elsif human.choice == 'paper' && computer.choice == 'rock' ||\n human.choice == 'rock' && computer.choice == 'paper'\n puts 'Paper covers rock!'\n elsif human.choice == 'paper' && computer.choice == 'spock' ||\n human.choice == 'spock' && computer.choice == 'paper'\n puts 'Paper disproves Spock!'\n elsif human.choice == 'scissors' && computer.choice == 'paper' ||\n human.choice == 'paper' && computer.choice == 'scissors'\n puts 'Scissors cut paper!'\n elsif human.choice == 'scissors' && computer.choice == 'lizard' ||\n human.choice == 'sizard' && computer.choice == 'scissors'\n puts 'Scissors decapitates lizard!'\n elsif human.choice == 'lizard' && computer.choice == 'spock' ||\n human.choice == 'spock' && computer.choice == 'lizard'\n puts 'Lizard poisons Spock!'\n elsif human.choice == 'lizard' && computer.choice == 'paper' ||\n human.choice == 'paper' && computer.choice == 'lizard'\n puts 'Lizard eats paper!'\n elsif human.choice == 'spock' && computer.choice == 'rock' ||\n human.choice == 'rock' && computer.choice == 'spock'\n puts 'Spock vaporizes rock!'\n elsif human.choice == 'spock' && computer.choice == 'scissors' ||\n human.choice == 'scissors' && computer.choice == 'spock'\n puts 'Spock smashes scissors!'\n end\n end",
"def play(answer)\n until answer.downcase != \"y\"\n puts \"#{$scores[:player1_name]}, I assume that you already know the rules ;)\"\n puts \"Let's go!\"\n r = rand(3)\n computer_rps = $rps[r]\n puts \"Please enter 'R' for Rock, 'P' for Paper or 'S' for Scissors:\"\n player_rps = gets.chomp\n player_rps.upcase!\n case player_rps\n when \"R\"\n player_rps = \"Rock\"\n when \"P\"\n player_rps = \"Paper\"\n when \"S\"\n player_rps = \"Scissors\"\n else\n player_rps = \"Error\"\n end\n if player_rps != \"Error\"\n puts evaluate(player_rps, computer_rps)\n puts get_scores()\n else\n puts \"Error! you have enter something else than R, P or S\"\n end\n puts \"Do you want to play again? y/Y or n/N\"\n answer = gets.chomp\n end\n puts \"Thank you, bye!\"\nend",
"def play\n @moves = ['rock', 'paper', 'scissors',]\n @player_choice = $stdin.gets.chomp.downcase\n @opponent_choice = @moves.sample\n end",
"def rps(choice)\n choice = choice.capitalize\n rps = [\"Rock\", \"Paper\", \"Scissors\"]\n computer_choice = rps[rand(3)]\n return \"You: #{choice}, Computer: #{computer_choice}, Draw\" if choice == computer_choice\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Rock\" && computer_choice == \"Scissors\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Rock\" && computer_choice == \"Paper\"\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Paper\" && computer_choice == \"Rock\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Paper\" && computer_choice == \"Scissors\"\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Scissors\" && computer_choice == \"Paper\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Scissors\" && computer_choice == \"Rock\"\nend",
"def player_input\n loop do\n puts \"Type 'r', 'p' or 's'.\\n\"\n computer_choice = strategy_implement(strategy)\n input = gets.chomp.downcase\n if input == 'r'\n value = {rock: 1}\n player_choice.clear\n player_choice.merge!(value)\n puts \"Rock\\n\"\n play_game(value.keys.pop, computer_choice)\n @previous_player_choice = value\n add_player_choice_to_log\n elsif input == 'p'\n value = {paper: 1}\n player_choice.clear\n player_choice.merge!(value)\n puts \"Paper\\n\"\n play_game(value.keys.pop, computer_choice)\n add_player_choice_to_log\n @previous_player_choice = value\n elsif input == 's'\n value = {scissors: 1}\n player_choice.clear\n player_choice.merge!(value)\n puts \"Scissors\\n\"\n play_game(value.keys.pop, computer_choice)\n add_player_choice_to_log\n @previous_player_choice = value\n elsif input == 'exit'\n exit_message\n break\n else\n puts \"That is not a valid choice - please try again\"\n end\n end\n end",
"def play_game\n until win_game? == true do\n get_user_selection\n get_comp_selection\n play_round\n end #end of until\n\n #adding option to play best of out of 5\n puts \"You you like to play best out of 5? (enter \\\"yes\\\" or \\\"no\\\")\"\n user_answer = gets.chomp.downcase\n\n if user_answer == \"y\" || user_answer == \"yes\"\n until best_out_of_five? == true do\n get_user_selection\n get_comp_selection\n play_round\n end\n else\n puts \"Until next time, have a great day!!\"\n end\n\n end",
"def play_game\n\t#user_choose_rps \n\tcomp_choice = comp_choose_rps #<-- no need to use this because it's used once \n\tuser_choice = user_choose_rps \n\tputs \"The computer chose #{comp_choice}. You chose #{user_choice}.\" \n\tputs get_winner(comp_choice, user_choice) \n\treplay \nend",
"def rpc\n puts \"Rock Paper Scissors?\"\n user_choice = gets.strip\n cpu_choice = ['rock', 'paper', 'scissors'].sample\n puts cpu_choice\n if user_choice === cpu_choice\n puts 'Tie'\n else\n case user_choice\n when 'rock'\n result = (cpu_choice === 'scissors') ? 'Win' : 'Lose'\n puts result\n when 'paper'\n result = (cpu_choice === 'rock') ? 'Win' : 'Lose'\n puts result\n when 'scissors'\n result = (cpu_choice === 'paper') ? 'Win' : 'Lose'\n puts result\n else\n user_choice\n end\n end\nend",
"def rps_game\n puts \"Player 1 enter rock, paper, or scissors: \"\n player1 = gets.chomp\n puts \"Player 2 enter rock, paper, or scissors: \"\n player2 = gets.chomp\n if player1 != \"rock\" || player1 != \"paper\" || player1 != \"scissors\"\n puts \"Player 1 MUST enter rock, paper, or scissors! \"\n elsif player2 != \"rock\" || player2 != \"paper\" || player2 != \"scissors\"\n puts \"Player 2 MUST enter rock, paper, or scissors! \"\n elsif player1 == \"rock\" && player2 == \"paper\"\n puts \"Player 2 wins\"\n elsif player1 == \"rock\" && player2 == \"scissors\"\n puts \"Player 1 wins\"\n elsif player2 == \"rock\" && player1 == \"paper\"\n puts \"Player 1 wins\"\n elsif player2 == \"rock\" && player1 == \"scissors\"\n puts \"Player 2 wins\"\n elsif player1 == \"paper\" && player2 == \"scissors\"\n puts \"Player 2 wins\"\n elsif player1 == \"paper\" && player2 == \"rock\"\n puts \"Player 2 wins\"\n else\n puts \"Its a tie!\"\n end\nend",
"def play()\n \n begin\n \n @computer_choice = get_computer_choice()\n @player_choice = get_player_choice()\n \n result = logic(@computer_choice, @player_choice)\n\n get_choices()\n \n case result\n\n when \"tie\"\n @rounds -= 1\n @ties += 1\n puts \"[~] it's a tie !\"\n \n when \"player win\"\n @rounds -= 1\n @player_wins += 1\n puts \"[$] Player win this round (#{@player_wins}/3)!\"\n\n when \"computer win\"\n @rounds -= 1\n @computer_wins += 1\n puts \"[$] Computer win this round (#{@computer_wins}/3)!\"\n\n end\n\n rescue Interrupt\n\n puts \"\\n\\n[!] Keyboard interrupt, Exting.\"; exit()\n \n \n end\n \n\n end",
"def winning_msg(player_input, computer_input)\n puts \"You chose #{player_input} and the computer chose #{computer_input}. \\n You win!\"\nend",
"def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend",
"def human_vs_computer_game\n game = nil\n puts \"Get three in a row to win!\"\n puts \" \"\n puts \"Do you want to be X? Enter y/n\"\n selection = gets.strip\n if selection == \"y\"\n game = Game.new(Players::Human.new(\"X\"), Players::Computer.new(\"O\"))\n elsif selection == \"n\"\n game = Game.new(Players::Computer.new(\"X\"), Players::Human.new(\"O\"))\n else\n puts \"Please enter a valid response\"\n selection = gets.strip\n end\n game.play\n play_again?\n end",
"def prompt(guess, answer, tried_again)\n\n\tif guess == answer\n\n\t\t# if a user wins give them the option to play the game again\n\n\t\tputs \"Congratulations! You chose wisely\" \n\t\tputs \"Would you like to play again? Yes or No?\"\n\t\t\ttried_again = false\n\t\t\tanswer_2 = gets.chomp.downcase\n\t\t\tcase answer_2\n\t\t\t\twhen \"yes\" then start_game(tried_again)\n\t\t\t\twhen \"y\" then start_game(tried_again)\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\tend\n\telse\n\n\t\t# tell the user if their guess are 'higher' or 'lower' than the correct number\n\n\t\tif guess > answer \n\t\t\tputs \"You chose too high with #{guess}.\"\n\t\t\tif tried_again == true \n\t\t\t\tanswer_temp(guess, answer)\n\t\t\tend\n\t\telse\n\t\t\tputs \"You chose too low with #{guess}.\"\n\t\t\tif tried_again == true \n\t\t\t\tanswer_temp(guess, answer)\n\t\t\tend\n\t\tend\n\n\t\t# give them the option to play the game again\n\n\t\tputs \"Would you like to try again? Yes or No?\"\n\t\t\ttried_again = true\n\t\t\tanswer_2 = gets.chomp.downcase\n\t\t\tcase answer_2\n\t\t\t\twhen \"yes\" then input(answer, tried_again)\n\t\t\t\twhen \"y\" then input(answer, tried_again)\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\tend\n\tend\n\nend",
"def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend",
"def print_result(user_input, computer_input, who_win)\n puts ''\n puts '================================================='\n puts ''\n puts \"You choose: #{transfer_input_string(user_input)}\"\n puts \"The computer chooses: #{transfer_input_string(computer_input)}\"\n puts \"***** #{who_win} ******\"\n puts ''\n puts '================================================='\n puts ''\nend",
"def prompt\n until game_won? || game_tied?\n\n display_board\n puts \"Player #{@current_player.name}, it's your turn!\"\n puts \"Please enter the numbered square where you'd like to player you #{@current_player.mark}\"\n input_square = get_input\n\n until input_square && @board.is_clear?(input_square)\n puts \"Sorry, that's not an option. Try again!\"\n input_square = get_input\n end\n\n play(@current_player.mark, input_square)\n switch_player\n\n end\n\n if game_tied?\n display_board\n puts 'GAME TIED!'\n else\n switch_player\n display_board\n puts \"#{@current_player.name.upcase} WINS THE GAME!\"\n end\n end",
"def display_results(player, computer)\n if win?(player, computer)\n prompt 'You won!'\n elsif win?(computer, player)\n prompt 'You lost!'\n else\n prompt \"It's a tie!\"\n end\nend",
"def play\n while(true)\n answer1 = @human.choose\n answer2 = @computer.choose\n puts self.win?(answer1,answer2)\n self.continue?\n end\n end",
"def play\n #keep running this loop till game over. could also do while both lives > 0 instead of definding game over\n until game_over do\n \n next_round\n \n # setting current player\n current_player = @players[0]\n \n # player is asked question via chomps\n new_question = Question.new\n puts \"#{current_player.name}: What does #{new_question.num_1} plus #{new_question.num_2} equal?\"\n answer = $stdin.gets.chomp.to_i\n if answer == new_question.answer\n puts \"#{current_player.name}: YES! You are correct.\"\n else \n puts \"#{current_player.name}: Seriously? No!\"\n current_player.hp_loss\n end\n \n # show game status\n current_hp\n\n #could add sleep (sleep 1) to add wait time between rounds\n\n end\n # show winner once above until loop is done\n display_winner\n\n end",
"def play_to_n\n puts \"Prepare to battle your opponent!\\n\\nYour weapons: A rock, a piece of paper, and a pair of scissors.\\n\\nThe rock will crush the scissors, the paper will smother the rock, and the scissors will cut the paper to shreds. The first player to win the following number of games wins the battle. What number would you like to play to?: \"\n \n @num_of_games = gets.chomp.to_i\n until @num_of_games > 0 && @num_of_games.class == Fixnum\n puts \"Your answer was not recognized, please try again.\"\n @num_of_games = gets.chomp.to_i\n @num_of_games\n end\n \n # Public: #players_choose\n # Sets each player's move to a unique variable then prints what each player chose.\n #\n # Parameters:\n # None.\n #\n # Returns:\n # Prints two sentences stating what move each player chose.\n #\n # State Changes:\n # Sets @p1_game_move and @p2_game_move.\n \n def players_choose\n @p1_game_move = @player1.p1_moves\n @p2_game_move = @player2.p2_moves\n puts \"#{@player1.name} chooses: #{@p1_game_move}\\n\" + \"#{@player2.name} chooses: #{@p2_game_move}\"\n end\n\n # Public: #determine_winner\n # Determines which player won based on each round's moves.\n #\n # Parameters:\n # None.\n #\n # Returns:\n # Prints out tie, or if there was not a tie, which player won and what the score is.\n #\n # State Changes:\n # None.\n \n # def determine_winner\n # players_choose\n # if @p1_game_move == @p2_game_move\n # puts \"Tie!\"\n # format\n # elsif @p1_game_move == \"rock\" && @p2_game_move == \"scissors\" || @p1_game_move == \"paper\" && @p2_game_move == \"rock\" || @p1_game_move == \"scissors\" && @p2_game_move == \"paper\"\n # @player1.p1_win\n # puts \"#{@player1.name} wins!\\n\" \"The score is: #{@player1.name} - #{@player1.score}\\t #{@player2.name} - #{@player2.score}\"\n # format\n # else\n # @player2.p2_win\n # puts \"#{@player2.name} wins!\\n\" \"The score is: #{@player1.name} - #{@player1.score}\\t #{@player2.name} - #{@player2.score}\"\n # format\n # end\n # end\n\n # Public: #game_loop\n # Continues the game each round until a player has won the stated number of games.\n #\n # Parameters:\n # None.\n #\n # Returns:\n # The determine_winner method\n #\n # State Changes:\n # None.\n \n def game_loop\n until @player1.score >= @num_of_games || @player2.score >= @num_of_games do\n #determine_winner\n @rules.determine_winner\n end\n end\n \n # Public: #play\n # Initiates the game loop and prints who the winner is once the game is over.\n #\n # Parameters:\n # None.\n #\n # Returns:\n # A puts statement which states who the overall winner is.\n #\n # State Changes:\n # None.\n \n def play \n game_loop\n if @player1.score >= @num_of_games\n puts \"#{@player1.name} is the WINNER!\"\n elsif @player2.score >= @num_of_games\n puts \"#{@player2.name} is the WINNER!\"\n end\n end\n \n # Public: #format\n # Separates each round with a line of dashes.\n #\n # Parameters:\n # None.\n #\n # Returns:\n # Sixty dashes.\n #\n # State Changes:\n # None.\n \n def format\n puts \"-\" * 60\n end\n\nend",
"def print_what_each_player_picked player_picked, comp_picked\n puts \"You picked #{player_picked} and Computer picked #{comp_picked}\"\nend",
"def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end",
"def welcome_message_for_user_as_codemaker\n puts \"OK, great! You're the codemaker.\"\n puts \"In order to play, you need to think up a secret code with 4 spots.\"\n puts \"The colors you can choose from are: red, blue, green, yellow, purple, and orange.\"\n puts \"Hit enter when you're ready for my first guess!\"\n get_input\n end",
"def record_users_choice input\n\n if input == \"p\"\n player_picked = \"Paper\"\n elsif input == \"r\"\n player_picked = \"Rock\"\n elsif input == \"s\"\n player_picked = \"Scissors\"\n end\nend",
"def explain_game\n\t\tputs \"In the Secret Number Game, you guess a number between 1 and 10 and, if you pick the right number, you win!\"\n\t\tputs \"Good luck #{@player}!\"\n\tend",
"def determine_what_comp_picks\n random = [1,2,3].shuffle\n choice = random[0]\n\n if choice == 1\n comp_picked = \"Paper\"\n elsif choice == 2\n comp_picked = \"Rock\"\n elsif choice == 3\n comp_picked = \"Scissors\"\n end\n\nend",
"def encourage\n r = rand(4)\n if r == 0\n puts \"Watch out world, here comes the next great multiplier!\\n\"\n elsif r == 1\n puts \"I haven't seen these kind of skills since ancient Egypt!\\n\"\n elsif r == 2\n puts \"You're so good you could take on Einstein!\\n\"\n else\n puts\"You're really tearing it up now!\\n\"\n end\nend",
"def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend",
"def play_again\n prompt = TTY::Prompt.new\n choices = [\n {name: 'Yes', value: 1},\n {name: 'No', value: 2},\n ]\n players_input = prompt.select(\"Would You like to play again?\", choices) \n case players_input\n when 1\n execute_game\n when 2\n main_menu\n end \nend",
"def start\nputs \" \"\nputs \" \"\nputs \" --- The Escape --- \"\nputs\" ----------------\"\nputs\"|1) New Game |\"\nputs\"|2) Load Game |\"\nputs\"|3) Intro |\"\nputs\"|4) About |\"\nputs\"|5) Exit |\"\nputs\" ---------------- \"\n$choice=0\n until (($choice>=1)&&($choice<=5)) do\nputs \"Chose your option:\"\n$choice = gets.chomp.to_i\nend\n\nif ($choice==4)\nabout\nstart\nend\n\nif ($choice==3)\nintro\nstart\nend\n\nif ($choice==5)\nclose\nend\n\nif ($choice==2)\nload_game\nend\n\nif ($choice==1)\nnew_game\nend\n\n end",
"def choose_user_input\n begin\n puts 'Please choose one of the following:'\n puts ' R ==> Rock'\n puts ' P ==> Paper'\n puts ' S ==> Scissors'\n user_input = gets.chomp.upcase\n end while !['R', 'P', 'S'].include?(user_input)\n user_input\nend",
"def rps_game()\n print \"Player 1: Rock, paper, scissors? \"\n move1 = gets.chomp.downcase\n print \"Player 2: Rock, paper, scissors? \"\n move2 = gets.chomp.downcase\n\n if move1 == \"rock\"\n if move2 == \"rock\"\n puts \"It's a tie\"\n elsif move2 == \"paper\"\n puts \"Player 2 wins\"\n elsif move2 == \"scissors\"\n puts \"Payer 1 wins\"\n else\n puts \"Wrong input!\"\n end\n elsif move1 == \"paper\"\n if move2 == \"rock\"\n puts \"Player 1 wins\"\n elsif move2 == \"paper\"\n puts \"It's a tie\"\n elsif move2 == \"scissors\"\n puts \"Player 2 wins\"\n else\n puts \"Wrong input!\"\n end\n elsif move1 == \"scissors\"\n if move2 == \"rock\"\n puts \"Player 2 wins\"\n elsif move2 == \"paper\"\n puts \"Player 1 wins\"\n elsif move2 == \"scissors\"\n puts \"It's a tie\"\n else\n puts \"Wrong input!\"\n end\n else\n puts \"Wrong input!\"\n end\nend",
"def intro #passes tests, quick and dirty to make it playable\n puts \"Welcome to Tic Tac Toe, please select:\"\n puts \"1. Human versus Computer.\"\n puts \"2. Human versus Human.\"\n puts \"3. Watch Computer versus Computer.\"\n puts \"4. Exit.\"\n input = gets.strip.to_i\n if input == 1\n player1 = Human.new(\"X\")\n player2 = Computer.new(\"O\")\n game = Game.new(player1, player2)\n game.play\n intro\n elsif input == 2\n player1 = Human.new(\"X\")\n player2 = Human.new(\"O\")\n game = Game.new(player1, player2)\n game.play\n intro\n elsif input == 3\n player1 = Computer.new(\"X\")\n player2 = Computer.new(\"O\")\n game = Game.new(player1, player2)\n game.play\n intro\n elsif input == 4\n\n else intro\n end\n\n end",
"def get_user_input\n\n\tputs \"What is your name\"\n\t@name = gets\n\tputs \"You are about to enter the world of wrestling, if you want to step foot in it then you will be remembered with your ring name, not as #{@name}\"\n\tputs \"So speaking about ring names, What is your Ring name?\"\n\t@ring_name = gets\n\tputs \"A catchphrase is a thing that you like to say?\"\n\tputs \"What is your catchphrase?\"\n\t@catchphrase = gets\n\tputs \"What is your insult?\"\n\t@insult = gets\n\tputs \"What is your theme song\"\n\t@theme_song = gets\n\tputs \"What are the lyrics of your theme song\"\n\t@lyrics_of_theme_song = gets\n\tputs \"The Indie Circuit is where most people start, if you get promoted to the big leagues maybe you need to change your gimmick.\"\n\tputs \"If you decide to be in the Indies, What will the company be called?\"\n\t@company_indies = gets\n\tputs \"The big leagues are the places where very few people start, it is the main place of wrestling\"\n\tputs \"If you decide to be in the big leagues, you can choose either real or fictional companies, what will the fictional one be called?\"\n\t@company_big_leagues = gets\n\tputs \"If you want to be in a team, what will it be called. if you want to be a singles competitor then just put enter and select\n\tthe choice that you don't want to be in a tag team.\"\n\t@team_name = gets\n\tputs \"Who is your partner, just put a random name if you dont want to be in the tag team\n\tand do the same thing as the last question told you.\"\n\t@partner_tag_first = gets\n\tputs \"Getting back to the fictional company, what will your boss be called?\"\n\t@boss_name = gets\n\tputs \"who is the interviewer for the indies?\"\n\t@interviewername = gets\n\tputs \"If you are a heel during your debut in indies or big leagues, who will be your rival?\"\n\t@rival_name = gets\n\tputs \"but If you are a face during your debut in the indies or big leagues, who will be your rival?\"\n\t@rival_name_face = gets\n\tputs \"Ok so lets get to the story\"\n\n\nend",
"def present_test(challenge)\n\n\tConsole_Screen.cls #clear the display area\n\tprint challenge + \"\\n\\n: \" #display the challenge sentence\n\tresult = STDIN.gets #collect the player's input\n\tresult.chop! #remove the end of line marker\n\n\t#analyze the player input and see if it is correct\n\tif challenge == result then\n\n\t#keep track of the number of corretly retyped challenge sentences \n\t$noRight += 1\n\tConsole_Screen.cls #clear the display area\n\t#keep player informed\n\tprint \"Correct!\\n\\nPress Enter to continue.\"\n\tConsole_Screen.pause #pause the game\n\nelse \n\n\tConsole_Screen.cls #clear the diplay area\n\t#keep the player informed\n\tprint \"Incorrect!\\n\\nPress Enter to continue\"\n\tprint \" Correct sentence: \" + challenge.to_s + \"\\tYour sentence: \" + result.to_s \n\tConsole_Screen.pause #clear the game\n\nuntil result != \" \"\n\n\tConsole_Screen.cls #clear the diplay area\n \n #prompt the playwer for permission to bein the test\n print \"You have to type something \"\n\n result = STDIN.gets #collect the player's response \n result.chop! #remove any extra characters appended to the string\t\nend\nend\nend",
"def intro\n\tputs \"Welcome to the Secret Number game!! Created by Jason Haas.\"\n\tputs \"What is your name?\"\n\tplayer_name = gets.chomp\n\tputs \"Hi #{player_name}!!\"\n\tputs \"For this game you must guess a number between 1 and 10. You have 3 tries to guess correctly.\"\n\t# player_name\t\t# return the player_name\nend",
"def display_results(man, cpu)\n if win?(man, cpu)\n prompt(\"#{man} against #{cpu}. You won!\")\n elsif win?(cpu, man)\n prompt(\"#{man} against #{cpu}. You lost!\")\n else\n prompt(\"#{man} against #{cpu}. It's a tie!\")\n end\nend",
"def ask_user\n\tmessages = [\"You will get it!\", \"Sorry it won't happen\", \"You bet\", \"No way\", \"Maybe\", \"It depends on you\", \"I believe in you\", \"The odds are against you\"]\n\tquestion = puts \"This is magic 8-Ball. Do you want to shake the eight ball? Y/N\"\n\tuser_response = gets.chomp.capitalize\n\twhile(true)\n\t\tif user_response == \"Y\" || user_response == \"Yes\"\n\t\t\tputs messages[rand(0..7)]\n\t\t\task_user\n\t\t\tbreak\n\t\telsif user_response == \"N\" || user_response == \"No\"\n\t\t\tputs \"Bye!\"\n\t\t\tbreak\n\t\telse\n\t puts \"Type Y/N please\"\n\t ask_user\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def rps(user_hand)\nuser_hand.downcase!\ncomp_hand = [\"rock\", \"paper\", \"scissors\"].sample\n# \"rock\" < \"paper\"=== tru\n# \"rock\" > \"scissor\"\n# \"paper\" < \"scissor\"\n if (comp_hand == \"rock\" && user_hand == \"paper\") || \n (comp_hand== \"scissors\" && user_hand == \"rock\") || \n (comp_hand== \"paper\" && user_hand == \"scissors\")\n \"user had #{user_hand} and computer had #{comp_hand}. User wins!\"\n elsif comp_hand == user_hand\n \"user had #{user_hand} and computer had #{comp_hand}. Draw!\"\n else \n \"user had #{user_hand} and computer had #{comp_hand}. Computer wins!\"\n end\nend",
"def welcome\n puts \"Welcome to MASTERMIND\"\n puts \"Would you like to (p)lay, read the (i)nstructions, or (q)uit?\"\n piq = gets.chomp\n if piq == \"play\" || piq == \"p\" || piq == \"(p)\"\n setup\n elsif piq == \"instructions\" || piq == \"i\" || piq == \"(i)\"\n instructions\n elsif piq == \"quit\" || piq == \"q\" || piq == \"(q)\"\n quit\n else\n puts \"Invalid entry\"\n welcome\n\n end\n end",
"def round selected_player \n puts \"#{selected_player.name}: what does #{Question.number1} + #{Question.number2} equal?\"\n value = gets.chomp\n \n #It checks to see if a question is right or not and outputs the corresponding text prompt\n\n Question.output(value) ? \n (puts \"Correct! Wow you are so smart!\") : \n (selected_player.incorrect\n puts \"Seriously? No!\")\n \n #Outputs the score of the game\n\n puts \"#{Player1.name}: #{Player1.life}/3 vs #{Player2.name}: #{Player2.life}/3\"\nend",
"def losing_msg(player_input, computer_input)\n puts \"You chose #{player_input} and the computer chose #{computer_input}.\\n You lose, better luck next time!\"\nend",
"def input\n\n\tanswer = rand(10) + 1\n\n\tputs \"\\n\\nGuess a number between 1 and 100 correctly.\"\n\tguess = gets.chomp.to_i\n\n\tif guess < 101 && guess > 0 \n\t\tprompt(guess, answer)\n\telse\n\t\tputs \"The cowboy with wise old eyes sighs.. you lost your chance for free admission.\" \n\t\treturn false\n\tend\n\nend",
"def opening\n puts \"Welcome to TicTacToe! You can play with a human or computer opponent.\"\n while true\n puts \"If you would like to play against a human, type \\\"human\\\".\"\n puts \"If you would like to play against the computer, type \\\"computer\\\".\"\n @mode = gets.strip.upcase\n if @mode == \"HUMAN\"\n break\n elsif @mode == \"COMPUTER\"\n @humanturn = rand(1..2)\n @compturn = (@humanturn%2) + 1\n puts \"You are Player \" + @humanturn.to_s + \".\"\n puts \"The computer is Player \" + @compturn.to_s + \".\"\n break\n else\n puts \"That is not a valid input.\"\n end\n end\n end",
"def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend",
"def get_user_selection\n guess_again = true\n until guess_again == false\n puts \"Please choose rock, paper, or scissors (or q to quit)\"\n @user_current_throw = gets.chomp\n case @user_current_throw.downcase\n when \"q\"\n puts \"Thanks for playing!\"\n exit\n when \"rock\"\n @user_current_throw = @rock\n guess_again = false\n when \"scissors\"\n @user_current_throw = @scissors\n guess_again = false\n when \"paper\"\n @user_current_throw = @paper\n guess_again = false\n else\n puts \"That is not a valid entry\"\n guess_again = true\n end\n end #end of until\n end",
"def game\n puts \"\\nIs your baby (H)ungry, (S)leepy, or (P)oopy?\"\n sleep(1)\n puts \"\\nWAAAAAAAH\"\n puts \"\\nWAH WAH WAH\"\n sleep(1)\n puts \"\\nWAAAAAAAH\"\n\n computer = \"hsp\"[rand(3)].chr\n player = gets.chomp.downcase\n case [player, computer]\n when ['h','h'],['s','s'],['p','p']\n puts \"\\nAwesome! The baby stopped crying. You're doing great.\"\n puts \"\\nThe baby is #{computer}.\"\n roundcount\n again\n when ['s','p'],['p','h'],['h','s']\n puts \"\\nWAAAAH! Something else must be wrong! Try again.\"\n puts \"\\nThe baby is #{computer}.\"\n roundcount\n again\n when ['s','h'],['p','s'],['h','p']\n puts \"\\nDon't just stand there! Help your baby!\"\n puts \"\\nThe baby is #{computer}.\"\n roundcount\n again\n else\n puts \"\\nType the first letter of what the baby needs to stop crying!\"\n game\n end\nend",
"def user_input\n puts \"Do you often play video-games? (yes/no)\"\n print '> '\n frequency = gets.chomp.downcase\n if frequency == \"yes\"\n begin \n puts \"How many hours a week on average do you think you have played video-games in the past month?\"\n @weekly_playtime = Integer(gets.chomp)\n #integer part of kernel module - can be called anywhere on a file, can be called on a particular thing. will try to convert to_int then to_i if that fails. \n if weekly_playtime == 0\n puts \"Please be realistic, you did play video games.\"\n exit \n end \n rescue ArgumentError \n puts \"Error! please type a whole number!\"\n retry \n end \n elsif frequency == \"no\"\n puts \"Are you using a stick to press the keys while you're up on your high horse!?\"\n exit\n else \n puts \"Error! Try again with yes or no!\"\n user_input \n end \n end",
"def ask(question, a, b)\n print \"#{question} (#{a}/#{b})> \"\n r = $stdin.gets.strip\n\n 4.times do\n unless r == a or r == b\n print \"\\nPlease type '#{a}' or '#{b}': \"\n r = $stdin.gets.strip\n end\n end\n\n unless r == a or r == b\n abort EXIT_MSG\n end\n\n r\nend",
"def play\n display_welcome_message\n loop do\n number_of_games = 0\n loop do\n computer.choose(@human)\n human.choose\n display_moves\n increment_game_count\n puts\n display_winner\n display_score\n update_win_history\n number_of_games += 1\n puts\n break if first_to_score?(10)\n end\n display_final_outcome\n reset_game\n break unless play_again?\n end\n display_goodbye_message\n end",
"def coin2\n print \"Heads or tails?\"\n guess = gets.chomp\n options = [\"Heads\", \"Tails\"]\n pc_choice = options.sample\n puts \"The computer flipped #{pc_choice.upcase}\"\n \n if pc_choice == \"Heads\"\n if guess == \"Heads\"\n puts \"You guessed correctly!\"\n else\n puts \"You guess incorrectly.\"\n end\n end\n if pc_choice == \"Tails\"\n if guess == \"Tails\"\n puts \"You guessed correctly!\"\n elsif guess == \"Heads\"\n puts \"You guessed incorrectly.\"\n end\n end\nend",
"def print_winning_message(winning_choice)\n case\n when 'Rock'\n say('Rock smashes scissors!')\n when 'Paper'\n say('Paper covers rock!')\n when 'Scissors'\n say('Scissors cuts paper!')\n end\nend",
"def game\n puts \"\\nTake your pick: (R)ock, (P)aper, (S)cissors\"\n sleep(1)\n puts \"\\nShoot!\"\n\n computer = \"rps\"[rand(3)].chr\n player = gets.chomp.downcase\n case [player, computer]\n when ['r','s'],['s','p'],['p','r']\n puts \"\\nWIN\"\n puts \"\\nThe computer chose #{computer}.\"\n roundcount\n again\n when ['r','r'],['p','p'],['s','s']\n puts \"\\nTIE\"\n puts \"\\nThe computer chose #{computer}.\"\n roundcount\n again\n when ['s','r'],['p', 's'],['r', 'p']\n puts \"\\nLOSER\"\n puts \"\\nThe computer chose #{computer}.\"\n roundcount\n again\n else\n puts \"\\nARE YOU A MORON? CHOOSE R,P,S\"\n game\n end\nend",
"def ask_question\n \"What does #{random_num1} plus #{random_num2} equal?\"\n end",
"def run_guessing_game\n comp_num = computer_num\n prompt_user\n user_num = user_input\n \n if user_num == comp_num\n puts \"You guessed the correct number!\"\n elsif user_num == \"exit\"\n puts \"Goodbye!\"\n else\n puts \"Sorry! The computer guessed #{comp_num}.\"\n end\n \nend",
"def prompt_user\n puts \"Please choose a number between 1 and 6\"\nend",
"def computer_ai_3\n rock = 0\n paper = 0\n scissors = 0\n most_played = \"r\"\n choice = \"p\"\n\n # Find which moves have been played the most.\n \n @human_moves.each do |move|\n if move == 'r'\n rock = rock + 1\n elsif move == 'p'\n paper = paper + 1\n elsif move == 's'\n scissors = scissors + 1\n end\n end\n\n if rock > paper && rock > scissors\n most_played = \"r\"\n elsif paper > rock && paper > scissors\n most_played = \"p\"\n elsif scissors > paper && scissors > rock \n most_played = \"s\"\n else\n #choose random if they tie\n choices =['r', 'p', 's']\n most_played = choices.sample\n end\n\n #play the hand that beats the human move.\n if most_played == 'r'\n choice = 'p'\n elsif most_played == 'p'\n choice = 's'\n elsif most_played == 's'\n choice = 'r'\n end\n\n return choice\n end",
"def play_game\r\n\r\n #Call on the generate_number method in order to get a random number\r\n number = generate_number\r\n $noOfGuesses = 0 \r\n\r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n \r\n\r\n if $noOfGuesses > $maxGameGuesses then\r\n print \"You exceeded the allowed number of guesses of \" + $maxGameGuesses.to_s + \".\"\r\n print \"\\nYou lose! Please try again.\"\r\n print \"\\n\\nPress enter to continue.\"\r\n Console_Screen.pause \r\n break\r\n end\r\n\r\n if $cheatMode == true then\r\n print \"\\nShh.... the answer is \" + number.to_s \r\n end\r\n\r\n #Prompt the player to make a guess\r\n print \"\\n\\nEnter your guess and press the Enter key: \"\r\n \r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line character\r\n\r\n reply = reply.to_i\r\n\r\n if reply < 1 || reply > $maxChallengeRange then\r\n Console_Screen.cls\r\n print \"\\nInvalid entry. Please enter a number between 1 and \" + $maxChallengeRange.to_s\r\n print \"\\n\\nPlease press enter to continue.\"\r\n Console_Screen.pause\r\n redo #Redo the current iteration of the loop\r\n end\r\n \r\n $noOfGuesses = $noOfGuesses + 1\r\n \r\n #Analyze the player's guess to determine if it is correct\r\n if reply == number then #The player's guess was correct\r\n Console_Screen.cls #Clear the display area\r\n print \"You have guessed the number! Press enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Exit loop\r\n elsif reply < number then #The player's guess was too low\r\n Console_Screen.cls #Clear the display area\r\n print \"Your guess is too low! Press Enter to continue.\\n\\n\"\r\n Console_Screen.pause #Pause the game\r\n elsif reply > number then #The player's guess was too high\r\n Console_Screen.cls #Clear the display area\r\n print \"Your guess is too high! Press Enter to continue.\\n\\n\"\r\n Console_Screen.pause #Pause the game\r\n end\r\n\r\n \r\n \r\n end\r\n\r\n end",
"def play_again\n divider2\n puts \"Do you want to play again? (y/n)\"\n @pinput = gets.strip.downcase\n if @pinput == \"no\" || @pinput == \"n\"\n puts \"Thanks for Playing!\"\n elsif @pinput == \"yes\" || @pinput == \"y\"\n play\n else\n play_again\n end\n end",
"def display_win_message(winning_choice)\n case winning_choice\n when 'p'\n puts \"Paper covers Rock!\"\n when 'r'\n puts \"Rock smashes Scissors\"\n when 's'\n puts \"Scissors cuts Paper!\"\n end\nend",
"def start\n input = nil\n while input != 5\n puts \"How would you like to play? Please select a number:\"\n puts \"1. computer vs. computer\"\n puts \"2. human vs. computer\"\n puts \"3. human vs. human\"\n puts \"4. wargame mode\"\n puts \"5. quit\"\n\n puts \" \"\n puts \"Make a selection:\"\n input = gets.strip.to_i\n case input\n when 1\n game = Game.new(Computer.new(\"X\"), Computer.new(\"O\"), board = Board.new)\n game.play\n play_again?\n\n when 2\n human_vs_computer\n\n when 3\n game = Game.new(Human.new(\"X\"), Human.new(\"O\"), board = Board.new)\n puts \"Player 1 will be 'X'.\"\n puts \"Player 2 will be 'O'.\"\n game.play\n play_again?\n\n when 5\n puts \"Thanks for playing!\"\n\n when 4\n puts \"How many wargames would you like to simulate? Choose a number.\"\n number = gets.strip.to_i\n number.times { wargame }\n puts \"**Games played: #{number} ** Games drawn: #{@@draws} ** Games won: #{number-@@draws} **\"\n puts \" \"\n else\n puts \"That's an invalid choice.\"\n end\n end\nend",
"def rps\nputs \"Rock...\"\nsleep(0.5)\nputs \"Paper...\"\nsleep(0.5)\nputs \"Scissors...\"\nsleep(0.5)\nputs \"Shoot!\"\nsleep(0.1)\nputs \" \"\nend",
"def play\n puts \"Let's play 'Bulls and Cows'! (if you are stuck enter 'resign' or 'quit')\"\n loop do \n prompt()\n @user_try = gets.chomp()\n if @user_try == 'resign'\n @result = :resign\n puts \"Number was #{@guess_num.join}\"\n break\n end\n if @user_try == 'quit'\n @result = :quit\n puts \"Number was #{@guess_num.join}\"\n break\n end\n @result = test() if correct?\n end\n return @result\n end",
"def play_again(name)\n\tplay_choice = play_again_Q\n\tif play_choice == \"Y\"\n\t\tputs \"\\nHigh five, #{name}! Don't you just love this game?\"\n\t\tsecret_num = rand(10) + 1\n\t\tguess = first_guess.to_i\n\t\ttries = 1\n\t\teval_num(secret_num, guess, tries)\n\t\tplay_again(name)\n\telsif play_choice == \"N\"\n\t\tputs \"\\nThank you for playing #{name}! Come test your mind again when you're bored.\"\n\tend\nend",
"def display_message(winning_choice)\n case winning_choice\n when 'p'\n puts \"Paper wraps rock!\"\n when 'r'\n puts \"Rock smashes scissors!\"\n when 's'\n puts \"Scissors cuts paper!\"\n end\nend",
"def play_game\n\n\t\t# ask who would like to go first, user or computer\n\t\tputs \"Would you like to go first? Y/N\"\n\t\tstarter = gets.chomp.upcase\n\n\t\t# case when user takes first go\n\t\tif starter == \"Y\"\n\t\t\twhile total(current_score) > 0\n\t\t\t\tplayer_turn\n\t\t\t\t\n\t\t\t\t# case when player wins\n\t\t\t\tif total(current_score) == 0\n\t\t\t\t\tputs \"You win!\"\n\t\t\t\t\tplay_again\n\t\t\t\tend\n\n\t\t\t\tcomputer_turn\n\n\t\t\t\t# case when computer wins\n\t\t\t\tif total(current_score) == 0\n\t\t\t\t\tputs \"The computer wins!\"\n\t\t\t\t\tplay_again\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\t# case when computer takes first go\n\t\telse\n\t\t\twhile total(current_score) > 0\n\t\t\t\tcomputer_turn\n\n\t\t\t\t# case when player wins\n\t\t\t\tif total(current_score) == 0\n\t\t\t\t\tputs \"The computer wins!\"\n\t\t\t\t\tplay_again\n\t\t\t\tend\n\n\t\t\t\tplayer_turn\n\t\t\t\t\n\t\t\t\t# case when computer wins\n\t\t\t\tif total(current_score) == 0\n\t\t\t\t\tputs \"You win!\"\n\t\t\t\t\tplay_again\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def game_mode\n puts \"\\nDo you want to play against another person or against the computer?\"\n puts \"\\nEnter 1 to play against another person.\"\n puts \"Enter 2 to play against the computer.\"\n choice = gets.chomp\n until choice == \"1\" || choice == \"2\"\n puts \"Please enter 1 or 2:\"\n choice = gets.chomp\n end\n choice\nend",
"def question\n puts \"Do you want: \\n1. Stuff\\n2. No stuff\\n3. enumerated stuff\"\n prompt; stuff = gets.chomp.to_i #This is magic! Love it!\n return stuff\nend",
"def playRound(score)\n\tputs \"Player 1 enter your weapon: \"\n\tp1 = gets.chomp.downcase\n\tputs \"Player 2 enter your weapon: \"\n\tp2 = gets.chomp.downcase\n\tresult = determineWinner(p1, p2)\n\tupdateScore(score,result)\nend",
"def intro_prompt(intro_prompt_answer, current_user)\n\n if intro_prompt_answer == \"Run inside and save them\"\n system \"clear\"\n\n puts user_stats(current_user)\n\n puts \"You run up the steps to save the villages. The doors have been chained shut.\"\n # sleep 1\n\n run_into_temple(current_user)\n\n elsif intro_prompt_answer == \"Look for water to put out the fire\"\n system \"clear\"\n puts user_stats(current_user)\n\n puts \"You frantically search for water but find nothing. You return to the temple.\"\n sleep 1\n\n look_for_water(current_user)\n\n else\n system \"clear\"\n puts user_stats(current_user)\n\n puts \"It’s too dangerous and you need to save your energy in case you run into more trouble.\"\n sleep 1\n puts \"You continue making your way through the village.\"\n sleep 1\n\n continue(current_user)\n end\n end",
"def p_again\n \n\n\tputs\n\tputs \"Shoot again? (y/n):\"\n\tputs\n\tchoice2 = gets.chomp.downcase\n\tputs\n\n\tcase choice2\n\t\twhen \"y\"\n\n\t\t\t$play = \"y\"\n\t\telse\n\n\t\t\t$play = \"n\"\n\tend\n\nend",
"def comp_play\n master_list = create_list\n puts \"Enter the code: \"\n @code = get_input\n puts \"Code: #{@code}\"\n\n guess_count = 1\n matches = 0\n\n rand1 = rand(6)\n rand2 = rand(6)\n until rand2 != rand1\n rand2 = rand(6)\n end\n input = [@@COLORS[rand1], @@COLORS[rand1], @@COLORS[rand2], @@COLORS[rand2]]\n\n until matches == 4 or guess_count > @@MAX_GUESSES\n puts \"Turn #{guess_count}\"\n puts \"Computer guesses #{input}\"\n\n results = check_guess(input, @code)\n matches = results[0]\n\n puts \"Black pins: #{results[0]} White pins: #{results[1]}\"\n guess_count += 1\n\n master_list = prune_list(master_list, input, results)\n\n input = master_list.sample\n end\n\n if matches == 4\n puts \"You lose\"\n else\n puts \"You win\"\n end\n end",
"def run\n choose_game(prompt)\nend",
"def play\n @p1.score = 0\n @p2.score = 0\n choose_game\n puts \"How many games do you want to play?\"\n x = gets.chomp.to_i\n if x < 1\n puts \"That's no fun!\"\n elsif x == 1\n new_game(@p1, @p2)\n else\n new_match(x, @p1, @p2)\n end\n end",
"def start_game(states,capitals,correct,incorrect)\n50.times do\n question = rand(0..50)\n puts \"what is the Capitol of \" + states[question]\n answer = gets.chomp\n if answer == capitals[question]\n \t puts \"You ROCKSTAR!\"\n correct += 1\n puts \"You have #{correct} correct answer(s) so far - and #{incorrect} incorrect answer(s)\"\n check_finish(states,capitals,correct,incorrect)\n else\n \t puts \"Learn our map... you UNPATRIOT!\"\n incorrect +=1\n puts \"You have #{incorrect} incorrect answer(s) so far - and #{correct} correct answer(s)\"\n check_finish(states,capitals,correct,incorrect)\n end\n end\nend",
"def main_game\n p1_wins = 0\n p2_wins = 0\n puts \"Let's play Rock-Paper-Scissors!\"\n games = how_many_games\n best_of(games)\n\n until p1_wins == games || p2_wins == games\n winner = one_round\n display_winner(winner)\n p1_wins += track_p1_wins(winner)\n p2_wins += track_p2_wins(winner)\n end\n\n overall_winner = overall_winner?(p1_wins, p2_wins)\n display_overall_winner(overall_winner)\nend",
"def howl_win\n sleep(2)\n slowly do\n\"\"\"\nThe troll yawns again! His eyelids flutter, and he falls face first onto the bride.\n\nHe loud, rattling snores don't bother Duncan.\n\nHe sits to eat his bacon, and then makes his way home to his humans. \n\nHis humans feed him more treats, of course. \n\nDuncan curls up in his nice soft bed and dreams of a conveyer belt conveying bacon \ninto his drueling maul. \n\nHe sleeps well. \n\"\"\"\n end #end for slowly\n $ending += 5\n slowly do\n \"Press Enter to continue.\"\n end\n prompt\n STDIN.gets.chomp!\n ending_chooser($ending)\n end",
"def magicEightball \n\tanswered = \n\t[\n\t\"Most def.\", \"No doubt\", \"Hell yes\", \n\t\"maybe...\", \"It's a possibility.\", \"It could happen.\",\n\t\"never eva eva!\", \"NO!\", \"Not in a thousand years.\"\n\t] \n\n\tputs \"Please ask me a question.\"\n\tquestion = gets.chomp\n\tputs \"So your question is #{question}\"\n\tputs answered[rand(8)]\nend",
"def ask_question(player)\n puts \"#{player.name}: What does #{@num1} plus #{@num2} equal?\"\n puts \" \"\n end"
] | [
"0.79446936",
"0.75527847",
"0.75349027",
"0.7512115",
"0.75055546",
"0.7451891",
"0.7248234",
"0.71866965",
"0.717533",
"0.71686935",
"0.71383506",
"0.7125307",
"0.7117587",
"0.7108755",
"0.70825565",
"0.7061152",
"0.7060648",
"0.704767",
"0.7039294",
"0.692148",
"0.6889509",
"0.6870156",
"0.686365",
"0.6853395",
"0.6850445",
"0.6843237",
"0.68423563",
"0.68378794",
"0.682015",
"0.6810142",
"0.67991173",
"0.67988",
"0.67924976",
"0.6785873",
"0.6781222",
"0.67538947",
"0.67532855",
"0.6753194",
"0.6748291",
"0.67459804",
"0.672649",
"0.6725705",
"0.6711793",
"0.6710023",
"0.66917366",
"0.6679751",
"0.6677234",
"0.66672575",
"0.6664865",
"0.6664405",
"0.6657178",
"0.66569054",
"0.66550845",
"0.66515315",
"0.6643272",
"0.6640404",
"0.6633289",
"0.66258734",
"0.6618646",
"0.6610974",
"0.6601754",
"0.66003215",
"0.6591968",
"0.65844285",
"0.65736467",
"0.6568075",
"0.6562312",
"0.65565956",
"0.65563995",
"0.65536135",
"0.6551392",
"0.6550695",
"0.6550185",
"0.6548276",
"0.6548207",
"0.6547694",
"0.6547226",
"0.6545129",
"0.65439427",
"0.6542471",
"0.6540502",
"0.65396184",
"0.65359414",
"0.6532009",
"0.6519479",
"0.6517951",
"0.6512313",
"0.6505437",
"0.65022945",
"0.64962524",
"0.64935803",
"0.64932877",
"0.64880055",
"0.6486127",
"0.6479237",
"0.6478927",
"0.6475829",
"0.64735603",
"0.64699817",
"0.6469316",
"0.6468081"
] | 0.0 | -1 |
Finds Single match via the supplied ID Usage: match = PUBG::Match(1337) Arguments: id: (Integer) | def match(id)
self.get("/matches/#{id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(match_id)\n get_request(shard_endpoint_uri(\"matches/#{match_id}\"))\n end",
"def find options={}, match_id:\n DynamicModel.new perform_request api_url \"matches/#{match_id}\", options\n end",
"def get_match\n @match = Match.find( params[:match_id] )\n raise ActiveRecord::RecordNotFound unless @match\n end",
"def get_match\n @match = Match.find(params[:match_id])\n end",
"def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end",
"def set_match\n @match = Match.find params[:id]\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n @match = Match.find(params[:id])\n end",
"def set_match\n # @match = Match.find(params[:id])\n @fes = Fes.where(:id => params[:fes_id]).first\n @match = @fes.matches.where(:id => params[:id]).first\n end",
"def get_first_team_to_bat_by_match(match_id)\n if match_id.blank? \n else\n team_id = Match.find(match_id).first_to_bat\n Matchteam.where(match_id: match_id, team_id: team_id).pluck(:player_id)\n end\n end",
"def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n CSV.foreach('contacts.csv') do |contact|\n if contact[0].to_i == id\n match = Contact.new(contact[1],contact[2],contact[0])\n contact.drop(3).each do |number|\n number = number.split(\": \")\n phone = PhoneNumber.new(number[0],number[1])\n match.add_number(phone)\n end\n return match\n end\n end\n nil\n end",
"def find_single(id, *args)\n data = get(id.to_s, *args)\n return nil unless data && !data.empty?\n instantiate(id, data)\n end",
"def find(id, optional = {})\n find_all([id], optional).first\n end",
"def set_match\n @match = Match.find(params[:id])\n if @match.nil?\n render :file => 'public/404.html'\n end\n end",
"def find(id); end",
"def find(id); end",
"def get_match(match)\n fetch(\"match/#{match}\")\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end",
"def find_match\n user_match = User.find_by(id: self.id)\n end",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def find (candidate_id)\n @candidates.detect{|candidate| candidate_id == candidate[:id]}\n puts \"No match foud\" if nil \n end",
"def find(id, params = {})\n from_base id, params\n end",
"def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end",
"def find_by_id(id)\n find_by_attributes(:id => id).first\n end",
"def match\n @match\n end",
"def get_match(id, matches, p1, p2)\n outputmatch = nil\n matches.each do |match|\n outputmatch = match['match'] if ((match['match']['player1_id'].to_s.eql?(p1) && match['match']['player2_id'].to_s.eql?(p2))||(match['match']['player1_id'].to_s.eql?(p2) && match['match']['player2_id'].to_s.eql?(p1)))\n end\n return outputmatch\nend",
"def find(id)\n end",
"def find_by_tournament match_id, tournament_code\n DynamicModel.new perform_request api_url \"matches/#{match_id}/by-tournament-code/#{tournament_code}\"\n end",
"def get_current_match\n\t\t@current_match ||= if params[:match_id].present?\n\t\t\tMatch.find(params[:match_id])\n\t\tend\n\tend",
"def find(id)\n find_result\n end",
"def set_match\n @match = Match.find(params[:match_id])\n end",
"def player_by_id id\n @players.select {|p| p.id == id}.first\n end",
"def find_by_id(id)\n find(id)\n end",
"def find(id)\n\t@candidates.detect { |candidate| candidate[:id] == id }\nend",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id]\n candidate\n end\n end\n nil\nend",
"def find(id)\n @records.find { |record| record.id == id }\n end",
"def find(id)\n self.detect{|x| x.id == id.to_i}\n end",
"def find(match)\n hits = search(match)\n raise(MissingTemplate, \"No matching templates.\") if hits.size == 0\n if hits.size > 1\n message = \"More than one match:\\n \" + hits.map{|name, dir| name}.join(\"\\n \")\n raise(DuplicateTemplate, message)\n end\n hits.first\n end",
"def set_matchparticipant\n @matchparticipant = Matchparticipant.find(params[:id])\n end",
"def find(id)\n where({'id' => \"#{id}\"}).first\n end",
"def find(id)\n puts id\n @candidates.each do |candidate|\n if candidate[:id] == id \n return candidate\n end\n end\n puts \"No candidate found with that ID\"\n return nil\nend",
"def find(id)\n # Your code Here\n @candidates.each do |el|\n # logic to check if id match else null\n if el[:id] == id\n puts 'found match'\n return el\n end\n end\n return nil\nend",
"def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end",
"def single_match(matches, request, command)\n\n if matches.length == 0\n Views::no_match_error \"projects\", request\n return false\n elsif matches.length > 1\n Views::ambiguous_project matches, command\n return false\n else\n match = matches[0]\n end\n end",
"def find(id)\n finder_or_run(:find, id)\n end",
"def get_match_simple(match_key, opts = {})\n data, _status_code, _headers = get_match_simple_with_http_info(match_key, opts)\n data\n end",
"def find(id)\n @candidates.each do |person|\n if person[:id] === id\n return person\n end\n end\n return nil\nend",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id] \n return candidate\n end\nend\n\n nil\nend",
"def get_match ( match_key )\n get_api_resource \"#{@@api_base_url}match/#{match_key}\"\n end",
"def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && !results['id'].blank? && new(results) || nil\n end",
"def get_match_data(match_id)\n uri = URI.parse match_url(match_id)\n resp = Net::HTTP.get_response uri\n \n unserialize_match_data(resp.body)\n end",
"def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end",
"def find(id)\n found = nil\n @candidates.each do |candidate|\n if candidate[:id] == id\n found = candidate\n end\n end\n found\nend",
"def find(id)\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n else\n return nil\n end\n end\nend",
"def find(id)\n binding.pry\n candidate.each do |candidate|\n if @candidate[:id] == id\n return candidate\n else\n nil\n end \n end \nend",
"def find(id)\n @candidates.detect do |candidate|\n candidate[:id] === id\n end\nend",
"def find(id)\n @candidates.each do | candidate |\n if candidate[:id] == id\n return candidate \n end\n end\nend",
"def set_match_player\n @match_player = MatchPlayer.find(params[:id])\n end",
"def set_match_participant\n @match_participant = MatchParticipant.find(params[:id])\n end",
"def find(id)\n @candidates.each do |candidate|\n return candidate if id == candidate[:id]\n end\n nil\nend",
"def find_by_id!(id)\n new(one.find_by_id(id) || raise(RecordNotFound, \"A #{name} record for #{id} does not exist.\"))\n end",
"def set_match_detail\n @match_detail = MatchDetail.find(params[:id])\n end",
"def find_timeline match_id\n DynamicModel.new perform_request api_url \"timelines/by-match/#{match_id}\"\n end",
"def find(id, ignore: [])\n hit = es_get(id, ignore: ignore)\n if hit['found']\n result = instantiate_result(hit)\n return result\n end\n false\n end",
"def find(id)\n\traise '@candidates must be an Array' if @candidates.nil?\n\t@candidates.each do |x|\n\t\tif x[:id] == id\n\t\t\treturn x\n\t\tend\n\tend\n\tputs \"Candidate not found\"\n\tnil\nend",
"def find(id)\n # Your code Here\n # puts \"you are looking for id: #{id}\"\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n return nil\nend",
"def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && new(results) || nil\n end",
"def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self.class.name}#find with ID #{id.inspect} was not found\"\n end\n }\n end",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def find(id)\n res = transmit(\"peek #{id}\")\n Job.new(client, res)\n rescue Beaneater::NotFoundError\n nil\n end",
"def first\n matches.first\n end",
"def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n return nil\nend",
"def find(id)\n # Your code Here\n @candidates.each do |candidate|\n \tif candidate[:id] == id\n \t return candidate\n \tend\n end\n return nil\nend",
"def find(id)\n find_by_index(id: id)\n end"
] | [
"0.7601857",
"0.7325076",
"0.687629",
"0.6634679",
"0.6585606",
"0.65841526",
"0.65738595",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6543685",
"0.6543685",
"0.6543685",
"0.6543685",
"0.6543685",
"0.64343077",
"0.6395939",
"0.6379684",
"0.6377953",
"0.63577497",
"0.62844664",
"0.6277305",
"0.6277305",
"0.6273348",
"0.625755",
"0.625755",
"0.6189275",
"0.618278",
"0.6171514",
"0.6165944",
"0.6127511",
"0.61197096",
"0.6117906",
"0.61148345",
"0.6114452",
"0.61106735",
"0.6089804",
"0.6089049",
"0.6083083",
"0.6082358",
"0.6081697",
"0.60791516",
"0.60464",
"0.6045745",
"0.60387474",
"0.60355544",
"0.60335034",
"0.60215825",
"0.6019179",
"0.6012692",
"0.6011876",
"0.59986323",
"0.599742",
"0.5993733",
"0.5983658",
"0.59749734",
"0.59711176",
"0.59647745",
"0.5957963",
"0.59400004",
"0.59396815",
"0.5931485",
"0.59153557",
"0.5914604",
"0.59139717",
"0.59107375",
"0.5908869",
"0.59071374",
"0.5901559",
"0.58957213",
"0.58954376",
"0.58948016",
"0.58885723",
"0.5873814",
"0.58730197",
"0.5872739",
"0.5872696",
"0.5866415",
"0.5864526",
"0.5850801",
"0.58414674",
"0.58377343"
] | 0.79567343 | 0 |
Builds the query that will be passed to the matches request, based on what options are supplied (if any) | def query_builder(options)
parsed_options = []
options.each do |key,value|
case key
when :offset
parsed_options << "page[offset]=#{value}"
when :limit
parsed_options << "page[limit]=#{value}"
when :sort
parsed_options << "sort=#{value}"
when :created_at_start
parsed_options << "filter[createdAt-start]=#{value}"
when :created_at_end
parsed_options << "filter[createdAt-end]=#{value}"
when :player_ids
parsed_options << "filter[playerIds]=#{value.join(',')}"
when :game_mode
parsed_options << "filter[gameMode]=#{value}"
end
end
if options.empty?
"/matches"
else
queries = parsed_options.join("&")
"/matches?#{queries}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_query(options)\n array = []\n\n options.each do |key, value|\n next if key == :all\n if [:filter, :select, :top].include?(key)\n array << \"$#{key}=#{value}\" if value\n elsif key == :continuation_token\n value.each { |k, token| array << \"#{k}=#{token}\" if token }\n else\n array << \"#{key}=#{value}\" if value\n end\n end\n\n array.join('&')\n end",
"def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end",
"def build_query(query, options={})\n queries = []\n QUERY_KEYWORDS.each do |kw|\n next unless options[kw]\n if options[kw].is_a? Array\n kw_query = options[kw].map {|s| \"#{kw}:#{s}\".strip }.join(\" OR \")\n queries << \" (#{kw_query})\"\n else\n queries << \" #{kw}:#{options[kw]}\"\n end\n end\n \"#{query} #{queries.join(' ')}\".strip\n end",
"def generate_search (options)\n conditions_stmt = ''\n\n if options[:id].to_s.strip != '' then\n options[:id] = CGI::unescape(options[:id])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n conditions_stmt += 'code = \"' + options[:id].to_s.strip + '\"'\n end\n\n if options[:visited].to_s.strip != '' then\n options[:visited] = CGI::unescape(options[:visited])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n conditions_stmt += 'visited = \"' + (options[:visited] == 'true' ? 't' : 'f') + '\"'\n end\n \n if options[:name].to_s.strip != '' then\n options[:name] = CGI::unescape(options[:name])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n if options[:name] =~ /\\*|\\%/\n options[:name] = options[:name].gsub('*', '%')\n conditions_stmt += 'name LIKE \"' + options[:name].to_s.strip + '\"'\n else\n if options[:name] =~ /!/\n conditions_stmt += 'name != \"' + options[:name].gsub('!', '').to_s.strip + '\"'\n else\n conditions_stmt += 'name = \"' + options[:name].to_s.strip + '\"'\n end\n end\n end\n \n Rails.logger.debug {\"Search conditions: #{conditions_stmt}\"}\n conditions_stmt\n end",
"def custom_query(options)\n form_data = {}\n options.each {|k,v| form_data[k.to_s] = v.to_s }\n form_data['action'] = 'query'\n make_api_request(form_data).first.elements['query']\n end",
"def construct_filter_query(queries)\n query_string = '?'\n query_list = Array[]\n\n # Format the include_* queries similarly to other queries for easier\n # processing\n if queries.key?('include_deleted')\n queries['include_deleted'] = if queries['include_deleted']\n ['true']\n else\n ['false']\n end\n end\n\n if queries.key?('include_revisions')\n queries['include_revisions'] = if queries['include_revisions']\n ['true']\n else\n ['false']\n end\n end\n\n # If uuid is included, the only other accepted queries are the\n # include_*s\n if queries.key?('uuid')\n query_string = format('/%s?', queries['uuid'])\n if queries.key?('include_deleted')\n query_string += format('include_deleted=%s&',\n queries['include_deleted'][0])\n end\n\n if queries.key?('include_revisions')\n query_string += format('include_revisions=%s&',\n queries['include_revisions'][0])\n end\n\n # Everthing is a list now, so iterate through and push\n else\n # Sort them into an alphabetized list for easier testing\n # sorted_qs = sorted(queries.to_a, key = operator.itemgetter(0))\n sorted_qs = queries.to_a.sort\n sorted_qs.each do |query, param|\n param.each do |slug|\n # Format each query in the list\n # query_list.push('%s=%s' % Array[query, slug])\n query_list.push(format('%s=%s', query, slug))\n end\n end\n\n # Construct the query_string using the list.\n # Last character will be an & so we can push the token\n query_list.each do |string|\n query_string += format('%s&', string)\n end\n end\n query_string\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end",
"def query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_date = parse_date(search)\n\n query = nil\n case table \n when :track\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :guideway\n query = infrastructure_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :power_signal\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :capital_equipment\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n when :service_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n when :bus, :rail_car, :ferry, :other_passenger_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(esl_category_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n .or(fta_funding_type_query search_string)\n .or(fta_ownership_type_query search_string)\n when :passenger_facility, :maintenance_facility, :admin_facility, :parking_facility\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n end\n query = query.or(TransamAsset.arel_table[:in_service_date].eq(search_date)) if search_date\n query.or(ServiceStatusType.arel_table[:name].matches(search_string))\n .or(life_cycle_action_query search_string, search_date)\n .or(term_condition_rating_query search_string, search_number)\n end",
"def query_string\n _f = @params.fields.include?(:full_text) ? [:full_text] : fields\n # byebug\n a = query.gsub('/', '').scan( /\"[^\"]+\"|[^ ]+/ ).map do |word|\n if word[0] === '\"'\n m = word.match( /^\"(.*)\"$/ );\n word = m ? m[1] : word;\n end\n Unicode.downcase(word.gsub('\"', ''))\n end\n _q = '(' + a.join('* AND ') + '*)'\n # _q = '/(?=.*?'+a.join( ')(?=.*?' )+').*/';\n #byebug\n index.filter{ ~q(query_string: {fields: _f, query: \"#{_q}\", default_operator: 'or'}) } if _q.present? && _f.present?\n\n #index.query(multi_match: {query: \"#{_q}*\", fields: _f}) if _q.present? && _f.present\n end",
"def build_queries(text, build_opts, norm_opts)\n\t\ttrier = TEXT_TO_TRIE.new( build_opts[:min_tokens],\n\t\t\t\t\t\t\t\t build_opts[:max_tokens],\n\t\t\t\t\t\t\t\t )\n\t\t\n\t\t# Queries are normalized.\n\t\tqueries = trier.to_trie( text, \n\t\t \t\t\t\t norm_opts[:lowercased], \n\t\t \t norm_opts[:hyphen_replaced], \n\t\t \t norm_opts[:stemmed], \n\t\t \t)\n\t\t# queries - A hash of key (the normalized query string) and value (the array of \n\t\t# offsets (range values)) pairs.\n\t\tqueries\n\tend",
"def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end",
"def build_query(*args)\n opts = {}\n opts = args.pop if args.last.kind_of? Hash\n\n # Add the default query, if there is one\n if not @default_query.nil? then\n # make sure there is an AND if working with a cmdline supplied part\n args.push('AND') unless args.empty?\n case @default_query\n when Array\n args.push @default_query.join(' AND ')\n when Proc\n args.push @default_query.call()\n else\n args.push @default_query.to_s\n end\n end\n\n # Get prefix as a String.\n case @prefix_query\n when Array\n prefix = @prefix_query.join(' AND ') + ' AND'\n when Proc\n prefix = @prefix_query.call()\n else\n prefix = @prefix_query.to_s\n end\n args.unshift(prefix) unless opts.has_key? :noprefix\n\n # Get suffix as a String.\n case @suffix_query\n when Array\n suffix = 'AND ' + @suffix_query.join(' AND ')\n when Proc\n suffix = @suffix_query.call()\n else\n suffix = @suffix_query.to_s\n end\n args.push(suffix) unless opts.has_key? :nosuffix\n\n args.flatten.compact.join(' ')\n end",
"def compile_query\r\n str = []\r\n\r\n str << \"controller|#{q[:controller]}|\" if q[:controller].present?\r\n str << \"action|#{q[:action]}|\" if q[:action].present?\r\n str << \"format|#{q[:format]}|\" if q[:format].present?\r\n str << \"status|#{q[:status]}|\" if q[:status].present?\r\n\r\n str << \"datetime|#{q[:on].strftime('%Y%m%d')}*|\" if q[:on].present?\r\n\r\n str << \"method|#{q[:method]}|\" if q[:method].present?\r\n str << \"path|#{q[:path]}|\" if q[:path].present?\r\n\r\n str.join(\"*\")\r\n end",
"def parse_options(options) # :nodoc\n options[:max_results] ||= 25\n options[:order_by] ||= 'startTime' # other option is 'updated'\n options[:expand_recurring_events] ||= true\n query_string = \"&orderBy=#{options[:order_by]}\"\n query_string << \"&maxResults=#{options[:max_results]}\"\n query_string << \"&singleEvents=#{options[:expand_recurring_events]}\"\n query_string << \"&q=#{options[:query]}\" unless options[:query].nil?\n query_string\n end",
"def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end",
"def query_options; end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def build_query(builder)\n builder.OPTION {\n @option.each do |k, v|\n builder.PARAMETER k.to_s.upcase\n value = case v\n when Array then v.join(',')\n when Hash then v.map { |a| a.join(':') }.join(',')\n else\n v.to_s\n end\n\n # I don't know this is correct or not, but I think we should not\n # touch third party ID.\n value.upcase! unless k == :prefer_xid\n\n builder.VALUE value\n end\n }\n end",
"def query\n q = @root.clone\n\n # Navigation paths come first in the query\n q << \"/#{@navigation_paths.join(\"/\")}\" unless @navigation_paths.empty?\n\n # Handle links queries, this isn't just a standard query option\n q << \"/$links/#{@links_navigation_property}\" if @links_navigation_property\n\n # Handle count queries, this isn't just a standard query option\n q << \"/$count\" if @count\n query_options = generate_query_options\n\n q << \"?#{query_options.join('&')}\" if !query_options.empty?\n q\n end",
"def build_query\n query = { key: @api_key }\n query.merge! @parameters if @parameters\n query.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def build_search_url(options = {})\n url = APP_CONFIG['ac']['api_url']\n search_path = APP_CONFIG['ac']['api_search_path']\n search_url = \"#{url}#{search_path}\"\n\n api_params = {}\n\n # basic query params\n basics = %w(q page per_page sort order)\n basics.each do |key|\n api_params[key] = options[key] if options[key].present?\n end\n\n # If we get non-AC sort params, either fix or ignore\n sort_key = options['sort']\n order_key = options['order']\n\n # combined, e.g.: sort=pub_date_sort+desc\n if sort_key.present? && sort_key.match(/\\w+ \\w+sc/)\n sort_key, order_key = sort_key.match(/(\\w+) (\\w+sc)/).captures\n end\n sort_key = 'date' if sort_key == 'pub_date_sort'\n if %w(best_match date title).include? sort_key\n api_params['sort'] = sort_key\n api_params['order'] = order_key if %w(asc desc).include? order_key\n end\n\n # *** remap params ***\n # \"SEARCH FIELD\" V.S. \"SEARCH TYPE\"\n key_remaps = {\n 'search_field' => 'search_type'\n }\n value_remaps = {\n 'all_fields' => 'keyword',\n 'all' => 'keyword'\n }\n key_remaps.each do |clio_key, api_key|\n # We have a key that needs to be remapped\n next unless options[clio_key].present?\n # if the value is in our remap table, remap value also\n clio_value = options[clio_key]\n api_value = value_remaps[clio_value] || clio_value\n api_params[api_key] = api_value\n end\n\n # facet filter params\n filters = %w(author date department subject type columbia_series)\n filters.each do |key|\n api_params[key] = options[key] if options[key].present?\n end\n\n # DISSERTATIONS\n # hardcode filter to show only dissertations if we're in that datasource\n api_params['type[]'] = 'Theses' if options['datasource'] == 'ac_dissertations'\n\n search_url = \"#{search_url}?#{api_params.to_query}\" if api_params.present?\n Rails.logger.debug \"Spectrum::SearchEngines::Ac build_search_url(options)\\n #{search_url}\"\n search_url\n end",
"def search(query, options = {}); end",
"def generate_search_query(per_page)\n q = Replay.select(\"DISTINCT(replays.*)\").public.processed.includes(:event, :plays, :players)\n \n player_id = nil\n if params[:player] =~ /\\A#\\d+\\z/\n player_id = params[:player][1..-1].to_i\n end\n\n if player_id\n q = q.joins(:plays).where(:plays => {:player_id => player_id})\n elsif !params[:player].blank?\n q = q.joins(:players).where(\"players.name ILIKE ?\", \"%#{params[:player]}%\")\n else\n end\n \n unless params[:league].blank?\n q = q.joins(:players).where(\"players.league_1v1 = ?\", params[:league])\n end\n \n unless params[:gateway].blank?\n q = q.where(\"replays.gateway = ?\", params[:gateway])\n end\n \n unless params[:map].blank?\n q = q.where(\"replays.map_name LIKE ?\", \"%#{params[:map]}%\")\n end\n \n unless params[:version].blank?\n q = q.where(:version => params[:version])\n end\n \n unless params[:game_format].blank?\n q = q.where(:game_format => params[:game_format])\n end\n \n mu = params[:mu]\n @any = false\n if mu == \"tvp\"\n q = q.where(:terrans => 1, :protosses => 1, :zergs => 0)\n elsif mu == \"tvz\"\n q = q.where(:terrans => 1, :protosses => 0, :zergs => 1)\n elsif mu == \"pvz\"\n q = q.where(:terrans => 0, :protosses => 1, :zergs => 1)\n elsif mu == \"tvt\"\n q = q.where(:terrans => 2, :protosses => 0, :zergs => 0)\n elsif mu == \"pvp\"\n q = q.where(:terrans => 0, :protosses => 2, :zergs => 0)\n elsif mu == \"zvz\"\n q = q.where(:terrans => 0, :protosses => 0, :zergs => 2)\n else\n @any = true\n end\n \n if params[:order] == \"date_posted\"\n q = q.order(\"replays.created_at DESC\")\n elsif params[:order] == \"date_played\"\n q = q.order(\"replays.saved_at DESC\")\n elsif params[:order] == \"downloads\"\n q = q.order(\"replays.downloads DESC\")\n elsif params[:order] == \"comments\"\n q = q.order(\"replays.comments_count DESC\")\n else\n q = q.recent\n params[:order] = \"date_posted\"\n end\n \n # @replays = q.includes(:plays => [:player]).paginate(:per_page => 5, :page => params[:page])\n @replays = q.paginate(:per_page => per_page, :page => params[:page])\n end",
"def query_options(options)\n options.each_with_object({}) do |(key, val), hash|\n case key\n when :date\n hash[:ShowDate] = val.to_ShowDate\n when :movie_id\n hash[:movie_id] = val\n when :movie_source\n # Set both movie_id and ShowDate.\n movie_source = val\n hash.merge! query_options(movie_id: movie_source.external_id)\n hash.merge! query_options(date: movie_source.released_on) if movie_source.released_on\n when :postal_code\n hash[:SearchZip] = val.to_s.gsub(' ', '')\n else\n raise \"unknown option: #{key}\"\n end\n end\n end",
"def qs\n if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?\n '?' + @r['QUERY_STRING']\n elsif query && !query.empty?\n '?' + query\n else\n ''\n end\n end",
"def build_where_query(options)\n query_keys = {}\n options.each do |k,v|\n # as expected by DynamoDB\n typed_key = k.to_s\n query_keys[typed_key] = dyno_typed_key(key: typed_key, val: v)\n end\n {\n table_name: self.table_name,\n attributes_to_get: attribute_names,\n key: query_keys\n }\n end",
"def query_options\n opts = options.merge(:input => input)\n session ? session.query_options.merge(opts) : opts\n end",
"def query\n @options[:query].presence\n end",
"def build_query_string()\n unless parameters.nil? || parameters.empty?\n query_strings = parameters.keys.sort {|a,b|\n a.to_s <=> b.to_s\n }.inject([]) do |result, element|\n value = parameters[element]\n value = value.join(\";\") if value.class == Array\n result << \"#{element.to_s}-#{value.to_s}\"\n end\n query_strings.join('/')\n else\n nil\n end\n end",
"def as_query(opts={})\n Tripod.logger.debug(\"TRIPOD: building select query for criteria...\")\n\n return_graph = opts.has_key?(:return_graph) ? opts[:return_graph] : true\n\n Tripod.logger.debug(\"TRIPOD: with return_graph: #{return_graph.inspect}\")\n\n select_query = \"SELECT DISTINCT ?uri \"\n\n if graph_lambdas.empty?\n\n if return_graph\n # if we are returning the graph, select it as a variable, and include either the <graph> or ?graph in the where clause\n if graph_uri\n select_query += \"(<#{graph_uri}> as ?graph) WHERE { GRAPH <#{graph_uri}> { \"\n else\n select_query += \"?graph WHERE { GRAPH ?graph { \"\n end\n else\n select_query += \"WHERE { \"\n # if we're not returning the graph, only restrict by the <graph> if there's one set at class level\n select_query += \"GRAPH <#{graph_uri}> { \" if graph_uri\n end\n\n select_query += self.query_where_clauses.join(\" . \")\n select_query += \" } \"\n select_query += \"} \" if return_graph || graph_uri # close the graph clause\n\n else\n # whip through the graph lambdas and add into the query\n # we have multiple graphs so the above does not apply\n select_query += \"WHERE { \"\n\n graph_lambdas.each do |lambda_item|\n select_query += \"GRAPH ?g { \"\n select_query += lambda_item.call\n select_query += \" } \"\n end\n\n select_query += self.query_where_clauses.join(\" . \")\n select_query += \" } \"\n end\n\n select_query += self.extra_clauses.join(\" \")\n\n select_query += [order_clause, limit_clause, offset_clause].join(\" \")\n\n select_query.strip\n end",
"def get_search_params_and_query_string\n if !params[:tire_model_id].blank?\n @tire_store.tire_model_id = params[:tire_model_id]\n @search_query = \"tire_model_id=#{params[:tire_model_id].to_i}\"\n else\n if !params[:auto_options_id].blank?\n option = AutoOption.find(params[:auto_options_id])\n @tire_store.tire_size_id = option.tire_size_id if option\n elsif !params[:width].blank? && !params[:ratio].blank? && !params[:wheeldiameter].blank?\n # check and make sure the size is valid\n ts = TireSize.find_by_sizestr(\"#{params[:width].to_i}/#{params[:ratio].to_i}R#{params[:wheeldiameter].to_i}\")\n @tire_store.tire_size_id = ts.id if ts\n end\n \n if @tire_store.tire_size_id\n @search_query = \"tire_size_id=#{@tire_store.tire_size_id}\"\n \n #Don't include the manufacturer filter unless we have a valid size search going\n if !params[:tire_manufacturer_id].blank?\n @tire_store.tire_manufacturer_id_filter = params[:tire_manufacturer_id]\n @search_query += \"&tire_manufacturer_id_filter=#{params[:tire_manufacturer_id].to_i}\"\n end\n end\n end\n end",
"def build_query(queries)\n query_string = ''\n case queries\n when String\n query_string = queries\n when Array\n query_string = queries.join(' ')\n when Hash\n query_string_array = []\n queries.each do |k,v|\n if v.is_a?(Array) # add a filter for each value\n v.each do |val|\n query_string_array << \"#{k}:#{val}\"\n end\n elsif v.is_a?(Range)\n query_string_array << \"#{k}:[#{v.min} TO #{v.max}]\"\n else\n query_string_array << \"#{k}:#{v}\"\n end\n end\n query_string = query_string_array.join(' ')\n end\n query_string\n end",
"def query_options\n # todo: support more options?\n options = {}\n options.merge!({:limit => limit_value.to_json}) if limit_value\n options.merge!({:skip => @options[:skip].to_json}) if @options[:skip]\n options.merge!({:reversed => reversed?.to_json}) if reversed?\n options.merge!({:order => @options[:order]}) if @options[:order]\n options.merge!({:cursor => @options[:cursor]}) if @options[:cursor]\n options\n end",
"def build_query(key, queries, localparams = \"\")\n query_string = ''\n case queries\n when String\n query_string = queries\n when Array\n query_string = queries.join(' ')\n when Hash\n query_string_array = []\n queries.each do |k,v|\n query_string_array << key_value_pair_string(k, v)\n end\n query_string = query_string_array.join(' ')\n end\n\n query_string = localparams + query_string\n\n {key => query_string}\n end",
"def advanced_search_options_via_search_form(params, offset, per_page)\n query = {}\n query[:q] = params[:description] || \"\"\n query[:l] = params[:location] || \"\"\n query[:radius] = validate_radius( params )\n query[:postedDate] = validate_fromage( params )\n query[:jtype] = validate_job_type( params )\n query[:startPage] = (offset / per_page)\n query[:limit] = per_page\n query[:sort] = validate_sort( params )\n \n return query\n end",
"def build_path_query\n @path = '/' + @dn\n\n query = []\n [@extensions, @filter, @scope, @attributes].each do |x|\n next if !x && query.size == 0\n query.unshift(x)\n end\n @query = query.join('?')\n end",
"def params_for_query\n params.merge(q: params[:cq])\n end",
"def build_query\n case query = build_query_values.inject{|q,v| query_coder.decode(q).deep_merge(query_coder.decode(v)) }\n when Hash\n query_coder.encode(query)\n when String, NilClass\n query\n else\n raise InvalidRepresentationError, 'expected Hash, String, or NilClass but got: '+query.class.name\n end\n end",
"def query_params\n validate_params!\n \n qargs = {\n Ebay::Search::Api::OPERATION_NAME[:key] => Ebay::Search::Api::OPERATION_NAME[:value],\n Ebay::Search::Api::SERVICE_VERSION[:key] => Ebay::Search::Api::SERVICE_VERSION[:value],\n Ebay::Search::Api::SECURITY_APPNAME[:key] => self.app_name,\n Ebay::Search::Api::GLOBAL_ID[:key] => self.global_id,\n Ebay::Search::Api::RESPONSE_DATA_FORMAT[:key] => Ebay::Search::Api::RESPONSE_DATA_FORMAT[:value],\n Ebay::Search::Api::PER_PAGE[:key] => self.per_page,\n Ebay::Search::Api::KEYWORDS[:key] => self.keywords\n }\n \n query_formatter(qargs) do |params|\n params.join(\"&\")\n end\n end",
"def create_classic_query(options)\n raise ArgumentError, \"Query name is not present\" unless options[:query_name]\n raise ArgumentError, \"Parent list id is not present\" unless options[:parent_list_id]\n raise ArgumentError, \"Criteria is required\" unless options[:criteria]\n\n options[:visibility] ||= 0\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n xml.instruct!\n\n xml.Envelope do\n xml.Body do\n xml.CreateQuery do\n xml.QUERY_NAME options[:query_name]\n xml.PARENT_LIST_ID options[:parent_list_id]\n xml.VISIBILITY options[:visibility]\n\n xml.PARENT_FOLDER_ID options[:parent_folder_id] if options.has_key?(:parent_folder_id)\n xml.SELECT_COLUMNS options[:select_columns] if options.has_key?(:select_columns)\n xml.ALLOW_FIELD_CHANGE options[:allow_field_change] if options.has_key?(:allow_field_change)\n\n xml.CRITERIA do\n xml.TYPE options[:criteria][:type] if options[:criteria].has_key?(:type)\n\n options[:criteria][:expressions].each do |exp|\n xml.EXPRESSION do\n xml.TYPE exp[:type] if exp.has_key?(:type)\n xml.COLUMN_NAME exp[:column_name] if exp.has_key?(:column_name)\n xml.OPERATORS exp[:operators] if exp.has_key?(:operators)\n xml.VALUES exp[:values] if exp.has_key?(:values)\n xml.TABLE_ID exp[:table_id] if exp.has_key?(:table_id)\n xml.LEFT_PARENS exp[:left_parens] if exp.has_key?(:left_parens)\n xml.RIGHT_PARENS exp[:right_parens] if exp.has_key?(:right_parens)\n xml.AND_OR exp[:and_or] if exp.has_key?(:and_or)\n if exp[:rt_expressions]\n exp[:rt_expressions].each do |rt_exp|\n xml.RT_EXPRESSION do\n xml.TYPE rt_exp[:type] if rt_exp.has_key?(:type)\n xml.COLUMN_NAME rt_exp[:column_name] if rt_exp.has_key?(:column_name)\n xml.OPERATORS rt_exp[:operators] if rt_exp.has_key?(:operators)\n xml.VALUES rt_exp[:values] if rt_exp.has_key?(:values)\n xml.LEFT_PARENS rt_exp[:left_parens] if rt_exp.has_key?(:left_parens)\n xml.RIGHT_PARENS rt_exp[:right_parens] if rt_exp.has_key?(:right_parens)\n xml.AND_OR rt_exp[:and_or] if rt_exp.has_key?(:and_or)\n end\n end\n end\n end\n end\n end\n\n if options[:behavior]\n xml.BEHAVIOR do\n xml.OPTION_OPERATOR options[:behavior] if options.has_key?(:behavior)\n xml.TYPE_OPERATOR options[:type_operator] if options.has_key?(:type_operator)\n xml.MAILING_ID options[:mailing_id] if options.has_key?(:mailing_id)\n xml.REPORT_ID options[:report_id] if options.has_key?(:report_id)\n xml.LINK_NAME options[:link_name] if options.has_key?(:link_name)\n xml.WHERE_OPERATOR options[:where_operator] if options.has_key?(:where_operator)\n xml.CRITERIA_OPERATOR options[:criteria_operator] if options.has_key?(:criteria_operator)\n xml.VALUES options[:values] if options.has_key?(:values)\n end\n end\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['ListId']\n end",
"def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end",
"def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end",
"def query_string(options={})\n default_options.merge(options).delete_if{ |k, v| v.nil? || v == \"\" }.sort.map{ |arr| \"#{arr[0]}=#{arr[1]}\" }.join(\"&\")\n end",
"def build_query(payload)\n if payload[:file]\n payload\n else\n Rack::Utils.build_nested_query(payload)\n end\n end",
"def create_query_string(opts, parameterList)\n result = \"\"\n is_first = true\n parameterList.each do |param|\n if (opts.has_key?(param) && opts[param])\n if (!is_first)\n result += \"&\"\n end\n is_first = false\n result += \"#{param}=#{opts[param]}\"\n end\n end\n if (result.length > 0)\n result = \"?\" + result\n end\n result\n end",
"def transit_asset_query_builder search_string, search_number \n query = TransamAsset.arel_table[:asset_tag].matches(search_string)\n .or(TransamAsset.arel_table[:other_manufacturer_model].matches(search_string))\n .or(TransamAsset.arel_table[:description].matches(search_string))\n .or(TransamAsset.arel_table[:external_id].matches(search_string))\n .or(TransamAsset.arel_table[:quantity_unit].matches(search_string))\n if search_number\n query = query.or(TransamAsset.arel_table[:manufacture_year].matches(search_number))\n .or(TransamAsset.arel_table[:quantity].matches(search_number))\n .or(TransamAsset.arel_table[:purchase_cost].matches(search_number))\n .or(TransitAsset.arel_table[:pcnt_capital_responsibility].matches(search_number))\n end\n query \n end",
"def advanced_search_options(params, offset = 0, per_page = 5)\n boolean_opr = validate_boolean_opr(params)\n description = params[:description] || \"\"\n \n query = {}\n query[:for_all] = boolean_opr == \"all\" ? description : \"\"\n query[:for_one] = boolean_opr == \"any\" ? description : \"\"\n query[:for_exact] = boolean_opr == \"exact\" ? description : \"\"\n query[:for_none] = \"\"\n query[:for_jt] = \"\"\n query[:for_com] = \"\"\n query[:for_loc] = params[:location] || \"\"\n query[:radius] = validate_radius( params )\n query[:postedDate] = validate_fromage( params )\n query[:jtype] = validate_job_type( params )\n query[:startPage] = (offset / per_page) + 1 unless Integer(offset/per_page) == 0 # \"+ 1\" ?\n query[:limit] = per_page\n query[:sort] = validate_sort( params )\n \n return query\n end",
"def build_qs(args)\n args.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def query\n @query || params[:q] || params[:tq]\n end",
"def params_for_members_query\n params.merge(q: params[:cq])\n end",
"def params_for_members_query\n params.merge(q: params[:cq])\n end",
"def query_options\n @query_options\n end",
"def query_string_for(options)\n message = @env['warden'].try(:message) || options[:message] || default_message\n\n params = case message\n when Symbol\n { message => true }\n when String\n { :message => message }\n else\n {}\n end\n\n Rack::Utils.build_query(params)\n end",
"def query(*conditions)\n filters = (conditions + @mapping.conditions).compact.join(\" and \")\n filters = \" where #{filters}\" unless filters.empty?\n\n \"select #{lookups} from #{@record_type}#{filters}\"\n end",
"def build_query(winners, iteration)\n\tq = []\n\t(0..iteration).each do |i|\n\t\t((i+1)..(winners.length - 1)).each do |j|\n\t\t\tq << \"(\" + winners[i][0] + \"^#{winners.length-i} AND \" + winners[j][0] + \"^#{(winners.length-j)/2})\"\n\t\tend\n\tend\n\treturn CGI::escape(q.join(\" OR \"))\nend",
"def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end",
"def build_find_params(options)\n keyconditions = []\n keyparameters = []\n parameters = []\n includes = []\n joins = []\n\n # Build SQL WHERE clause using the AST\n sql = @ast.to_sql(self, definition) do |notification, value|\n\n # Handle the notifications encountered during the SQL generation:\n # Store the parameters, includes, etc so that they can be added to\n # the find-hash later on.\n case notification\n when :keycondition then keyconditions << value\n when :keyparameter then keyparameters << value\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n # Build SQL ORDER BY clause\n order = order_by(options[:order]) do |notification, value|\n case notification\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n sql = (keyconditions + (sql.blank? ? [] : [sql]) ).map {|c| \"(#{c})\"}.join(\" AND \")\n # Build hash for ActiveRecord::Base#find for the named scope\n find_attributes = {}\n find_attributes[:conditions] = [sql] + keyparameters + parameters unless sql.blank?\n find_attributes[:include] = includes.uniq unless includes.empty?\n find_attributes[:joins] = joins.uniq unless joins.empty?\n find_attributes[:order] = order unless order.nil?\n\n # p find_attributes # Uncomment for debugging\n return find_attributes\n end",
"def params_for_members_query\n params.merge(q: params[:cq])\n end",
"def build_query(uri, args = {})\n new_query = URI.decode_www_form(uri.query || '')\n args.to_a.each { |arg| new_query << arg }\n key = Phantomblaster.configuration.api_key\n new_query << ['key', key] if key && ENV['GEM_ENV'] != 'test'\n URI.encode_www_form(new_query)\n end",
"def match_query(query); end",
"def query_type_to_clause_params()\n where_clause = nil\n sql_parameters = []\n qextra = false\n all_query = false\n\n type = self.type\n query = self.query\n if type == 'All'\n all_query = true\n elsif type == 'None'\n where_clause = '1=0'\n elsif type == 'Date'\n where_clause = \"(Begin_Date REGEXP ? OR EndDate REGEXP ?)\"\n sql_parameters << query\n sql_parameters << query\n elsif type == 'after'\n where_clause = \"Begin_Date > ?\"\n sql_parameters << query\n elsif type == 'before'\n where_clause = \"EndDate < ?\"\n sql_parameters << query\n elsif type == 'parameter'\n where_clause = \"`bottle_dbs`.`parameters` LIKE ?\"\n sql_parameters << \"%#{query}%\"\n qextra = 'params'\n elsif type == 'basin'\n where_clause = \"spatial_groups.`#{query}` = 1\"\n qextra = 'spatial_group'\n elsif type == 'Chief_Scientist'\n where_clause = \"contacts.LastName LIKE ?\"\n sql_parameters << \"%#{query}%\"\n qextra = 'contacts'\n else\n if @@cruise_columns.include?(type)\n where_clause = \"`cruises`.`#{type}` REGEXP ?\"\n sql_parameters << query\n else\n Rails.logger.debug(\"Search: unrecognized type #{type}\")\n where_clause = nil\n end\n end\n [where_clause, sql_parameters, qextra, all_query]\n end",
"def apply_criteria_options\n unless criteria.selector.empty?\n command[:pipeline][0][\"$match\"] = criteria.selector\n end\n if sort = criteria.options[:sort]\n command[:pipeline][0][\"$sort\"] = sort\n end\n if limit = criteria.options[:limit]\n command[:pipeline][0][\"$limit\"] = limit\n end\n if skip = criteria.options[:skip]\n command[:pipeline][0][\"$skip\"] = skip\n end\n if fields = criteria.options[:fields]\n command[:pipeline][0][\"$project\"] = fields\n end\n end",
"def prepare_query(q_hash, options={})\n terms = options.fetch(:terms, {})\n limit = options.fetch(:limit, -1)\n skip = options.fetch(:skip, -1)\n order = options.fetch(:order, {})\n\n # Load the query but don't return any field data since we don't need it\n query = {\n 'fields' => [],\n 'query' => q_hash\n }\n\n # If we have terms that must match (such as user_id) set them\n if terms.length > 0\n if q_hash.include?('term')\n q_hash['term'].merge! terms\n else\n if q_hash.include?('bool')\n if !q_hash['bool'].include?('must')\n q_hash['bool']['must'] = []\n end\n\n q_hash['bool']['must'] << {term: terms}\n else\n query['query'] = {\n 'bool' => {\n 'must' => [q_hash]\n }\n }\n\n query['query']['bool']['must'] << {term: terms}\n end\n end\n end\n\n # Set the limit\n if limit > 0\n query['size'] = limit\n end\n\n # Set the number of records to skip\n if skip > 0\n query['from'] = skip\n end\n\n # Set the sort order, sorting by _score last\n if !query.include? 'sort'\n query['sort'] = []\n end\n\n order.map do |k, v|\n query['sort'] << {k => v}\n end\n\n if query['sort'].select { |x| x.keys.first == '_score' }.count == 0\n query['sort'] << {'_score' => 'desc'}\n end\n\n query\n end",
"def query\n @query ||= Waves::Request::Query.new( \n Waves::Request::Utilities.destructure( request.query ) )\n end",
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end",
"def to_query_options(options)\n return '' if !options.is_a?(Hash) || options.empty?\n \"?#{options.map{ |k,v| \"#{k}=#{v}\" }.join('&')}\"\n end",
"def query\n params.sort.map { |k, v| \"#{k}=\" + escape(v) }.join('&')\n end",
"def query\n normalize_query(phrase_query, query_filters.compact)\n end",
"def setup_search_options\n @original_search_parameter = params[:search]\n params[:search] ||= \"\"\n params.keys.each do |param|\n if param =~ /(\\w+)_id$/\n unless params[param].blank?\n query = \"#{$1} = #{params[param]}\"\n params[:search] += query unless params[:search].include? query\n end\n end\n end\n end",
"def query ; @query ||= Waves::Request::Query.new( request.query ) ; end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n \n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n \n end\n \n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n \n return res.join(' > ')\n end",
"def merge_query\n\t\t\tp = []\n\t\t\tp << @params.query_string unless @params.query_string == \"\"\n\t\t\tp << @filters.query_string unless @filters.query_string == \"\"\n\t\t\treturn p.size > 0 ? p.join(\"&\") : nil\n\t\tend",
"def prep_query\n @options[:query]['region_id'] = @region_id if @region_id\n @options[:query]['state'] = @state if @state\n @options[:query]['county'] = @countye if @county\n @options[:query]['city'] = @city if @city\n @options[:query]['childtype'] = @childtype if @childtype\n @options\n end",
"def where_clause_from(options)\n return nil unless options\n query = String.new()\n query = sanitize_wql(options)\n puts \"NOW, we'll execute this: #{query}\"\n return query\n end",
"def query_string\n \"#{base_url}dmQuery/#{collection_alias}/#{searchstrings}/#{fields}/\" +\n \"#{sortby}/#{max_recs}/#{start}/#{suppress_pages}/#{docptr}/#{suggest}/\" +\n \"#{facets}/#{showunpub}/#{denormalize_facets}/#{response_format}\"\n end",
"def query_string\n \"#{base_url}dmQuery/#{collection_alias}/#{searchstrings}/#{fields}/\" +\n \"#{sortby}/#{max_recs}/#{start}/#{suppress_pages}/#{docptr}/#{suggest}/\" +\n \"#{facets}/#{showunpub}/#{denormalize_facets}/#{response_format}\"\n end",
"def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end",
"def query_params\n {\n affiliate:,\n access_key:,\n query:,\n offset:,\n limit:\n }\n end",
"def build_search_url(options)\n query_params = options.to_query\n url = @@dice_results_url + '?' + query_params\n end",
"def search_options(options)\n {\n search: {\n parameters: options\n }\n }\n end",
"def create_queries arg\n a = \"\"\n arg.each_key do |key|\n a << ((a.empty?) ? \"\" : \"&\") \n a << key.to_s << \"=\" << arg[key].to_s\n end\n a\n end",
"def to_query\n {\n params: query\n }\n end",
"def to_query\n {\n params: query\n }\n end",
"def query\n sanitize search_params['query']\n end",
"def build_query_string(fields)\n return nil if fields.nil?\n tmp = []\n fields.each{|k,v|\n tmp << \"#{k.to_s}=#{CGI::escape(v.to_s)}\"\n }\n tmp.join(\"&\")\n end",
"def query(query, phrase=false)\n if phrase\n q = %q[]\n params['q'] = query.gsub(\" \",\"+\").gsub('\"',\"'\")\n else\n params['q'] = CGI.escape(query)\n end\n params.merge!({'fq' => query_filters.uniq.join(\"+AND+\")}) unless query_filters.empty?\n self\n end",
"def get_buy_requests_query\n s1='\"properties\".\"order_type\" = '+\"'#{params[:property][:order_type]}'\"\n if params[:property][:property_type] != 0 && params[:property][:property_type] != \"NILL\" && params[:property][:property_type].present?\n s1=s1+\" AND \"+'\"properties\".\"property_type\" = '+\"'#{params[:property][:property_type]}'\"\n end\n if params[:property][:property_location] != 0 && params[:property][:property_location] != \"NILL\" && params[:property][:property_location].present? \n s1=s1+\" AND \"+'\"properties\".\"property_location\" = '+\"'#{params[:property][:property_location]}'\"\n end\n if params[:property][:property_locality] != 0 && params[:property][:property_locality] != \"NILL\" && params[:property][:property_locality].present? \n s1=s1+\" AND \"+'\"properties\".\"property_locality\" = '+\"'#{params[:property][:property_locality]}'\" \n end \n return s1\n end",
"def create_raw_query\n\n recordings_search = AudioRecording.scoped\n\n if self.invalid?\n raise ArgumentError, \"SavedSearchStore has errors: #{self.errors.to_json}.\"\n end\n\n unless self.pre_params.blank?\n if self.pre_params.invalid?\n raise ArgumentError, \"SavedSearchStorePre has errors: #{self.pre_params.errors.to_json}.\"\n end\n end\n\n unless self.body_params.blank?\n\n if self.body_params.invalid?\n raise ArgumentError, \"SavedSearchStoreBody has errors: #{self.body_params.errors.to_json}.\"\n end\n\n # these are in a specific order, from the ones that will filter the most, to those that will filter the least.\n recordings_search = recordings_search.recording_ids(self.body_params.audio_recording_id) if self.body_params.audio_recording_id\n recordings_search = recordings_search.recording_uuids(self.body_params.audio_recording_uuid) if self.body_params.audio_recording_uuid\n\n recordings_search = recordings_search.recording_projects(self.body_params.project_id) if self.body_params.project_id\n recordings_search = recordings_search.recording_sites(self.body_params.site_id) if self.body_params.site_id\n\n if self.body_params.date_start && self.body_params.date_end\n recordings_search = recordings_search.recording_within_date(self.body_params.date_start, self.body_params.date_end)\n elsif self.body_params.date_start\n recordings_search = recordings_search.recording_within_date(self.body_params.date_start, self.body_params.date_start)\n elsif self.body_params.date_end\n recordings_search = recordings_search.recording_within_date(self.body_params.date_end, self.body_params.date_end)\n end\n\n if self.body_params.time_start && self.body_params.time_end\n recordings_search = recordings_search.recording_within_time(self.body_params.time_start, self.body_params.time_end)\n elsif self.body_params.time_start\n recordings_search = recordings_search.recording_within_time(self.body_params.time_start, self.body_params.time_start)\n elsif self.body_params.time_end\n recordings_search = recordings_search.recording_within_time(self.body_params.time_end, self.body_params.time_end)\n end\n\n recordings_search = recordings_search.recording_tags(self.body_params.tags) if self.body_params.tags\n end\n\n\n unless self.post_params.blank?\n if self.post_params.invalid?\n raise ArgumentError, \"SavedSearchStorePost has errors: #{self.post_params.errors}.\"\n end\n end\n\n recordings_search\n end",
"def query_params\n @query_params ||= params[:query].present? ? JSON.parse(params[:query].gsub('=>', ':')) : {}\n end",
"def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end",
"def prepare_query\n if @taxon_concept && TaxonData.is_clade_searchable?(@taxon_concept)\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, nil, limit_clause)\n end",
"def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end",
"def prepare_query\n if @taxon_concept\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, inner_order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, inner_order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, outer_order_clause, limit_clause)\n end",
"def apply_options(options) \r\n if options.kind_of? Hash\r\n conditions = options.delete(:conditions) || {}\r\n \r\n conditions.each do | c_name, c_value |\r\n c_name = c_name.to_s\r\n \r\n case c_name\r\n when /list\\Z/i\r\n # List filters\r\n list = query.__send__(c_name.camelize)\r\n c_value = [c_value] unless c_value.kind_of?(Array)\r\n c_value.each { |i| list.Add(i) }\r\n when /range\\Z/i\r\n # Range filters\r\n c_value = parse_range_value(c_value)\r\n range_filter = filter_for(c_name)\r\n range_name = c_name.match(/(.*)_range\\Z/i)[1]\r\n if range_name == 'modified_date'\r\n # Modified Date Range use the IQBDateTimeType which requires a\\\r\n # boolean 'asDateOnly' value.\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first, true) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last, true) if c_value.last\r\n else\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last) if c_value.last\r\n end\r\n when /status\\Z/i\r\n # Status filters\r\n filter.__send__(\"#{c_name}=\", c_value)\r\n else\r\n # Reference filters - Only using FullNameList for now\r\n ref_filter = filter_for(c_name)\r\n c_value = [c_value] unless c_value.respond_to?(:each)\r\n c_value.each do | val |\r\n ref_filter.FullNameList.Add(val)\r\n end\r\n end\r\n end\r\n \r\n add_owner_ids(options.delete(:owner_id))\r\n add_limit(options.delete(:limit))\r\n add_includes(options.delete(:include))\r\n\r\n options.each do |key, value|\r\n self.send(key.to_s.camelize).SetValue(value)\r\n end\r\n end\r\n end",
"def merge_query_options(opts)\n # return nil if opts is empty, else concat\n opts.blank? ? nil : '?' + opts.to_a.map {|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end",
"def generate_bq_query_string\n if self.is_array_based\n self.generate_array_query\n elsif self.is_numeric?\n self.generate_minmax_query\n else\n self.generate_non_array_query\n end\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n\n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n\n end\n\n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n\n return res.join(' > ')\n end",
"def query_params\n p = base_params.merge(filter_params).\n merge(options_params).\n merge(pivot_params)\n p.merge!(measures: measures_param) unless measures.empty?\n p.merge!(dimensions: dimensions_param) unless dimensions.empty?\n p.merge!(sort: sort_option) if sort_option\n p\n end",
"def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end"
] | [
"0.72319084",
"0.6983082",
"0.6948496",
"0.6912919",
"0.6810623",
"0.6707633",
"0.6572565",
"0.65251833",
"0.648483",
"0.6458556",
"0.6419039",
"0.64018494",
"0.6397483",
"0.63915026",
"0.6379985",
"0.6338988",
"0.6320643",
"0.6273354",
"0.6254824",
"0.62426573",
"0.6222928",
"0.6218922",
"0.6201203",
"0.62008667",
"0.61927336",
"0.61722034",
"0.6169331",
"0.6150025",
"0.6147973",
"0.6135232",
"0.6056473",
"0.6052061",
"0.6040895",
"0.6020825",
"0.601475",
"0.60138184",
"0.6013121",
"0.6011281",
"0.60060626",
"0.5999362",
"0.5983339",
"0.59722096",
"0.5967966",
"0.59616154",
"0.5958537",
"0.5933597",
"0.59328175",
"0.59150237",
"0.5908601",
"0.5902955",
"0.58931094",
"0.58931094",
"0.5878623",
"0.5872047",
"0.5869925",
"0.5869469",
"0.58681995",
"0.58635926",
"0.58625144",
"0.584938",
"0.5849072",
"0.584755",
"0.5835048",
"0.5830963",
"0.5830155",
"0.5823943",
"0.5821262",
"0.5818026",
"0.58135796",
"0.58093816",
"0.58044475",
"0.57974666",
"0.5792085",
"0.5787228",
"0.5786218",
"0.57721907",
"0.57721907",
"0.57666105",
"0.57572806",
"0.57522726",
"0.57364076",
"0.5736058",
"0.57353765",
"0.57353765",
"0.57254183",
"0.57235",
"0.572313",
"0.5716382",
"0.5711327",
"0.5708413",
"0.5701119",
"0.5700973",
"0.5699167",
"0.5698079",
"0.56965107",
"0.569249",
"0.5683861",
"0.5682063",
"0.5679795",
"0.56797445"
] | 0.80172116 | 0 |
overrides documents with the same url | def elastics_id
Digest::MD5.hexdigest url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end",
"def set_document\n url = params[:document_url] ? params[:document_url] : 'kei-press-documentation'\n @document = Article.find_by(content_url: url)\n end",
"def documents; end",
"def documents; end",
"def document\n raise Datasource::MethodOverride.new(\"document method needs to be overridden\")\n end",
"def inherit_from(document)\n\t\t\t@bookmarks = document.bookmarks\n\t\t\t@headers = document.headers\n\t\t\t@todos = document.todos\n\t\t\t@placeholders = document.placeholders\n\t\tend",
"def url_for_document(_doc)\n '#'\n end",
"def assign_current_document!; end",
"def url_for_document(doc, _options = {})\n return [hyrax, doc] if doc.collection?\n [main_app, doc]\n end",
"def process_documents(docs)\n docs.each do |doc|\n relativize_urls doc\n end\n end",
"def process_documents(docs)\n docs.each do |doc|\n relativize_urls doc\n end\n end",
"def url\n @doc.url\n end",
"def reload\n self.replace( CouchDB.get( uri ) )\n end",
"def initialize(document, url)\n @document = document\n @url = url\n end",
"def update; @doc = get(link('self')); nil; end",
"def update; @doc = get(link('self')); nil; end",
"def defaults\n super\n\n @rdoc_dir = '.rdoc'\n end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end",
"def external_document\n read_attribute(:external_document).try(:dup) || {}\n end",
"def request_doc\n \n end",
"def call\n refs = replace_refs\n replace_references(refs)\n\n doc\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def current_document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document(path); end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def documentation_url; end",
"def original_url; end",
"def document=(name)\n @document = name\n end",
"def converted_doc\n # In the future, change to point to reference material within Tutor\n return @converted_doc unless @converted_doc.nil?\n\n @converted_doc = doc.dup\n\n @converted_doc.css(\"[src]\").each do |link|\n src = link.attributes[\"src\"]\n uri = Addressable::URI.parse(src.value)\n\n if uri.absolute?\n # Since this is embedded content, make sure it is https\n uri.scheme = \"https\"\n src.value = uri.to_s\n else\n next if uri.path.blank?\n\n # Relative link: make secure and absolute\n src.value = OpenStax::Cnx::V1.url_for(uri, secure: true)\n end\n end\n\n @converted_doc.css(\"[href]\").each do |link|\n href = link.attributes[\"href\"]\n uri = Addressable::URI.parse(href.value)\n\n # Anchors don't need to be https\n next if uri.absolute? || uri.path.blank?\n\n # Relative link: make secure and absolute\n href.value = OpenStax::Cnx::V1.url_for(uri, secure: true)\n end\n\n @converted_doc\n end",
"def documenturls91\n return unless object.documents.attachments\n document_urls = object.documents.map do |adoc| \n URI.join(\n ActionController::Base.asset_host, \n rails_blob_path(adoc))\n end\n end",
"def url_for_document(document, options = {})\n document[:id] = document.id.gsub(/#{I18n.locale.to_s}:/, '')\n search_state.url_for_document(document, options)\n end",
"def index\n if request.format.html?\n api_canon_docs\n else\n super\n end\n end",
"def document_overrides(document)\n if document.respond_to?(:data) and document.data.has_key?(\"app_engine\")\n document.data.fetch(\"app_engine\")\n else\n {}\n end\n end",
"def process_doc_or_page(doc)\n site_hostname = URI(doc.site.config['url']).host\n\n # TODO: Read anchor_contents from site config\n anchor_contents = \"<i class='fas fa-link'></i>\"\n\n unless doc.respond_to?(:asset_file?) and doc.asset_file?\n if doc.respond_to?(:id)\n if $processed_urls.include? doc.id\n return\n end\n $processed_urls << doc.id\n end\n doc.output = process_content(site_hostname, doc.output, anchor_contents)\n end\nend",
"def retrieve_docs_from_host1\n apis = {}\n host = @doc_urls[:doc_base1][%r{^https?:\\/\\/[^\\/]+}]\n apis_received = open(@doc_urls[:doc_base1], @api_docs, &:read).scan(/<a class=\"swagger-list--item-link\" href=\"\\/(.+?)\".*?>\\s*(.+?)\\s*<\\/a>/i)\n \n apis_received.each do |path, title|\n begin\n api = { path: \"#{@doc_urls[:doc_base1]}#{path}\",\n title: title.sub(/\\s*\\(.+?\\)$/, ''),\n deprecated: title.include?('(Deprecated)') }\n\n fetched_path = open(api['path'], Options, &:read).scan(%r{url:\\s*'(.+?)'})\n api[:path] = \"#{host}#{fetched_path}\"\n apis[api[:title]] = api\n rescue OpenURI::HTTPError\n # Some log here\n end\n end\n\n apis\n end",
"def update!(**args)\n @doc_id = args[:doc_id] if args.key?(:doc_id)\n @url = args[:url] if args.key?(:url)\n end",
"def url\n super\n end",
"def set_doc\n @doc = @repository.docs.find_by_slug(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find_by(slug: params[:id])\n end",
"def resolve_document\n case document\n when /^http[s]?:/ then \n response = HTTPI.get(request)\n if response.error?\n raise Savon::HTTP::Error.new(response)\n else\n response.body\n end\n when /^</ then document\n else File.read(document)\n end\n end",
"def url\n URL_MAPPING[@docid]\n end",
"def set_document(options)\n period = Period.find(options[:period_id])\n nomenclature = period.organism.nomenclature\n folio = nomenclature.folios.find_by_id(options[:folio_id])\n @document = nomenclature.sheet(period, folio)\n end",
"def set_document\n @document = LibraryDocument.find_by(:object_key => params[:id])\n if @document.nil?\n redirect_to '/404'\n return\n end\n end",
"def set_document(options)\n # TODO faire une méthode dans le modèle\n period = Period.find(options[:period_id])\n nomenclature = period.organism.nomenclature\n # @docs est une collection de Compta::Sheet\n @docs = options[:collection].map do |c|\n fol = nomenclature.folios.find_by_name(c.to_s)\n nomenclature.sheet(period, fol) if fol\n end.reject { |r| r.nil?}\n \n end",
"def url_for_document doc, options = {}\n require 'cgi'\n if respond_to?(:blacklight_config) and\n blacklight_config.show.route and\n (!doc.respond_to?(:to_model) or doc.to_model.is_a? SolrDocument)\n route = blacklight_config.show.route.merge(action: :show, id: doc).merge(options)\n route[:controller] = controller_name if route[:controller] == :current\n route\n else\n # This branch is the one executed for a search results index page \n if doc and doc[\"DocId\"]\n # IF doc exists and has this field\n Rails.logger.debug(\"Route - returning doc #{doc['DocId']}\" )\n # One mechanism is to return the doc itself (Ruby can recognize that it is an object and create the appropriate url)\n # In that case, the url would be catalog/id\n # but here, we want to ensure we pass the DocId parameter and we are escaping the ID in the parameter \n # Additionally, we tried updating the doc id to be the escaped uri, but that did not work correctly\n # What we are doing here is passing the local name (which has no slashes, etc. that could throw either apache or ruby off)\n # and then utilizing the normal behavior for showing a document but passing in the parameter as well\n # Code on the solr document helper side knows to expect that parameter and utilize that for the solr document id if it exists\n # Not passing in a local name in the url would make the code expect this was some search query, and without a query it jsut\n # goes back to the front page\n id = doc[\"DocId\"]\n uri_sliced = id.split(\"/\")\n local_name = uri_sliced.last\n uri_escaped = CGI::escape(id)\n # This was there originally before but let's try it without this, this would be useful if we were passing back doc\n # instead of passing the parameter in the URL\n # doc[\"id\"] = local_name \n \"/catalog/\" + local_name + \"?DocId=\" + id\n else \n #Does what this code would do without our updates \n doc \n end\n \n end\n end",
"def create\n if(@document = Document.new(params[:document])).save\n flash['notice'] = 'Document was successfully created.'\n respond_with @document, \n :location => site_document_url(@document.site.slug , @document.id.to_s)\n else\n\n if doc = Document.where(uri: params[:document][:uri]).first\n params[:id] = doc.id\n update\n else\n respond_with @document\n end\n end\n \n end",
"def api_docs(method)\n @doc_urls ||= {}\n @doc_urls[method]\n end",
"def download_origin\n send_data(@document.original_file, type: @document.data_type, filename: @document.name)\n end",
"def render_document; end",
"def coordinate_documents(docs)\n regex = document_url_regex\n approved = {}\n docs.each do |doc|\n lang = doc.data['lang'] || @default_lang\n url = doc.url.gsub(regex, '/')\n doc.data['permalink'] = url\n next if @file_langs[url] == @active_lang\n next if @file_langs[url] == @default_lang && lang != @active_lang\n approved[url] = doc\n @file_langs[url] = lang\n end\n approved.values\n end",
"def coordinate_documents(docs)\n regex = document_url_regex\n approved = {}\n docs.each do |doc|\n lang = doc.data['lang'] || @default_lang\n url = doc.url.gsub(regex, '/')\n doc.data['permalink'] = url\n next if @file_langs[url] == @active_lang\n next if @file_langs[url] == @default_lang && lang != @active_lang\n approved[url] = doc\n @file_langs[url] = lang\n end\n approved.values\n end",
"def set_document\r\n @document = Document.find(params[:id])\r\n end",
"def supercede_or_replace_document\n if params[:document_home].present?\n @doc_home = DocumentHome.scoped_by_company_id(@company.id).find(params[:doc_id])\n old_document=@doc_home.latest_doc\n params[:document_home][:employee_user_id]= get_employee_user_id\n params[:document_home][:company_id]= @company.id\n params[:document_home][:created_by_user_id]= current_user.id\n params[:document_home][:old_document]=old_document.id\n params[:document_home][:name]=old_document.name\n params[:document_home][:bookmark]=old_document.bookmark\n params[:document_home][:phase]=old_document.phase\n params[:document_home][:privilege]=old_document.privilege\n params[:document_home][:description]= old_document.description\n params[:document_home][:doc_source_id] = old_document.doc_source_id\n params[:document_home][:author]=old_document.author\n params[:document_home][:employee_user_id]=old_document.employee_user_id\n if params[:document_home][:data].present? && @doc_home.superseed_document(params[:document_home], false)\n flash[:notice]=\"#{t(:text_document)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_updated)}\"\n else\n flash[:error]=\"File size should be between is 1KB-50MB.\"\n end\n else\n flash[:error]=\"File size should be between is 1KB-50MB.\"\n end\n redirect_to :action => :index\n end",
"def set_document\r\n @document = Document.find(params[:id])\r\n end",
"def url=(_); end",
"def documents\n return bad_request unless params[:id] and request.format.json? || request.format.js? || request.format.text?\n return not_found unless current_document\n opts = {:access => true, :sections => true, :annotations => true, :data => true}\n if current_account\n opts[:account] = current_account\n opts[:allowed_to_edit] = current_account.allowed_to_edit?(current_document)\n opts[:allowed_to_review] = current_account.reviews?(current_document)\n end\n @response = {'document' => current_document.canonical(opts)}\n respond_to do |format|\n format.text do\n direct = [PRIVATE, ORGANIZATION, EXCLUSIVE].include? current_document.access\n redirect_to(current_document.full_text_url(direct: direct))\n end\n format.json { render_cross_origin_json }\n format.js { render_cross_origin_json }\n end\n end",
"def update!(**args)\n @documents = args[:documents] if args.key?(:documents)\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['member_works_count_isi'] = member_works_count\n solr_doc['title_ssort'] = sort_title\n solr_doc['creator_ssort'] = object.creator.first\n solr_doc['generic_type_sim'] = [\"Collection\"]\n solr_doc['banner_path_ss'] = banner_path\n solr_doc['source_collection_title_for_collections_ssim'] = source_collection\n solr_doc['deposit_collection_titles_tesim'] = deposit_collection\n solr_doc['deposit_collection_ids_tesim'] = object.deposit_collection_ids\n end\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n # Only do this after the indexer has the file_set\n unless object.file_sets.nil?\n load_elections_xml(object)\n if @noko.nil?\n Rails.logger.warn(\"Couldn't find the Voting Record XML for #{solr_doc['id']}\")\n else\n solr_doc['voting_record_xml_tesi'] = @noko.to_xml\n solr_doc['format_ssim'] = 'Election Record' # solr_doc['format_tesim']\n solr_doc['title_ssi'] = solr_doc['title_tesim'].first # solr_doc['title_tesi']\n\n solr_doc['party_affiliation_sim'] = get_all_vs('//candidate/@affiliation', '//elector/@affiliation')\n solr_doc['party_affiliation_id_ssim'] = get_all_vs('//candidate/@affiliation_id', '//elector/@affiliation_id')\n # solr_doc['party_affiliation_id_ssim'].delete_if { |party_id| Party.find(party_id).nil? }\n\n solr_doc['date_tesim'] = get_all_vs('/election_record/@date')\n solr_doc['date_isi'] = solr_doc['date_tesim'].map(&:to_i).first\n # solr_doc[\"date_sim\"] = date.first[0..3] unless date.first.nil?\n\n solr_doc['office_id_ssim'] = get_v('/election_record/office/@office_id')\n solr_doc['office_role_title_tesim'] = get_all_vs('//role/@title')\n solr_doc['office_name_tesim'] = get_authority_from_nnv(solr_doc['office_id_ssim'], \"office\")\n\n solr_doc['state_name_tesim'] = solr_doc['state_name_sim'] = get_all_vs('//admin_unit[@type=\"State\"]/@name')\n\n solr_doc['election_id_ssim'] = [get_v('/election_record/@election_id')]\n solr_doc['election_type_tesim'] = solr_doc['election_type_sim'] = [get_v('/election_record/@type')]\n\n solr_doc['candidate_id_ssim'] = get_all_vs('//candidate/@name_id')\n solr_doc['candidate_name_tesim'] = get_all_vs('//candidate/@name')\n\n solr_doc['elector_name_tesim'] = get_all_vs(\"//elector/@name\")\n\n solr_doc['jurisdiction_tesim'] = solr_doc['jurisdiction_sim'] = [get_v('/election_record/office/@scope')]\n\n solr_doc['handle_ssi'] = get_v('/election_record/@handle')\n solr_doc['iteration_tesim'] = [get_v('/election_record/@iteration')]\n # solr_doc['page_image_urn_ssim'] = get_all_vs(\"//reference[@type='page_image']/@urn\").uniq\n solr_doc['iiif_page_images_ssim'] = get_iiif_ids(get_all_vs(\"//reference[@type='page_image']/@urn\").uniq)\n\n solr_doc['all_text_timv'] = get_all_text(solr_doc)\n end\n end\n end # End super.tap\n end",
"def initialize\n super(Network.generate_id(\"document_\"))\n @view = View.new\n @layout = Layout.new\n self.link(:default_view, @view)\n self.link(:default_layout, @layout)\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end"
] | [
"0.6641335",
"0.6539788",
"0.65353876",
"0.65353876",
"0.6282879",
"0.6169774",
"0.6070363",
"0.6063825",
"0.60279983",
"0.59925115",
"0.59925115",
"0.59732217",
"0.5966653",
"0.5940291",
"0.59290653",
"0.59290653",
"0.5928588",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58986956",
"0.58883506",
"0.58748716",
"0.5867934",
"0.58245015",
"0.5794692",
"0.57906085",
"0.5781895",
"0.5781895",
"0.5781895",
"0.5781895",
"0.5781895",
"0.5781895",
"0.5781895",
"0.5781895",
"0.5781895",
"0.57723397",
"0.5767142",
"0.5767142",
"0.574869",
"0.5733549",
"0.5721699",
"0.57181984",
"0.5717445",
"0.5715049",
"0.5714086",
"0.56797916",
"0.5649331",
"0.56427455",
"0.5636564",
"0.5630116",
"0.56247103",
"0.5608986",
"0.560034",
"0.5600301",
"0.5598735",
"0.5585602",
"0.5561661",
"0.55555385",
"0.5553904",
"0.55385816",
"0.5537971",
"0.5536937",
"0.5530019",
"0.5527086",
"0.5527086",
"0.55183876",
"0.5516838",
"0.55167073",
"0.5509213",
"0.55054057",
"0.5504902",
"0.5499692",
"0.54940367",
"0.54934317",
"0.54932743",
"0.54932743",
"0.54932743",
"0.54932743",
"0.54932743",
"0.54932743",
"0.54932743",
"0.54932743",
"0.54932743"
] | 0.0 | -1 |
returns the original title of the document or missing_title | def attachment_title
orig_title = super
orig_title.blank? ? missing_title : orig_title
rescue NoMethodError
missing_title
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_title\n document[\"originalTitle\"] rescue nil\n end",
"def title\n @doc.title || DEFAULT_TITLE\n end",
"def title\n @title ||= Utilities.longest_common_substring_in_array(titles.values) \n @title = titles[:og_title] unless title_ok?\n @title = titles[:html_title] unless title_ok?\n @title = titles[:from_doc] unless title_ok?\n\n @title\n end",
"def inferred_title?(document); end",
"def extract_default_title\n\t\treturn self.name unless self.readme&.table_of_contents&.first\n\t\ttitle = self.readme.table_of_contents.first.text\n\t\ttitle ||= self.name\n\tend",
"def extract_title( existing_payload, solr_doc, fedora_doc )\n\n # general approach\n title = IngestHelpers.solr_first_field_extract(solr_doc, 'mods_title_info_t')\n return title if title.present?\n\n return nil\n end",
"def original_title\n details.at(\"div.originalTitle\").children.first.text.gsub('\"', '').strip rescue nil\n end",
"def title(force_refresh = false)\n if @title && !force_refresh\n @title\n else\n @title = document[\"title\"] rescue nil\n end\n end",
"def title\n @title ||= parsed_document.css('title').inner_text rescue nil\n end",
"def create_default_title(solr_document)\n title = solr_document[:display_title]\n pcdm_file_of = solr_document[:pcdm_file_of]\n if pcdm_file_of\n file_of_result = fetch(pcdm_file_of)\n file_of_document = file_of_result[1]\n file_of_title = file_of_document[:display_title]\n title += \" - #{file_of_title}\"\n end\n title\n end",
"def title\n @data.title ||= parsed_document.css('title').inner_html.gsub(/\\t|\\n|\\r/, '') rescue nil\n end",
"def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end",
"def accurate_title\n nil\n end",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def title\n @rdig_document.title\n end",
"def title\n filename.nil? ? nil : File.basename(filename)\n end",
"def title\n t = nil\n # default to long title\n long_titles = self.courses.map(&:long_title)\n return t if (t = long_titles.find(&:present?)).present?\n\n # then try specific title. then short title\n return self.specific_title if self.specific_title.present?\n\n short_titles = self.courses.map(&:short_title)\n return t if (t = short_titles.find(&:present?)).present?\n\n return '(Title Unavailable)'\n end",
"def title_with_page_title_check\n return @page.title if @page && !@page.title.blank?\n title_without_page_title_check\n end",
"def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend",
"def title\n evaluate(\"document.title\")\n end",
"def inferred_title?(document)\n return false unless document.is_a?(Jekyll::Document)\n\n meta = read_yaml(File.dirname(document.path), File.basename(document.path))\n !meta.key?(\"title\")\n end",
"def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def get_title\n\t\t@fields_hash[FIELDS_MAP[:title]] || \"\"\n\tend",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def title\n document.search(\".bookTitle\").innerHTML.strip rescue nil\n end",
"def title_with_page_title_check\n return @content_node.title if @content_node && !@content_node.title.blank?\n title_without_page_title_check\n end",
"def getTitle(doc)\n\tfirstLine = doc.strip[/^[^\\n]+(?=\\n|$)/]\n\tfirstLine.length <= TITLE_LENGTH ? firstLine : firstLine[0,TITLE_LENGTH-3]+\"...\"\nend",
"def prioritized_title\n first = self.titles.first\n return first.nil? ? self.id : first.title\n end",
"def check_title\n if self.title.blank? && st = (url && Site.by_link(self.url))\n self.title = (st.yield :Title, st.sampleURL)[:Title] || \"\"\n self.title = self.trimmed_title\n else\n self.title\n end\n end",
"def get_saved_title()\n begin\n return File.read(TITLE_FILE).strip!\n rescue => e\n return \"\"\n end\nend",
"def get_title\n @doc.css('title').text\n end",
"def title\n if @title == nil\n \"Movie not found!\"\n else\n @title\n end\n end",
"def complete_title\n if self.title.present?\n self.title\n else\n I18n.translate(\"bento_search.missing_title\")\n end\n end",
"def should_extract_title(doc)\n return true\n end",
"def html_title\n @html_title || title\n end",
"def read_draft_title\n match = read.match(/title:\\s+(.+)?$/)\n match[1] if match\n end",
"def get_title\r\n return nil if @blog_model.nil?\r\n return (@blog_model.title.blank? ? \"[untitled]\" : @blog_model.title)\r\n end",
"def get_page_title(page_doc)\n\treturn page_doc.css('title').text.strip\nend",
"def title\n return @title if @title\n return @filename if @filename\n return @type if @type\n return \"Unknown file name\"\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end",
"def title_or_default(page_title = '') # turn nil into empty\n if page_title.empty?\n title = DEFAULT_TITLE\n else\n title = page_title\n end\n \n return \"#{title} | #{TITLE_SUFFIX}\"\n end",
"def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end",
"def title\n dt = doc_text_by_current_language\n unless dt.nil?\n return dt.title \n else\n return ESTEAM_NO_LANGUAGE_TXT\n end\n end",
"def title()\n @markdown_document.title()\n end",
"def title\n return nil\n end",
"def title\n super.first || \"\"\n end",
"def title\n super.first || \"\"\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def guess_title(resource)\n resource.try title_field_finder.find\n end",
"def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end",
"def title\n if @data.attribute_names.include?(:title)\n @title ||= @data[:title].last\n else\n if @data.attribute_names.include?(:cmutitle)\n @title ||= @data[:cmutitle].last\n else\n @title ||= nil\n end\n end\n end",
"def titleize\n\t\tif @title.nil?\n\t\t\tmeta = @source.titleize metadata\n\t\t\t@title = \"#{@settings.title || @origin_id} - #{meta}\"\n\t\tend\n\t\treturn @title\n\tend",
"def title\n doc.css(\"titleproper\").children.first.text.strip\n end",
"def extract_title(doc)\n entry_text = doc['entry_text'].strip\n title_text = nil\n\n # Get the title.\n loc_firstperiod = entry_text.index(\".\")\n loc_firstnewline = entry_text.index(\"\\n\")\n if not loc_firstnewline.nil? and not loc_firstperiod.nil?\n # Newline before the first period or directly after it.\n if loc_firstnewline < loc_firstperiod\n title_text = entry_text[0, loc_firstnewline]\n entry_text = entry_text[loc_firstnewline + 1..entry_text.length]\n elsif loc_firstperiod == loc_firstnewline - 1\n title_text = entry_text[0, loc_firstperiod]\n entry_text = entry_text[loc_firstperiod + 1..entry_text.length]\n end\n elsif not loc_firstnewline.nil? and loc_firstperiod.nil?\n title_text = entry_text[0, loc_firstnewline]\n entry_text = entry_text[loc_firstnewline+1..entry_text.length]\n end\n doc['entry_text'] = entry_text\n doc['title_text'] = title_text\n end",
"def title title = nil\n if title\n @title = title.to_s\n else\n @title ||= name[/([^:]+)$/, 1]\n end\n end",
"def page_title() nil end",
"def title\n return @title if @title\n if matches = class_const(:TITLE_RE).match(page)\n @title = matches[1].to_s.strip\n title_processor\n @title = decode_entities(@title)\n end\n end",
"def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end",
"def _RefTitle\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_RefTitleSingle)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_RefTitleDouble)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_RefTitleParens)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_EmptyTitle)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_RefTitle unless _tmp\n return _tmp\n end",
"def display_name\n title.present? && title || _('Untitled')\n end",
"def full_title\n ti = title_values&.first\n st = subtitle_values&.first\n if ti && st\n # Remove the automatically-appended subtitle (in the case of search\n # results entries).\n ti = ti.delete_suffix(st).rstrip.delete_suffix(':')\n # Append the subtitle only if it doesn't appear to already be included in\n # the base title itself.\n ti = \"#{ti}: #{st}\" unless significant(ti).include?(significant(st))\n end\n ti || st || '???'\n end",
"def normalized_title\n t = self.title.presence || default_title\n t.gsub('.', '').strip\n end",
"def title\n if title_attribute = read_attribute(:title)\n title_attribute\n elsif self.properties && self.properties['title'].present?\n self.properties['title']\n else\n default_title\n end\n end",
"def title\n @title ||= hash.fetch('title') { |key|\n raise \"Page id=#{id} is missing #{key}\"\n }\n end",
"def custom_slug_or_title\n title.presence\n end",
"def first_title\n title.first\n end",
"def page_title\n nil\n end",
"def populate_title\n if self.title.blank?\n self.title = self.file_file_name.blank? ? \"\" : self.file_file_name.gsub(/_/, \" \").capitalize\n end\n\tend",
"def title\n # strip some non-breaking space at the end\n @title ||= details.at(\"h1[itemprop='name']\").children.first.text.strip.gsub(' ', '') rescue nil\n end",
"def title(title = nil)\n @title = title if title\n @title\n end",
"def title\n og.title || meta.title || body.title\n end",
"def get_title()\n return @title\n end",
"def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end",
"def f_title\n self.title[0]\n end",
"def title\n @document['title_citation_display']&.first&.truncate(250)\n end",
"def title(doc)\n node = doc.at('/html/head/title') and node.text\n end",
"def name; (page.title rescue ''); end",
"def name; (page.title rescue ''); end",
"def title\n return @title unless link\n\n # handle the most common cases next\n return \"#{@title}. \" unless @title.ends_with?('. ', '.')\n return \"#{@title} \" if @title.ends_with?('.')\n\n @title\n end",
"def title\n @title ||= parsed.css('head title').inner_text rescue nil\n end",
"def header_text(page_title)\n page_title || @@base_title\n end",
"def title\n title_raw.downcase\n end",
"def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def series_title\n return title if series?\n @doc = SolrDocument.new(Blacklight.solr.select(:params => { :fq => \"#{SolrDocument.unique_key}:#{series}\" })[\"response\"][\"docs\"].first)\n @doc.title\n end",
"def citation_title\n self.article_title || self.book_title || self.title\n end",
"def title(alt = nil)\n # Return the resource title if available, otherwise return the specified alternative\n return self.resource.title || @title if self.resource\n case alt\n when :library_note, :private_note\n self.library_note || nil\n when :note\n self.student_note || self.note || self.library_note || nil\n when :public_note, :student_note\n self.student_note || self.note || nil\n when :uri\n self.uri\n else\n nil\n end\n end",
"def meta_title\n read_attribute(:meta_title).blank? ? self.title : read_attribute(:meta_title)\n end",
"def get_title\n return nil if @rapid_miner_model.nil?\n return nil if @rapid_miner_model.title.blank?\n\n @rapid_miner_model.title\n end",
"def acf_title\n @title ||= postmetas.find_by(meta_key: \"title\").try(:meta_value)\n end",
"def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def guess_title(view_page)\n title = \"unknown\"\n h1 = view_page.css('h1')\n if (h1 != nil)\n title = view_page.title\n else\n title = h1.text\n end\n title\n end",
"def data_title\n metadata[dataset_uri][dct.title.to_s][0] rescue nil\n end",
"def title\n @title ||= doc.search('.moviename-big').xpath('text()').text.strip\n end",
"def title_for_google\n google_title.present? ? google_title : name\n end",
"def augmented_title\n return self.title\n end",
"def fallback_title\n exception = StandardError.new(\"page title missing: #{controller_name}##{action_name}\")\n raise exception if Rails.application.config.consider_all_requests_local\n Sentry.capture_exception(exception)\n\n title ''\n end",
"def normalized_title\n normalized(full_title)\n end",
"def title_raw\n conf['title'] || proj.title\n end"
] | [
"0.8779934",
"0.79077226",
"0.77170014",
"0.75443035",
"0.7420337",
"0.738242",
"0.7377188",
"0.73455167",
"0.73398316",
"0.73380643",
"0.7327446",
"0.72898304",
"0.72233427",
"0.71817076",
"0.713298",
"0.7102444",
"0.7089676",
"0.7065898",
"0.701621",
"0.69968915",
"0.6986478",
"0.69853693",
"0.6985245",
"0.6977957",
"0.6977228",
"0.6944431",
"0.694118",
"0.6938699",
"0.6938509",
"0.6938002",
"0.69330865",
"0.6917036",
"0.6916521",
"0.691356",
"0.69072217",
"0.6906443",
"0.6905363",
"0.6889231",
"0.6878246",
"0.6875222",
"0.6875058",
"0.686357",
"0.68447614",
"0.6838494",
"0.6824508",
"0.68199056",
"0.68199056",
"0.6818991",
"0.6818991",
"0.6818991",
"0.6807609",
"0.68055594",
"0.68034166",
"0.6799075",
"0.6796786",
"0.67965466",
"0.67939484",
"0.6793775",
"0.6793378",
"0.6778494",
"0.6769905",
"0.676552",
"0.67486256",
"0.6740639",
"0.67300993",
"0.67296565",
"0.67286533",
"0.67284065",
"0.6715672",
"0.6712656",
"0.6706829",
"0.6704063",
"0.67033887",
"0.6700428",
"0.6680936",
"0.66756827",
"0.66749895",
"0.6670934",
"0.66680944",
"0.66680944",
"0.66664815",
"0.66656417",
"0.6663084",
"0.6658663",
"0.6657184",
"0.66548294",
"0.6650005",
"0.66412216",
"0.6623626",
"0.66230285",
"0.6617361",
"0.66172874",
"0.6609939",
"0.66091746",
"0.66084176",
"0.6607337",
"0.6601804",
"0.6601088",
"0.66002315",
"0.6592873"
] | 0.7502274 | 4 |
Makes a Web Scrapper to get the twitter description | def fetch_twitter_informations
unparsed_html = Nokogiri::HTML(open(twitter_profile_address))
self.twitter_username = fetch_twitter_username(unparsed_html)
self.twitter_description = fetch_twitter_description(unparsed_html)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTwitters(searchTerm)\n # url encoding the searchterm\n searchTerm = CGI::escape(searchTerm)\n \n # grabbing the search results for the given searchTerm from summize as a REXML document\n doc = REXML::Document.new open(\"http://summize.com/search.atom?lang=en&rpp=100&q=#{searchTerm}\").read\n \n # this part swaps the current @content stack with the search result\n @content.clear {\n doc.elements.each(\"feed/entry\") do |element|\n stack(:width => 500, :height => 80) do\n fill \"#282828\"..\"#141414\", :angle => 180\n rect 0, 0, 500, 80, 5\n flow(:margin_left => 5, :margin_top => 5) do\n flow(:width => 50) do\n #clicking on avatar => visit the person's twitter profile in a webbrowser\n click do\n visit(element.elements['author'].elements['uri'].text)\n end\n \n element.each_element_with_attribute('rel', 'image', 1) do |pic|\n image pic.attributes['href'] # downloads and displays avatar\n end\n end\n flow(:width => 440) do\n # clicking on message => visit the message on twitter in a webbrowser\n click do\n element.each_element_with_attribute('rel', 'alternate', 1) do |profile|\n visit(profile.attributes['href'])\n end\n end\n \n inscription getFormattedTime(element.elements[\"published\"].text), :stroke => orange\n para element.elements[\"title\"].text, :stroke => white\n end\n end\n end\n end\n }\n end",
"def description\n\t\"Search twitter for this username.\"\nend",
"def fetch_details(attr)\n url = attr['href'].text\n if args = url.match('https?://twitter\\.com.*status/(\\d+)')\n data = @api[\"/statuses/show/#{args[1]}.json\"].get\n tweet = Yajl::Parser.parse(data.body)\n\n tags = DeliciousLetter.build_tags(attr)\n\n template = Tilt.new('templates/twitter.haml')\n html = template.render(self, tweet: tweet, url: url, tags: tags)\n text = \"#{tweet['user']['name']}:\\n#{tweet['text']}\\n#{url}\\n\\n\"\n\n {'text' => text, 'html' => html}\n end\n end",
"def downloadTwitterWebPage\n twitterURL = 'https://twitter.com/' + @screen_name\n\n uri = ::URI.parse(twitterURL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Make the HTTP request to Twitter.\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n # If it's not accepted, throw an exception.\n @web_page = response.body\n end",
"def search_description_scrape\n @doc.search('.muted a').first(10).each do |description|\n @descriptions << description.text\n end\n check_for_results\n end",
"def scrape_basic_content(t)\n\t\t\tbegin\n\t\t\t\ttweet_id = t.xpath(\"@data-item-id\").text().to_s.strip\n\t\t\t\tposter_name = t.xpath(\"//strong/text()\").to_s.strip\n\t\t\t\t#check if the poster is the current user!!\n\t\t\t\tputs \"NAME#{@name}\"\n\t\t\t\t@max_tweet_id = tweet_id\n\t\t\t\tset_id(tweet_id)\n\t\t\t\t#puts tweet_id\n\t\t\t\ttweet_content = t.xpath(\"./div/div/p/text()\").to_s.strip\n\t\t\t\t#puts tweet_content\n\t\t\t\tset_content(tweet_content)\n\n\n\t\t\trescue Exception => e\n\t\t\t\tLogWriter.error(e)\n\t\t\t\treturn self\t\n\t\t\tend\n\tend",
"def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend",
"def parse_tweet_content (t)\n\t\tbegin\n\t\ttweet_id = t.xpath(\"@data-item-id\").text().to_s.strip\n\t\txpath = '//*[@id=\"stream-item-tweet-'+tweet_id+'\"]/div/div/div[1]/a/strong/text()'\n\t\tposter_name = t.xpath(xpath)\n\t\t#poster_name = t.xpath('//*[@id=\"stream-item-tweet-371766472051138560\"]/div/div/div[1]/a/strong/text()')\n\t\t#check if the poster is the current user!!\n\t\t#test_name = poster_name.partition(\" \").first\n\t\t#puts \"is of page owner real name:#{@real_name} poster name: #{poster_name}\"\n\t\tif @real_name.include?(poster_name.to_s)\t\t\n\t\t\t@is_of_page_owner = true\n\t\tend\n\t\t@max_tweet_id = tweet_id\n\t\tset_id(tweet_id)\n\t\t#puts tweet_id\n\t\ttweet_content = t.xpath(\"./div/div/p/text()\").to_s.strip\n\t\t#puts tweet_content\n\t\tset_content(tweet_content)\n\t\t#fetching retweets and favourites gets complicated\n\t\tif @is_of_page_owner\n\t\t\tfetch_retweet_favourites(t)\t\n\t\tend\n\trescue Exception => e\n\t\tLogWriter.error(e)\n\t\treturn self\n\tend\n\tend",
"def get_twitter(npo)\n\t\trequire 'net/http'\n\t\trequire 'rexml/document'\n\n begin\n\n res = Net::HTTP.get(URI.parse(\"http://api.twitter.com/1/users/show.xml?screen_name=#{npo.twitter}\"))\n document = REXML::Document.new(res)\n\n if document.root.elements[2]\n document.root.elements[2].expanded_name == 'error' ? nil : npo.twitter\n end\n rescue\n nil\n end\n\tend",
"def search_twitter()\n search_call = \"#{@api_endpoint_twitter}?ors=#{@search_term}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @response = http_get search_call\n end",
"def extract_description(document)\n node = document.css('div.well>p')\n @description = node.inner_html\n end",
"def description\n \"This task grabs the robots.txt and adds each line as a web page\"\nend",
"def tweet\r\n\treturn \"tweet tweet tweet\"\r\n\tend",
"def scrape_text\n\n end",
"def tweet\n\treturn \"Tweet Tweet Twitter\"\nend",
"def webscrape_possible(hashtag_tweet)\n\t\tif tweet_contains_author?(hashtag_tweet) && tweet_contains_book_title?(hashtag_tweet)\n\t\t @author_match = hashtag_tweet.match(AUTHOR)[2].strip\n\t\t @book_title_match=hashtag_tweet.match(BOOK_TITLE)[1].gsub(\".\",\"\").strip \n \t\tend\n\tend",
"def description\n \"This task searches for common social media profiles\"\nend",
"def description\n \"This task searches for common social media profiles\"\nend",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend",
"def tweet\n \"<blockquote class='twitter-tweet' lang='en'><p lang='en' dir='ltr'>\" + tweet_text + \n \"</p>—\" + twitter_user + \"<a href='\" + twitter_url + \"'>\" + tweet_date + \n \"</a></blockquote><script async src='//platform.twitter.com/widgets.js' charset='utf-8'></script>\"\n end",
"def get_description(n)\n description = Nokogiri::HTML(super(n)).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[0]\n description = description.split(\" \")[3..-1].join(\" \") # remove \"by 'author name'\"\n description.slice!(\"[ Subscribe to the comments on this story ] \")\n description\n else\n nil\n end\n end",
"def get_politician_tweet(client, twitter_handle)\n client.user_timeline(twitter_handle).sample.text\nend",
"def tweet(title)\n unless @twitter_client.nil?\n\n # Make sure the title is short enough\n if title.length > 80\n title = title[0,80]\n end\n if @dj_tweeting\n @twitter_client.update(\"Now playing on #DuaneFM: #{title} http://bit.ly/1ErYiZr #hewitt\")\n end\n\n end\n end",
"def extract_description(info_url)\n agent = Mechanize.new\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n page = agent.get(info_url)\n\n # The horrible thing about this page is they use tables for layout. Well done!\n # Also I think the \"Intended use\" bit looks like the most useful. So, we'll use that for the description\n table = page.at('div#bodypadding table')\n # For some reason occasionaly this page can be entirely blank. If it is just do our best and continue\n if table\n table.search('table')[1].search('tr').find do |row|\n # <th> tag contains the name of the field, <td> tag contains its value\n row.at('th') && row.at('th').inner_text.strip == \"Intended use\"\n end.at('td').inner_text.strip\n end\nend",
"def tweet\n\t\treturn \"Polly want's a cracker.\"\n\tend",
"def get_info\n doc = Hpricot(open(noaa_url))\n puts noaa_url\n if !self.description\n doc.search(\"h1\").each do |elem| \n desc = elem.inner_html\n # remove imbeded links in the middle of the description\n desc.gsub!(/\\<a.href.*?\\<\\/a\\>/,' ')\n self.description = desc\n puts self.description\n self.save\n end\n end\n if !self.geo_location\n begin\n elems = doc.search(\"p/b\").to_a.map{|elm| elm.inner_html}\n if elems[1] == \"Owned and maintained by National Data Buoy Center\"\n puts elems[4]\n self.geo_location = elems[4]\n self.save\n end\n rescue\n end \n end\n end",
"def tweet\n\t\treturn \"AHHP! Pretty bird!\"\n\tend",
"def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend",
"def description\n \"This task runs a web scan and adds webpages with interesting contents\"\nend",
"def tweet_format message\n\n # We begin the hunt for links. The good news is that Slack marks them out for us!\n # Links look like:\n # <http://google.com>\n # or\n # <http://google.com|Google!>\n # We want to ignore the label, and just get the URL\n\n links = []\n message['text'].scan(/<(https?:\\/\\/.+?)>/).each do |m|\n url = m[0].split('|')[0]\n links.append url #URI.encode url\n end\n\n return nil if links.length == 0 #return nil if no links found\n\n # Just take the first link.\n\n response = Faraday.get links[0]\n\n # We are now in our own thread, operating asynchronously. We can take our time here.\n\n # First, we use Nokogiri to extract the page title.\n page = Nokogiri::HTML(response.body)\n page.css('script, link, style').each {|node| node.remove}\n title = page.css('title').text\n\n # Now craft a tweet message; remember max is 140 chars!\n\n # First, check the current max length of a t.co link wrapper\n # TODO\n t_co = 20\n length = title.length + t_co + 1 # 1 for the space.\n delta = length - 140\n if delta > 0\n title = title[0..-delta-2] + '…'\n end\n\n title + ' ' + links[0]\n end",
"def scrape\n end",
"def scrape_course_description(parsed_html)\n parsed_html.css('div.desc')[0].children.text.strip\n end",
"def parsed_description\n @parsed_description ||= Nokogiri::HTML(description) \n end",
"def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end",
"def parse_tweet(t)\n URI.extract(t, %w[ http https ftp ]).each do |url|\n t.gsub!(url, \"<a href=\\\"#{url}\\\">#{url}</a>\")\n end\n \t# auto-link @usernames\n \tt = linkup_mentions_and_hashtags(t)\n end",
"def twitter\n @data['social']['twitter']\n end",
"def main\n test_url = \"http://eatsblog.guidelive.com/archives/2007/06/you-know-you-want-it.html\"\n parse(test_url)\n end",
"def twitter_stats\n # would be nice to use the twitter gem here, but twitter\n # doesn't expose list counts on user info.\n doc = Nokogiri::HTML(open(\"http://twitter.com/#@twitter\"))\n followers = doc.css(\"#follower_count\").first.content.to_i\n lists = doc.css(\"#lists_count\").first.content.to_i\n \"followers: #{followers}; lists #{lists}\"\n end",
"def get_description(detail_page, tds)\n table = detail_page.search('table')[31]\n\n tr = table.search('tr')[3]\n\n tds_detail_description = tr.search('td')\n\n description = \"\"\n\n if !tds_detail_description[1].at('span').nil? \n\n description = clean_whitespace(tds_detail_description[1].at('span').text)\n\n else\n\n description = clean_whitespace(tds_detail_description[1].text)\n\n end\n return description\nend",
"def get_description(detail_page, tds)\n table = detail_page.search('table')[31]\n\n tr = table.search('tr')[3]\n\n tds_detail_description = tr.search('td')\n\n description = \"\"\n\n if !tds_detail_description[1].at('span').nil? \n\n description = clean_whitespace(tds_detail_description[1].at('span').text)\n\n else\n\n description = clean_whitespace(tds_detail_description[1].text)\n\n end\n return description\nend",
"def tweet\n return \"Arrrr matey\"\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:entries][:send_twitts] && self.published > self.feed.created_at\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:entries][:prefix]} #{self.title[0..150]} #{self.url}\"\n end\n end",
"def link_twitter\n\n end",
"def website_content(url)\r\n # Give the content of the website on the given url\r\n require 'restclient'\r\n Nokogiri::HTML(RestClient.get(url))\r\nend",
"def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmichiganstatewin.com\"\nend",
"def scrape_event(url)\n description=\"\"\n page = get_url_or_cache(url)\n description=page.css('p#bodytext').inner_text\n description+=' '+page.css('div#listing-details').inner_text.gsub('Details','')\n tmp=description.split\n description=\"\"\n tmp.each do |w|\n description+=w+' '\n end\n #linkVenue=page.css('div#listingheader p.nextevent a')[0]['href']\n #puts description\n yield description\nend",
"def call\n begin\n doc = open_and_scrap_url\n content = TAGS.inject({}) {|hsh, tag| hsh[tag] = doc.css(tag).map(&:text); hsh}\n rescue StandardError => e\n result = Result.new(:error, e.message, Hash.new([]))\n else\n result = Result.new(:ok, \"\", content)\n end\n end",
"def url\n \"http://twitter.com/search/?q=\" + self.query\n end",
"def extract_description(content)\n Woro::TaskList.extract_description content\n end",
"def tweet\n return \"chirp chirp\"\n end",
"def fetch!\n scrub_url\n\n parameters = Jewel.get_service(url)\n self.parameters = parameters\n\n if parameters[:service] == :twitter_status\n twitter = Twitter.status(parameters[:status_id])\n self.name = \"Tweet from #{twitter.user.name}\"\n self.name = twitter.text\n self.content = twitter.text\n tweet_media = twitter.media\n if tweet_media.length > 0\n self.avatar = URI.parse(tweet_media.first.media_url)\n end\n self.kind = Jewel::TYPES[:other]\n elsif parameters[:service] == :other\n page = MetaInspector.new(url, allow_redirections: :safe)\n self.name = page.title\n self.content = page.description\n if page.image\n self.avatar = URI.parse(page.image)\n elsif !page.images.empty?\n self.avatar = URI.parse(page.images.first)\n end\n self.kind = Jewel::TYPES[:other]\n self.fetch_embed!\n elsif parameters[:service] == :youtube\n page = MetaInspector.new(url, allow_redirections: :safe)\n self.name = page.title\n self.content = page.description\n self.avatar = URI.parse(page.image) if page.image\n self.kind = Jewel::TYPES[:video]\n self.fetch_embed!\n elsif parameters[:service] == :idealme\n if parameters[:kind] == :courses\n self.kind = Jewel::TYPES[:course]\n course = Course.where(slug: parameters[:slug]).first\n self.course_id = course.id\n elsif parameters[:kind] == :goals\n self.kind = Jewel::TYPES[:goal]\n goal = Goal.where(id: parameters[:slug]).first\n self.goal_id = goal.id\n end\n end\n\n self.save!\n self\n end",
"def tweet\n\t\treturn \"tweee\"\n\tend",
"def description\n \"This takes a screenshot of a website using webdriver\"\nend",
"def test\n #render :text => TwitterAuth::Dispatcher::Basic.get(\"/search?q=#{CGI.escape(\"school\")}\").inspect\n #render :text => CGI.escape('#twitter')\n \n # http://a1.twimg.com/profile_images/70050636/techPresident_–_How_the_candidates_are_using_the_web__and_how_the_web_is_using_them._normal.jpg\n #begin_time = Time.now\n #plaa = cur_user.twitter.get(\"/statuses/home_timeline?count=20\")\n #time_past = Time.now - begin_time\n #render :text => request.env['HTTP_REFERER'].inspect #session.inspect #Message.first.tags_mentioned.inspect\n \n if true\n plaa = \"jaa jaa\"\n end\n render :text => \"taa: #{plaa}\"\n end",
"def process_html\n benchmark \"Process HTML for #{self.url}\" do\n doc = Readability::Document.new(self.html)\n html = doc.html\n self.title = content_for_open_graph_tag('og:title', html) || doc.title\n self.description =\n content_for_open_graph_tag('og:description', html) ||\n content_for_meta_tag('name=\"description\"', html) ||\n html.xpath('//head/meta/@description', html).first.try(:content)\n image_url = content_for_open_graph_tag('og:image', html) || doc.images.first\n self.image_url = image_url if image_url =~ URI.regexp\n self.site_name = content_for_open_graph_tag('og:site_name', html) || get_url_domain.try(:humanize)\n self.content_html = doc.content.encode_from_charset!(doc.html.encoding)\n self.content = Nokogiri::HTML(self.content_html).text\n end\n self\n end",
"def scrape_it\n \n end",
"def index(url)\n open(url, \"User-Agent\" => USER_AGENT){ |doc| \n h = Hpricot(doc)\n title, body = h.search('title').text.strip, h.search('body')\n %w(style noscript script form img).each { |tag| body.search(tag).remove}\n array = []\n body.first.traverse_element {|element| array << element.to_s.strip.gsub(/[^a-zA-Z ]/, '') if element.text? }\n array.delete(\"\")\n yield(array.join(\" \").words, title)\n } \n end",
"def twitter_list_name\n end",
"def description\n\t\"This task scrapes Hoovers for company info.\"\nend",
"def scrape\t\t\n url = 'http://api.nytimes.com'\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n #If the api being scraped uses https, then set use_ssl to true.\n #http.use_ssl = false\n request_url = '/svc/search/v2/articlesearch.json?q=bangkok+bombings&page=1&sort=newest&api-key=e89effddaf8553d3a95336aaf6882ebe:5:72702694'\n response = http.send_request('GET', request_url)\n article_parse = JSON.parse(response.body)\n article_data= article_parse['response']['docs']\n puts \"Title: The New York Times\"\n puts \"--------------------------------\"\n article_data.each do |v|\n\n tags= tag_article(v['headline']['main'].to_s)\n article = Article.new(title: v['headline']['main'].to_s, \n summary: v['snippet'].to_s, \n link: v['web_url'], \n source: \"New York Times\", \n date: v['pub_date'].to_s.gsub(/,/,'.'), \n tag_list: tags)\n article.save\n end\n\t end",
"def getTweet(tweet,rt)\n\tflds=[]\n\n\trt_original_tweetID=nil\n\tif tweet[\"retweeted_status\"]\n\t\trt_original_tweetID=tweet[\"retweeted_status\"][\"id\"]\n\tend\n\n\ttweetID=tweet[\"id\"]\n\tflds << tweetID\n\tflds << tweet[\"user\"][\"id\"]\n\tif tweet[\"created_at\"]\n\t\tflds << tweet[\"created_at\"]\n\t\tdt=DateTime.parse(tweet[\"created_at\"])\n\t\tflds << dt.strftime(\"%Y%m%d\")\n\t\tflds << dt.strftime(\"%H%M%S\")\n\telse\n\t\tflds << nil\n\t\tflds << nil\n\t\tflds << nil\n\tend\n\tflds << rt\n\tflds << rt_original_tweetID\n\tif $orgText\n\t\tflds << tweet[\"text\"]\n\telse\n\t\tif tweet[\"text\"]\n\t\t\tflds << tweet[\"text\"].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\telse\n\t\t\tflds << nil\n\t\tend\n\tend\n\tif tweet[\"source\"]\n\t\tflds << tweet[\"source\"].gsub(/<a.*?>/,\"\").gsub(/<\\/a.*?>/,\"\")\n\telse\n\t\tflds << nil\n\tend\n\tflds << tweet[\"truncated\"]\n\tflds << tweet[\"in_reply_to_status_id\"]\n\tflds << tweet[\"in_reply_to_user_id\"]\n\tflds << tweet[\"in_reply_to_screen_name\"]\n\tdat=tweet[\"coordinates\"]\n\tif dat\n\t\tflds << dat[0]\n\t\tflds << dat[1]\n\telse\n\t\tflds << nil\n\t\tflds << nil\n\tend\n\tflds << tweet[\"contributors\"]\n\n\t#dat=tweet[\"current_user_retweet\"]\n\t#if dat\n\t#\tflds << dat[\"id\"]\n\t#else\n\t#\tflds << nil\n\t#end\n\n\tflds << tweet[\"avorite_count\"]\n\tflds << tweet[\"favorited\"]\n\tflds << tweet[\"filter_level\"]\n\tflds << tweet[\"lang\"]\n#place\tPlaces\n\tflds << tweet[\"possibly_sensitive\"]\n#scopes\tObject\n\tflds << tweet[\"retweet_count\"]\n\tflds << tweet[\"retweeted\"]\n#\tflds << tweet[\"withheld_copyright\"]\n#withheld_in_countries\tArray of String\n#\tflds << tweet[\"withheld_scope\"]\n\n\n\treturn tweetID,flds\nend",
"def get_all_the_urls_of_val_doise_townhalls (web_list)\npage = Nokogiri::HTML(RestClient.get(web_list))#recupere le code html du site\npage.css(\"a.lientxt\").each do |note|\nnote['href'] = note['href'][1..-1]#donne les urls de chaque commune en retirant le premier caractaire c-a-d \".\"\nweb_page = \"http://annuaire-des-mairies.com\" + note['href']\nputs web_page\nget_the_email_of_a_townhal_from_its_webpage(web_page)#rappel la fonction get_the_email_of_a_townhal_from_its_webpage pour recuperer les adresses emails grace aux liens (fonctions recurssive)\nend\nend",
"def set_title_and_description\n website = Nokogiri::HTML(open(self.url))\n self.title = website.css('title').text\n self.description = website.at(\"meta[name='description']\")['content'] unless website.at(\"meta[name='description']\").nil?\n end",
"def get_page_content\n begin\n @page_content = open( \"http://twitter.com/#{@name}\" )\n rescue OpenURI::HTTPError => e\n raise \"Username doesn't exist -- #{name}\"\n end\n end",
"def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end",
"def getLastfmArtistPopularity altnet_name\n url = getLastfmArtistPopularityUrl(altnet_name)\n puts url \n begin\n html = open(url, \"User-Agent\" => getUseragent(), :proxy=>getProxy()) \n document = Hpricot(html)\n #ar = document.search(\"//div[@id='catalogueHead']\");\n ar = document.search(\"//div[@id='catalogueHead']\").search(\"//p[@class='stats']\"); \n return ar\n rescue Exception => e\n puts \"html grab error\"\n return \"\"\n end \n end",
"def driver_method\n flash[:alert] = \"Your resume has been sent to the company. You will be contacted if you are a good fit for this job.\"\n bumeran = \"http://bumeran.com.mx/\"\n page = HTTParty.get(bumeran)\n parsed_page = Nokogiri::HTML(page)\n #add some variables here that can access the data from bumeran\n end",
"def print_timeline(tweets)\n # ADD CODE TO ITERATE THROUGH EACH TWEET AND PRINT ITS TEXT\n tweets.each do |tweet| puts tweet['text'] end\n \n\nend",
"def run\n super\n require 'twitter'\n\n # Initialize a Twitter search\n search = Twitter::Search.new\n\n search.containing(\"#{@object.fname} #{@object.lname}\").result_type(\"recent\").per_page(10).each do |r|\n #puts \"#{r.from_user}: #{r.text}\"\n Fact.create :user_id => @object.id, :text => \"#{r.from_user}: #{r.text}\"\n end\n\n # Enough about\n search.clear\n\n\tnil\nend",
"def getIncomingTweets\n words = ['Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter']\n TweetStream::Client.new.on_error do |message|\n puts \"Error: #{message.to_s} \"\n end.track('Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter') do |status|\n if status.text.language.to_s == \"english\" && !status.retweet?\n if words.any? {|word| status.text.include?(word)}\n prep = @conn.prepare(\"INSERT INTO stream(response) VALUES(?)\")\n prep.execute status.text\n prep.close\n end\n end\n end\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def embedding_tweet(content)\n embedded_content = content\n content.scan(/(https?:\\/\\/twitter\\.com\\/[a-zA-Z0-9_]+\\/status\\/([0-9]+)\\/?)/).each do |url, id|\n tweet_json = open(\"https://api.twitter.com/1/statuses/oembed.json?id=#{id}\").read\n tweet_html = JSON.parse(tweet_json, { :symbolize_names => true })[:html]\n embedded_content = embedded_content.gsub(/#{url}/, tweet_html)\n end\n embedded_content\nend",
"def embedding_tweet(content)\n embedded_content = content\n content.scan(/(https?:\\/\\/twitter\\.com\\/[a-zA-Z0-9_]+\\/status\\/([0-9]+)\\/?)/).each do |url, id|\n tweet_json = open(\"https://api.twitter.com/1/statuses/oembed.json?id=#{id}\").read\n tweet_html = JSON.parse(tweet_json, { :symbolize_names => true })[:html]\n embedded_content = embedded_content.gsub(/#{url}/, tweet_html)\n end\n embedded_content\nend",
"def desc\n\t\t\"Useful for analyzing scanned web sites later.\"\n\tend",
"def leech_story_info\n doc = Nokogiri::HTML(open(\"#{FicSourceURL}/s/#{@fic_id}\"), \"UTF-8\") \n # get author name\n author = doc.xpath(\"//table[@id='gui_table1i']/tbody/tr[1]/td[1]/a[1]\").first.inner_text\n # get story title\n title = doc.xpath(\"//table[@id='gui_table1i']/tbody/tr[1]/td[1]/b[1]\").first.inner_text\n {:title => title, :author => author}\n end",
"def get_data\n response = fetch\n if response \n if response.header.code == \"200\"\n doc = Nokogiri::HTML(response.body)\n self.title = doc.title.to_s\n content_description = doc.xpath(\"//meta[@name='description']/@content\")\n # Some people use the wrong capitlization\n if content_description.blank?\n content_description = doc.xpath(\"/html/head/meta[@name='Description']/@content\")\n end\n unless content_description.blank?\n self.description = content_description.to_s\n end\n content_keywords = doc.xpath(\"//meta[@name='keywords']/@content\").to_s\n if content_keywords.blank?\n content_keywords = doc.xpath(\"//meta[@name='Keywords']/@content\").to_s\n end\n \n self.tag_names = content_keywords unless content_keywords.blank?\n self.data_recived_on = Time.now\n end\n self.code = response.header.code.to_i\n else\n self.code = 502\n end\n return response\n end",
"def scrape(para)\n # need SECTION & PLACENAME from para\n # need to follow embedded href to get DESCRIPTION\n links = para.css(\"a\")\n # puts links.length\n # puts links.text\n\n # grabs href from anchor elements\n links.each{|links| puts links['href']}\n #grabs title from anchor elements\n links.each{|links| puts links['title']}\nend",
"def scrape(para)\n # need SECTION & PLACENAME from para\n # need to follow embedded href to get DESCRIPTION\n links = para.css(\"a\")\n # puts links.length\n # puts links.text\n\n # grabs href from anchor elements\n links.each{|links| puts links['href']}\n #grabs title from anchor elements\n links.each{|links| puts links['title']}\nend",
"def extract_link(tweet)\n if tweet\n text = tweet['text']\n start = text.index('http') if text\n if start\n stop = text.index(' ', start) || 0\n text[start..stop-1]\n end\n end\n end",
"def description(page_description) \n content_for(:description) do \n \"<meta name=\\\"description\\\" content=\\\"#{page_description}\\\" />\\n\" \n end \n end",
"def tweet\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"YOUR_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"YOUR_CONSUMER_SECRET\"]\n config.access_token = ENV[\"YOUR_ACCESS_TOKEN\"]\n config.access_token_secret = ENV[\"YOUR_ACCESS_SECRET\"]\n end\n if self.title != nil\n client.update(\"#{self.title} - #{self.short_desc} ($#{self.price})\")\n end\n end",
"def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend",
"def prepare_target(target_message)\n target = {}\n target[:link] = target_message\n unless target[:link] == nil || target[:link].empty?\n # (not necessary /status/, but may be /statuses/, so .*?)\n all_match = (/twitter.com\\/(.*?)\\/.*?\\/(.*)/).match(target[:link].downcase)\n target[:name] = all_match[1] unless all_match == nil\n target[:sid] = all_match[2] unless all_match == nil \n # we want to get here the actual target message\n req = target[:link]\n begin\n open(req) do |f|\n data = f.read\n # get the body\n body_match = (/<span class=\"entry-content\">(.*?)<\\/span>.*<span class=\"published\">(.*?)<\\/span>/).match(data) unless data == nil\n target[:body] = body_match[1].strip unless body_match == nil\n target[:body] = \"N/A\" if body_match == nil\n # the body may contain @username, need to replace with good url\n target[:body] = target[:body].gsub(/@<a href=\\\"\\//, \"@<a href=\\\"http://twitter.com/\") \n target[:time] = Time.parse(body_match[2]) unless body_match == nil \n target[:time] = Time.now if body_match == nil \n end\n rescue\n # we can ignore here too, at least we'll show smth :-)\n end \n else\n target = nil\n end\n target\nend",
"def construct_tweet(path = \"\", text = ENV[\"TWEET_COPY_GENERAL\"])\n return \"https://twitter.com/share?url=\"+u(get_url(path))+\"&text=\"+text\n end",
"def print_tweet(tweets)\ngets tweets.each do |tweet| puts tweet[\"text\"]\nend\nend",
"def scrape\n google_url = create_google_url\n google_data = Scrubyt::Extractor.define do\n fetch google_url\n\n link_title \"//a[@class='l']\", :write_text => true do\n link_url\n end\n end\n google_data.to_hash.map {|r| r[:link_url]}\n end",
"def on_timeline(tweet)\n #don't reply to retweets\n return if tweet.retweeted_status?\n #check if bot can \"pester\" this user\n return unless can_pester?(tweet.user.screen_name)\n\n #see if bot finds the tweet interesting (based off top 100 / top 20 model words)\n tokens = Ebooks::NLP.tokenize(tweet.text)\n interesting = tokens.find { |t| top100.include?(t.downcase) }\n very_interesting = tokens.find_all { |t| top20.include?(t.downcase) }.length > 2\n\n #do various actions depending on how interesting the tweet is\n delay do\n if very_interesting\n favorite(tweet) if rand < 0.5\n retweet(tweet) if rand < 0.1\n if rand < 0.05 #0.01\n userinfo(tweet.user.screen_name).pesters_left -= 1\n reply(tweet, make_response_wrapper(tweet))\n end\n elsif interesting\n favorite(tweet) if rand < 0.05\n if rand < 0.01 #0.001\n userinfo(tweet.user.screen_name).pesters_left -= 1\n reply(tweet, make_response_wrapper(tweet))\n end\n end\n end\n end",
"def crawlNameFromWiki()\n\tbase_url = \"http://en.wikipedia.org\"\n\tpage = \"/wiki/List_of_American_film_actresses\"\n\tremote_full_url = base_url + page\n\tpage = Nokogiri::HTML(open(remote_full_url))\n\tdivs = page.css(\"div#mw-content-text\")\n\tlinks = divs.css(\"div.div-col\").css(\"li\")\n\tpeople = Hash.new(0)\n\thead =\"Name ID\\n\"\n\n\t(0..links.length - 1).each do |n|\n\t\tdata = links[n].text # get the info of each celebrity\n\t\tname = links[n].css(\"a\")[0][\"title\"] # get name\n\t\t# <Optional_lines> --> using birthday to optimize crawling performance\n\t\tbirthD = \"\" \n\t\tif !data.nil?\n\t\t\tregexpression = data[/[^-]\\d{4}$/]\n\t\t\tif !regexpression.nil? and !regexpression.include?\"-\"\n\t\t\t\tbirthD = data[-4..-1]\n\t\t\tend\n\t\tend\n\t\t#</Optional_lines> \n\t\tpeople[name] = birthD # map person name to birthday\n\tend\n\tverifiedTwitter(people)\nend",
"def set_title_and_description\n \t\tresp = get_resp(self.url)\n \t\tself.title = resp.match(/<title>(.+)<\\/title>/)[1]\n \t\tself.description = resp.match(/<meta name=\"description\" content=\"([^\\\"]*)/)[1]\n \t\tself.save!\n \tend",
"def artist_details(artist)\n Scraper.scrape_individual_artist(artist) \n\n puts \"\"\n puts \"Here are more details about #{artist.name.bold}.\".black.on_light_white\n puts \"\"\n puts \"Representing Gallery: #{artist.gallery.name} \"\n puts \"\"\n puts \"Artist Bio: #{artist.bio}\"\n puts \"\"\n puts \"About the Artist : #{artist.about_art}\"\n puts \"\"\n\n end",
"def description\n \"This task looks for usernames via google searchs.\"\nend",
"def getTwitterFullName\n # Find a string in the HTML that looks like:\n # <h1 class=\"fullname\"> Foo Bar </h1>\n # OR (verified)\n # <h1 class=\"fullname\"> Foo Bar <a title=\"Verified profile\" href=\"/help/verified\" class=\"js-tooltip\" data-placement=\"right\"><i class=\"verified-large-border\"></i></a> </h1>\n\n regex = /<h1 class=\"fullname\">\\s*([^<]+?)\\s*(<a .+<\\/a>)?\\s*<\\/h1>/m\n if @web_page.match(regex)\n full_name = @web_page.match(regex)[1]\n end\n return full_name\n end",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def description\n search_by_itemprop 'description'\n end",
"def grab_url(tweet)\n\t\t# only grabs the url from the tweet text and replaces any https with http\n\t\ttweet.text.split(' ').find { |hunk| hunk =~ /\\Ahttps{0,1}:\\/\\/t.co/ }.gsub('https', 'http')\n\tend",
"def scraper(url2)\n dataUrl = Nokogiri::HTML(open(\"http://www.timeout.com#{url2}\"))\n linksUrl = dataUrl.css('#content')\n \n linksUrl.each do |review|\n arr = []\n # name\n arr << review.css('h1.listing_page_title').text.strip\n # neighborhood\n arr << review.css('span.listings_flag').text.strip\n # street-address\n #arr << review.css('span.street-address').text.strip\n # summary\n arr << review.css('h2.review__summary').text.strip\n # food rating\n arr << review.css('ul.star_rating li.sr-only').text[0]\n #cost rating\n arr << review.css('span.listings_flags__price li.icon_highlight').count\n\n return arr\n end \nend",
"def set_meta_description\n html = html_overview || html_content || ''\n\n self.meta_description =\n html.\n gsub(/<\\/?[^>]*>/, ' '). # replace HTML tags with spaces\n gsub(/&\\w{1,9};|\"/, ''). # remove HTML special chars and double quotes\n gsub(/\\n+/, \" \"). # remove new lines\n gsub(/\\s+/, ' '). # remove duplicated spaces\n strip[0..200] # strip spaces and get first 200 chars\n end",
"def create_tweets_text(long_tweet, continuation_text = User::DEFAULT_CONTINUATION)\n words = long_tweet.strip.split(' ')\n\n tweets = []\n current_tweet = ''\n words.each do |word|\n if word.length > 140\n return [], :error\n end\n\n if ((current_tweet.length + word.length + 1 + continuation_text.length) < 140)\n current_tweet << word + ' '\n else\n current_tweet << continuation_text\n tweets << current_tweet\n current_tweet = word + ' '\n end\n end\n\n tweets << current_tweet.strip\n shortened_tweets = []\n tweets.each do |tweet|\n shortened_tweets << shorten_urls(tweet)\n end\n\n return shortened_tweets, :success\n end",
"def tumblr\n client = Tumblr::Client.new({\n :consumer_key => ENV['OAUTH_CONSUMER_KEY'],\n :consumer_secret => ENV['SECRET_KEY'],\n :oauth_token => ENV['OAUTH_TOKEN'],\n :oauth_token_secret => ENV['OAUTH_TOKEN_SECRET']\n })\n client.text(\"syndicator2\", :title => \"#{self.title}\", :body => \"#{self.full_desc}\")\n end"
] | [
"0.66195697",
"0.65626043",
"0.6519734",
"0.6477642",
"0.64733297",
"0.64159995",
"0.6252092",
"0.62426245",
"0.61802083",
"0.6168861",
"0.6164772",
"0.6151207",
"0.6137684",
"0.60889065",
"0.6015941",
"0.60034657",
"0.5990987",
"0.5990987",
"0.59700227",
"0.59684956",
"0.5963488",
"0.59608185",
"0.5957646",
"0.5955295",
"0.5940951",
"0.5910541",
"0.58903104",
"0.58618176",
"0.58257437",
"0.58233196",
"0.5814634",
"0.581166",
"0.58098453",
"0.57888615",
"0.5783274",
"0.57741064",
"0.5773016",
"0.57676077",
"0.57629186",
"0.57534933",
"0.57534933",
"0.5745242",
"0.5740833",
"0.5734551",
"0.57309115",
"0.572422",
"0.5714383",
"0.5712143",
"0.5700835",
"0.5688316",
"0.56709415",
"0.5664639",
"0.5645055",
"0.5634461",
"0.5631335",
"0.5628493",
"0.5628266",
"0.561634",
"0.5614597",
"0.56021607",
"0.55972135",
"0.55968547",
"0.5593348",
"0.55933326",
"0.5592878",
"0.5580955",
"0.5575365",
"0.5575202",
"0.5573268",
"0.5565176",
"0.55614614",
"0.5558081",
"0.55531234",
"0.55531234",
"0.5549865",
"0.5549801",
"0.5546441",
"0.5540335",
"0.5540335",
"0.55399656",
"0.5529152",
"0.55271214",
"0.55262476",
"0.55242735",
"0.55226547",
"0.5522008",
"0.55119914",
"0.5511638",
"0.5511586",
"0.5511532",
"0.5510494",
"0.55048656",
"0.55008423",
"0.549874",
"0.54931915",
"0.548893",
"0.5469949",
"0.54675967",
"0.54656863",
"0.54626936"
] | 0.6654091 | 0 |
Return all the elements containing currency input text field | def get_currency_input_field_elements
elements(xpath: './/label[contains(text(),"Limit") or contains(text(), "Accounts Receivable") or contains(text(), "On Premises") or contains(text(), "Off Premises")]//following-sibling::app-currency-input/input[1]')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_currency_input_field_elements\n get_currency_input_field_elements.each do |ele|\n # This is a temporary work around for clearing the currency input field as '.clear' on element is not working\n ele.send_keys(:control, a)\n end\n end",
"def get_all_price\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) # ça ouvre la page web coinmarket et enregistre dans la variable page \n noko_o = page.xpath(\"//tbody/tr/td/a[@class='price']\") #je prends la page web coinmarket de la variable page et je lui extrait les prix de chaque currencies et je les stock dans la variable noko_o\n currencies_price = noko_o.map { |n| n.text.delete_prefix('$').to_f} # c'est un array qui contient la variable noko_o dont on a extrait les prix , dont on retire le symbole $ \n puts currencies_price # affiche mon tableau currencies sans le symbole $ \n\treturn currencies_price #je récupère tous les prix des monnaies \nend",
"def scrapp_prices\n\tpage = get_page\n\tcrypto_prices = page.xpath('//*[@class=\"price\"]')\n\tcrypto_prices_array = []\n\tcrypto_prices.each do |price|\n\t\tcrypto_prices_array << price.text[1..-1].to_f\n\tend\n\treturn crypto_prices_array\nend",
"def input_multi_currency_amount(name)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n id_dd: \"#{id}_dd\",\n id_mm: \"#{id}_mm\",\n id_yy: \"#{id}_yy\",\n name: name,\n name_dd: \"#{name}_dd\",\n name_mm: \"#{name}_mm\",\n name_yy: \"#{name}_yy\",\n description: prop(field, 'description'),\n text: prop(field, 'label'),\n }\n end",
"def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end",
"def check_for_curr\n res = false\n not_matched_currency = []\n val_arr = [@txt_val1, @txt_val2, @txt_val3, @txt_val4, @txt_val5, @txt_val_ttl]\n val_arr.each do |val|\n not_matched_currency = false unless val.text.to_s.chr == \"$\"\n end\n res = false unless not_matched_currency.empty?\n res\n end",
"def crypto_scrapper ()\r\n url = \"https://coinmarketcap.com/all/views/all/\"\r\n page_inspect = URI.open(url)\r\n page_inspected = Nokogiri::HTML(page_inspect)\r\n page_inspected.xpath('//a[contains(@href, \"/currencies\")]').each do |crypto|\r\n \r\n crypto = crypto.text\r\n B << crypto\r\n end\r\n #puts B.to_s\r\nend",
"def input_text_montant\n \"\".in_input_text(class:'medium', name:'facture[montant_amount]', id:'facture_montant_amount')\nend",
"def get_data\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) # ça ouvre la page web coinmarket et enregistre dans la variable page \n noko_o = page.xpath(\"//tbody/tr/td/a[@class='currency-name-container link-secondary']\") # dans la variable page j'ai extrait toutes les noms des currencies de la variable page et je les ai enregistré dans la variable noko_o \n currencies = noko_o.map {|n| n.text} # j'ai fais une boucle à partir des élements de noko_o , et j'enregistre toutes ces valeurs dans l'array currencies en string car j'utlise .text\n return currencies # je récupère toutes les monnaies \nend",
"def scrapp_symbols\n\tpage = get_page\n\tcrypto_symbols = page.xpath('//*[@class=\"text-left col-symbol\"]')\n\tcrypto_symbols_array = [] #/ initiliaze the array for stocking all symbols\n\tcrypto_symbols.each do |symbol| #/ put .text to be in string the symbols\n\t\tcrypto_symbols_array << symbol.text \n\tend\n\treturn crypto_symbols_array\nend",
"def currency\n params['currency']\n end",
"def essai\n\npage = Nokogiri::HTML(open('https://coinmarketcap.com'))\nresult = page.css('tbody tr').each do |tr|\n id = tr.css(\"currency-name\").text\n price = tr.css(\"price\").text \n puts id + \"vaut aujourd'hui\" + price\nend\nend",
"def get_crypto_names\n symbols_array = []\n @page.xpath('//tr/td[@class = \"text-left col-symbol\"]').each do |symbol|\n symbols_array << symbol.text\n end\n return symbols_array\nend",
"def currency\n params[\"Currency\"]\n end",
"def currency\n params['list_currency']\n end",
"def get_prices\n prices = html_open_url.css(\"a.price\")\n price_array = put_in_array(prices)\n price_array.each do |i| \n i.delete!('$')\n sprintf(\"%.2f\", i.to_f) \n end\n return price_array\nend",
"def add_all_values\n ValuesLib.remove_currency_format(text_value_one) + ValuesLib.remove_currency_format(text_value_two_element)\n + ValuesLib.remove_currency_format(text_value_three) + ValuesLib.remove_currency_format(text_value_four)\n + ValuesLib.remove_currency_format(text_value_five)\n end",
"def trader_obscur\ncurrency_name = []\npage = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")).css(\".currency-name-container\").each do |item|\n name = item.text\n currency_name << name\nend\n\ncurrency_price = []\npage = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")).css(\".price\").each do |item|\n price = item.text\n currency_price << price\nend\n\nputs Hash[currency_name.zip(currency_price)]\n\nend",
"def currencies\n raise NotImplementedError\n end",
"def currency_list\n %w(USD EUR GBP JPY AUD INR)\n end",
"def car_price(price_text)\n\tprice = price_text.css('span.result-price').text\n\tprice = price.gsub(/\\D/,'').to_i\nend",
"def currency(input)\n\t(/\\$?[+-]?[0-9]{1,3}((\\,)?[0-9]{3})*(\\.[0-9]{2})?/i =~ input)? \"true\" : \"false\"\nend",
"def currency; end",
"def currency; end",
"def get_charges\n #fill in the remaining claim info\n # box 28\n text_box sprintf(\"%.2f\", @charges_for_service.to_s), :at => [370, 82]\n # box 29\n text_box sprintf(\"%.2f\", @copay_amount.to_s), :at => [450, 82]\n # box 30\n text_box sprintf(\"%.2f\", @balance_owed.to_s), :at => [520, 82]\n end",
"def raw_exchange_rates\n table_rows = Oga.parse_html(response.body).css('.ORANGE_TEXT, .BLUE_TEXT')\n # AlAhliBankOfKuwait porvide 8 currencies on the home page\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 8\n table_rows.lazy.map(&:children).map do |cell|\n cell.map(&:text).map(&:strip)\n end\n end",
"def currency_filter(selection)\n\t\t\tif selection == 'any'\n\t\t\t\tself.all\n\t\t\telse\n\t\t\t\tself.where(name_of_class + '.currency = ?', selection)\n\t\t\tend\n\t\tend",
"def currencies\n @currencies || []\n end",
"def raw_exchange_rates\n table_rows = Oga.parse_html(response.body).css('#f_box option')\n # CAE porvide 17 currencies on the home page but with header\n # and an empty row in the end\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 17\n table_rows.lazy.map do |row|\n [\n row.text,\n row.attribute('data-buy').value,\n row.attribute('data-sell').value\n ]\n end\n end",
"def currency\n params['X-CURRENCY']\n end",
"def currency_types\n collection(\"currency_types\")\n end",
"def result_credit\n @value = $from == 'lending' ? @@xp_txt_result : @@xp_txt_result_fees\n wait_displays(:xpath, @value, 2)\n get_result = get_element_text(:xpath, @value).gsub(/[.,$]/, '').strip\n get_result.should == $money\n end",
"def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end",
"def get_currency_symbol\n \"€\"\n end",
"def currency\n 'INR'\n end",
"def clean_price(input)\n input[0] == \"$\" ? input[1..-1].to_f : input.to_f\n end",
"def input_dinheiro_precisao(form, field, label = nil, id = nil, place_holder = nil, required = false, separador_centena = nil,\n separador_centavos = nil, complemento = nil, label_col = 'col-md-2', control_col = 'col-md-10',\n precisao = 2, classe = '')\n html = \"\n #{form.text_field field,\n value: (Util.formata_moeda_sem_ponto(form.object.attributes[field.to_s]) if form.object.attributes[field.to_s]),\n label: label, name: \"#{id}_mask_money\", \"id\" => \"#{id}_mask_money\", placeholder: place_holder,\n data_required: required,\n hide_label: label.nil?,\n class: \"form-control input-money #{classe}\", \"data-decimal\" => separador_centavos,\n \"data-thousands\" => separador_centena,\n onkeyup: \"$(\\\"[name='#{form.object_name}[#{field}]']\\\").val(this.value.replace(/\\\\./g, '').replace(/\\\\,/g,'.'));\"}\n #{form.hidden_field field}\n <script>\n jQuery(document).ready(function () {\n $('.input-money').maskMoney({\n precision: #{precisao}\n });\n });\n </script>\n \"\n html.html_safe\n end",
"def extract_price(text)\n text.gsub('£', '').to_d\n end",
"def getValueAllServices\n ActionController::Base.helpers.number_to_currency(totalValueServices, precision: 0, delimiter: \".\")\n end",
"def get_crypto_value(url)\n\n\t\tcrypto_value = []\n\n\t\tpage = Nokogiri::HTML(open(url))\n\t\tpage_link_price = page.css(\"a.price\")\n\t\t\tpage_link_price.each do |value|\n\t\t\t\tcrypto_value << value[\"data-usd\"]\n\t\t\tend\n\t\treturn crypto_value\n\tend",
"def money_currencies\n Money::Currency.table.keys.map { |c| c.to_s.upcase }\n end",
"def currency\n 'INR'\n end",
"def get_crypto_value(url)\n\n\tcrypto_value = []\n\n\tpage = Nokogiri::HTML(open(url))\n\tpage_link_price = page.css(\"a.price\")\n\t\tpage_link_price.each do |value|\n\t\t\tcrypto_value << value[\"data-usd\"]\n\t\tend\n\treturn crypto_value\nend",
"def raw_exchange_rates\n # Banque Du Caire provide 17 currencies only\n table_rows = Oga.parse_html(response.body).css('table.curTbl tr')\n # But they have 1 empty <tr> and 1 header <tr> elements\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 19\n table_rows.lazy.drop(2).map(&:children).map { |cell| cell.map(&:text) }\n end",
"def us_dollar(cents); end",
"def page_reading\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\"))\n crypto_name_array = []\n crypto_value_array = []\n\n # on récupère \n page.xpath('//tr/td[3]/div').each do |crypto|\n crypto_name_array.push(crypto.text)\n end\n\n page.xpath('//tr/td[5]/div').each do |value|\n crypto_value_array.push(value.text)\n end\n\n general_array = crypto_name_array.zip(crypto_value_array).map { |x, y| {x=>y.delete('$,').to_f}}\n\n return general_array\n\nend",
"def exchange_rate\n http = Net::HTTP.new('themoneyconverter.com', 443)\n http.use_ssl = true\n\n url = \"/CurrencyConverter.aspx?from=#{from_currency.to_s.upcase}&to=#{to_currency.to_s.upcase}\"\n response = http.get(url)\n\n doc = Nokogiri::HTML(response.body)\n result = doc.css('div.cc-rate div#cc-ratebox').first.text\n\n regexp = Regexp.new('(\\\\d+(?:\\\\.\\\\d+)?)')\n regexp.match result\n\n return $1\n rescue Timeout::Error\n raise StandardError, 'Please check your internet connection'\n end",
"def payment_info\n arr_pay_info = []\n\n # Go through all divs that contains payments infor\n saved_payments_txt.each do |saved_payment_txt|\n arr_pay_info.push(saved_payment_txt.text)\n end\n\n arr_pay_info[0]\n end",
"def get_price(page)\n web_object = page.css(\"a.price\")\n price_coin = [] #stocke les donnees dans nouvel array\n web_object.each { |link| puts price_coin << link[\"data-usd\"] }\n return price_coin\n end",
"def contains_clearance_fees_price\n hash[\"CCFPrice\"]\n end",
"def currency\n nil\n end",
"def currency\n nil\n end",
"def currency()\n return \" ש\\\"ח\"\n end",
"def standardize_currency(input)\n plurals = @currency_set.keys.map{|key| key.pluralize}\n\n plurals.each do |word|\n input.gsub!(/#{word}/,word.singularize)\n end #standardize to singular word for lookup\n\n input.gsub!(/\\s/,\"\") #standardizes spacing\n input.split(\",\")\n end",
"def parse_price(val, ele)\n val.gsub(/[ ,]/, ' ' => '', ',' => '.')\n end",
"def parse_price(val, ele)\n val.gsub(/[ ,]/, ' ' => '', ',' => '.')\n end",
"def currency_multiplier_js\n javascript_tag \"$(function() {\n $('#currency_conversion_multiplier').keyup(function() {\n updateCurrencyCalculation();\n });\n });\"\n end",
"def get_crypto_name(url)\n\n\t\tcrytpo_names = []\n\n\t\tpage = Nokogiri::HTML(open(url))\n\t\tpage_link_names = page.css(\"a.currency-name-container.link-secondary\")\n\t\t\tpage_link_names.each do |name|\n\t\t\t\tcrytpo_names << name.text\n\t\t\tend\n\t\treturn crytpo_names\n\tend",
"def get_crypto_name(url)\n\n\tcrytpo_names = []\n\n\tpage = Nokogiri::HTML(open(url))\n\tpage_link_names = page.css(\"a.currency-name-container.link-secondary\")\n\t\tpage_link_names.each do |name|\n\t\t\tcrytpo_names << name.text\n\t\tend\n\treturn crytpo_names\nend",
"def cours\n\n\trequire 'nokogiri'\n\trequire 'open-uri'\n\n\tnam= []\n\txprice= []\n\thash_cours={}\n\n# Fetch and parse HTML document\n\tdoc = Nokogiri::HTML(open('https://coinmarketcap.com/all/views/all/'))\n\n\n\tdoc.search('td.no-wrap.currency-name > a').each do |link|\n \t\tnam << link.content\n\tend\n\n\n\n\tdoc.css('a[class=price]').each do |link|\n \t\txprice << link.content\n\tend\n\n\thash_cours=[nam.zip(xprice)]\n\nreturn hash_cours\nend",
"def delimiters(text)\n dots = text.count('.')\n has_dots = dots > 0\n\n has_commas = text.include?(',')\n has_spaces = text.include?(' ')\n\n possible_dollars, possible_cents = text.split('.') if dots == 1\n\n single_dot_cents_delimiter = dots == 1 &&\n !has_commas && !has_spaces &&\n (possible_dollars.to_i == 0 || (possible_cents.length > 2 && possible_cents.to_i != 0))\n\n cents_delimiter = if has_dots && text.match(/\\.[0-9]{1,2}$/)\n '.'\n elsif has_commas && text.match(/,[0-9]{1,2}$/)\n ','\n elsif single_dot_cents_delimiter\n '.'\n end\n\n thousands_delimiter = if cents_delimiter == '.' && has_commas\n ','\n elsif cents_delimiter == ',' && has_dots\n '.'\n end\n if thousands_delimiter.nil? && cents_delimiter.nil?\n thousands_delimiter = if has_dots\n '.'\n elsif has_commas\n ','\n end\n end\n\n thousands_delimiter = ' ' if thousands_delimiter.nil? && has_spaces\n\n if !cents_delimiter.nil? && text.count(cents_delimiter) > 1\n warn('invalid input')\n cents_delimiter = nil\n thousands_delimiter = nil\n end\n\n # puts \"#{text} => cents, thousands => #{[cents_delimiter, thousands_delimiter]}\"\n raise if !cents_delimiter.nil? && !thousands_delimiter.nil? && cents_delimiter == thousands_delimiter\n\n [cents_delimiter, thousands_delimiter]\nend",
"def exchange_rate\n url = \"/currencyconverter/convert/?Amount=1&From=#{from_currency.to_s.upcase}&To=#{to_currency.to_s.upcase}\"\n uri = URI.parse('https://www.xe.com')\n\n request = Net::HTTP.new(uri.host, uri.port)\n request.use_ssl = true\n response = request.get(url)\n\n doc = Nokogiri::HTML(response.body)\n result = doc.css('span.uccResultAmount').text\n\n regexp = Regexp.new('(\\\\d+(?:\\\\.\\\\d+)?)')\n regexp.match result\n\n return $1\n rescue Timeout::Error\n raise StandardError, 'Please check your internet connection'\n end",
"def currency_filters\n\t\t\t[\n\t\t\t\t[I18n.t('filters.currency.any'), 'any'],\n\t\t\t\t[I18n.t('filters.currency.eur'), 'EUR'],\n\t\t\t\t[I18n.t('filters.currency.gbp'), 'GBP'],\n\t\t\t\t[I18n.t('filters.currency.sek'), 'SEK']\n\t\t\t]\n\t\tend",
"def getValueAllProducts(quantity)\n ActionController::Base.helpers.number_to_currency(totalValueProducts(quantity), precision: 0, delimiter: \".\")\n end",
"def currency\n params['mc_currency']\n end",
"def currency\n params['mc_currency']\n end",
"def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend",
"def currency_exchanges\n self.invoice.currency_exchanges\n end",
"def special_prices\n prices\n end",
"def currency_as_string; end",
"def raw_exchange_rates\n table_rows = Oga.parse_html(response.body).css('table').first&.children\n # AlBarakaBank porvide 7 currencies on the home page\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 8\n table_rows.lazy.drop(1).map(&:children).map { |cell| cell.map(&:text) }\n end",
"def currency\n\tparams['mc_currency']\n end",
"def fetch_application_currency_types\n application_currency_types\n end",
"def textfields_exact(value)\n elements = tags_exact class_names: [text_field_class, secure_text_field_class], value: value\n select_visible_elements elements\n end",
"def parse_price(e)\n # prices can be restricted\n begin\n return e.css('span')[1].content.gsub(',', '.').to_f\n rescue\n return 0.0\n end\n end",
"def raw_exchange_rates\n # Suez Canal Bank provides 13 currencies only\n table_rows = Oga.parse_html(response.body)\\\n .css('#Table_01 tr:nth-child(4) > td:nth-child(2) > table tr')\n # But they have 2 <tr> used for the table headers\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 15\n table_rows.lazy.drop(2).map(&:children).map { |cell| cell.map(&:text) }\n end",
"def set_Currency(value)\n set_input(\"Currency\", value)\n end",
"def set_Currency(value)\n set_input(\"Currency\", value)\n end",
"def cigaret_price\n 0.30\n end",
"def getCurrencyValue(entry)\r\n\r\n # if entry is formatted as currency\r\n if isEntryCurrency?(entry)\r\n\r\n # ignore the initial $\r\n entry = entry[1..]\r\n\r\n # get rid of commas\r\n entry.gsub!(/,/, \"\")\r\n\r\n # convert to a number and return. We will convert everything to \r\n # a float for simplicity\r\n return entry.to_f()\r\n\r\n # if it is not formatted as currency, returns nil as an error value\r\n else\r\n return nil \r\n end\r\n end",
"def currencies_array\n CURRENCIES\n end",
"def currencies\n @currencies ||= definitions.keys.sort_by(&:to_s)\n end",
"def number\n input(xpath: './/p-inputmask/input').value\n end",
"def raw_exchange_rates\n table_rows = Oga.parse_html(response.body)\n .css('#MainContent_grdcurrency tr')\n # MIDB porvide 7 currencies on the home page but with header\n # and an empty row in the end\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 8\n table_rows.lazy.drop(1).map(&:children).map { |cell| cell.map(&:text) }\n end",
"def currency\n \"EUR\"\n end",
"def currency\n\t\t\"USD\"\n\tend",
"def get_prices(noko)\n prices_str = noko.css('div#prices').children.to_s.strip\n prices = Sanitize.clean(prices_str)\n .gsub(/We're Sorry/, '')\n .gsub(/Inventory Restriction/, '')\n .gsub(/Inventory Failure/, '')\n .gsub('Success!', '')\n .gsub(/\\s+/, ' ')\n .strip\n price_points = prices.split(/\\s\\|\\s/)\n prices_array = []\n price_points.each do |price|\n size = price.match /\\d+(oz|cl)/\n dollars = price.match(/\\$\\d+\\.*\\d*/).to_s.sub('$', '')\n crowler = price.match ' Crowler'\n size = size.to_s + crowler.to_s\n p = {size: size, cost: dollars}\n prices_array.push p\n end\n prices_array\n end",
"def raw_exchange_rates\n # BanqueMisr provide 18 currencies (17 Used and CYPRUS POUND)\n # But they have 2 <tr> for headers\n table_rows = Oga.parse_html(response.body).css('.exchangeRates tbody tr')\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 20\n # remove the first 2 headers of the array and the last element\n # which is CYPRUS POUND which is not used anymore\n table_rows.lazy.drop(2).take(17).map(&:children).map do |cell|\n cell.map(&:text)\n end\n end",
"def available_currency\n # GROUP THE ORDER BY THE CURRENCY, AND TOTAL THE AMOUNT FOR THAT CURRENCY\n grouped_orders = orders.group_by(&:converted_currency)\n grouped_orders.map{|c| {c[0].denomination => c[1].map(&:purchase_amount).reduce(:+)}}\n end",
"def get_all_available_currencies\n [@currency].concat @cross_rate.keys\n end",
"def currency_code\n @currency_code\n end",
"def crypto_scrapper\n\n # 1/ Ouverture du fichier avec nokogiri et uri.open \n # ----------------------------------------------\n doc_html_crypto = crypto_open_file\n\n\n # 2/ On applique des recherches via WPath Recherches !\n # ------------------------------------\n # Ceci_est_un_array_d_elements_html = page.xpath('/mettre_ici_le_XPath') \n\n puts \" Recherche des noms de Crypto : (Symbols) :\\n-------------------------------------------\"\n\n crypto_symbols_html = crypto_names(doc_html_crypto)\n\n puts \"\\n Recherche des cours de ces Crypto : \\n-------------------------------------\"\n\n crypto_prices_html = crypto_values(doc_html_crypto)\n\n # On met les noms (symbols) dans un tableau de strings \"crypto_symbols\"\n crypto_symbols = Array.new\n crypto_symbols_html.each do |symbols_link|\n crypto_symbols << symbols_link.text \n print \".\"\n end\n puts \n\n crypto_prices = Array.new\n crypto_prices_html.each do |prices_link|\n crypto_prices << prices_link.text.gsub(/[$,]/,'').to_f\n print \".\"\n end\n puts\n\n # Au cas où il n'y ait pas autant de names que de symbols\n #\n return nil if (crypto_prices.size != crypto_symbols.size)\n\n #Initialisation d'un Hash et hash_crypto_currencies['crypto_symbols'] = crypto_prices\n # sinon : # hash_crypto_currencies = [crypto_symbols, crypto_prices].transpose.to_h\n hash_crypto_currencies = Hash.new\n hash_crypto_currencies = Hash[crypto_symbols.zip crypto_prices]\n\n\n # 3/ Mise en forme finales : Faire un array de plusieurs mini-Hash\n # -----------------------------------------------------------------\n crypto_currencies = Array.new\n\n hash_crypto_currencies.each do | key, value |\n crypto_currencies << { key => value }\n end\n\n\n # 4/ Return de l'objet créé\n # -------------------------\n crypto_currencies.class\n return crypto_currencies\n\nend",
"def search_fx_rates(vat)\n open_sub_menu('List Foreign Exchange Rates')\n search_fx_value = [vat.fx_from_currency, vat.fx_to_currency, vat.fx_rate, vat.fx_effective_date,\"Delete\"]\n multi_pages_xpath = \"//div[@id='internal-list_foreign_exchange_rates-content']//div[2]/p/a\"\n page_size = all(:xpath, multi_pages_xpath).size\n i = 0\n begin\n all_vat_value = vat_fx_tbl.raw_text\n row_index = all_vat_value.index(search_fx_value)\n if row_index != nil\n break\n end\n if page_size >= i+1\n find(:xpath, multi_pages_xpath + \"[#{i+1}]\").click\n wait_until_bus_section_load\n end\n i = i + 1\n end while i <= page_size\n row_index == nil ? 0:row_index\n end",
"def currency\n money.currency\n end",
"def scan_quote\n\t\t\n\t\tstock_price = @quote.scan(/\\W\\W\\W\\d+\\.\\d+/i)\n\t\t@number = stock_price[0]\n\t\t\n\tend",
"def get_currency_name\n \"euro\"\n end",
"def raw_exchange_rates\n table_rows = Oga.parse_html(response.body).css('#idts_content tr')\n # NBE provide 17 currencies only\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 18\n # Drop 1 remove the table headers\n table_rows.lazy.drop(1).map(&:children).map { |cell| cell.map(&:text) }\n end",
"def currency\n number_to_currency(self)\n end",
"def textfields(value = false)\n return tags_include(class_names: [text_field_class, secure_text_field_class]) unless value\n\n elements = tags_include class_names: [text_field_class, secure_text_field_class], value: value\n select_visible_elements elements\n end",
"def get_currencies\n response_xml = http_get(@client, \"#{xero_url}/Currencies\")\n parse_response(response_xml, {}, {:request_signature => 'GET/currencies'})\n end"
] | [
"0.6336415",
"0.58622056",
"0.56495047",
"0.5637705",
"0.55859274",
"0.55801743",
"0.557341",
"0.5567995",
"0.55606097",
"0.55167186",
"0.54955214",
"0.54481405",
"0.5432425",
"0.54159683",
"0.53988266",
"0.53815293",
"0.53564405",
"0.53067076",
"0.5246456",
"0.5239302",
"0.5230846",
"0.52161795",
"0.5212394",
"0.5212394",
"0.5173812",
"0.51714605",
"0.51713824",
"0.51635927",
"0.5144954",
"0.5142969",
"0.5121032",
"0.5099238",
"0.5081353",
"0.50758684",
"0.5063842",
"0.505547",
"0.5046436",
"0.5043634",
"0.50305736",
"0.50137925",
"0.5002912",
"0.49972725",
"0.49870422",
"0.4985339",
"0.49820557",
"0.49809393",
"0.49673527",
"0.49672762",
"0.49458742",
"0.49455336",
"0.49262896",
"0.49262896",
"0.49252898",
"0.49231434",
"0.49195313",
"0.49195313",
"0.49090847",
"0.48952487",
"0.4894994",
"0.4892709",
"0.48906556",
"0.48862392",
"0.4879937",
"0.48794627",
"0.48794338",
"0.48794338",
"0.4874576",
"0.4869324",
"0.4864966",
"0.48619783",
"0.48538896",
"0.48482445",
"0.48212275",
"0.48186702",
"0.48118824",
"0.4807856",
"0.48050573",
"0.48028335",
"0.48020768",
"0.47953427",
"0.47944003",
"0.47913384",
"0.47834346",
"0.47769994",
"0.47649452",
"0.47635815",
"0.4759072",
"0.4757571",
"0.4750316",
"0.47488728",
"0.47457942",
"0.47427568",
"0.47414815",
"0.4737837",
"0.47317418",
"0.4711544",
"0.47031054",
"0.46993044",
"0.46964976",
"0.46904773"
] | 0.7382589 | 0 |
Clear input field of all the elements containing currency input text field | def clear_currency_input_field_elements
get_currency_input_field_elements.each do |ele|
# This is a temporary work around for clearing the currency input field as '.clear' on element is not working
ele.send_keys(:control, a)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_text_field(locator)\n find(locator).clear\n end",
"def clear\n set ' '\n # PhoneNumber inputs have country dial code pre-populated on focus. To have\n # it fully cleared, need more than one \"backspace\" hit\n wait_until_true do\n native.send_keys :backspace\n value.empty?\n end\n end",
"def clear\r\n self.value = \"\"\r\n end",
"def clear\n wait_until_exists\n @text_field.clear\n end",
"def clear_text(element_name)\n $LOG.info \"clear value of text field or text area : #{element_name}\"\n wait_and_find_element(element_name)\n begin\n wait_and_find_element element_name\n clear_value = el element_name\n clear_value.clear\n rescue Exception => e\n $LOG.error \"Unable to clear value of text field or text area : #{element_name} \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Unable to clear value of text field or text area : #{element_name} \"+e.message\n end\n end",
"def do_clear\n @editor.value = ''\n @editor.focus\n end",
"def clear_expression\n @input = \"\"\n @output.text = \"\"\n end",
"def reset\n self.base_currency = nil\n self.currency_rates = nil\n end",
"def clear_input!\n current = params[:Body] || params[:Digits]\n\n params[:Body] = nil\n params[:Digits] = nil\n\n @session.clear_session_input!\n end",
"def clear_field(field_name)\n\t\tend",
"def clear\n if %w(input textarea).include? type\n `#@native.value = null`\n else\n children.each do |child|\n remove_child child\n end\n end\n\n self\n end",
"def clear\n input_manager.unsubscribe_all self\n end",
"def price=(input)\n input.delete!(\"$\")\n super\n end",
"def clear(locator)\n el = find(locator)\n el.send_keys('')\n el.clear\n end",
"def clear_choices\n\t\t@order.clear\n\t\t@balance = 20.00\n\n\tend",
"def clear!\n fields.each { |tag, field| self.__send__(\"#{field.name}=\", nil) }\n end",
"def clear\n\t\t\t@store.transaction { @store.delete(:custom_numerals); @store.commit}\n\t\t\tputs \"User defined Roman Numerals cleared.\"\n\t\t\tconfig(true)\t\t\t\n\t\tend",
"def clear_fields\n\t\tend",
"def clear\n @field.each_index { |i| @field[i] = 0 }\n end",
"def clear_text_field_by_id(id)\n\t\t\tBrowser::LOGGER.reporter_event(\"clear_text_field_by_id\", id)\n\t\t\ttxt_field = find_text_field_by_id(id)\n\t\t\ttxt_field.clear\n\t\tend",
"def clear(driver = $focus_driver)\r\n driver.find_element(self).clear\r\n end",
"def add_all_values\n ValuesLib.remove_currency_format(text_value_one) + ValuesLib.remove_currency_format(text_value_two_element)\n + ValuesLib.remove_currency_format(text_value_three) + ValuesLib.remove_currency_format(text_value_four)\n + ValuesLib.remove_currency_format(text_value_five)\n end",
"def reset_new_customer_box\n @new_customer_box.setHidden_(true)\n\t for i in 0..8\n @customer_form.cellAtIndex_(i).setStringValue(\"\")\n\t end\n end",
"def _stomp_input_text(*args)\n Log.debug(\"[GRIDIUM::Element] Clearing \\\"#{value}\\\" from element: (#{self})\")\n element.clear\n sleep @text_padding_time\n Log.debug(\"[GRIDIUM::Element] Typing: #{args} into element: (#{self}).\")\n element.send_keys(*args)\n sleep @text_padding_time\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clear_symbols\n @interface.clear_symbols\n end",
"def clear_rates!\n store.each_rate do |iso_from, iso_to|\n add_rate(iso_from, iso_to, nil)\n end\n end",
"def clear\n send_cmd \"clear\"\n nil\n end",
"def empty_equation_field(equation_dom_element, del_dom_element)\n if equation_dom_element.text.empty?\n puts equation_dom_element.text\n else\n flash_and_ensure_click(del_dom_element)\n empty_equation_field(equation_dom_element, del_dom_element)\n end\nend",
"def remove_currency\n remove :currency\n money_columns do |money_column|\n column \"#{money_column}_currency\", \"string\"\n end\n end",
"def get_currency_input_field_elements\n elements(xpath: './/label[contains(text(),\"Limit\") or contains(text(), \"Accounts Receivable\") or contains(text(), \"On Premises\") or contains(text(), \"Off Premises\")]//following-sibling::app-currency-input/input[1]')\n end",
"def clean_price(input)\n input[0] == \"$\" ? input[1..-1].to_f : input.to_f\n end",
"def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end",
"def set_Currency(value)\n set_input(\"Currency\", value)\n end",
"def set_Currency(value)\n set_input(\"Currency\", value)\n end",
"def clear\n MSPhysics::Newton::CurvySlider.clear_points(@address)\n end",
"def clear\n MSPhysics::Newton::CurvySlider.clear_points(@address)\n end",
"def clear\n ''\n end",
"def user_clear (element)\r\n begin\r\n key_processor(element)\r\n ****_clear(@selector, @locator)\r\n rescue Exception => e\r\n raise e.message\r\n raise e.backtrace.inspect\r\n end\r\n end",
"def clear(locator)\n find_element(locator).clear\n end",
"def clear_scr\n system 'clear'\n system 'cls'\n end",
"def clean_price(price)\n regexp = /\\D/\n price.gsub(regexp, '')\n end",
"def clear_text(text)\n text = text.tr(\"\\n\", \" \")\n text.gsub(/[^0-9A-Za-z. ]/, '')\n end",
"def clear\n @val = 0\n self\n end",
"def clear() end",
"def clear() end",
"def clear(letter)\n @available_digits.add @letters[letter]\n @letters[letter] = nil\n end",
"def clear_namebox\n @nametxt.bitmap.dispose\n @namebox.dispose\n @namebox = nil\n @name_text = nil\n end",
"def reset_fields\n each_field_name do |key|\n reset_field(key)\n end\n end",
"def clear\n system 'clear'\n \n end",
"def input_text_montant\n \"\".in_input_text(class:'medium', name:'facture[montant_amount]', id:'facture_montant_amount')\nend",
"def clear\n writeln(\"clear\")\n end",
"def strip_formatting_from_numbers \t# to remove commas added to web form for readability\n\t\tif self.income.include? \",\"\n\t\t\tself.income = self.income.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\t\tif self.debt.include? \",\"\n\t\t\tself.debt = self.debt.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\t\tif self.down_payment.include? \",\"\n\t\t\tself.down_payment = self.down_payment.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\tend",
"def currency\n nil\n end",
"def currency\n nil\n end",
"def clear_card_totalhours\n unless timecard.totalhours.nil?\n timecard.totalhours = nil\n timecard.save\n end\n end",
"def clear_adjustments!\n adjustments.tax.each(&:destroy)\n price_adjustments.each(&:destroy)\n end",
"def ClearAll\n ClearErrors()\n ClearWarnings()\n ClearMessages()\n ClearYesNoMessages()\n\n nil\n end",
"def rl_clear_pending_input()\r\n @rl_pending_input = 0\r\n rl_unsetstate(RL_STATE_INPUTPENDING)\r\n 0\r\n end",
"def clearsign()\n # TODO\n end",
"def clear\n do_clear\n end",
"def reset\n\t\tself.state = \"off\"\n\t\tself.content_text = \"\"\n\t\tself.title_text = \"\"\n\t\tself.components.each do |c|\n\t\t\tc.reset\n\t\tend\n\tend",
"def clearing_span\n\t\tcontent_tag(:span, '', :class => 'clear')\n\tend",
"def clear\n VIM::command(\"%d\")\n end",
"def clear_default_fields\n reset_cleared_default_fields\n self.default_fields.each do |k, v|\n if respond_to?(\"#{k}=\") && unescape(self.send(\"#{k}\")) == unescape(v)\n add_to_cleared_default_fields(k, self.send(\"#{k}\")) and self.send(\"#{k}=\", \"\")\n end\n end\n end",
"def resetForm(presetViewsOption = nil, cityOption = nil, minCapacity, maxCapacity, minPriceRange, maxPriceRange)\n if !presetViewsOption.eql?(nil) && !cityOption.eql?(nil) then\n\n EnziUIUtility.wait(@driver, :id, \"presetViews\", 30)\n EnziUIUtility.clickElement(@driver, :id, 'presetViews')\n EnziUIUtility.selectOption(@driver, :id, 'presetViews', presetViewsOption)\n sleep(5)\n #EnziUIUtility.wait(@driver,:id,\"Available_From__c\",30)\n EnziUIUtility.clickElement(@driver, :id, 'Available_From__c')\n element = @driver.find_element(:link, 'Clear')\n element.click\n #EnziUIUtility.clickElement(@driver,:id,'Available_From__c')\n #EnziUIUtility.selectOption(@driver,:id,'Available_From__c',availableFromOption)\n\n #EnziUIUtility.wait(@driver,:id,\"city\",30)\n EnziUIUtility.clickElement(@driver, :id, 'city')\n EnziUIUtility.selectOption(@driver, :id, 'city', cityOption)\n else\n #EnziUIUtility.wait(@driver,:id,\"minCapacity\",30)\n @driver.find_element(:id, minCapacity).clear()\n @driver.find_element(:id, maxCapacity).clear()\n @driver.find_element(:id, minPriceRange).clear()\n @driver.find_element(:id, maxPriceRange).clear()\n end\n end",
"def clear!\n @fm.each_value { |fm| fm.close }\n @fm.clear\n end",
"def clear_data!\n @data = ''\n end",
"def clear\r\n system('clear')\r\n end",
"def clear(str)\n end",
"def strip_commas_from_prices\n params[:product][:price] = params[:product][:price].gsub(',', '')\n unless params[:product][:flatrate_shipping_cost].nil?\n params[:product][:flatrate_shipping_cost] = params[:product][:flatrate_shipping_cost].gsub(',', '')\n end\n unless params[:product][:international_flatrate_shipping_cost].nil?\n params[:product][:international_flatrate_shipping_cost] = params[:product][:international_flatrate_shipping_cost].gsub(',', '')\n end\n end",
"def inputs= new_inputs\n @inputs = new_inputs.gsub /\\D/, ''\n reset\n end",
"def clear\n Vedeu::Terminal.clear\n end",
"def clear\n Vedeu::Direct.write(value: clear_output, x: bx, y: by)\n end",
"def clear\n end",
"def clear\n end",
"def search_clear\n @search_text = @sb[:search_text] = nil\n params[:miq_grid_checks] = []\n if params[:in_explorer] == \"true\"\n reload\n else # non-explorer screens\n javascript_redirect(last_screen_url)\n end\n end",
"def clear\n `c$Element.prototype.m$clear_styles.call(#{@element})`\n end",
"def clean_costs\n self.cost = nil\n save\n end",
"def clean(input)\n input.to_s.gsub(/[^0-9]/, '')\n end",
"def clear\n @display.clear\n end",
"def clear\n @class_formatters.clear\n @module_formatters.clear\n self\n end",
"def clear(name = nil)\n if name.nil?\n @field_objs.each { |f| f.clear unless f.nil? }\n else\n obj = find_obj_for_name(name.to_s)\n obj.clear unless obj.nil?\n end\n end",
"def remove_decimal_mark(value)\n value.delete('$,')\n end",
"def clear_w1c\n each(&:clear_w1c)\n self\n end",
"def clear\n end",
"def clear_answer\n \t\tself.answer = nil\n \tend",
"def unclear\n system(\"clear\")\n puts \"I'm sorry. That seems to be invalid input.\\n\n Please try again.\"\n sleep(1)\n system(\"clear\")\n initial_prompt\n end",
"def clear(locator)\n @driver.find_element(locator).send_keys [:command, 'a'], :delete\n end",
"def clear_text(access_type, access_name)\n find(:\"#{access_type}\", \"#{access_name}\").set(\"\")\nend",
"def reset\n <<-JS.gsub(/^ {10}/, '')\n mixpanel.reset();\n JS\n end",
"def clear\n end",
"def clear\n end",
"def clear\n end",
"def clear(p)\n p.to_plain_text.gsub(/\\n/, \"\").gsub(/\\[.*?\\]/, '')\n end",
"def clear()\n \n if OS.linux? or OS.mac?\n\n system(\"clear\")\n\n elsif OS.windows?\n\n system(\"cls\")\n\n end\n\n end",
"def clear\n @total = 0\n end",
"def clear_all\n @name_1 = \"\"\n @name_2 = \"\"\n @ori_backdrop1 = \"\"\n @ori_backdrop2 = \"\"\n end",
"def remove_assignment_text\n frm.frame(:id, \"Assignment.view_submission_text___Frame\").div(:title=>\"Select All\").fire_event(\"onclick\")\n frm.frame(:id, \"Assignment.view_submission_text___Frame\").td(:id, \"xEditingArea\").frame(:index=>0).send_keys :backspace\n end"
] | [
"0.6813654",
"0.65169317",
"0.6312544",
"0.6279329",
"0.6050338",
"0.60489315",
"0.59699625",
"0.5887981",
"0.58871186",
"0.5874187",
"0.5860212",
"0.58410794",
"0.57665896",
"0.5751195",
"0.5736496",
"0.5716399",
"0.5713885",
"0.5687539",
"0.5665564",
"0.5622061",
"0.55887365",
"0.5472241",
"0.5456509",
"0.5303892",
"0.52650094",
"0.52650094",
"0.52070034",
"0.52005804",
"0.51858395",
"0.5184497",
"0.5180074",
"0.51741844",
"0.5156003",
"0.51529896",
"0.51458544",
"0.5144223",
"0.5121859",
"0.5121859",
"0.51185244",
"0.5117152",
"0.50506246",
"0.5048652",
"0.5020383",
"0.501739",
"0.5009884",
"0.50036216",
"0.50036216",
"0.49986854",
"0.4985952",
"0.49793842",
"0.49635655",
"0.49625137",
"0.4939369",
"0.4926227",
"0.4923984",
"0.4923984",
"0.4918654",
"0.4917218",
"0.49152923",
"0.49043626",
"0.4899056",
"0.4890804",
"0.4890025",
"0.48736373",
"0.48723227",
"0.4870879",
"0.48706788",
"0.48660177",
"0.48657",
"0.48650193",
"0.48628107",
"0.4859018",
"0.48558086",
"0.48464546",
"0.48416927",
"0.4841634",
"0.4841634",
"0.48413864",
"0.48323777",
"0.48215073",
"0.48202333",
"0.48138884",
"0.48090118",
"0.48030686",
"0.480107",
"0.48000905",
"0.47704875",
"0.47692698",
"0.47680658",
"0.4764995",
"0.47623396",
"0.47612932",
"0.4756903",
"0.4756903",
"0.4756903",
"0.47555488",
"0.47552848",
"0.4754477",
"0.47508085",
"0.4748293"
] | 0.8816248 | 0 |
DNA to RNA Conversion Deoxyribonucleic acid, DNA is the primary information storage molecule in biological systems. It is composed of four nucleic acid bases Guanine ('G'), Cytosine ('C'), Adenine ('A'), and Thymine ('T'). Ribonucleic acid, RNA, is the primary messenger molecule in cells. RNA differs slightly from DNA its chemical structure and contains no Thymine. In RNA Thymine is replaced by another nucleic acid Uracil ('U'). Create a funciton which translates a given DNA string into RNA. For example: DNAtoRNA("GCAT") returns ("GCAU") The input string can be of arbitrary length in particular, it may be empty. All input is guaranteed to be valid, i.e. each input string will only ever consist of 'G', 'C', 'A' and/or 'T'. | def DNAtoRNA(dna)
dna.gsub("T", "U")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dna_to_rna(string)\n index = 0\n rna_strand = \"\"\n while index < string.length\n if string[index] == \"G\"\n rna_strand << \"C\"\n elsif string[index] == \"C\"\n rna_strand << \"G\"\n elsif string[index] == \"T\"\n rna_strand << \"A\"\n elsif string[index] == \"A\"\n rna_strand << \"U\"\n end\n index += 1\n end\n return rna_strand\nend",
"def dna_to_rna(dna)\n dna.gsub(\"T\", \"U\")\n end",
"def dna_to_rna(dna)\n dna.tr('T', 'U')\nend",
"def rna_to_dna(rna)\n rna.gsub(\"U\", \"T\")\n end",
"def rna_to_amino_acid(rna)\n # Protein Translation Problem: Translate an RNA string into an amino acid string.\n # Input: An RNA string Pattern and the array GeneticCode.\n # Output: The translation of Pattern into an amino acid string Peptide. \n\n r_to_c_h = rna_to_codon_hash\n # puts r_to_c_h\n i = 0\n codon_length = 3\n amino_acid = \"\"\n while (codon = rna.slice(i, codon_length)) do\n # puts codon\n # puts r_to_c_h[codon.to_sym]\n break if codon.empty?\n amino_acid += r_to_c_h[codon.to_sym].to_s\n i += codon_length\n end\n return amino_acid\n end",
"def to_rna\n @dna = @dna_type.tr('T', 'U')\n end",
"def DNA_strand(dna)\n dna.tr('ATGC', 'TACG')\nend",
"def DNA_strand(dna)\n n = dna.split(\"\")\n mapping = {'T' => 'A', 'A' => 'T', 'C' => 'G', 'G' => 'C'}\n # n = n.map {|e| mapping[e] || e}\n n.map! {|e| mapping[e] || e}\n n = n.join(\"\")\n return n\nend",
"def DNA_strand(dna)\n\n new_dna = \"\"\n dna.each_char do |letter|\n\n if letter == \"A\"\n new_dna += \"T\"\n elsif letter == \"T\"\n \tnew_dna += \"A\"\n elsif letter == \"C\"\n \tnew_dna += \"G\"\n elsif letter == \"G\"\n \tnew_dna += \"C\"\n else\n \tnew_dna += letter\n end\n \n end\n return new_dna\nend",
"def DNA_strand(dna)\n dna.tr('ATCG', 'TAGC')\n new_strand = []\n dna.split('').each do |letter|\n if letter === 'A'\n new_strand.push('T')\n elsif letter === 'T'\n new_strand.push('A')\n elsif letter === 'C'\n new_strand.push('G')\n elsif letter === 'G'\n new_strand.push('C')\n end\n end\n return new_strand.join('')\nend",
"def DNA_strand(dna)\n dna.tr(\"ACTG\", \"TGAC\")\nend",
"def reverse_complement(dna_string)\n complementary = {'A' => 'T', 'T' => 'A', 'C' => 'G', 'G' => 'C'}\n complement = \"\"\n dna_string.reverse.each_char do |nucleotide|\n complement += complementary[nucleotide]\n end\n complement\nend",
"def DNA_strand(dna)\n arr = dna.split(//)\n another_arr = Array.new\n arr.each do |chr|\n case chr\n when \"A\"\n another_arr << \"T\"\n when \"T\"\n another_arr << \"A\"\n when \"C\"\n another_arr << \"G\"\n else\n another_arr << \"C\"\n end\n end\n \"String #{dna} is #{another_arr.join}\"\nend",
"def translate(codon)\n x = Bio::Sequence::NA.new(codon)\n a = x.translate # or a = x.translate.codes \n return a\nend",
"def DNA_strand(dna)\n new_dna = ''\n dna.each_char do |x|\n case x\n when 'a'\n new_dna << 't'\n when 't'\n new_dna << 'a'\n when 'g'\n new_dna << 'c'\n when 'c'\n new_dna << 'g'\n end\nend\nputs new_dna\nend",
"def getDna (cds, seq)\n loc = cds.locations\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n end\n dna = Bio::Sequence.auto(fasta)\n return dna\nend",
"def dna_string(string)\n letters = string.upcase.split('')\n return_arr = []\n letters.each do |i|\n if i == 'G'\n arr = []\n arr.push('G','C')\n return_arr.push(arr)\n elsif i == 'C'\n arr = []\n arr.push('C','G')\n return_arr.push(arr)\n elsif i == 'A'\n arr = []\n arr.push('A','T')\n return_arr.push(arr)\n elsif i == 'T'\n arr = []\n arr.push('T','A')\n return_arr.push(arr)\n end\n end\n p return_arr\nend",
"def getDna (cds, seq)\n loc = cds.locations\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n end\n dna = Bio::Sequence.auto(fasta)\n return dna\n end",
"def guess_sequence_type(sequence_string)\n cleaned_sequence = sequence_string.gsub(/[^A-Z]/i, '') # removing non-letter characters\n cleaned_sequence.gsub!(/[NX]/i, '') # removing ambiguous characters\n\n return nil if cleaned_sequence.length < 10 # conservative\n\n composition = composition(cleaned_sequence) \n composition_NAs = composition.select { |character, count|character.match(/[ACGTU]/i) } # only putative NAs\n putative_NA_counts = composition_NAs.collect { |key_value_array| key_value_array[1] } # only count, not char\n putative_NA_sum = putative_NA_counts.inject { |sum, n| sum + n } # count of all putative NA\n putative_NA_sum = 0 if putative_NA_sum.nil?\n\n if putative_NA_sum > (0.9 * cleaned_sequence.length)\n return :nucleotide\n else\n return :protein\n end\n end",
"def dnaSequence s\n hash, diff = Hash.new(0), Hash.new(0)\n diff[[0, 0, 0]] = 1\n\n sum = 0\n s.chars.each { |c|\n hash[c] += 1\n res = [hash['A'] - hash['C'], hash['C'] - hash['G'], hash['G'] - hash['T']]\n sum += diff[res]\n diff[res] += 1\n }\n sum\nend",
"def guess_type(sequence_string)\n cleaned_sequence = sequence_string.gsub(/[^A-Z]/i, '') # removing non-letter characters\n cleaned_sequence.gsub!(/[NX]/i, '') # removing ambiguous characters\n\n return nil if cleaned_sequence.length < 10 # conservative\n\n composition = composition(cleaned_sequence)\n composition_NAs = composition.select {|character, count| character.match(/[ACGTU]/i)} # only putative NAs\n putative_NA_counts = composition_NAs.collect {|key_value_array| key_value_array[1]} # only count, not char\n putative_NA_sum = putative_NA_counts.inject {|sum, n| sum + n} # count of all putative NA\n putative_NA_sum = 0 if putative_NA_sum.nil?\n\n if putative_NA_sum > (0.9 * cleaned_sequence.length)\n return :nucleotide\n else\n return :protein\n end\n end",
"def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend",
"def rev_comp(seq) # AAAGG-G => CCCTT-T\n # remove N start and last bases\n seq = seq.sub(/^N+/, '')\n seq.sub!(/N+$/, '')\n return nil if seq.include?(\"N\".freeze)\n seq.upcase!\n seq.reverse!\n seq.tr!('ATGC'.freeze, 'TACG'.freeze)\n return seq\n end",
"def submit_dna(sequence)\n\n\n params = Hash.new\n params['email'] = 'dunarel@gmail.com'\n params['title'] = 'test_web_service'\n params['sequence'] = sequence\n #clustalw2 specific params\n params['format'] = 'fasta' #\n params['alignment'] = 'fast' #slow\n #params['quicktree'] = 0\n params['type'] = 'dna'\n params['output'] = 'phylip'\n\n\n #call inherited\n return run_params(params)\n\n\n end",
"def encode_peptide(genome, amino_acid)\n # We say that a DNA string Pattern encodes an amino acid string Peptide if the \n # RNA string transcribed from either Pattern or its reverse complement Pattern translates into Peptide. \n # For example, the DNA string GAAACT is transcribed into GAAACU and translated into ET. \n # The reverse complement of this DNA string, AGTTTC, is transcribed into AGUUUC and translated into SF. \n # Thus, GAAACT encodes both ET and SF.”\n\n # Peptide Encoding Problem: Find substrings of a genome encoding a given amino acid sequence.\n # Input: A DNA string Text, an amino acid string Peptide, and the array GeneticCode.\n # Output: All substrings of Text encoding Peptide (if any such substrings exist). \n\n match_dna = []\n codon_length = 3\n rna_seq_length = (amino_acid.length * codon_length)\n \n rna = dna_to_rna(genome)\n i = 0\n while (rna_seq = rna.slice(i, rna_seq_length )) do\n # puts rna_seq\n match_dna << rna_to_dna(rna_seq) if rna_peptide_match?(rna_seq, amino_acid)\n i += 1\n end\n\n rna = dna_to_rna(reverse_complement(genome))\n # puts rna\n i = 0\n while (rna_seq = rna.slice(i, rna_seq_length )) do\n # puts rna_seq\n match_dna << reverse_complement(rna_to_dna(rna_seq)) if rna_peptide_match?(rna_seq, amino_acid)\n i += 1\n end\n\n match_dna\n end",
"def phylipstring_to_fastastring(phystr)\n ph=Bio::Phylip::PhylipFormat.new(phystr)\n return ph.alignment.output(:fasta) #output_fasta\n\n end",
"def fasta_parse(fasta_string)\n fasta_parts = fasta_string.split('>')[1..-1]\n no_pfamid = fasta_parts.map { |x| x.split(',')[1].chomp() }\n seqs = no_pfamid.map { |s| {:genus => s.lines.first.chomp(), :seq => s.split(\"\\n\")[1..-1].join.gsub(\"\\n\",'') } }\n seqs.sort_by! { |h| h[:genus] } #makes sure to sort alphabetically, allowing us to build partitioned character matrices\n return seqs\nend",
"def pirates_say_arrrrrrrrr(string)\n\tchars = string.split(//)\n\treturnString = ''\n\tchars.each_with_index do |c,i|\n\t\treturnString << chars[i+1].to_s if c == 'r' || c == 'R'\n\tend\n\treturnString\nend",
"def translate(str)\n\tvowel=%w[a e i o u]\n\tcons=[*'a'..'z']-vowel\n\n\ta_str=str.split(\" \")\n\n\tfor i in 0..a_str.length-1\n\t\tif vowel.include?a_str[i][0]\n\t\t\tpig_l = a_str[i] + \"ay\"\n\t\t\treturn pig_l.split(\",\").join(\"\")\n\t\telsif cons.include?a_str[i][0]\n\t\t\tif cons.include?a_str[i][1]\n\t\t\t\tz=a_str[i].slice!(0..1)\n\t\t\telse\n\t\t\t\tz=a_str[i].slice!(0)\n\t\t\tend\n\t\t\tpig_l=a_str[i] + z+ \"ay\"\n\t\t\treturn pig_l.split(\",\").join(\"\")\n\t\tend\n\tend\nend",
"def translate(string)\n initial_consonants =Regexp.new(/^(sch|scr|shr|sph|spl|spr|squ|str|thr|bl|br|ch|cl|cr|dr|dw|fl|fr|gl|gr|pl|pr|qu\\\n|sc|sk|sl|sm|sn|sp|st|sw|th|tr|tw|b|c|d|f|g|h|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z)/)\n array = string.split(' ')\n new_array = []\n array.each do |element|\n if initial_consonants.match(element)\n position = ((initial_consonants.match(element)).to_s.length)\n new_string = element[position..element.length]+element[0...position] + 'ay'\n else\n new_string = element + 'ay'\n end\n new_array << new_string\n end\n new_array.join(' ')\nend",
"def pirates_say_arrrrrrrrr(string)\n result = \"\"\n string.each_char.with_index do |letter, index|\n unless string.size-1 == index\n if (letter == \"r\" || letter == \"R\")\n next_letter = string[index + 1]\n result = result + next_letter\n end\n end\n end\n return result\nend",
"def pirates_say_arrrrrrrrr(string)\n output = \"\"\n string.chars.each_with_index do |n, index|\n if string[index] == \"r\" || string[index] == \"R\"\n output << string[index+1,1]\n else\n end\n end\n return output\nend",
"def amino_acid_2 (bases)\n bases_to_aa = []\n aa_list = []\n base1 = bases[0].to_list\n base2 = bases[1].to_list\n base3 = bases[2].to_list\n l1 = base1.size - 1\n l2 = base2.size - 1\n l3 = base3.size - 1\n (0..l1).each do |n1|\n b1 = base1[n1]\n (0..l2).each do |n2|\n b2 = base2[n2]\n (0..l3).each do |n3|\n b3 = base3[n3]\n bases_all = b1 + b2 + b3\n bases_to_aa << bases_all\n end\n end\n end\n\n bases_to_aa.each do |base|\n case base\n when /^TT[TCY]$/\n aa = \"F\"\n when /^TT[AGR]$/\n aa = \"L\"\n when /^CT.$/\n aa = \"L\"\n when /^AT[TCAHYWM]$/\n aa = \"I\"\n when \"ATG\"\n aa = \"M\"\n when /^GT.$/\n aa = \"V\"\n when /^TC.$/\n aa = \"S\"\n when /^CC.$/\n aa = \"P\"\n when /^AC.$/\n aa = \"T\"\n when /^GC.$/\n aa = \"A\"\n when /^TA[TCY]$/\n aa = \"Y\"\n when /^TA[AGR]$/\n aa = \"*\"\n when /^T[GR]A$/\n aa = \"*\"\n when /^CA[TCY]$/\n aa = \"H\"\n when /^CA[AGR]$/\n aa = \"Q\"\n when /^AA[TCY]$/\n aa = \"N\"\n when /^AA[AGR]$/\n aa = \"K\"\n when /^GA[TCY]$/\n aa = \"D\"\n when /^GA[AGR]$/\n aa = \"E\"\n when /^TG[TCY]$/\n aa = \"C\"\n when \"TGG\"\n aa = \"W\"\n when /^CG.$/\n aa = \"R\"\n when /^AG[TCY]$/\n aa = \"S\"\n when /^[AM]G[AGR]$/\n aa = \"R\"\n when /^GG.$/\n aa = \"G\"\n when /^[ATW][CGS][CTY]$/\n aa = \"S\"\n when /^[TCY]T[AGR]$/\n aa = \"L\"\n else\n aa = \"-\"\n end\n aa_list << aa\n end\n aa_out = aa_list.uniq.join\n return aa_out\n end",
"def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend",
"def translate str\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(str[0])\n str + 'ay'\n elsif consonants.include?(str[0]) && consonants.include?(str[1])\n str[2..-1] + str[0..1] + 'ay'\n elsif consonants.include?(str[0])\n str[1..-1] + str[0] + 'ay'\n else\n str # return unchanged\n end\nend",
"def all_else_dna(dna)\n # Input: A\n # Output: C G T\n # Input: C\n # Output: A G T\n dna_a = [\"A\", \"C\", \"G\", \"T\"]\n # puts dna_a.join(\" \")\n dna_a.delete(dna)\n # puts dna_a.join(\" \")\n return dna_a\n end",
"def pirates_say_arrrrrrrrr(string)\n newstring = ''\n string.downcase!\n string.length.times do |index|\n newstring += string[index + 1] if char_is_r(string, index) && next_char_not_nil(string, index)\n end\n newstring\nend",
"def decode(string)\n string.tr('A-Za-z', (('a'..'z').to_a + ('A'..'Z').to_a).reverse.join) rescue \"Input is not a string\"\nend",
"def pirates_say_arrrrrrrrr(string)\n new_string = String.new\n string.chars.each_with_index do |x,i|\n while i < string.length-1\n new_string += string[i+1] if x=='r' || x=='R' \n break\n end\n end\n new_string\nend",
"def read_sequence (seq)\n g = 0\n a = 0\n t = 0\n c = 0\n # testen, ob uebergebenes Objekt einzelne Zeichen zurueckgeben kann\n if not seq.respond_to?(\"each_char\")\n return nil\n end\n # iteration ueber alle Symbole (in Großschreibweise) und Ermittlung\n # der absoluten Haeufigkeit der Basen\n seq.each_char do |base|\n base.upcase!\n if base == \"G\"\n g += 1\n elsif base == \"A\"\n a += 1\n elsif base == \"T\"\n t += 1\n elsif base == \"C\"\n c += 1\n else\n return nil\n end\n end\n return g,a,t,c\nend",
"def pirates_say_arrrrrrrrr(string)\n\tnew_string = \"\"\n\tstring_array = string.split('')\n\tfor i in 0..string_array.length-1\n\t\tif string_array[i] == \"r\" || string_array[i] == \"R\"\n\t\t\tnew_string << string_array[i+1].to_s\n\t\tend\n\tend\n\tnew_string\nend",
"def amino_acid (bases)\n case bases\n when /^TT[TCY]$/\n return \"F\"\n when /^TT[AGR]$/\n return \"L\"\n when /^CT.$/\n return \"L\"\n when /^AT[TCAHYWM]$/\n return \"I\"\n when \"ATG\"\n return \"M\"\n when /^GT.$/\n return \"V\"\n when /^TC.$/\n return \"S\"\n when /^CC.$/\n return \"P\"\n when /^AC.$/\n return \"T\"\n when /^GC.$/\n return \"A\"\n when /^TA[TCY]$/\n return \"Y\"\n when /^TA[AGR]$/\n return \"*\"\n when /^T[GR]A$/\n return \"*\"\n when /^CA[TCY]$/\n return \"H\"\n when /^CA[AGR]$/\n return \"Q\"\n when /^AA[TCY]$/\n return \"N\"\n when /^AA[AGR]$/\n return \"K\"\n when /^GA[TCY]$/\n return \"D\"\n when /^GA[AGR]$/\n return \"E\"\n when /^TG[TCY]$/\n return \"C\"\n when \"TGG\"\n return \"W\"\n when /^CG.$/\n return \"R\"\n when /^AG[TCY]$/\n return \"S\"\n when /^[AM]G[AGR]$/\n return \"R\"\n when /^GG.$/\n return \"G\"\n when /^[ATW][CGS][CTY]$/\n return \"S\"\n when /^[TCY]T[AGR]$/\n return \"L\"\n else\n return \"#\"\n end\n end",
"def pirates_say_arrrrrrrrr(string)\n new_string = ''\n string.downcase.chars.map.with_index{ |char, idx| new_string += string[idx+1].to_s if char == 'r' }\n new_string\nend",
"def submit_dna(sequence)\n\n\n #clustalw2 specific params\n params = Hash.new\n\t params['email'] = 'dunarel@gmail.com'\n params['title'] = 'test_web_service'\n params['sequence'] = sequence\n \n \n #call base class\n return run_params(params)\n\n end",
"def pirates_say_arrrrrrrrr(string)\n\tcounter = 0\n\tpirate_string = \"\"\n\twhile counter < string.length - 1 do \n\n\t\tif string[counter] == \"r\" || string[counter] == \"R\"\n\t\t\tpirate_string += string[counter + 1]\n\t\tend\t\n\n\t\tcounter += 1\n\tend\n\t return pirate_string \nend",
"def pirates_say_arrrrrrrrr(string)\n return_string = \"\"\n\n string_length = string.length\n\n for x in 0...string_length\n if string[x] == \"r\" || string[x] == \"R\"\n return_string << string[x+1] unless (x+1) == string_length\n end\n end\n return_string\nend",
"def pirates_say_arrrrrrrrr(string)\n output = ''\n string.each_char.with_index do |letter, i|\n unless string[i + 1].nil?\n output += string[i + 1] if letter == 'r' || letter == 'R'\n end\n end\n output\nend",
"def test_genomic2cdna_fw # forward strand (variation rs67960011)\n t = Ensembl::Core::Transcript.find_by_stable_id(\"ENST00000039007\")\n assert_equal(573,t.genomic2cdna(38260562)) \n end",
"def pirates_say_arrrrrrrrr(string)\n\tnewstr = \"\"\n\tlength = string.length - 1\n\tlength.times do |x|\n\t\tif string[x] == \"r\" || string[x] == \"R\"\n\t\t\tpos = x + 1\n\t\t\tnewstr << string[pos]\n\t\tend\n\tend\n\tnewstr\nend",
"def pirates_say_arrrrrrrrr(string)\n\tresult = ''\n\tstring_array = string.downcase.split('')\n\tstring_array.each.with_index{|x,i| result += string_array[i+1] if x == 'r' && i != string.length - 1}\n\treturn result\nend",
"def translate_string_to_number(input)\n\n #take the input\n #break it up into individual letters\n #map the letters to a dictionary (a = 1) or\n #map the input to a placement in an array\n\nend",
"def pirates_say_arrrrrrrrr(string)\n # find index of r's but ignore when r is the last letter\n indices_of_r = (0..string.length - 2).select{|n| string[n] == \"r\" || string[n] == \"R\"}\n letters = \"\"\n # extract letters at indices of r + 1\n indices_of_r.each {|n|\n letters += string[n + 1]}\n letters\nend",
"def rot13(string)\n string.tr(\"A-Za-z\", \"N-ZA-Mn-za-m\")\nend",
"def a(str)\n case\n when str == \"0\"\n return \"\"\n when str == \"1\"\n return 'one'\n when str == \"2\"\n return 'two'\n when str == \"3\"\n return 'three'\n when str == \"4\"\n return 'four'\n when str == \"5\"\n return 'five'\n when str == \"6\"\n return 'six'\n when str == \"7\"\n return 'seven'\n when str == \"8\"\n return 'eight'\n when str == \"9\"\n return 'nine'\n end\nend",
"def rotx1(x, string, encrypt=true)\n\n return string if x % 26 == 0\n offset = encrypt ? x % 26 : -x % 26\n\n return string.tr('A-Za-z', 'B-ZAb-za') if offset == 1\n return string.tr('A-Za-z', \"ZA-Yza-y\") if offset == 25\n rot_a = (offset + 'a'.ord).chr\n rot_z = (rot_a.ord - 1).chr\n \n string.tr('A-Za-z', rot_a.upcase + \"-ZA-\" + rot_z.upcase + rot_a + \"-za-\" + rot_z)\nend",
"def convert(str)\n return nil unless str.is_a? String\n str = tokenize(str)\n return nil if str == \"\"\n return nil unless balanced_brackets? str\n return translate(str)\n end",
"def complement(nucleotide)\n case nucleotide\n when \"A\"\n \"T\"\n when \"T\"\n \"A\"\n when \"G\"\n \"C\"\n when \"C\"\n \"G\"\n end\nend",
"def convert_to_ar(str)\n bgn = 0\n cur = str[bgn]\n ar = []\n unless str.empty?\n str.length.times do |ind|\n next unless str[ind] != cur\n\n ar.append(str[bgn, ind - bgn])\n bgn = ind\n cur = str[ind]\n end\n ar.append(str[bgn, str.length])\n end\n ar\n end",
"def convert_string string\n string\n end",
"def togr str\n ''.tap do |into|\n togrer.transcribe str.to_enum(:each_char), into\n end\n end",
"def gb_to_fasta(gb, fasta, seq_type=:nt, task_name=\"rast_annotate\")\n abort \"FATAL: Task #{task_name} requires specifying STRAIN_NAME\" unless STRAIN_NAME\n abort \"FATAL: gb_to_fasta called with invalid seq_type\" unless [:nt, :aa].include? seq_type\n system <<-SH\n module load python/2.7.6\n module load py_packages/2.7\n python #{REPO_DIR}/scripts/gb_to_fasta.py -i #{gb} -s #{seq_type} -o #{fasta}\n SH\nend",
"def pirates_say_arrrrrrrrr(string) \n to_return = \"\" # return a string\n add_next = false \n string.size.times do |index| #iterate upwards adding to the index for each look\n current_char = string[index,1] # the present character is index 1 ont he string\n to_return << current_char if add_next #move to the next character\n add_next = (current_char == \"r\" || current_char == \"R\") # only add if the current character is an upper or lower case \n end\n to_return\nend",
"def pirates_say_arrrrrrrrr(string)\n\tcharacters = string.split('')\n\tchar_index = []\n\toutput = \"\"\n\tcharacters.each_with_index {|char,index| char.downcase == \"r\" ? char_index.push(index += 1) : ''}\n \tcharacters.map.with_index {|char,index| char_index.include?(index) ? output << char : nil }.compact\n return output\nend",
"def convert_string string\n return string unless @in_b or @in_em\n chars = if @in_b then\n string.chars.map do |char| \"#{char}\\b#{char}\" end\n elsif @in_em then\n string.chars.map do |char| \"_\\b#{char}\" end\n end\n\n chars.join\n end",
"def translate string\n\n\t#This splits the string into an array of words\n\twords = string.split(\" \")\n\t\n\t#Goes through each word in array words\n\tfor i in 0...words.length\n\n\t\t#This splits each word into an array of characters\n\t\tcharacters = words[i].chars\n\n\t\t#If a word begins with a vowel, add \"ay\" to the end of the word\n\t\tif isVowel characters[0]\n\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\t#If a word does not begin with a vowel...\n\t\telse\n\n\t\t\t#While the first character is not a vowel, move it to the back of the word\n\t\t\twhile !(isVowel characters[0])\n\n\t\t\t\t#If the first character is a \"q,\"\n\t\t\t\tif characters[0] == \"q\"\n\n\t\t\t\t\t#and the next character is a \"u,\" push both the \"qu\" to the end\n\t\t\t\t\tif characters[1] == \"u\"\n\n\t\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\t\tcharacters.push(consonant)\n\t\t\t\t\t\tu = characters.shift\n\t\t\t\t\t\tcharacters.push(u)\n\n\t\t\t\t\tend\n\n\t\t\t\t#Otherwise, just push the first letter to the end\n\t\t\t\telse\n\n\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\tcharacters.push(consonant)\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Then add \"ay\" to the end of the word\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\tend\n\t\t\n\tend\n\n\t#Joins together all the words with a space in between them and returns the modified string as an answer\n\tanswer = words.join(\" \")\n\treturn answer\n\nend",
"def reverse_upcase_noLTA(string)\n string = string.downcase\n string = string.delete \"a\"\n string = string.delete \"l\"\n string = string.delete \"t\"\n string = string.upcase\n string = string.reverse\n return string\nend",
"def reverseString(string)\n\nend",
"def next_vowel(string)\n\tvowels = \"aeiou\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding vowel and if so goes to the next vowel by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"u\", converts to \"a\"\n\t\tif string[index] == vowels[4]\n\t\t\tconverted_string += \"a\"\n\t\t#if the string has any vowel besides \"u\"\n\t\telsif string[index] == vowels[i]\n\t\t\tconverted_string += vowels[i+1]\n\t\t# for consonants doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend",
"def pirates_say_arrrrrrrrr(string)\n\n\tarr = string.split(//)\n\n output = []\n arr.each_cons(2) { |a,b| output << b if a == \"r\" || a == \"R\" }\n output.join\n\nend",
"def reorganize_string(a)\np a\n a = get_frequencies(a)\n\n count = count_char_numbers(a)\n\n return \"\" unless can_reorganize?(count)\n\n build_new_string(a, count)\nend",
"def buildRGString()\n currentTime = Time.new\n\n # If sample name was provided in the configuration parameters, use it.\n # If not, use FC-lane as the sample name. If that also is not availble\n # use the string \"unknown\" as the sampleID\n if @sampleName != nil && !@sampleName.empty?()\n sampleID = @sampleName.to_s\n elsif @fcName != nil && !@fcName.empty?()\n sampleID = @fcName.to_s\n if @laneNumber != nil && !@laneNumber.to_s.empty?()\n sampleID = sampleID + \"-\" + @laneNumber.to_s\n end\n else\n sampleID = \"unknown\"\n end\n \n rgString = \"'@RG\\\\tID:0\\\\tSM:\" + sampleID\n\n if @libraryName != nil && !@libraryName.empty?()\n rgString = rgString + \"\\\\tLB:\" + @libraryName.to_s\n end\n\n # If PU field was already obtained from config params, use that. Build up a\n # dummy PU field if it was not already available.\n if @rgPUField != nil && !@rgPUField.empty?()\n rgString = rgString + \"\\\\tPU:\" + @rgPUField.to_s\n else\n if @fcBarcode != nil && !@fcBarcode.empty?()\n rgString = rgString + \"\\\\tPU:\" + @fcBarcode.to_s\n end\n end\n\n rgString = rgString + \"\\\\tCN:BCM\\\\tDT:\" + currentTime.strftime(\"%Y-%m-%dT%H:%M:%S%z\")\n rgString = rgString + \"\\\\tPL:Illumina\"\n rgString = rgString + \"'\"\n puts \"RGString = \" + rgString.to_s\n return rgString.to_s\n end",
"def rot13(string) #puts (ascii % 90)+64+13 #T-G 84-71\n # binding.pry\n rot = \"\"\n string.length.times do |i|\n ascii = string[i].ord\n if ascii >= 65 && ascii <= 90 then\n if (ascii + 13) > 90\n rot.concat((((ascii+13) % 90)+64).chr)\n else\n rot.concat((ascii+13).chr)\n end\n elsif ascii >= 97 && ascii <= 122\n if (ascii + 13) > 122\n rot.concat((((ascii+13) % 122)+96).chr)\n else\n rot.concat((ascii+13).chr)\n end\n else\n rot << \" \"\n end\n end\n return rot\nend",
"def arv_reg_str\n arvs = [\n ['zidovudine' , 'ZDV'],\n [ 'stavudine' , 'd4T (stav)'],\n [ 'lamivudine' , '3TC'],\n [ 'didanosine' , 'ddI'],\n [ 'nevirapine' , 'NVP'],\n [ 'efavirenz' , 'EFV'],\n [ 'kaletra' , 'kaletra']\n ]\n s = ''\n arvs.each do | arv |\n being_used = self.send('reg_'+arv[0])\n s << ', ' + arv[1] if being_used # add abbreviation of each arv being used e.g. \"zdv, 3tc, nvp\"\n end\n return s[2,100] # trim off the first comma and space NB: Gives nil if s was ''\n end",
"def reverse_string(str)\nend",
"def pirates_say_arrrrrrrrr(string)\n answer = []\n array = string.split(\"\")\n array.each_with_index do |v,i|\n unless array[i+1].nil?\n \tif v == \"R\" || v == \"r\"\n \t\tanswer << array[i+1]\n \tend\n end\n end\n\n answer.join\nend",
"def pirates_say_arrrrrrrrr(string)\n resultArr = []\n\n string.split(\"\").each_index do |x|\n if (string[x].downcase === \"r\" && string[x+1] != nil)\n resultArr.push(string[x+1])\n end\n end\n\n return resultArr.join(\"\")\n\n\nend",
"def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend",
"def pirates_say_arrrrrrrrr(string)\n a = string.split(\"\")\n return_string = Array.new\n\n a.length.times { |x| return_string.push(a[x + 1]) if a[x] == \"r\" || a[x] == \"R\" }\n\n return_string.join(\"\")\nend",
"def validate_nucleuotides!(dna)\n invalid = dna.chars.uniq - VALID_NUCLEOTIDE\n raise ArgumentError unless invalid.empty?\n end",
"def rot13(string)\nend",
"def pirates_say_arrrrrrrrr(string)\n counter = 0\n result = ''\n while counter <= string.length\n if (string[counter] == \"r\" || string[counter] == \"R\") && counter < (string.length - 1)\n result += string[counter + 1]\n end\n counter += 1\n end\n result\nend",
"def string_gnirts(word)\n word.reverse\nend",
"def translate(s)\n vowels = 'aeiou'\n phoneme1 = ['ch', 'qu', 'br', 'th']\n phoneme2 = ['sch', 'thr', 'squ']\n\nstring = s.split.each do |i|\n if vowels.include?i[0]\n i << \"ay\"\n elsif\n phoneme2.include?(i[0..2])\n return i[3..-1] + i[0..2] + \"ay\"\n elsif\n phoneme1.include?(i[0..1])\n return i[2..-1] + i[0..1] + \"ay\"\n else\n new_ending = i.slice!(0)\n i << new_ending + \"ay\" \n end\n end\n string = string.join(\" \")\nend",
"def pirates_say_arrrrrrrrr(string)\n return \"\" if string == \"\"\n string.downcase!\n result = \"\"\n (0..string.length-2).each do |i|\n if string[i] == 'r'\n result += string[i + 1]\n end\n end\n result\nend",
"def pirates_say_arrrrrrrrr(string)\n\tletters = string.split(\"\")\n\n\tword = []\n\ti = 1\n\tletters.each do |element|\n\t\tif element == \"r\" || element == \"R\"\n\t\t\tword.push(letters[i])\t\n\t\tend\n\ti +=1\n\tend\n\treturn word.join(\"\")\nend",
"def rdn_to( dn )\n\t\tbase_re = Regexp.new( ',' + Regexp.quote(self.base_dn) + '$' )\n\t\treturn dn.to_s.sub( base_re, '' )\n\tend",
"def translate(line)\r\n if line[0,3] == \"A2P\"\r\n return to_phonetic(line[4,line.length])\r\n end\r\n if line[0,3] == \"P2A\"\r\n return from_phonetic(line[4,line.length])\r\n end\r\n \r\n return nil\r\n end",
"def special2csa(str)\n {\n '中断' => 'CHUDAN',\n '投了' => 'TORYO',\n '持将棋' => 'JISHOGI',\n '千日手' => 'SENNICHITE',\n '詰み' => 'TSUMI',\n '不詰' => 'FUZUMI',\n '切れ負け' => 'TIME_UP',\n '反則勝ち' => 'ILLEGAL_ACTION', # 直前の手が反則(先頭に+か-で反則した側の情報を含める必要が有る)\n '反則負け' => 'ILLEGAL_MOVE' # ここで手番側が反則,反則の内容はコメントで表現\n }[str] || (raise ParseError)\n end",
"def reverse_upcase_noLTA(string)\n nouveaustring = string.reverse.upcase.tr(\"LTA\", \"\")\n p nouveaustring\nend",
"def pirates_say_arrrrrrrrr(string)\n\toutput = Array.new\n\tstring.chars.each_with_index do |item, index|\n\t\tnext if item.downcase != \"r\"\n\t\toutput << string[index+1]\n\tend\n\treturn output.join\nend",
"def name_converter(first_name, last_name)\n #1. swap the order names\n swapped_names = fake_name(first_name, last_name)\n #2 break swappedNames into array\n character_array = swapped_names.split('')\n #3. iterate through array\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n consonant = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\",\"y\",\"z\"]\n\n result = ''\n character_array.each do |character|\n if vowel.include?(character)\n #move forward next vowel in vowel array\n if character == 'u'\n result += 'a'\n next\n end \n \n current_index = vowel.index (character)\n new_index = current_index + 1\n #3. go to vowel array with new_index and retrieve that letter\n # next_letter = 'i'\n # add next_letter to result\n result += vowel[new_index]\n\n #follow same steps for moving forward next vowel for consonant \n\n elsif consonant.include?(character)\n if character == \"z\"\n result += 'b'\n next\n end\n\n current_index = consonant.index (character)\n new_index = current_index + 1\n\n result += consonant [new_index]\n\n result += character \n # add new letter to result\n end\n end\n #4. if the character is a vowel do a vowel swap\n #5. elsif the character is a consonant do a consonant swap\n \n result\nend",
"def pirates_say_arrrrrrrrr(string)\n arr = string.downcase.split(\"\")\n r_array = []\n arr.each_with_index do |elem, index|\n if elem == \"r\"\n r_array << index + 1\n end\n end\n final = []\n r_array.each {|x| final << arr[x]}\n return final.join(\"\")\nend",
"def convertStringToCode(string, codeTable)\n code = \"\"\n string.split(\"\").each do |i|\n code += codeTable[i].to_s + \" \"\n end\n return code\nend",
"def pirates_say_arrrrrrrrr(string)\n #sort through letters in a string, return next letter\n array = string.split('')\n array.select.each_with_index do |item, index|\n if item == \"r\" \n array[index + 1].join\n else\n nil\n end\n end\nend",
"def translate(your_string)\n words = your_string.split(/\\s+/)\n vowels = %w{a e i o u}\n th_ch = %q{th ch sh sc qu }\n three_letter = %q{sch}\n translated_words=[]\n words.each do |word|\n letters = word.scan(/\\w/)\n word_length = letters.length\n \n if vowels.include?(letters[0])\n #word begins with a vowel\n word += \"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && !vowels.include?(letters[2])\n # word begins with three consonants\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && vowels.include?(letters[2])\n #word begins with two defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n elsif (letters[1]+letters[2]) == \"qu\"\n # word starts with a <consonant + \"qu\">\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif !vowels.include?(letters[0]) && !vowels.include?(letters[1])\n #word begins with two not_defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n else\n # only one consonant begins the word\n word = (letters[1..word_length-1]<<letters[0]).join.to_s+\"ay\"\n end\n translated_words << word\n end\n translated_words.join(\" \").to_s\nend",
"def pirates_say_arrrrrrrrr(string)\n new_string = \"\"\n\n (string.size-1).times do |index|\n current_character = string[index]\n next_character = string[index + 1]\n\n new_string << next_character if (current_character == \"r\" || current_character == \"R\")\n end\n new_string\nend",
"def encode(string)\n\ta = (\"a\"..\"z\").to_a\n\tb = a.rotate(13)\n\t@result = string.split(\"\")\n\n\t@result.map! do |l|\n\t\tindex = a.index(l)\n\n\t\tb[index]\n\tend\n\n\t@result.join\nend",
"def pirates_say_arrrrrrrrr(string)\n\tnewString = \"\"\n\tindex = 0\n\tadd_next = false\n\tstring = string.split(\"\").each do |letter|\n\t\tif letter == \"r\" || letter ==\"R\"\n\t\t\t#puts string[index], index\n\t\t\tif index + 1 < string.size\n\t\t\t#if index < string.size\n\t\t\t\tadd_next= index + 1\n\t\t\t\tnewString << string[add_next]\n\t\t\tend\n\t\t\n\t\tend\n\n\t\t\n\n\t\t\n\t\t\n\n\t\t\t#puts add_next\n\t\t\t#puts letter, index\n\t\t\n\t\t\t#string.index(letter)\n\t\t\n\n\n\t\t# if letter == \"r\" || letter == \"R\"\n\t\t# \tstring.index(letter)\n\t\t# \t#puts index\n\t\t\t\n\t\t\t\n\n\n\t\t\t\n\t\t\n\t\t#print string.index(letter),letter\n\n\t\t# if letter == \"r\" || \"R\"\n\t\t# \tputs string.index(letter)\n\n\t\t# #print letter, string.index(letter)\n\t\t# end\n\n\n\n\t\t#newString << current_char if add_next\n\t\t#\tadd_next = (current_char == \"r\" || current_char==\"R\")\n\t\t\n\t\t\n\t\t#puts letter\n\t\tindex += 1\n\tend\n\treturn newString\n\nend",
"def pirates_say_arrrrrrrrr(string)\n \n arr = string.downcase.split('') # turning into an array and making lowercase\n \n index_no = arr.each_index.select { |r| arr[r] == 'r' } # finding the index no of each r\n \n new_index_no = index_no.map {|n| n + 1} # adding 1 to each index no\n \n p new_index_no.map {|i| arr[i] }.join # mapping the index no to the original arr and chaning to a str\n \nend",
"def pirates_say_arrrrrrrrr(string)\n characters = \"\"\n add_letter = false\n string.length.times do |index|\n current = string[index]\n characters << current if add_letter\n add_letter = (current == 'r' || current == 'R')\n end\n characters\nend"
] | [
"0.77877134",
"0.75076234",
"0.7242171",
"0.72287625",
"0.6791206",
"0.6569357",
"0.63117486",
"0.6245453",
"0.61811334",
"0.6178439",
"0.6146539",
"0.6055493",
"0.57858807",
"0.5694598",
"0.56432116",
"0.5634003",
"0.5576411",
"0.5539162",
"0.53444237",
"0.53415924",
"0.53281105",
"0.5310712",
"0.5206901",
"0.51740897",
"0.51553226",
"0.50740385",
"0.5042332",
"0.5031544",
"0.50123054",
"0.49682474",
"0.49616158",
"0.49514106",
"0.49473023",
"0.49409983",
"0.49216107",
"0.49189818",
"0.49162588",
"0.49111298",
"0.48788017",
"0.48642358",
"0.48397562",
"0.48192805",
"0.48151064",
"0.48120213",
"0.47862718",
"0.47676966",
"0.47512114",
"0.47485396",
"0.4743344",
"0.4736121",
"0.47279885",
"0.4722695",
"0.47209933",
"0.47184736",
"0.47090018",
"0.46765316",
"0.4663299",
"0.46571425",
"0.46566242",
"0.46533102",
"0.4643366",
"0.46391585",
"0.46372026",
"0.46341467",
"0.46318033",
"0.4623305",
"0.46189114",
"0.46159637",
"0.46051425",
"0.45941865",
"0.4589527",
"0.45893806",
"0.45881647",
"0.45823413",
"0.45811412",
"0.45804977",
"0.45792112",
"0.4577463",
"0.45720866",
"0.4571725",
"0.45710975",
"0.45640874",
"0.4553877",
"0.45495537",
"0.4547883",
"0.45472726",
"0.4543262",
"0.45421463",
"0.45384932",
"0.45369834",
"0.45342746",
"0.45337296",
"0.45224276",
"0.45194376",
"0.4518257",
"0.45167434",
"0.45123884",
"0.4508666",
"0.4502887",
"0.4494858"
] | 0.7727879 | 1 |
Password not required when using omniauth | def password_required?
super && identities.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_required?\n super unless has_facebook_auth\n end",
"def password_required?\n if new_record? && oauth_account\n false\n else\n super\n end\n end",
"def password_required?; end",
"def password_required?; false; end",
"def password_required?\n return false if provider.to_s == 'google_oauth2'\n super\n end",
"def password_required?\n super && facebook_uid.blank? && twitter_uid.blank? && google_uid.blank?\n end",
"def password_required?\n provider.present? ? false : super\n end",
"def password_required?\n provider.blank? && super\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n super && provider.blank?\n end",
"def password_required?\n # Skip password validations if facebook connect user\n return false if facebook_connect_user?\n crypted_password.blank? || !password.blank?\n end",
"def password_required?\n self.provider.blank?\n end",
"def new_password; nil; end",
"def password_required?\n super && authorizations.length == 0 && !auth_temp_token\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n return false if using_open_id? || fb_user?\n crypted_password.blank? || !password.blank?\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required? \n false \n end",
"def password_required?\n (identities.empty? || !password.blank?) && super\n end",
"def set_password; nil; end",
"def valid_password?; end",
"def password_required?\n super && uid.blank?\n end",
"def password_required?\n super\n end",
"def password_required?\n super\n end",
"def encrypted_password\n nil\n end",
"def validate_password?\n provider == :password\n end",
"def password_required?\n return false if !persisted? and provider.present?\n super\n end",
"def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end",
"def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end",
"def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end",
"def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end",
"def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end",
"def password_required?\n is_user? && super && provider.blank? # provider.blank?\n end",
"def password_required?\n allow_blank_password ? false : super\n end",
"def password_required?\n allow_blank_password ? false : super\n end",
"def password_optional?\n false\n end",
"def password\n nil\n end",
"def apply_omniauth(auth)\n self.email = auth['extra']['raw_info']['email'] if auth['extra']['raw_info']['email']\n self.password = Devise.friendly_token[0,20]\n authentications.build(:provider=>auth['provider'], :uid=>auth['uid'], :token=>auth['credentials']['token'], :secret=>auth['credentials']['secret'])\n end",
"def password\n\n end",
"def password\n end",
"def password\n end",
"def password_required?\n (authentications.empty? || !password.blank?) && super\n end",
"def password_required?\n (authentications.empty? || !password.blank?) && super\n end",
"def password_required?\n (authentications.empty? || !password.blank?) && super\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password_required?\n provider.nil?\n #return false\n end",
"def password_blank?\n params[:profile][:password].blank?\n end",
"def password_required?\n !password.nil?\n end",
"def password_required?\n !password.nil?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def valid_password?(password); end",
"def no_password?\n encrypted_password.blank?\n end",
"def auth_options\n params.require(:email)\n params.require(:password)\n end",
"def password_non_blank\n errors.add_to_base(\"Missing Password\") if hashed_password.blank?\n end",
"def needs_password?(_user, params)\n params[:password].present?\n end",
"def password_required?\n\t\tsuper && provider.blank?\n\tend",
"def password_required?\n\t\tsuper && provider.blank?\n\tend",
"def password_required?\n confirmed? ? super : false\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def password_required?\n encrypted_password.blank? || !password.blank?\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def password_non_blank\n errors.add(:password, \"Missing password\") if hashed_pwd.blank?\n end",
"def standard_password\n \"!@Cd5678\"\n end",
"def get_password(password)\n password\n end",
"def check_if_password_and_email_provided!\n\n unless @user_credential_params[:email].blank? || @user_credential_params[:password]\n fail_immediately(:no_email_or_pwd_provided)\n end\n\n end",
"def has_no_password?\n self.password.blank?\n end",
"def password_blank?\n params[:ngo][:password].blank?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def has_no_password?\n #super\n self.encrypted_password.blank? || (self.uid && self.provider)\n end"
] | [
"0.7306579",
"0.70609087",
"0.69560224",
"0.69510645",
"0.69500375",
"0.69206387",
"0.6811992",
"0.68007916",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.6742667",
"0.67293924",
"0.6710736",
"0.66908914",
"0.6689485",
"0.6689341",
"0.6689341",
"0.6689341",
"0.6689341",
"0.6689341",
"0.66401345",
"0.66110396",
"0.66110396",
"0.6595814",
"0.6589288",
"0.6574205",
"0.6573869",
"0.65697056",
"0.65550596",
"0.65550596",
"0.65320593",
"0.65227205",
"0.65117246",
"0.6509196",
"0.6509196",
"0.6509196",
"0.6509196",
"0.6509196",
"0.65059197",
"0.6500349",
"0.6500349",
"0.64962375",
"0.6491875",
"0.6465934",
"0.64623904",
"0.6458613",
"0.6458613",
"0.64448273",
"0.64448273",
"0.64448273",
"0.64353395",
"0.64353395",
"0.64353395",
"0.64353395",
"0.64353395",
"0.64353395",
"0.6428467",
"0.6405738",
"0.64002746",
"0.64002746",
"0.63935393",
"0.63935393",
"0.63935393",
"0.63935393",
"0.63935393",
"0.63935393",
"0.63910764",
"0.6388212",
"0.63868904",
"0.6356471",
"0.6353624",
"0.6338346",
"0.6338346",
"0.63376945",
"0.6334551",
"0.6334109",
"0.6327167",
"0.6326703",
"0.63222265",
"0.6317425",
"0.63173026",
"0.63169754",
"0.6313033",
"0.63127905",
"0.63127905",
"0.63127905",
"0.63119245"
] | 0.63136417 | 95 |
PATCH /project_evaluations?id=2 only for lecturers | def update
if @pe.update(update_project_evaluation_params)
render json: @pe, status: :ok
else
render json: format_errors(@pe.errors), status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n redirect_to(root_url) && return unless current_user.can_edit_patient_laboratories?\n\n lab = Laboratory.find_by(id: params.permit(:id)[:id])\n lab.update!(lab_type: params.permit(:lab_type)[:lab_type],\n specimen_collection: params.permit(:specimen_collection)[:specimen_collection],\n report: params.permit(:report)[:report],\n result: params.permit(:result)[:result])\n History.lab_result_edit(patient: params.permit(:patient_id)[:patient_id],\n created_by: current_user.email,\n comment: \"User edited a lab result (ID: #{lab.id}).\")\n end",
"def update\n @evaluacion = Evaluacion.find(params[:id])\n\n respond_to do |format|\n if @evaluacion.update_attributes(params[:evaluacion])\n format.html { redirect_to @evaluacion, notice: 'Evaluacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluare = Evaluare.find(params[:id])\n\n respond_to do |format|\n if @evaluare.update_attributes(params[:evaluare])\n format.html { redirect_to @evaluare, notice: 'Evaluare was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluare.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluacione = Evaluacione.find(params[:id])\n\n respond_to do |format|\n if @evaluacione.update_attributes(params[:evaluacione])\n format.html { redirect_to(@evaluacione, :notice => 'Evaluacione was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evaluacione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n @observation = @evaluation.observation\n \n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n session.delete(:teacher_id)\n session.delete(:guarant_id)\n session.delete(:path)\n format.html { redirect_to evaluation_path(@evaluation), notice: 'Hodnocení bylo úspěšně upraveno.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\", :layout => \"evaluation_tabs\" }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to course_evaluations_url, notice: 'La evaluación fue modificada correctamente!' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n format.html { redirect_to @evaluation, notice: 'Avaliacao atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n if @researcher.update_attributes(params[:researcher])\n format.html { redirect_to @researcher, notice: 'Researcher was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @researcher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecturer.update(lecturer_params)\n format.html { redirect_to @lecturer, notice: \"Lecturer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @lecturer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @lecturer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end",
"def update\n @evaluation_criterium = EvaluationCriterium.find(params[:id])\n\n respond_to do |format|\n if @evaluation_criterium.update_attributes(params[:evaluation_criterium])\n format.html { redirect_to @evaluation_criterium, notice: 'Evaluation criterium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_criterium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lecture = Lecture.find(params[:id])\n \n respond_to do |format|\n if @lecture.update_attributes(params[:lecture])\n format.html { redirect_to @lecture, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @lecture.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lecture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n if @competency_pertenece_evaluation.update_attributes(params[:competency_pertenece_evaluation])\n format.html { redirect_to @competency_pertenece_evaluation, notice: 'Competency pertenece evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competency_pertenece_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @lecture.update(lecture_params)\n redirect_to lectures_path, notice: 'Lezione aggiornata correttamente.'\n else\n render :edit\n end\n end",
"def update\n @expertise = Expertise.find(params[:id])\n\n if @expertise.update(expertise_params)\n head :no_content\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @project_evaluation.update(project_evaluation_params)\n format.html { redirect_to @project_evaluation, notice: 'Project evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_evaluation }\n else\n format.html { render :edit }\n format.json { render json: @project_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n format.html { redirect_to(@evaluation, :notice => 'Evaluation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lecture = Lecture.find(params[:id])\n @course= Course.find(params[:course_id])\n \n respond_to do |format|\n if @lecture.update_attributes(params[:lecture])\n format.html { redirect_to [@course, @lecture], notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #raise params.inspect\n @evaluation_result = EvaluationResult.find(params[:id])\n\n if params[:commit].to_s == \"Gravar Rascunho\"\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Em Avaliacao\")\n app.appointment_status = s\n app.save\n else\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Realizada\")\n app.appointment_status = s\n app.save\n end\n\n respond_to do |format|\n if @evaluation_result.update_attributes(params[:evaluation_result])\n if params[:commit].to_s == \"Gravar Rascunho\"\n format.html { redirect_to appointments_path, notice: 'Resultados da avaliacao guardados com sucesso.' }\n else\n format.html { redirect_to \"http://localhost:8000/reporting?report=Avaliacao&Appointment_Id=#{params[:appoint_id].to_s}\", notice: 'Resultados da avaliacao guardados com sucesso.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n if @researcher.update_attributes(params[:researcher])\n format.html { redirect_to(researchers_url, :notice => 'Researcher was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @researcher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @evaluacione.update(evaluacione_params)\r\n format.html { redirect_to @evaluacione, notice: 'Evaluacione was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @evaluacione }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @evaluacione.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def update\n @score_evaluation = ScoreEvaluation.find(params[:id])\n params[:score_evaluation][:discipline_ids] ||= []\n \n respond_to do |format|\n if @score_evaluation.update_attributes(params[:score_evaluation])\n format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @score_evaluation.class.model_name.human) }\n format.json { head :no_content }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @lecture = Lecture.find(params[:id])\n\n respond_to do |format|\n if @lecture.update_attributes(params[:lecture])\n flash[:notice] = 'Lecture was successfully updated.'\n format.html { redirect_to(admin_lecture_path(@lecture)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lecture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def lecturer\n unless logged_user.lecturer? then\n render_403 and return\n end\n\n if request.get? then\n @lecturer = logged_user.lecturer\n elsif request.put? then\n lecturer = Lecturer.find(logged_user.lecturer.id)\n lecturer.department_id = params[:department]\n lecturer.scientific_degree_id = params[:degree]\n # Сброс уровная подтверждения преподавателя\n unless lecturer.real? then\n lecturer.confirm_level = Lecturer::CONFIRM_LEVELS[:unconfirmed]\n end\n if lecturer.save then\n if params[:reg] then\n redirect_to :root\n else\n redirect_to :settings_lecturer, alert: t('settings.save_suc')\n end\n else\n redirect_to :settings_lecturer, notice: t('settings.save_fail')\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n flash[:notice] = 'Evaluation was successfully updated.'\n format.html { redirect_to(@evaluation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @laborer = Laborer.find(params[:id])\n\n respond_to do |format|\n if @laborer.update_attributes(params[:laborer])\n format.html { redirect_to([@project, @laborer], :notice => 'Laborer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @laborer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @educator = Educator.find(params[:id])\n ong_desc = params[:ong_desc]\n union_movement_desc = params[:union_movement_desc]\n educator_years = params[:educator_years]\n educator_popular_education_years = params[:educator_popular_education_years]\n respond_to do |format|\n if @educator.update_attributes(params[:educator])\n if !@educator.social_participations.first.nil?\n @educator.social_participations.first.save_with_descs(ong_desc, union_movement_desc)\n end\n if !@educator.educators_education_exps.first.nil?\n @educator.educators_education_exps.first.update_with_years(educator_years, educator_popular_education_years)\n end\n flash[:success] = t('educator.updated')\n format.html { redirect_to(educators_path) }\n format.xml { head :ok }\n else\n if @educator.core_id.nil?\n @rooms = []\n else\n @rooms = Core.find(core_id).rooms\n end\n flash[:error] = t('default_error_message')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @educator.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n lparams = labor_params\n respond_to do |format|\n # set pledge and muster correctly\n if @labor.status == Labor::SUBMITTED && lparams[:status].to_i==Labor::APPROVED && current_user.is_admin_of?(@labor.project)\n\n #does this work match a previous pledge?\n @pledge = @user.first_unfulfilled_pledge_for(@project)\n lparams[:pledge_id] = @pledge.id if @pledge\n \n #does this work match a muster to which the user checked in?\n start_time = DateTime.parse(lparams[:start_time]) if lparams[:start_time]\n @muster = @labor.user.muster_for(@project, start_time ? start_time : @labor.start_time)\n lparams[:muster_id] = @muster.id if @muster\n end\n \n if @project.is_private? && current_user.is_admin_of?(@project)\n stars = params.permit(:rating)[:rating]\n available_stars = current_user.membership_for(@project.community).total_stars\n if stars.to_i * @labor.hours > available_stars\n render :new and return\n end\n end\n\n if @labor.update(lparams)\n rparam = params.permit(:rating)\n if rparam.has_key?(:rating) and current_user.is_admin_of?(@labor.project)\n stars = rparam[:rating]\n existing = current_user.ratings.where(labor_id:@labor.id)\n existing.last.update_column(:stars, stars) if existing.any? and existing.last.stars != stars.to_i\n Rating.create(stars:stars, labor:@labor, user_id:current_user.id) if existing.empty?\n end\n format.html { redirect_to [@community, @project], notice: 'Labor was successfully updated.' }\n format.json { render :show, status: :ok, location: @labor }\n else\n format.html { render :edit }\n format.json { render json: @labor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n redirect_to action: \"index\", notice: 'Evaluation was successfully updated.' \n else\n render :edit \n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n flash[:success] = 'Actualizado correctamente'\n redirect_to evaluations_url\n else\n flash[:danger] = 'Ocurrió un error'\n render :edit\n end\n end",
"def set_enrolls\r\n @lecture = Lecture.find(params[:lecture_id])\r\n end",
"def re_edit_qc_inspection_test\n id = params[:id]\n if id && @qc_inspection_test = QcInspectionTest.find(id)\n @qc_inspection_type_code = @qc_inspection_test.qc_inspection.qc_inspection_type.qc_inspection_type_code\n return if authorise_for_web(program_name(@qc_inspection_type_code),'edit')== false\n\n @qc_inspection_test.set_status QcInspectionTest::STATUS_CREATED\n edit_qc_inspection_test\n end\n end",
"def update\n respond_to do |format|\n if @teaching.update(teaching_params)\n #si repetition ou repet number change, detruire les scedules et les refaire\n if @teaching.update_schedules(teaching_params)\n format.html { redirect_to @teaching, notice: 'Teaching was successfully updated.' }\n format.json { render :show, status: :ok, location: @teaching }\n else\n format.html { render :edit }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :edit }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'La evaluación fue actualizada correctamente' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_evaluacione\r\n @evaluacione = Evaluacione.find(params[:id])\r\n end",
"def update\n @research = Research.find(params[:id])\n\n respond_to do |format|\n if @research.update_attributes(params[:research])\n format.html { redirect_to @research, notice: 'Research was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_evaluation\n @evaluation = @course.evaluations.find(params[:id])\n # @evaluation = Evaluation.find(params[:id])\n end",
"def update\n if ENV[\"NEW_EVALUATION\"] == nil\n raise ActionController::RoutingError\n return\n end\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lecture = Lecture.find(params[:id])\n\n respond_to do |format|\n if @lecture.update_attributes(params[:lecture])\n if request.referrer.split('/').last == \"preview\"\n format.html { redirect_to lecture_preview_path(@lecture), notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n end\n else\n if request.referrer.split('/').last == \"preview\"\n @from_preview = true\n format.html { render \"form_preview\", :layout => \"preview\" }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam.exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n authorize! :update, @exam\n end",
"def update\n respond_to do |format|\n if @practitioner.update(practitioner_params)\n format.html { redirect_to @practitioner, notice: 'Practitioner was successfully updated.' }\n format.json { render :show, status: :ok, location: @practitioner }\n else\n format.html { render :edit }\n format.json { render json: @practitioner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n if params[:patent][:research_areas]\n research_area = ResearchArea.find(params[:patent][:research_areas].to_i)\n @patent.research_areas << research_area\n @patent.save\n format.json { render json: research_area }\n elsif @patent.update_attributes(params[:patent])\n format.html { redirect_to @patent, notice: 'Patent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Avaliação atualizada.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @evaluation.update(evaluation_params)\n if params[:evaluation][:grades_attributes].present?\n @evaluation.set_grade=true\n @evaluation.save\n end\n format.html { redirect_to course_evaluation_path(@course,@evaluation), notice: 'La evaluación fue actualizada con éxito.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n if params[:evaluation][:grades_attributes].present?\n format.html { render :show }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: \"Evaluation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to result_url(@evaluation), notice: \"\" }\n format.json { redirect_to result_url(@evaluation) }\n #else\n # format.html { render :edit }\n # format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluo.update(evaluo_params)\n format.html { redirect_to @evaluo, notice: 'Evaluo was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluo }\n else\n format.html { render :edit }\n format.json { render json: @evaluo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @study_program_element\n @study_program = StudyProgram.find(params[:study_program_id])\n @requirement = Requirement.find(params[:requirement_id])\n if @study_program_element.update(study_program_element_params)\n redirect_to study_program_requirements_path(@study_program), notice: 'Element uspešno posodbljen.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n @practice = Practice.find(@evaluation.practice_id)\n if @practice.answer == @evaluation.your_answer\n @justice = Justice.create!(\n user_id: 1,\n evaluation_user_id: @evaluation.user_id,\n practice_id: @evaluation.practice_id,\n\t evaluation_id: @evaluation.id,\n\t score: @evaluation.practice_score, # 得到满分\n\t p_score: @evaluation.practice_score,\n remark: \"完全正确!\",\n )\n @evaluation.update(score: @evaluation.practice_score)\n end\n format.html { redirect_to @evaluation, notice: \"答案更新成功\" }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @selection_criterium.update(selection_criterium_params)\n format.html { redirect_to team_path(@selection_criterium.team_id), notice: 'Selection criteria updated and will be applied to future opportunities.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @selection_criterium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n render :show, status: :ok\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def update\n if (@user == @responsavel || admin_signed_in?)\n respond_to do |format|\n if @laboratorio.update(laboratorio_params)\n format.html { redirect_to @laboratorio, notice: 'Laboratorio was successfully updated.' }\n format.json { render :show, status: :ok, location: @laboratorio }\n else\n format.html { redirect_to laboratorios_url, notice: 'Sem permissão para editar laboratório.' }\n format.json { head :no_content }\n end\n end\n end\n end",
"def update\n @discipline = Discipline.find(params[:discipline_id])\n @lecturer = Lecturer.find(params[:id])\n if @lecturer.update_attributes(params[:lecturer])\n redirect_to discipline_lecturer_url(@discipline, @lecturer)\n else\n render :action => \"edit\"\n end\n end",
"def update\n authorize @labor_request\n respond_to do |format|\n if @labor_request.update(labor_request_params)\n format.html { redirect_to @labor_request, notice: \"Labor request for #{@labor_request.description} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @labor_request }\n else\n format.html do\n assign_selectable_departments_and_units(@labor_request)\n render :edit\n end\n format.json { render json: @labor_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rcrieval = Rcrieval.find(params[:id])\n\n respond_to do |format|\n if @rcrieval.update_attributes(params[:rcrieval])\n format.html { redirect_to @rcrieval, notice: 'Rcrieval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rcrieval.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n professor = Professor.find(params[:id])\n professor.update!(professor_params)\n\n render json: professor.to_json(include: :courses)\n end",
"def set_evaluacion\n @evaluacions = Evaluacion.find(params[:id])\n end",
"def set_evaluacion\n @evaluacion = Evaluacion.find(params[:id])\n end",
"def set_project_evaluation\n @project_evaluation = ProjectEvaluation.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_evaluation.update(course_evaluation_params)\n format.html { redirect_to @course_evaluation, notice: 'Course evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_evaluation }\n else\n format.html { render :edit }\n format.json { render json: @course_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_evaluation\n @inscription.evaluation_id = params[:evaluation_id]\n if @inscription.save\n flash[:success] = \"Actualizada Inscripción\"\n else\n flash[:danger] = \"#{@inscription.erros.full_messages.to_sentence}\"\n end\n redirect_back fallback_location: \"#{evaluations_path}?type=test\"\n end",
"def update\n \n if @labor.update(labor_params)\n redirect_to labors_path, notice: 'Labor was successfully updated.'\n else\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @labor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @instructor = Instructor.find(params[:id])\n render :action => :edit unless @instructor.update_attributes(params[:instructor])\n \n end",
"def update\n respond_to do |format|\n @skills = Skill.all\n if @engineer.update(engineer_params)\n skills = []\n params['skills'].each do |skill|\n if skill[1]['year'].to_i > 0 || skill[1]['level'].to_i > 0\n skills.push({\n :skill_id => skill[1]['id'].to_i,\n :engineer_id => @engineer.id,\n :years_of_experience => skill[1]['year'],\n :level => skill[1]['level'] \n })\n end\n end\n pp skills\n EngineerSkill.insert_engineer_skills(skills)\n format.html { redirect_to @engineer, notice: 'プロフィールが正常に更新されました' }\n else\n @errors = @engineer.errors\n format.html { render :edit, notice: @errors }\n end\n end\n end",
"def update\n @experiment = @project.experiments.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n flash[:notice] = 'Experiment was successfully updated.'\n format.html { redirect_to([@project,@experiment]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n params[:project][:problem_ids] ||= []\n params[:project][:target_ids] ||= []\n params[:project][:factor_ids] ||= []\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(projects_path, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_method = LabMethod.find(params[:id])\n\n respond_to do |format|\n if @lab_method.update_attributes(params[:lab_method])\n format.html { redirect_to @lab_method, notice: 'Lab method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation_builder.update(evaluation_builder_params)\n format.html { redirect_to @evaluation_builder, notice: 'Evaluation builder was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation_builder }\n else\n format.html { render :edit }\n format.json { render json: @evaluation_builder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @researcharea = Researcharea.find(params[:id])\n\n respond_to do |format|\n if @researcharea.update_attributes(params[:researcharea])\n format.html { redirect_to @researcharea, notice: 'Research area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @researcharea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluationstatus = Evaluationstatus.find(params[:id])\n\n respond_to do |format|\n if @evaluationstatus.update_attributes(params[:evaluationstatus])\n format.html { redirect_to @evaluationstatus, notice: 'Evaluation status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluationstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specification = Specification.find(params[:id])\n\n if (params[:commit].eql? \"Отправить\") and :random #@specification.studying? then\n # @specification.approve! if @specification.can_approve?\n end\n \n if (params[:commit].eql? \"Удалить\") and :random #@specification.studying? then\n # @specification.delete_studying! if @specification.can_delete_studying?\n end\n\n if :random #@specification.studying? then\n @specification.contractor = current_user\n end\n\n if :random #@specification.approving? then\n @specification.controller = current_user\n end\n\n respond_to do |format|\n if @specification.update_attributes(params[:specification])\n format.html { redirect_to(specifications_path, :notice => 'Specification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @specification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @admin_interview.update_attributes(params[:interview])\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista atualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(lab_params)\n format.html { redirect_to @lab, notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_lecture_rule\n @lecture_rule = LectureRule.find(params[:id])\n end",
"def update\n @lab = lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n if @recommender.update_attributes(params[:recommender])\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @review = Review.find(params[:id])\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.lecture, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review.lecture }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @alumni = Alumni.find(params[:id])\n\n respond_to do |format|\n # params[:grad_season] is Spring or Fall\n if @alumni.update_attributes(alumni_params.merge(\n grad_semester: Alumni.grad_semester(params[:grad_season], params[:grad_year])\n ))\n # TODO: Actually subscribe and unsubscribe via Google Apps\n #if !@alumni.mailing_list && params[:on_mailing_list].eql?('true')\n #elsif @alumni.mailing_list && params[:on_mailing_list].eql?('false')\n #end\n\n format.html { redirect_to(@alumni, notice: 'Alumni was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @alumni.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @research_appointment = ResearchAppointment.find(params[:id])\n\n respond_to do |format|\n if @research_appointment.update_attributes(params[:research_appointment])\n format.html { redirect_to @research_appointment, notice: 'Research appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research_appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n enforce_permissions!('manage_collection', params[:id])\n @object = retrieve_object!(params[:id])\n\n @institutes = Institute.all\n @inst = Institute.new\n\n @collection_institutes = Institute.where(name: @object.institute).to_a\n @depositing_institute = @object.depositing_institute.present? ? Institute.find_by(name: @object.depositing_institute) : nil\n\n supported_licences\n\n respond_to do |format|\n format.html\n end\n end",
"def update\n @evaluation.updated_by = current_user.id\n\n respond_to do |format|\n if @evaluation.update_attributes(evaluation_params)\n format.html {redirect_to customer_evaluation_path(current_customer, @evaluation), notice: I18n.t('evaluations.messages.successfully_updated')}\n format.json {head :no_content}\n else\n format.html {render action: \"edit\"}\n format.json {render json: @evaluation.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @tutor = Tutor.find(params[:id])\n params[:tutor].delete :user_id\n params[:tutor].delete :approved\n respond_to do |format|\n if @tutor.update_attributes(params[:tutor])\n format.html { redirect_to @tutor, notice: 'Tutor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @performance_evaluation.update(performance_evaluation_params)\n format.html { redirect_to @performance_evaluation, notice: 'Performance evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @performance_evaluation }\n else\n format.html { render :edit }\n format.json { render json: @performance_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n if @evaluable_competency.update_attributes(params[:evaluable_competency])\n format.html { redirect_to @evaluable_competency, :notice => t('successfully_updated', :model => t('EvaluableCompetency.gender', :count => 1)) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluable_competency.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6515963",
"0.6326488",
"0.62572396",
"0.6192949",
"0.6171399",
"0.61149895",
"0.60738885",
"0.60724336",
"0.6042404",
"0.6032275",
"0.60265213",
"0.6025714",
"0.60237044",
"0.59762067",
"0.5975909",
"0.59741354",
"0.59681755",
"0.59662396",
"0.59509355",
"0.5947667",
"0.5937849",
"0.5933815",
"0.5920613",
"0.591763",
"0.58932334",
"0.58932334",
"0.58868194",
"0.58816105",
"0.58813477",
"0.58771384",
"0.5866699",
"0.5847892",
"0.5846587",
"0.5841086",
"0.58247095",
"0.5824252",
"0.5820561",
"0.5811022",
"0.58036953",
"0.5783075",
"0.5774841",
"0.5773112",
"0.5773077",
"0.57705235",
"0.57621527",
"0.57509106",
"0.57509106",
"0.57509106",
"0.5749149",
"0.5736708",
"0.57357234",
"0.57256216",
"0.5721311",
"0.5721311",
"0.5721311",
"0.5717663",
"0.5716914",
"0.571578",
"0.57149667",
"0.57142156",
"0.57138443",
"0.5706425",
"0.56998205",
"0.56984305",
"0.5696957",
"0.56959796",
"0.56887627",
"0.5685145",
"0.56693065",
"0.56655824",
"0.56526774",
"0.5634064",
"0.56298345",
"0.56213456",
"0.5617371",
"0.56135553",
"0.56130093",
"0.5606685",
"0.5602972",
"0.5602747",
"0.56007856",
"0.55986077",
"0.55949134",
"0.5594494",
"0.55904025",
"0.5584377",
"0.55786675",
"0.5572808",
"0.55668694",
"0.5550568",
"0.5548657",
"0.5545574",
"0.55425966",
"0.5542263",
"0.55392647",
"0.5536325",
"0.5525586",
"0.5515242",
"0.5510954",
"0.5503494"
] | 0.5961496 | 18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.