query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Compute the number of words that a letter appears in Because this is an expensive operation, cache the results. The cache is invalidated when the list of Words changes
def letter_count(letter) @letter_counts ||= compute_counts @letter_counts[letter[0] - ?a] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end", "def letter_counts(word) =\n word.chars.each_with_object(Hash.new(0)) { |c, counts| counts[c] += 1 }", "def words_that_contain(letter)\n letter_count(letter)\n end", "def letter_counts(word)\n counter = Hash.new(0)\n word.chars.each do |x|\n counter[x] += 1\n end\n counter\nend", "def count_words\n Hash.new(0).tap do |word_counts|\n words.each { |word| word_counts[word] += 1 }\n @words_counted = true\n end\n end", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end", "def letter_counts(word)\n hash = Hash.new(0)\n word.chars {|letter| hash[letter] += 1}\n hash\nend", "def letter_counts(word)\n answer = Hash.new(0)\n word.each_char { |chr| answer[chr] += 1 }\n answer\nend", "def letter_counts(word)\n count = Hash.new(0)\n word.each_char { |char| count[char] += 1}\n count\nend", "def letter_counts(word)\nend", "def count_letters_in_word(word)\n letters = Hash.new(0)\n word.chars.each { |letter| letters[letter] += 1 }\n letters\nend", "def word_count\n weighted(:count, :word).to_i\n end", "def letter_counts(word)\n hash = Hash.new(0)\n word.each_char do |ch|\n hash[ch] += 1\n end\n hash\nend", "def letter_counts(word)\n letter_counts = Hash.new(0)\n\n word.split(\"\").each do |ele| \n letter_counts[ele] += 1\n end\n letter_counts\nend", "def word_count_by_letter(letter)\n\t\tputs \"#{@dictionary_analyzer.word_count_by_letter(letter, @dictionary)} words begin with the letter #{letter}\"\n\tend", "def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end", "def word_count\n @@word_count\n end", "def wordCount\n count = 0\n\n if (@word.to_s != '')\n count += 1\n end\n\n if @children.size\n @children.each do |key, val|\n count += val.wordCount\n end\n end\n\n count\n end", "def letter_counts(word)\n hashed = word.chars.map {|char| [char, word.count(char)]}.flatten\n return Hash[*hashed]\nend", "def word_count\n return words.size\n end", "def count_frecuency(word_list)\n\tcounts = Hash.new(0) #es un hash que estará inicializado en 0, si indexamos en un key que no existe este retornará 0\n\tword_list.each do |word|\n\t\tcounts[word] +=1 #counts[word] es un hash con la clave del item actual, sabiendo que en principio no hay ningun item cuando asigne counts[word] +=1, sumará 1+0 ya que en principio el hash esta inicializado en 0\n \tend\n\tcounts\t\nend", "def letter_counts(word)\n letters = word.split(\"\")\n letter_hash = Hash.new(0)\n letters.each {|char| letter_hash[char]+= 1}\n letter_hash\nend", "def letter_counts(word)\n hash = {}\n word.chars.uniq.each {|char| hash[char] = word.count(char)}\n hash\nend", "def word_count\n words = @input.downcase.scan(/\\b[\\w']+\\b/)\n\n words.each_with_object(Hash.new(0)) do |word, result|\n result[word] += 1\n end\n end", "def letter_counts(word)\n hsh = Hash.new(0)\n\n word.each_char { |ch| hsh[ch] += 1 }\n\n hsh\nend", "def word_count\n words.size\n end", "def word_count\n words.size\n end", "def count\n self.wordcounts.map(&:count).inject(0, :+)\n end", "def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend", "def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > count\n count = repeats\n most = word\n end\n \n end\n \n return most\n \nend", "def word_diff\n return -1 unless (@word.size % 2 == 0)\n # initialize a hash with 26 lowercase alphabet character and set count for 0\n word_hash = ('a'..'z').inject({}) {|h,c| h[c] = 0; h}\n # Increment count for first word\n len = @word.size / 2\n @word[0..len-1].split(\"\").each {|c| word_hash[c] += 1}\n # Decrement count for second word\n @word[len..len*2].split(\"\").each {|c| word_hash[c] -= 1}\n # Check how many count > 0\n count = 0\n word_hash.each {|k,v| count += 1 if v > 0}\n count\n end", "def categories_with_word_count(word)\n return 0 unless @word_list[word] && @word_list[word][:categories]\n @word_list[word][:categories].length \n end", "def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "def letter_counts(word)\n wordArray = word.split(\"\")\n hash = {}\n wordArray.each do |element|\n if hash[element] == nil\n hash[element] = 1\n else\n hash[element] += 1\n end\n end\n return hash\nend", "def good_word(wordlist)\n # letter frequency\n freqs = Hash.new { |h,k| h[k] = 0 }\n wordlist.each do |w|\n w.chars.each { |c| freqs[c] += 1 }\n end\n\n # score = number of unique chars X sum of letter frequencies\n wordlist.max_by do |w|\n chars = w.chars.to_a.uniq\n chars.length * chars.map{|c| freqs[c]}.inject{|sum,n| sum + n}\n end\nend", "def letterCount(word)\n obj = {}\n word.chars.map do |currentLetter|\n if (!!obj[currentLetter])\n obj[currentLetter] += 1\n else\n obj[currentLetter] = 1\n end\n end\n obj\n end", "def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend", "def count_words(words)\r\n word_hash = Hash.new(0)\r\n words.downcase.split.each do |word|\r\n word_hash[word] += 1\r\n end\r\n return word_hash\r\n\r\n\r\nend", "def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end", "def get_adjective_words_count\n @redis.llen(\"store:adjectives\").to_i\n end", "def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend", "def total_word_count\n @_total_word_count ||= words.values.reduce(:+)\n end", "def word_count\n result = {}\n words.each do |word|\n result[word] = words.count(word)\n end\n result # return result\n end", "def words_count\n get_at_words_count + \n get_ata_words_count + \n get_noun_words_count + \n get_adjective_words_count\n end", "def calculate_word_count\n 0x0C\n end", "def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend", "def count_letters(word)\r\n\r\n end", "def total_words\n words.size\n end", "def calculate_word_count\n 0x0A\n end", "def count\n @words.length\n end", "def word_count\n\t\tputs \"There are #{@dictionary_analyzer.word_count(@dictionary)} words in this dictionary.\"\n\tend", "def categories_with_word_count(word)\n return 0 unless @word_list[word] && @word_list[word][:categories]\n @word_list[word][:categories].length\n end", "def LetterCount(str)\n words = str.split(' ')\n num_repeats = nil\n best_word = nil\n \n idx = 0\n while idx < words.length\n word = words[idx]\n count = 0\n \n word_freq = Hash.new(0)\n word.split('').map {|x| word_freq[x] += 1 }\n if word_freq.select {|x,y| y > 1 }.empty?\n idx += 1\n next\n else\n count += word_freq.select {|x,y| y > 1 }.size\n end\n \n if num_repeats == nil || count > num_repeats\n num_repeats = count\n best_word = word\n end\n \n idx += 1\n end\n \n if num_repeats == nil\n return -1\n else\n return best_word\n end\nend", "def count_repeated_letters(word)\n # character: # of occurences\n occurences = Hash.new(0)\n count = 0\n\n word.each_char do |c|\n occurences[c] += 1\n if occurences[c] == 2\n count+=1\n end\n end\n count\nend", "def word_sizes(text)\n word_size = Hash.new(0)\n text.split.map do |word|\n word.delete \"^A-Za-z\"\n word_size[word.size] += 1\n end\n word_size\nend", "def word_sizes(input)\n hash = {}\n input .split.each do |word|\n num_of_letters = word.chars.count\n if hash.has_key?(num_of_letters)\n hash[num_of_letters] += 1\n else\n hash[num_of_letters] = 1\n end\n end\n hash\nend", "def count_letters_in_word(word)\n return word.length\n end", "def letter_count limit\n letters = Hash[0, 0, 1, 3, 2, 3, 6, 3, 10, 3, 4, 4, 5, 4, 9, 4, 3, 5, 7, 5, 8, 5, 40, 5, 50, 5, 60, 5, 11, 6, 12, 6, 20, 6, 30, 6, 80, 6, 90, 6, 15, 7, 16, 7, 70, 7, 13, 8, 14, 8, 18, 8, 19, 8, 17, 9]\n words = Hash[\"and\", 3, \"hundred\", 7, \"thousand\", 8]\n num = 1\n digits = []\n count = 0\n i = 0\n\n letters.each do |k, v|\n # puts \"#{k}, #{v}\"\n end\n\n # puts \"HASH: #{letters[13]}\"\n\n\n while num <= limit\n count_for_word = 0\n\n if num > 9\n digits = num.to_s.reverse.split(//)\n \n # puts \"DIGITS[0]: #{digits[0]}, #{i}\"\n \n if digits[1] == \"1\"\n count_for_word = letters[[digits[0], digits[1]].join.reverse.to_i]\n\n else\n count_for_word = letters[digits[0].to_i] +\n letters[digits[1].to_i * 10]\n end\n count_for_word += letters[digits.fetch(2, 0).to_i] +\n letters[digits.fetch(3, 0).to_i]\n\n if digits[2] != nil && digits[2] != \"0\"\n # if letters[[digits[0], digits[1]].join.reverse.to_i] != 0 \n if [digits[0], digits[1]].join.reverse != \"00\" \n puts count_for_word\n\n count_for_word += words[\"hundred\"] + words[\"and\"]\n else\n count_for_word += words[\"hundred\"]\n end\n end\n\n puts count_for_word\n\n if digits[3] != nil\n count_for_word += words[\"thousand\"]\n end\n\n else\n count_for_word = letters[num].to_i\n end\n\n count += count_for_word\n num += 1\n end\n\n count \nend", "def hash_word(word)\n word_count = Hash.new(0)\n word.each_char do |c|\n word_count[c] += 1\n end\n return word_count\nend", "def word_sizes(text)\n word_size = Hash.new(0)\n words = text.split\n words.each { |word| word_size[word.size] += 1 }\n word_size\nend", "def word_count\n result = { }\n words = @input.downcase.split(/[,\\s]/)\n words.each do |word|\n next if word.empty?\n word.gsub!(/\\W/, '') unless word.include?(\"'t\")\n\n if !result.key?(word)\n # puts \"new key: #{word}\"\n result[word] = 1\n else\n # puts \"Accumulating on #{word}: #{result[word]} + 1\n result[word] += 1\n end\n end\n result\n end", "def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend", "def number_of_unique_words\n @frequencies.keys.length\n end", "def word_sizes(str)\n word_count = Hash.new(0)\n\n str.split(' ').each do |word|\n word_count[word.size] += 1\n end\n\n word_count\n\nend", "def count_letters(word)\r\n letter_count = Hash.new(0)\r\n word.chars { |letter| letter_count[letter.to_sym] += 1 }\r\n # Note: a better way to do the following is:\r\n #letter_count.values.max\r\n # but the requrements say to use .each, so...\r\n max = 0\r\n letter_count.each do |key, value|\r\n if value > max\r\n max = value\r\n end\r\n end\r\n max\r\n end", "def letter_counts(word)\n counter = Hash.new(0)\n word.split('').each do |letter| #could also do each_char instead of split\n counter[letter] += 1\n end\n counter\nend", "def word_sizes(word_string)\n word_sizes = Hash.new(0)\n array = word_string.split.each { |string| string.slice!(/[^a-zA-Z]/) }\n array.each { |word| word_sizes[word.size] += 1 }\n word_sizes\nend", "def word_count\n @tried_solutions.length\n end", "def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend", "def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend", "def frequency_of_each_word(text)\n words = text.split(\" \")\n frequency = Hash.new(0)\n words.each { |word| frequency[word] += 1 }\n frequency\nend", "def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend", "def number_of_occurrences(word)\n @frequencies[word]\n end", "def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend", "def word_sizes(sentence)\n hash = Hash.new(0)\n words = sentence.split(\" \")\n words.map! { |word| word.gsub(/[^a-zA-Z]/, ' ')}\n words.map! { |word| word.delete(\" \")}\n words.each { |word| hash[word.length] += 1 }\n hash\nend", "def count_frequency(word_list)\n counts = Hash.new(0)\n for word in word_list\n counts[word] += 1\n end\n counts\nend", "def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend", "def word_worth(word)\n word.chars.sum { |char| char.ord - 'A'.ord + 1 }\nend", "def defect_count( dict_word, word )\n\n\tdict_letters = Hash.new \t# Characters in dictionary word\n\tword_letters = Hash.new \t# Characters in test word\n\n\t# Add the characters to hash, add the values if character is already present.\n\tdict_word.length.times do |i|\n\t\tif dict_letters[dict_word[i]].nil?\n\t\t\tdict_letters[dict_word[i]] = 1\n\t\telse\n\t\t\tdict_letters[dict_word[i]] += 1\n\t\tend\n\tend\n\n\t# Do the same thing for the other word\n\tword.length.times do |i|\n\t\tif word_letters[word[i]].nil?\n\t\t\tword_letters[word[i]] = 1\n\t\telse\n\t\t\tword_letters[word[i]] += 1\n\t\tend\n\tend\n\n\tdefects = 0 # Defect count to return\n\t\n\t# Compare the two words unique characters, for each non-matching character, add number of \n\t# characters present as defects\n\tif dict_letters.size > word_letters.size\n\t\tdict_letters.each do |key, val|\n\t\t\tdefects += val if word_letters[key].nil?\t\t\n\t\tend\n\telse\n\t\tword_letters.each do |key, val|\n\t\t\tdefects += val if dict_letters[key].nil?\t\t\n\t\tend\n\tend\n\n\t# For the matching unique characters, add the difference in quantity as defects\n\tdict_letters.each do |kd, vd|\n\t\tword_letters.each do |kw, vw|\n\n\t\t\tdefects += (vd - vw).abs if kd.eql? kw\n\t\tend\n\tend\n\n\t# Get the smallest word length\n\tbound = (dict_word.length < word.length)? dict_word.length : word.length\n\n\t# To reward words which have very similar sequences of characters, we add defects for\n\t# each character that does not match sequentially with other word.\n\tbound.times do |i|\n\n\t\t# add defect for each unmatching character\n\t\tdefects += 1 unless dict_word[i].eql? word[i]\n\tend\n\n\t# return score\n\treturn defects\nend", "def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend", "def word_sizes(words)\n word_count = Hash.new(0)\n words = words.delete \"^a-zA-Z \"\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend", "def num_words\n @words.length\n end", "def word_hash(sentence)\n letters = Hash.new(0)\n sentence.split.each { |word| letters[word.length] += 1 }\n letters\nend", "def word_sizes(words_string)\n\n # We create a new hash, but we have to initialize is this way vs hash = {}\n # Because the first time we go to count[word.size] += 1, the element doesn't\n # exist yet, and returns nil. Since nil can't be added to 1, we have to do it this way\n counts = Hash.new(0)\n\n # Next we're going to split the string into words, then iterate over each word.\n # We assign a new variable clean_word equal to the word that we're iterating on\n # and delete anything that's not a letter using a simple REGEX.\n\n # We will then be counting the length of each word (based on the new variable clean_word)\n # that we're iterating, and storing that in our hash, counts.\n\n words_string.split.each do |word|\n clean_word = word.delete('^A-Za-z')\n counts[clean_word.size] += 1\n end\n # Return our hash\n counts\nend", "def count_frequency(word_list)\n\tcounts = Hash.new(0)\n\tfor word in word_list\n\t\tcounts[word] += 1\n\tend\n\tcounts\nend", "def numWords\n @words\n end", "def count_words(string) \n words_hash = Hash.new(0)\n string.downcase.gsub(/\\b/, '').split().each do |i| \n words_hash[i] += 1 \n end\n words_hash \nend", "def num_unique_words\n @frequencies.keys.length\n end", "def total_word_count(word)\n return 0.0 unless @word_list[word] && @word_list[word][:_total_word]\n @word_list[word][:_total_word].to_f\n end", "def total_word_count(word)\n return 0.0 unless @word_list[word] && @word_list[word][:_total_word]\n @word_list[word][:_total_word].to_f\n end", "def word_counts(text)\n\tword_list = text.split(WORD_SPLIT)\n\tcounts = Hash.new(0)\n\tword_list.each { |word| counts[word] += 1 }\n\treturn counts\nend", "def word_sizes(words)\n length_arr = []\n hash_words = {}\n words.gsub(/[^[:word:]\\s]/, '').split(' ').each do |word| \n length_arr << word.length\n end\n length_arr.uniq.each do |element|\n hash_words[element] = length_arr.count(element)\n end\n hash_words\nend", "def word_counter(word, dictionnary)\n\t\thash = {nil} # Resultat initialized nil \n\t\t#check the table dictionnary\n\t\tdictionnary.map{|i|\n\t\t\t# test if word include in the dictionnary\n\t\t\tif word.downcase.include?(i) == true\n\t\t\t\thash[i] = word.downcase.scan(i).count \n\t\t\tend\n\t\t}\n\treturn hash\n\t\n\tend", "def word_instances(text)\n instances = Hash.new(0)\n normalized_words = normalize(text)\n unique(text).each do |word|\n instances[word] = normalized_words.count(word)\n end\n instances\nend", "def word_sizes(string)\n word_count = Hash.new(0)\n\n string.split.each do |element|\n word_count[element.size] += 1\n end\n word_count\nend", "def word_sizes(words_string)\n counts = Hash.new(0)\n words_string.split.each do |word|\n clean_word = word.delete('^A-Za-z')\n counts[clean_word.size] += 1\n end\n counts\nend", "def word_count(string)\n words = string.split(\" \")\n count = Hash.new(0)\n words.each { |word| count[word] += 1}\n count\nend", "def word_sizes(str)\n words = str.split(' ')\n counts = Hash.new(0)\n words.each do |word|\n clean_word = word.delete(/[^a-z]/i)\n counts[clean_word.size] += 1\n end\n counts\nend", "def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend", "def score\n word_score = 0\n self.word.each_char do |letter|\n word_score += @letter_scores[letter.to_sym]\n end\n return word_score\n end" ]
[ "0.7564061", "0.73660606", "0.72831446", "0.72173786", "0.7146906", "0.7132058", "0.7124142", "0.7103139", "0.7078919", "0.70704675", "0.7043042", "0.70237833", "0.70049113", "0.7003284", "0.6988094", "0.69697964", "0.6966417", "0.6939389", "0.6929861", "0.69005555", "0.690048", "0.6887444", "0.6884861", "0.68639123", "0.6856861", "0.68285465", "0.6827145", "0.6827145", "0.6814531", "0.68097705", "0.678374", "0.6782452", "0.6781198", "0.6774902", "0.6759497", "0.6756619", "0.67533416", "0.6738619", "0.6724614", "0.67245644", "0.6719012", "0.67181647", "0.6709713", "0.67040676", "0.67040205", "0.6698981", "0.6696285", "0.6686258", "0.6683319", "0.6681477", "0.6672859", "0.6664846", "0.66633934", "0.6662571", "0.6655202", "0.66384304", "0.6631001", "0.6620933", "0.6610404", "0.6579188", "0.6571622", "0.6567523", "0.6562592", "0.65589947", "0.65540063", "0.6550589", "0.6545082", "0.65326786", "0.65321815", "0.653037", "0.65276253", "0.6526631", "0.6525183", "0.6521046", "0.65006006", "0.6499389", "0.6495507", "0.64919674", "0.6486174", "0.64850664", "0.6479049", "0.6470314", "0.6469595", "0.6466963", "0.6459458", "0.6446671", "0.6442001", "0.6441259", "0.6440386", "0.6437817", "0.6437817", "0.6429957", "0.64272285", "0.6424348", "0.6419337", "0.640806", "0.64035165", "0.63988954", "0.63979095", "0.63972497", "0.63965607" ]
0.0
-1
Create a HangMan Solver puzzle should be a string of '' as long as the word to guess dictionary is a Dictionary. The solver can find words that are not in the dictionary strategy is an optional parameter to determine the letter choosing strategy a Strategy object should implement one method score_for(letter,dictionary) => numeric score the lowest scoring letter is chosen
def initialize(puzzle,dictionary,strategy=MostFrequentStrategy.new) @solution = puzzle.dup @dictionary = dictionary.with_only_words_of_size(puzzle.length) @possible_letters = ('a'..'z').to_a @strategy = strategy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n # string\n answer = params[:answer]\n # also string now\n letters = params[:letters].gsub(/\\s+/, '')\n\n if check_letters(answer, letters)\n if check_dictionary(answer)\n @answer = 'Well done! Here is your score: XXXX'\n else @answer = 'This is not even an English word, loser!'\n end\n else\n @answer = 'Sorry, your word is not contained in the letters grid'\n end\n end", "def score\n url = \"https://wagon-dictionary.herokuapp.com/#{params['word']}\"\n @letters = params['letters'].split\n user_serialized = open(url).read\n user = JSON.parse(user_serialized)\n if user['found'] == true\n @answers = 'Well done!'\n elsif included?(params['word'], @letters)\n @answers = 'Valid word but try to speak a better English!'\n else\n @answers = 'You can do better'\n end\n end", "def score_word (word)\n score = 0\n word = word.downcase\n word = word.split('')\n\n # award additional points per game rules\n if word.length >= 7 && word.length <= 10\n score =+ 8\n end\n\n # iterates over the input to assign score based on alphabet library\n letters = [\n { character: \"a\", quantity: 9, score: 1 },\n { character: \"b\", quantity: 2, score: 3 },\n { character: \"c\", quantity: 2, score: 3 },\n { character: \"d\", quantity: 4, score: 2 },\n { character: \"e\", quantity: 12, score: 1 },\n { character: \"f\", quantity: 2, score: 4 },\n { character: \"g\", quantity: 3, score: 2 },\n { character: \"h\", quantity: 2, score: 4 },\n { character: \"i\", quantity: 9, score: 1 },\n { character: \"j\", quantity: 1, score: 8 },\n { character: \"k\", quantity: 1, score: 5 },\n { character: \"l\", quantity: 4, score: 1 },\n { character: \"m\", quantity: 2, score: 3 },\n { character: \"n\", quantity: 6, score: 1 },\n { character: \"o\", quantity: 8, score: 1 },\n { character: \"p\", quantity: 2, score: 3 },\n { character: \"q\", quantity: 1, score: 10 },\n { character: \"r\", quantity: 6, score: 1 },\n { character: \"s\", quantity: 4, score: 1 },\n { character: \"t\", quantity: 6, score: 1 },\n { character: \"u\", quantity: 4, score: 1 },\n { character: \"v\", quantity: 2, score: 4 },\n { character: \"w\", quantity: 2, score: 4 },\n { character: \"x\", quantity: 1, score: 8 },\n { character: \"y\", quantity: 2, score: 4 },\n { character: \"z\", quantity: 1, score: 10 },\n ]\n word.each do |character|\n letters.each do |letter_ref|\n if character == letter_ref[:character]\n score = score + letter_ref[:score]\n end\n end\n end\n return score\nend", "def score\n @attempt = params[:word]\n @letters_list = params[:letters]\n @not_in_grid = \"Sorry but #{@attempt} can't be built out of #{@letters_list}\"\n @not_english = \"Sorry but #{@attempt} does not seem to be a valid English word...\"\n @success = \"Congratulation! #{@attempt} is a valid English word!\"\n @result = nil\n\n @word_check = english_word(@attempt)\n\n if grid_include?(@attempt, @letters_list) && @word_check[:found]\n @result = @success\n elsif grid_include?(@attempt, @letters_list) == false\n @result = @not_in_grid\n elsif @word_check[:found] == false\n @result = @not_english\n end\n end", "def initialize(word)\n # This is just some a printout of the game at initialization\n puts \"\n POORMAN's\n ___ ___ ____ ____ __ ____ ___ ___ _____ ____ __\n / / / / / _ | | \\\\ | | / ___\\\\ | \\\\ / | | _ \\\\ \\\\ \\\\_ \\\\ \\ \n / /__/ / / /_| | | |\\\\ \\\\| | | | ___ | |\\\\ \\\\ / /| | | |_\\\\ \\\\ \\\\ \\\\ \\\\ \\\\\n / ___ / / ___ | | | \\\\ | | |__| | | | \\\\ \\\\/ / | | | ___ \\\\ \\\\ \\\\\\\\ \\\\_\\\\ \\\\ \n /__/ /__/ /__/ |_| |_| \\\\__| \\\\____/ |_| \\\\__/ |_| |_| \\\\__\\\\ |_| \\_____|\n \n \"\n\n # instance variables for HangMan Class\n @word = word\n\n ## LOGIC: This is to set the number of guesses based on the length of the word\n if @word.length >= 12\n @guess_count = 9\n elsif @word.length >= 10 && @word.length < 12\n @guess_count = 8\n elsif @word.length >= 8 && @word.length < 10\n @guess_count = 7\n elsif @word.length >= 6 && @word.length < 8\n @guess_count = 6\n else\n @guess_count = 5\n end\n ## End of Logic\n\n @is_correct = false # Flag to see if the guess is correct\n # Nifty code to set a prompt variable with a bunch if underscores\n # Note the length of the underscores matches the length of the word\n @prompt = String.new(str=\"_\") * word.length\n @guess_history = Array.new # A guess history array to store guesses\n end", "def score\n # set new variable @input_word to eq. the value of 'word:' in the params HASH > input given by users\n @input_word = params[:word]\n # @letters_grid returns the original grid of letters\n @letters_grid = params[:letters]\n # check if @input_word contains the same letters from the @letters_grid\n if !valid_word?(@input_word, @letters_grid)\n @result = \"Sorry, but #{@input_word} cannot be built from #{@letters_grid}\"\n # check is the word input is valid from the directory API\n elsif english_word?(@input_word)\n @result = \"Congrats, #{@input_word} is a valid English word!\"\n else\n @result = \"Sorry, but #{@input_word} is not a valid English word.\"\n end\n end", "def get_valid_moves(dictionary)\n #iterates through each letter of the alphabet and checks to see how many moves can be made after adding that letter\n #if the letter would make a word then we skip that letter\n #returns a hash where keys are the letters that don't make a word and values are how many possible moves can be made after using that letter\n #also removes any letters that don't have any possible moves after (those would be invalid moves)\n valid_moves = {}\n \n if @current_fragment == '' #if ROB is the first player return a hash with all letters with value 1\n ALPHABET.each do |letter|\n valid_moves[letter] = 1\n end\n return valid_moves\n end\n \n \n ALPHABET.each do |letter|\n valid_moves[letter] = 0\n end\n \n ALPHABET.each do |guess| \n test_string = @current_fragment+guess\n if !dictionary.include?(test_string)\n valid_moves[guess] = dictionary.count {|word| word[0...test_string.length].include?(test_string)}\n end\n end\n\n if valid_moves.values.uniq.length > 1\n return valid_moves.keep_if {|letter,count| count > 0}\n else\n valid_moves\n end\n end", "def guess(letters)\n raise ArgumentError if letters == \"\"\n raise ArgumentError if letters !~ %r{\\w}\n letters.downcase!\n if @word.include?(letters) \n !@guesses.include?(letters) ? @guesses << letters : false\n\n else\n @wrong_guesses.include?(letters) ? false : wrong_guesses << letters \n end\n end", "def scrabble(word)\n\npoints = {\n \t\"a\" => 1,\n \t\"e\" => 1,\n \t\"i\" => 1,\n \t\"o\" => 1,\n \t\"u\" => 1,\n \t\"l\" => 1,\n \t\"n\" => 1,\n \t\"r\" => 1,\n \t\"s\" => 1,\n \t\"t\" => 1,\n \t\"d\" => 2,\n \t\"g\" => 2,\n \t\"b\" => 3,\n \t\"c\" => 3,\n \t\"m\" => 3,\n \t\"p\" => 3,\n \t\"f\" => 4,\n \t\"h\" => 4,\n \t\"v\" => 4,\n \t\"w\" => 4,\n \t\"y\" => 4,\n \t\"k\" => 5,\n \t\"j\" => 8,\n \t\"x\" => 8,\n \t\"q\" => 10,\n \t\"z\" => 10,\n }\n puts word\n\n #create a varialbe to store a Score\n score =0\n #go to letter by letter througth word\n word.each_char do |letter|\n #check in proint for a key that matches letter from word\n #take it's value add it to word\n score += points[letter] #try with puts = points[letter] !access to points\n #output message with the full score result\n\nend\n puts \"#{word} is worth #{score} points\" # TRY TO PUT THIS BEFORE END!!\nend", "def guess(letter)\n \n raise ArgumentError if letter.nil? ## Raise an error if the letter is null.\n raise ArgumentError if letter == '' ## Raise an error if the user entered an empty string. \n raise ArgumentError if !letter.match(/[a-zA-Z]/) ## Raise an error is the user entered a letter that is not in the alphabet.\n\n \n letter.downcase!\n \n # If word includes letter\n if(word.include? letter)\n # And the letter isnt already in guess\n unless (guesses.include? letter)\n # Add guessed word to guesses\n guesses.concat(letter)\n \n # For test case 14\n for i in 0..word.length do\n # If the guessedLetter is in the string, replace it with the guessed letter\n if(letter == word[i])\n word_with_guesses[i] = letter\n end\n \n end\n \n # If guessed letters match word set to win\n if(word_with_guesses == word)\n @check_win_or_lose = :win\n end\n \n return true # return true valid guess\n end #end unless\n return false # invalid guess false\n else\n unless (wrong_guesses.include? letter)\n # Add the guessed letter to the list of incorrected guesses\n wrong_guesses.concat(letter)\n \n # Wrong guesses greater than 7 set win or loose to loose\n if(@wrong_guesses.length>=7)\n @check_win_or_lose = :lose\n end\n \n return true\n end # end unless\n return false # invalid guess\n end # end for \n end", "def scrabble(word)\n\tpoints = {\n\t\t1 => [A,E,I,O,U,L,N,R,S,T],\n\t\t2 => [D,G],\n\t\t3 => [B,C,M,P],\n\t\t4 => [F,H,V,W,Y],\n\t\t5 => [K],\n\t\t8 => [J, X],\n\t\t10 => [Q, Z]\n\t}\n \n def self.score(word)\n \ttotal_score = 0\n \tword.each_char do |char|\n \t\tSCORES.each do |score, letters|\n \t\t\tif letters.include? char.upcase\n \t\t\t\ttotal_score += score\n \t\t\tend\n \t\tend\n \tend\t\n\nend", "def good_guess(pattern)\n merge(pattern)\n @dictionary.keep_only_words_that_match(@solution)\n @possible_letters.delete(letter_in(pattern))\n end", "def initialize(word)\n\t\t@word = word\n\t\t@guesses = word.length\n\t\t# Initialize a instance variable with empty hash.\n\t\t@guessed_words = {}\n\t\t# Initialize the game_end to boolean false \n\t\t@game_end = false\n\t\t# Index is used to replace the dashes with the correct guess.\n\t\t@index = 0\n\t\t# Initialize the hidden word with dashes instead of alphabets.\n\t\t@hidden_word = word.tr(word,\"-\")\n\tend", "def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end", "def guess(letter)\n # STEP 1: check to make sure the letter is not any non-letter character and\n # raises an error if it is\n if /^[a-zA-Z]+$/.match(letter)\n letter.downcase!\n else raise_error(\"Invalid letter\")\n end\n\n # STEP 2: check to make sure the user does not guess the same letter more\n # than once\n if @guesses.include? letter; return false; end\n if @wrong_guesses.include? letter; return false; end\n\n # STEP 3: check to see if the guessed letter matches any letters in the \n # word\n if @word.include? letter\n @guesses += letter\n # if there is a match, update the word_with_guesses to show where\n # in the string the letter was matched\n @word.each_char.with_index do |c, i|\n if c == letter\n @word_with_guesses[i] = c\n end\n end \n else \n @wrong_guesses += letter\n @attempts += 1\n end\n # update the number of attempts and call the function to check if\n # the user won, lost, or continues playing\n check_win_or_lose\n end", "def initialize word \n @word = word\n @guesses = ''\n @wrong_guesses = ''\n end", "def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"For\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend", "def score_word(word) \n points = {\n [\"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"] => 1,\n [\"D\", \"G\"] => 2,\n [\"B\", \"C\", \"M\", \"P\"] => 3,\n [\"F\", \"H\", \"V\", \"W\", \"Y\"] => 4,\n [\"K\"] => 5,\n [\"J\", \"X\"] => 8,\n [\"Q\", \"Z\"] => 10\n }\n\n score = 0 \n score += 8 if (word.length > 6) && (word.length < 11) \n\n tile_split = word.upcase.split(\"\")\n\n tile_split.each do |letter| \n points.each do |score_chart, point|\n score += point if score_chart.include?(letter) \n end \n end \n return score\nend", "def initialize(word)\n @word = word\n @guesses = ''\n @wrong_guesses = ''\n end", "def initialize(word)\n @word = word\n @guesses = ''\n @wrong_guesses = ''\n end", "def initialize(word)\n @word = word\n @guesses = ''\n @wrong_guesses = ''\n end", "def initialize(word)\n @word = word\n @guesses = ''\n @wrong_guesses = ''\n end", "def input_evaluation(guess, correct_word)\n if correct_word.word.include?(guess)\n # We learned that .each_with_index can be used to locate each letter corresponding with each spacific index\n # Then if the letter matches it will subsitue the \"_\", at the correct index, with the corresponding letter\n correct_word.word.each_with_index do |letter, index|\n if letter == guess\n correct_word.progress[index] = guess\n end\n end\n else\n # Storing wrong letters into an array and updating max_guesses\n correct_word.wrong_guesses << guess\n correct_word.max_guesses -= 3\n end\nend", "def check_guess(guess)\n bulls = 0\n cows = 0\n guess.upcase.split('').each_with_index do |letter, idx|\n if @dictionary.keys.include?(letter)\n if letter == @dictionary.keys[idx]\n bulls += 1\n else\n cows += 1\n end\n end\n end\n @guess_count += 1\n { guess: guess, cows: cows, bulls: bulls, score: (bulls * 5 + cows) }\n end", "def initialize(word)\n @word = word\n @guesses = ''\n @wrong_guesses = ''\n self\n end", "def guess(letter)\r\n\t\t\r\n\t\tif(@word.include?(letter))\r\n\t\t @good_guesses.add(letter)\r\n\t end\r\n\t\r\n\tend", "def solve\n\t\t# Attempt to find a mismatch in start/end\n\t\t# letters in the maps. This signifies first\n\t\t# and last words of the solution\n\t\tdiff_list = []\n\t\t@start_map.each {|k,v|\n\t\t\tr = @end_map[k]\n\t\t\tdiff = r-v\n\t\t\tputs \"#{k} => #{v} | #{r} diff #{diff}\"\n\t\t\t\n\t\t\t# If values in map don't match, remember this\n\t\t\tif diff != 0\n\t\t\t\tdiff_list << diff\n\t\t\tend\n\t\t}\n\n\t\t# Ensure the matchings satisfy the properties of\n\t\t# and solvable puzzle. If there are \n\t\tputs diff_list\n\t\tif diff_list.size == 0\n\t\t\t# This means there are cycles (multiple\n\t\t\t# choices for the first word).\n\t\telsif diff_list.size == 2\n\t\t\t# Ensure there is exactly one starting\n\t\t\t# word and exactly one ending word\n\t\t\treturn [] if !diff_list.include?( 1 )\n\t\t\treturn [] if !diff_list.include?( -1 )\n\t\telse\n\t\t\t# This signifies an unsolvable puzzle\n\t\t\tputs \"Not Solvable\"\n\t\t\treturn []\n\t\tend\n\n\t\t# The characteristics of this word list look\n\t\t# good so far. Let's now try to enumerate the\n\t\t# solution array\n\t\treturn enumerate_solution\n end", "def guess(letter)\r\n if word_has?(letter)\r\n \tput_letter_on_board(letter)\r\n else\r\n wrong_letter(letter) if !@guesses.include? letter\r\n end\r\n end", "def initialize()\n @word = ''\n @guesses = ''\n @wrong_guesses = ''\n end", "def initialize(word)\n @word = word\n @guesses = \"\"\n @wrong_guesses = \"\"\n end", "def initialize(word)\n @word = word\n @guesses = \"\"\n @wrong_guesses = \"\"\n end", "def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend", "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 make_guess(guess)\n @guesses_made << guess\n @guesses_made.sort!\n guess_list = Hash.new\t\t\n\n @active_list.each do |word|\n format = @pattern.dup\n @word_size.times{ |index| format[index] = guess if word[index] == guess }\n\n guess_list[format] = String.new if guess_list[format] == nil\n guess_list[format] << word\n guess_list[format] << ','\n end\n\n guess_list = guess_list.sort\n\n biggest = String.new\n second_biggest = String.new\n biggest_size = -1\n second_biggest_size = -1\n hold_list = Hash.new\n guess_list.each do |key, value|\n hold_list[key] = value.split(',')\t\n if biggest_size < hold_list.fetch(key).size\n biggest = key\n biggest_size = hold_list.fetch(key).size\n elsif biggest_size == hold_list.fetch(key).size\n first_reveal = 0\n second_reveal = 0\n @word_size.times do |index|\n first_reveal += 1 if biggest[index] == guess\t\t\t\t\t\n second_reveal += 1 if key[index] == guess\n end\n biggest = key if first_reveal > second_reveal\n end\n\n\n if second_biggest_size < hold_list.fetch(key).size && key != biggest \n second_biggest = key\n second_biggest_size = hold_list.fetch(key).size\n elsif biggest_size == hold_list.fetch(key).size && key != biggest\n first_reveal = 0\n second_reveal = 0\n @word_size.times do |index|\n first_reveal += 1 if second_biggest[index]== guess\t\t\t\t\t\n second_reveal += 1 if key[index] == guess\n end\n second_biggest = key if first_reveal > second_reveal\t\n end\n end\n\n output = Hash.new\n hold_list.each{ |key, value| output[key] = value.size }\n\n\n biggest = second_biggest if @diff_timer == 0 && second_biggest != String.new\n\t\t\t\n @active_list = hold_list.fetch(biggest)\n\n biggest == @pattern ? @guesses_left -= 1 : @pattern = biggest\n \n\n @diff_timer = @timer_max if @diff_timer == 0\n\t\t\t\n @diff_timer -= 1\n\t\t\n output\n end", "def initialize(input, output)\r\n\t\t\t\t\t@input = input\r\n\t\t\t\t\t@output = output\r\n\t\t\t\t\t@played = 0\r\n\t\t\t\t\t@score = 0\r\n\t\t\t\t\t@wordtable = []\r\n\t\t\t\t\t@wheel = [\"500\",\"900\",\"700\",\"300\",\"800\",\"550\",\"400\",\"500\",\"600\",\"350\",\"500\",\"900\",\"Bankrupt\",\"650\",\"Free spin\",\"700\",\"Lose a turn\",\"800\",\"500\",\"450\",\"500\",\"300\",\"Bankrupt\",\"5000\"]\r\n\t\t\t\t\t@template = \"\"\r\n\t\t\t\t\t@secretword = \"\"\r\n\t\t\t\t\t@turn = 0\r\n\t\t\t\t\t@turnsleft = GOES\r\n\t\t\t\t\t@reward = \"\"\r\n\t\t\t\t\t@num_guessed = 0\r\n\t\t\t\t\t@resulta = []\r\n\t\t\t\t\t@resultb = []\r\n\t\t\t\t\t@descr= []\r\n\t\t\t\t\t@secret_clue = \"\"\r\n\t\t\t\t\t@num_words = 0\r\n\t\t\t\t\t@console = true\r\n\t\t\t\t\t@break_flag = false\r\n\t\t\t\t\t@spin_flag = false\r\n\t\t\t\t\t@spin_counter=0\r\n\t\t\t\t\t@guess_counter=0\r\n\t\t\t\t\t@filename = \"wordfile.txt\"\r\n\t\t\t\t\t@phrases = [\"Kind of animal that lives by water.\",\"Heavy seabird.\",\"Common wild bird.\",\"Mohawk bird.\"]\r\n\t\t\t\t\t@game_analysis = Hash.new { |h, k| h[k] = Hash.new { |hh, kk| hh[kk] = {} } }\r\n\t\t\t\t\t@statistic = Hash.new { |h, k| h[k] = Hash.new { |hh, kk| hh[kk] = {} } }\r\n\t\t\t\t @message=\"Guess a letter from the word/phrase.\"\r\n\t\t\t\t @web_initial = true\r\n\t\t\t\t @win = false\r\n\t\t\t\t @game_over = false\r\n\t\t\t\tend", "def guess(letter)\n # raise an execption\n # raise will 'break' the method if valid_guess? == false\n raise InvalidGuessException.new(\"Invalid guess!\") unless valid_guess?(letter)\n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\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 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 make_guess\n\t\tbegin\n\t\t\thighest_letter_left = freq_hash\n\t\t\t\t.sort_by{|k, v| v}\n\t\t\t\t.reverse\n\t\t\t\t.map{|char, freq| char}\n\t\t\t\t.detect{|char| !@guessed_letters.include?(char)}\n\n\t\t\traise \"Aw, damn! Got nothin' left. Let's start a new game.\" unless highest_letter_left\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\t\texit\n\t\telse\n\t\t\t@guessed_letters << highest_letter_left\n\t\t\thighest_letter_left\n\t\tend\n\tend", "def construct_word(word, word_len, dict, twos=@@two_tiles, threes=@@three_tiles, fours=@@four_tiles)\n\t\n\t\tleftover = word_len - word.length\n\t\t\n\t\t# NOTE: I decided to repeat .each routines, as the alternative would mean passing a whole lot of variables to a routine that only executes a few lines of code. When changing one scenario, all other matching scenarios must be changed.\n\t\t# 0: A word of appropriate length has been found. All that remains is to search the dictionary.\n\t\t# 1: There will never be a scenario with one left-over. There are no tiles of length 1.\n\t\t# 2: The only tiles that will fit is of length 2. Only query 'twos'.\n\t\t# 3: The only tiles that will fit is of length 3.\n\t\t# 4: Valid tile placement includes tiles of length 2 and 4.\n\t\t# 5: Valid tile placement includes tiles of length 2 and 3.\n\t\t# 6+: Valid tile placement includes tiles of length 2, 3, and 4.\n\t\tcase leftover\n\t\t\twhen 0 \n\t\t\t\tif (dict.query(word))\n\t\t\t\t\t@@valid_combinations.push(word)\n\t\t\t\tend\n\t\t\twhen 2\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\twhen 3\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 4\n\t\t\t\ttwos.each { |tile|\n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\twhen 5\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 6..15\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\telse \n\t\t\t\tputs \"Leftover: \" << leftover.to_s\n\t\t\tend\n\t\t\n\tend", "def make_guess(word)\n raise_if_complete\n\n correct = word.downcase == password.word\n guesses.create!(word: word, correct: correct)\n self.game_state = 'lost' if lives_left.zero?\n self.game_state = 'won' if correct\n save!\n correct\n end", "def initialize(word)\r\n\t\t\r\n# \ti. Put a initializing game statement on the screen\r\n\tputs \"Initializing game...\"\r\n# \tii. Instance variables for:\r\n# \t \ta. The word (entered by first user - the word to be guessed)\r\n\t\t@word = word\r\n# \t \tb. Split the word into letters that can be guessed and assign to a new instance variable\r\n\t\t@word_split = word.split(\"\")\r\n# \t \tc. Default a guess count instance variable to start at 0\r\n\t\t@guess_count = 0 \r\n# \t \td. The chances of winning the game based on the amount of guesses you have. \r\n\t\t@chance = word.length\r\n# \t \te. Amt of guesses should be assigned to a variable using the length of the word to be guessed.\r\n\t\t@guessed = Array.new(word.length, \"_\")\r\n# \t \tf. Set variable to false for end of game\r\n\t\t@end_game = false\r\n# \t \tg. Letter guessed assigned to a variable.\r\n\t\t@letter_guessed = letter_guessed\r\n\tend", "def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend", "def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end", "def guess(letter)\n is_letter = /^[a-zA-Z]$/\n if letter.nil? or letter.empty? or not letter.match(is_letter)\n throw ArgumentError \n end\n letter.downcase!\n if self.guesses.include? letter or self.wrong_guesses.include? letter\n return false\n end\n if self.word.include? letter\n self.guesses = self.guesses + letter\n else\n self.wrong_guesses = self.wrong_guesses + letter\n end\n return true\n end", "def dictionary(word)\n words = {\n \"hello\": 'hi',\n \"to\": '2',\n \"two\": '2', \n \"too\": '2',\n \"for\": '4',\n \"be\": 'b',\n \"you\": 'u',\n \"at\": '@',\n \"and\": '&'\n }\n words[word.downcase.to_sym]\nend", "def guess letter\n raise InvalidGuessError if letter.strip.empty? || letter.length > 1\n letter = letter[0].upcase\n if @guesses.include?(letter)\n return {advance: false, message: \"#{letter} has already been played, silly!\"}\n else\n @guesses << letter\n end\n @guessed.each_with_index do |guessed_pos, index|\n if guessed_pos\n if letter == secret[index]\n return {advance: false, message: \"#{letter} has already been played, silly!\"}\n end\n else\n if letter == secret[index]\n reveal_all(letter)\n return {advance: true, message: \"We found #{letter}!\"}\n end\n end\n end\n {advance: true, message: \"Sorry, we did not find #{letter}!\"}\n end", "def feedback(guess_word)\n guessword_array=guess_word.split(\"\")\n word_array=@word.split(\"\")\n guessword_array.each do |letter|\n if word_array.include?(letter)\n @result[word.index(letter)]=letter\n end\n end\n puts \"here is your feedback: #{@result}\"\n end", "def solve(dictionary)\n\t\n\t\tunique_word_lengths = (@@word_lengths).uniq\n\t\tunique_word_lengths.sort!\n\t\t\n\t\ti = 1\n\t\t\n\t\tunique_word_lengths.each { |len|\n\t\t\n\t\t\tputs \"\\nSearching for words of length \" << unique_word_lengths[i-1].to_s << \"...\"\n\t\t\t\n\t\t\tconstruct_word(\"\", len, dictionary)\n\t\t\t\n\t\t\ti = i + 1\n\t\t\t\n\t\t}\n\t\t\n\tend", "def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, y: 4,\n z: 10}\n\n# Need to use @word with something to get the value of the letters combined \n\n\n return score\n end", "def test_guess_passes_letter\n\t\tword = \"hello\"\n\t\tchar = \"e\"\n\t\th= Hangman.new(word)\n\t\tassert_equal true, h.guess?(char)\n\tend", "def guess\n puts \"Enter a letter\"\n puts\n letter = gets.chomp\n if @word_array.include?(letter)\n @word_array.each_with_index do |char, index|\n if char == letter\n @puzzle_array[index] = letter\n end\n end\n puts \"Correct!\"\n else\n puts \"Try again!\"\n end\n @counter -= 1\n end", "def guess(input,dead_man)\n input.upcase!\n if input.length == 1\n letter_guess(input,dead_man) \n else\n whole_word_guess(input,dead_man)\n end\n end", "def hook_helper new_word, ad, word, board, char, row_1, col_1, best, adjusted_word\n\t\t\tind = (0..new_word.length-1).find_all { |i| new_word[i,1] == char }\n\t\t\tind.each do |i|\n\t\t\t\trow = row_1\n\t\t\t\tcol = col_1\n\t\t\t\tdir = nil\n\t\t\t\tif word.dir == :across\n\t\t\t\t\trow -= i\n\t\t\t\t\tcol += ad\n\t\t\t\t\tdir = :down\n\t\t\t\telse\n\t\t\t\t\trow += ad\n\t\t\t\t\tcol -= i\n\t\t\t\t\tdir = :across\n\t\t\t\tend\n\t\t\t\tnew_score = [false, 0]\n\t\t\t\thook_score = [false, 0]\n\t\t\t\tif (0..14).cover?(row) && (0..14).cover?(col)\n\t\t\t\t\tnew_score = attempt_score(new_word, board, row, col, dir)\n\t\t\t\t\thook_score = attempt_score(adjusted_word, board, row_1, col_1, word.dir)\n\t\t\t\tend\n\t\t\t\tif new_score[0] && hook_score[0]\n\t\t\t\t\tif new_score[0] + hook_score[0] > best.inject(0){|sum, i| sum + i.score}\n\t\t\t\t\t\tbest =[ScrabbleWord.new(new_word, new_score[0], row, col, dir),\n\t\t\t\t\t\t\tScrabbleWord.new(adjusted_word, hook_score[0], row_1, col_1, word.dir)]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tbest\n\t\tend", "def initialize()\n @word = get_random_word\n @guesses = ''\n @wrong_guesses = ''\n end", "def initialize(word = dictionary_word, progress = nil, bad_guesses = [])\n word = word.join(\"\") if word.is_a? Array\n @value = word.upcase.split(\"\")\n progress.nil? ? @progress = word.upcase.gsub(/\\w/,\"_\").split(\"\") : @progress = progress.join(\"\").upcase.split(\"\")\n @bad_guesses = bad_guesses.join(\"\").upcase.split(\"\")\n end", "def word_comparison(letters_hash, word_hash)\n result = {}\n word_hash.each do |key, _value|\n if !letters_hash.include?(key) || word_hash[key] > letters_hash[key]\n result[:score] = 0\n result[:message] = 'Your word is not in the grid :('\n return result\n else\n return {}\n end\n end\n end", "def guess(letter)\n raise InvalidGuessException.new(\"Invalid Guess!\") unless valid_guess?(letter)\n \n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def new_game(dictionary)\n\t\t@dictionary = dictionary.map { |w| w.chomp }\n\t\t@played_letters = []\n\t\t@letters = ('a'..'z').to_a\n\tend", "def guess!(letter)\n end", "def respond_to_guess(letter)\n letter = letter.clone.downcase\n\n if @incorrect_letters.include?(letter) || @progress.include?(letter) || @progress.include?(letter.upcase)\n puts \"You already guessed that letter!\"\n puts \"\"\n elsif @word.include?(letter) || @word.include?(letter.upcase)\n update_progress(letter)\n unless @progress.include?(\"_\")\n @round_finished = true\n @guessed = true\n end\n else\n @incorrect_letters << letter\n @round_finished = true if @incorrect_letters.size == 6\n end\n print_hangman\n end", "def wrong_guess(letter)\n @possible_letters.delete(letter)\n @dictionary.reject_words_that_contain(letter)\n end", "def guess(guess)\r\n\t\t# Make sure the guess is either a letter or the whole word\r\n\t\tif guess.length != 1 && guess.length != @win_word.length\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp \"Guess a letter, or the complete word!\"\r\n\t\t# check for repeated guesses\r\n\t\telsif @past_guesses.include? guess\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"You guessed that already!\"\r\n\t\t# check if they guessed the entire word correctly\r\n\t\telsif guess == @win_word\r\n\t\t\twin\r\n\t\t# if the letter is not in the word\r\n\t\telsif !@win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tif @remaining_guesses == 1\r\n\t\t\t\tlose\r\n\t\t\telse\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"Sorry, try again!\"\r\n\t\t\tend\r\n\t\t# if the letter is in the word\r\n\t\telsif @win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tupdate_hint(guess)\r\n\t\t\tif @hint_str == @win_word\r\n\t\t\t\twin\r\n\t\t\telse\r\n\t\t\t\tp \"Nice guess!\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tp \"Error\"\r\n\t\tend\r\n\r\n\tend", "def play_rules_orig\n <<~'HOWTOPLAY'\n The word to guess is represented by a row of dashes,\n representing each letter of the word.\n In most variants, proper nouns, such as names, places, and brands,\n are not allowed.\n Slang words, sometimes referred to as informal or shortened words,\n are also not allowed.\n If the guessing player suggests a letter which occurs in the word,\n the other player writes it in all its correct positions.\n If the suggested letter does not occur in the word,\n the other player draws one element of a hanged man stick figure\n as a tally mark.\n\n The player guessing the word may, at any time, attempt to guess\n the whole word.\n If the word is correct, the game is over and the guesser wins.\n Otherwise, the other player may choose to penalize the guesser by\n adding an element to the diagram.\n On the other hand, if the other player makes enough incorrect guesses\n to allow his opponent to complete the diagram, the game is also over,\n this time with the guesser losing.\n However, the guesser can also win by guessing all the letters that\n appear in the word, thereby completing the word, before the diagram\n is completed.\n HOWTOPLAY\n end", "def initialize(word)\r\n\t\tputs \"game initializing\"\r\n\t\t@guessed_letters = []\r\n\t\t@word = word\r\n\t\ttemp = word.downcase.delete(' ')\r\n \t@secret_word = temp.split('')\r\n \t\r\n \t@guess_count = word.length.to_i + 4\r\n \tif(guess_count > 26)\r\n \t\tguess_count = 24\r\n \tend\r\n \r\n \t@gameover = false\r\n\r\n\t\tshow_progress(secret_word,guessed_letters)\r\n\r\n \twhile @gameover == false \r\n \t\r\n begin\r\n\t\t\t puts \"guess a letter or the word: \"\r\n\t\t\t letter = gets.chomp\r\n letter = letter.downcase\r\n \r\n \r\n end until @guessed_letters.include?(letter) == false\r\n if (letter == temp)\r\n puts \"Letters guessed #{guessed_letters}\"\r\n puts \"YOU WIN by means of guessing the word\"\r\n break\r\n end\r\n\r\n\t\t\t@guessed_letters.push(letter)\r\n\t\t\tguess(letter,secret_word)\r\n\t\t\tputs \"Letters guessed #{guessed_letters}\"\r\n\t\t\tshow_progress(secret_word,guessed_letters)\r\n\t\t\t\r\n\r\n\r\n\t\t end\r\n\r\n \tend", "def is_word?(string, dictionary = Dictionary.new)\n dictionary.include?(string)\nend", "def scrabble_score(str)\n str.gsub(/\\W+/, '').upcase.chars.inject(0){|sum,x| sum + $dict[x]}\nend", "def guess(letter)\r\n\t\t@guessed << letter.downcase\r\n\t\t@word[0].each_index do |i| #Iterate through indexes instead of values\r\n\t\t\tif @word.dig(0,i) == letter #since @word is an array inside an array, dig helps us look in word ([0]) each index for the letter.\r\n\t\t\t\t@hidden_word[i] = letter #if found, substitute \"_\" for the letter guessed in the same index for @hidden_word\r\n\t\t\tend\r\n\t\tend\r\n\t\tp @hidden_word #give feedback of results\r\n\tend", "def guess\n letters = @possible_letters.collect {|letter| [ score_for(letter),letter ]}\n letter = letters.min {|letter1,letter2| letter1 <=> letter2 }\n letter[1]\n end", "def initialize(word=WordGuesserGame.get_random_word, guesses = '',wrong_guesses='')\n @word = word\n @guesses = guesses\n @wrong_guesses = wrong_guesses\n end", "def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\n end", "def initialize(word)\n @word = word.downcase\n @guesses = ''\n @wrong_guesses = ''\n @word_with_guesses = \" \"\n for i in 0...@word.length\n @word_with_guesses[i] = \"-\"\n end\n @check_win_or_lose = :play\n\n end", "def score_word(word)\n # - Each letter within `word` has a point value. The number of points of each letter is summed up to represent the total score of `word`\n # - Each letter's point value is described in the table below\n # - If the length of the word is 7, 8, 9, or 10, then the word gets an additional 8 points\n # return int points\nend", "def verify_word_on_board(w, hash_table)\n w = w.upcase # Since the letters on board is in capital letter\n\n p hash_table\n i = 0\n searched_index = {} # Hash table to keep track what has been searched\n (0...w.length).each { |i| searched_index.store(i, -1)} # Initiate values to indicate that no letters have been searched\n\n while i >= 0 && i < w.length\n # puts \"\\nStart of while loop, i = #{i}, searching letter #{w[i]}...\" ###\n move = false\n\n unless hash_table[w[i]].empty?\n # print \"Letter #{w[i]} exist at #{hash_table[w[i]]}\\n\" ###\n hash_table[w[i]].each_with_index do | value , index |\n # puts \"Scanning through #{w[i]} at position #{value}\" ###\n \n # This unmark the position that was used previously during backtracking.\n if value + @total_letters < 0\n # puts \"Position #{hash_table[w[i]][index]} of #{w[i]} is restored...\" ###\n hash_table[w[i]][index] += (@total_letters * 2)\n # puts \"Position of #{w[i]} is now #{hash_table[w[i]][index]}.\" ###\n end\n\n if index <= searched_index[i] # This skips letters that are already searched\n # puts \"#{w[i]} at #{hash_table[w[i]][index]} is already searched.\" ###\n next\n end\n\n if value >= 0\n \n # The position is subtrated by no of total letters to indicate that it has been searched.\n # No of total letters is used so that duplicate of hash table is not required.\n \n if i == 0 || is_adjacent(hash_table[w[i]][index],(@total_letters + hash_table[w[i-1]][searched_index[i-1]]))\n hash_table[w[i]][index] -= @total_letters\n # puts \"#{value} has been subracted by @total_letters to #{hash_table[w[i]][index]}\" ###\n \n \n searched_index[i] = index\n # puts \"Moving to next letter, searched_index[#{i}] now has been updated to #{searched_index[i]}\" ###\n move = true\n i += 1\n break\n end\n\n end\n end\n\n end\n\n # i -= 1 if move == false\n if move == false\n if i > 0\n # puts \"Previously used #{w[i-1]} position of #{hash_table[w[i-1]][searched_index[i-1]]} is being marked for restoration.\" ###\n \n hash_table[w[i-1]][searched_index[i-1]] -= @total_letters # To mark position to be restored to original value as it will not be used anymore\n # puts \"Current position of #{w[i-1]} is #{hash_table[w[i-1]][searched_index[i-1]]}.\" ###\n searched_index[i] = -1\n end\n\n\n # puts \"Letter #{w[i]} is not available/not adjacent and i will be subtracted\" ###\n i -= 1\n end\n\n end\n\n # Restore back all coordinates for next word\n\n\n restore_hash_table(hash_table)\n\n # Check whether word exists.\n if i >= 0 \n puts \"#{w} exists!\"\n return true\n else\n puts \"#{w} is not available.\"\n return false\n end\n \n end", "def initialize(word)\n @word = word.downcase\n @guesses = ''\n @wrong_guesses = ''\n end", "def guess(letter)\r\n letter = letter.downcase\r\n #find the guess\r\n returnValue = @word.count(letter) \r\n case returnValue\r\n when 0\r\n #Meaning this was an invalid guess\r\n @count-=1\r\n #maybe for debugging purposes\r\n @guessedFalse << letter\r\n else\r\n #maybe for debugging purposes\r\n @guessedTrue << letter\r\n #get all index of a matching letter\r\n arryOfMatchesIndexs = (0 ... @word.length).find_all { |i| @word[i,1] == letter }\r\n #iterate through the matches and replace the shadow word\r\n arryOfMatchesIndexs.each { |x| \r\n @shadowWord[x] = letter \r\n }\r\n \r\n #if the shadowWord array does not have any underscroes then we win \r\n if (@shadowWord.index(\"_\")).nil? \r\n @win = true\r\n end\r\n end\r\n #return the value of found\r\n returnValue\r\n end", "def print_puzzle(word,guessed_letters = [])\n word.each_char do |char|\n if guessed_letters.include?(char)\n print \"#{char}\"\n else\n print \"-\"\n end\n end\nend", "def initialize(word)\n @word = word\n @guesses = \"\"\n @wrong_guesses = \"\"\n @word_with_guesses = word.gsub(/./, \"-\") \n @check_win_or_lose = :play\n @wrong_count = 0\n end", "def test_hangman_logic()\r\n\thangman = Hangman.new('programming')\r\n\t\r\n\tputs hangman\r\n\t\r\n\t['a', 'b', 'i', 'e', 'o'].each() do |letter|\r\n\t\thangman.guess(letter)\r\n\tend\r\n\t\r\n\tputs hangman.status()\r\n\r\n\t# test win\r\n\t'programming'.split('').each() do |letter|\r\n\t\thangman.guess(letter)\r\n\tend\r\n\t\r\n\tputs hangman.status()\r\n\t\r\n\t# test loss\r\n\tputs\r\n\thangman = Hangman.new('ruby')\r\n\t\r\n\tputs hangman\r\n\t\r\n\t['a', 'u', 'i', 'e', 'o'].each() do |letter|\r\n\t\thangman.guess(letter)\r\n\tend\r\n\t\r\n\tputs hangman.status()\r\n\t\r\n\thangman.guess('s')\r\n\thangman.guess('t')\r\n\t\r\n\tputs hangman.status()\r\nend", "def result(user_word, included, valid_word, time_start, time_end)\n if included == false # if word doesn't use letters in grid.\n return \"It looks like you haven't used the letters provided.\"\n elsif valid_word == false # if the letters are included but the word is invalid.\n return \"Sorry, we can't find the word you provided in the dictionary.\"\n elsif (included == true) && (valid_word == true) # if its a valid word then return the score based on the WordLength/Time\n score = ((user_word.length / (time_end - time_start)) * 100).round(0)\n return \"Your word \\\"#{user_word}\\\"<br>is #{score} points!\"\n end\n end", "def initialize(player_1_word)\n @word_to_guess = player_1_word.split('')\n @number_guesses_left = @word_to_guess.length\n @letters_tried=[]\n end", "def score\n # raise\n # binding.pry\n @lettres = params[:grid]\n @attempt = params[:games]\n if included?(@attempt.upcase, @lettres)\n if english_word?(@attempt)\n @score = compute_score(@attempt)\n @result = [@score, \"Congrats! #{@attempt} is a valid English word\"]\n else\n @result = [0, \"Sorry, but #{@attempt} isn't a valid English word\"]\n end\n else\n @result = [0, \"Sorry, but #{@attempt} can't be build out of #{@lettres}\"]\n end\n end", "def initialize(word)\n @word = word\n @guesses=''\n @wrong_guesses=''\n @word_with_guesses=''\n @check_win_or_lose=''\n for i in 0..word.length-1\n @word_with_guesses[i]='-'\n end\n end", "def dictionary()\n word_list = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend", "def solve(words, letters)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n letters.each_char do |char|\n hash[char] += 1\n end\n \n longest = 0\n \n words.each_with_index do |word, idx|\n word.each_char.with_index do |char, idx|\n if !hash[char] || hash[char] <= 0\n next\n end\n if hash[char] > 0\n hash[char] -= 1\n end\n end\n \n end\n return longest\nend", "def guess char\n #get 1st char\n \n if char.nil?\n raise ArgumentError, 'Argument is not string' \n return false\n end\n if char.length != 1\n raise ArgumentError, 'Argument is not string'\n return false\n end \n if char.match(/[a-zA-Z]/) == nil\n raise ArgumentError, 'Argument is not string' \n return false\n end\n \n pick = char.chr.downcase\n\n #catch replicant entries\n if @guesses.match(\"#{pick}\") != nil\n # @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n if @wrong_guesses.match(\"#{pick}\") != nil\n# @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n #actual match\n if @word.match(\"#{pick}\") != nil\n guesses << pick # 1st char\n else\n wrong_guesses << pick # \n @attempt += 1\n end\n \n # build up guess string i.e. \"----a-e\"\n @word_with_guesses = '';\n @check_win_or_lose = :win\n word.each_char { |a|\n if @guesses.match(\"#{a}\") != nil \n @word_with_guesses << a\n else\n @word_with_guesses << '-'\n @check_win_or_lose = :play\n end\n }\n \n #check game status\n if @attempt > 6\n @check_win_or_lose = :lose\n end\n \n return true\n end", "def execute(input)\n puts_and_say(input)\n time_s = nil\n word = nil\n failed_attempts = 0\n start = Time.zone.now\n until !word.nil? && @hinter.good_word?(input, word)\n if !word.nil? && COMMANDS.exclude?(word)\n failed_attempts += 1\n if input.matches_word?(word)\n puts_and_say('Incorrect!', 'en')\n else\n puts_and_say('Bad word!', 'en')\n end\n end\n word = gets.chomp.downcase\n time_s = Time.zone.now - start\n case word\n when 'hint'\n # Brutal punishment for failed attempts\n # TODO: Use num_hints\n failed_attempts += 100\n hints = @hinter.hints(input.case_key)\n display_hints(hints)\n when 'delete'\n puts 'Deleting results for the last 30 seconds and exiting.'\n @results_model.delete_after_time(Time.zone.now - 30)\n exit\n when 'quit'\n exit\n end\n end\n puts \"Time: #{format_time(time_s)}; Failed attempts: #{failed_attempts}; Word: #{word}\"\n PartialResult.new(time_s: time_s, failed_attempts: failed_attempts, word: word)\n end", "def wordsmith letter_pool\n\t### Dictionary Read ###\n dictionary = []\n file_path = \"dictionary.txt\"\n File.foreach( file_path ) do |word|\n dictionary.push word.chop.to_s.downcase\n end\n\t#puts \"----------------->\" + dictionary.size.to_s\n\t############## EO Dicitonary\n\n\t############ Begin generating words ##############\n\t## Result holder\n\tresults = {}\n\ttotal_number = letter_pool.length - 1\n\t########## Check for words with 3 chars ########\n\tfor i in (2..total_number)\n\t\t######## 3 chararcters are held in min_word ; rest of all held in rest ############ \n\t\tmin_word = letter_pool[0..i]\n\t\trest = letter_pool[i + 1..total_number]\n\t\tnext if min_word.length < 3 || rest.length < 3\n\t\t######## All permutations of min_word resides in first_set\n\t\tfirst_set = min_word.shift.product(*min_word).map(&:join)\n\t\tnext if first_set.nil?\n\t\t########### All permutations of rest of chars residesd in rest_set\n\t\trest_set = rest.shift.product(*rest).map(&:join)\n\t\tnext if rest_set.nil?\n\t\tresults[i] = [(first_set & dictionary), (rest_set & dictionary)]\n\tend\n\t######################\n\tword_pool = []\n\tresults.each do |key, set|\n\t\tnext if set.first.nil? || set.last.nil?\n\t\tset.first.product(set.last).each do |words|\n\t\tword_pool << words\n\tend\n\tend\n\t##########################\n\tword_pool << (letter_pool.shift.product(*letter_pool).map(&:join) & dictionary).join(\", \")\n\tword_pool\nend", "def load_game(chosen_word,word_guess,dead_man)\n @chosen_word = chosen_word\n @word_guess = word_guess\n @dead_man = dead_man\n\n @word_guess.display(@dead_man)\n round\n end", "def score\n\n letters = word.split(//) #can also be typed .split(\"\")\n\n symbols = letters.map do|letter|\n letter.to_sym\n end\n\n word_score = symbols.reduce(0) do |sum, sym|\n sum + @letter_score[sym]\n end\n\n return word_score\n\n end", "def solved? (guesses, word)\n\tsolved = true\n\thits = []\n\tword.length.times do |i|\n\t\thits << word[i]\n\tend\n\thits.each do |hit|\n\t\tunless guesses.include? hit\n\t\t\tsolved = false\n\t\tend\n\tend\n\tsolved\n\n\n\t\nend", "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 new_game(dictionary)\n\t\t@dictionary = dictionary\n\t\t@frequency_hash = frequency_hash\n\t\t@vowels = vowels\n\t\t@letters = letters\n end", "def score_word(word)\n letter_values = {\n \"A\" => 1,\n \"B\" => 3,\n \"C\" => 3,\n \"D\" => 2,\n \"E\" => 1,\n \"F\" => 4,\n \"G\" => 2,\n \"H\" => 4,\n \"I\" => 1,\n \"J\" => 8,\n \"K\" => 5,\n \"L\" => 1,\n \"M\" => 3,\n \"N\" => 1,\n \"O\" => 1,\n \"P\" => 3,\n \"Q\" => 10,\n \"R\" => 1,\n \"S\" => 1,\n \"T\" => 1,\n \"U\" => 1,\n \"V\" => 4,\n \"W\" => 4,\n \"X\" => 8,\n \"Y\" => 4,\n \"Z\" => 10\n }\n total_score = 0\n word.upcase.split(//).each do |letter|\n total_score += letter_values[letter]\n end\n\n if word.length > 6\n total_score += 8\n end\n\n return total_score \nend", "def must_form_word(letter_vars)\n raise 'The word is too long.' if letter_vars.size > MAX_WORD_LENGTH\n # Create a variable for the word with the dictionary's words as\n # domain and add the constraint.\n word = int_var @dictionary.words_of_size(letter_vars.size)\n letter_vars.to_number(BASE).must == word\n @words << word\n end", "def main()\n rules = { # a/bc/bcd/bcdd/bcda/bcdbc/bcbc/cbc/aa/\n 'abcd' => [''],\n 'a' => ['bc'],\n 'bc' => ['bcd', 'c'],\n 'd' => ['a', 'db'],\n 'db' => ['b'],\n 'cbc' => ['ab'],\n '...' => ['a']\n }\n rows= [\n 'bd',\n ]\n moves = 10\n width = 7\n solver = Solver.new(rules, moves, width)\n game_data = GameState.new(rules, rows[0], width)\n solution = solver.find_solution(game_data)\n\n if !solution.nil?\n solution.each do |move|\n puts(move.to_s)\n end\n else\n puts 'No solution found'\n end\nend", "def dictionary \n {\n \"hello\" => 'hi',\n \"to\" => '2',\n \"two\" => '2',\n \"too\" => '2',\n \"for\" => '4',\n \"four\" => '4',\n 'be' => 'b',\n 'you' => 'u',\n \"at\" => \"@\", \n \"and\" => \"&\"\n \n }\nend", "def intelligent_guesses(num)\n word_options = File.readlines('dictionary.txt').select do |word|\n word.length == num\n end\n\n most_common_letters = {}\n word_options.join(\"\").split(\"\\n\").join(\"\").each_char do |letter|\n if most_common_letters.has_key?(letter)\n most_common_letters[letter] += 1\n else\n most_common_letters[letter] = 1\n end\n end\n\n @most_common_letters = most_common_letters\n\n end", "def corrections\n #For each word to be looked at\n $words.each do |word_array|\n #If the word is misspelled attempt corrections\n possible_matches = Array.new\n if word_array[1] == false\n #Sets word to the actual word, instead of array pair\n word = word_array[0]\n # Get lexicon searching vars\n first_char = word[0]\n len = word.length\n\n ##Find words with similar letters\n #Saves the length of the word for eaiser access\n size = word.length\n #Iterates over words with matching starting letter and length +- 1\n $lexicon[first_char][len].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n # only check shorter words if length is greater than 1\n if len > 1\n $lexicon[first_char][len-1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n end\n\n $lexicon[first_char][len+1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n #Iterate over the possible matches, taking the match with the highest percentage\n #Hash to hold similarity\n similarity = Hash.new(0.0)\n possible_matches.each do |word_to_compare|\n similarity[word_to_compare] = match_percentage word, word_to_compare\n end\n\n best_match = ''\n similarity.each do |match|\n if match[1] > similarity[best_match]\n best_match = match[0]\n end\n end\n $correction[word] = best_match\n end\n end\nend" ]
[ "0.6470329", "0.6167698", "0.61333984", "0.60663444", "0.60628045", "0.60478956", "0.5945501", "0.5944362", "0.5918582", "0.5893982", "0.58792496", "0.5876002", "0.58553874", "0.5844523", "0.5811667", "0.58113146", "0.5804311", "0.57754457", "0.575519", "0.575519", "0.575519", "0.575519", "0.5743523", "0.57431346", "0.5741259", "0.5729815", "0.5726443", "0.5710934", "0.57008785", "0.5698798", "0.5698798", "0.5697737", "0.56808114", "0.5671756", "0.56621873", "0.56598765", "0.56592697", "0.5658186", "0.5643105", "0.56391203", "0.5632472", "0.56323636", "0.5632063", "0.5616604", "0.56143254", "0.5613951", "0.5611635", "0.56104517", "0.5602662", "0.56024134", "0.5595292", "0.5585265", "0.5573951", "0.5549495", "0.5545628", "0.55297434", "0.55283004", "0.5512712", "0.55118006", "0.55098146", "0.5503868", "0.549809", "0.5489511", "0.54820937", "0.54777306", "0.5476014", "0.5471581", "0.5471441", "0.54699385", "0.54693365", "0.5459662", "0.54591507", "0.54582494", "0.5455535", "0.54542553", "0.5444689", "0.5441094", "0.54360795", "0.5434514", "0.54331726", "0.54309744", "0.5428132", "0.5424856", "0.54223746", "0.54208034", "0.53890574", "0.5381906", "0.5379045", "0.5376023", "0.5363297", "0.5361167", "0.5360746", "0.53576034", "0.5354677", "0.5349958", "0.5346211", "0.53457314", "0.5342913", "0.53386116", "0.53375185" ]
0.6951928
0
Returns true if the solution is known
def solved? @solution !~ /-/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solvable?\n find_solution > 0\n end", "def solved?\n @solution != nil\n end", "def solved?\n end", "def solution_exists?\n ! @solved_node.nil?\n end", "def solved?\n unknown_count == 0\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def solved?\n first_empty_index.nil? && legal?\n end", "def solved?\n\t\n\t\t# pour toutes les pièces\n\t\t(0..8).each { |i|\n\t\t\t# la case est encore vide : solved = false\n\t\t\treturn false if @cases[i] == nil\n\t\t\t\n\t\t\t# sinon, est-ce que les pièces matchent entre elles.\n\t\t\treturn false if not self.match?(i)\n\t\t}\n\t\t\n\t\t# sinon, ca match partout : le puzzle est résolu (solved) !\n\t\treturn true\n\tend", "def solved?\n !@grid.nil? && @grid.missing == 0\n end", "def solved?\n p @solved\n end", "def solvable?\n\t\tsteps > 0\n\tend", "def failed?\n solutions.empty?\n end", "def solved?\n !@grid.nil? && @grid.missing == 0\n end", "def solvable?\n steps > 0\n end", "def solved?\n @state == @goal\n end", "def is_solution? \n zero= false\n 0.upto(@width-1) do |x|\n 0.upto(@height-1) do |y|\n if @pole[x][y]==0\n zero = true\n break\n end\n end\n end\n print \"Je to reseni, pyco!\\n\" if !zero\n return !zero \n end", "def solved_by?(contestant)\n if solutions.where(:user_id => contestant).empty?\n return false # not solved\n else\n return true # solved\n end\n end", "def solvable?\n @cube_state.solvable?\n end", "def verifierCorrect()\n return @solution.equals(@partie.getCurrentGrid())\n end", "def solution_for?(puzzle)\n solution? and puzzle.subset?(self)\n end", "def solved?\n !!self.answers.select {|x| x.correct}[0]\n end", "def solved\n @solved = @rows.flatten.include?(\"0\") ? false : true\n end", "def solvable?\n return true if full?\n\n state_array_copy = @state_array.dup\n start_index = state_array_copy.index(false)\n index_stack = [start_index]\n connected_found = 0\n until index_stack.empty?\n index = index_stack.pop\n next if state_array_copy[index]\n\n state_array_copy[index] = true\n connected_found += 1\n index_stack += neighbor_indices(index)\n end\n return false unless connected_found + @num_occupied == @size ** @dimension\n\n num_dead_ends = (0...@size ** @dimension).to_a.count do |index|\n !@state_array[index] && neighbor_indices(index).count { |neighbor_index| !@state_array[neighbor_index] } == 1\n end\n return num_dead_ends <= 1\n end", "def problem?\n analysis.any? { |c| !c.ok? }\n end", "def is_solved?\n return false unless is_rows_valid?\n return false unless is_columns_valid?\n return false unless is_subgrids_valid?\n true\n end", "def solved?\n # Return whether the total passed in is equal to the total for a valid house.\n def is_valid_house_total?(total)\n return total == 45\n end\n\n # Return the total of adding up all the cells in this house.\n def house_total(house)\n return house.inject(0) {|sum, cell| sum + cell.to_i }\n end\n\n ## Check whether all the houses in the puzzle have valid totals.\n ##\n\n each_row do |row|\n return false unless is_valid_house_total?(house_total(row))\n end\n\n each_column do |column|\n return false unless is_valid_house_total?(house_total(column))\n end\n\n each_nonet do |nonet|\n return false unless is_valid_house_total?(house_total(nonet))\n end\n end", "def hook_solution?(a); end", "def solved?\n result = false\n @data.each do |turn|\n result = turn[:key].red >= 4 if !turn[:key].nil?\n break if result == true\n end\n @solved = result\n result\n end", "def solved?\n cols = @grid.transpose\n return false unless (0..8).all? {|i| check_cols(i) && check_row(i)}\n (0..2).each do |horiz| \n (0..2).each {|vert| return false unless check_square(horiz,vert)}\n end\n true\n end", "def routes_are_correct?\n @solution.each do |route|\n return false if route.demand > @vehicle_capacity\n end\n return true\n end", "def valid?\n tally = Hash.new(0)\n tally[:xxx] = 1\n \n 5.times do |u|\n 5.times do |h|\n if !@solution[h][u].nil?\n tally[@solution[h][u]] += 1\n end\n end\n return true if tally.values.max < 2\n end\n puts \"invalid: #{tally.inspect}\"\n puts self.to_s\n return false\n end", "def complete?(params)\n if @puzzle.complete?\n if @puzzle.to_s == @solution.to_s\n return JSON.generate({complete: true, accurate: true})\n else\n return JSON.generate({complete: true, accurate: false})\n end\n else\n return JSON.generate({complete: false, accurate: false})\n end\n end", "def solve_until_complete\n old_truth_table = nil\n while old_truth_table != @truth_table\n old_truth_table = @truth_table.dup\n solve_once\n end\n @solved = true\n end", "def resolved?\n !!@resolved\n end", "def suitable?\n @confines.all?(&:true?)\n end", "def contains_response_and_soln?() true ; end", "def solved\n all_queens_placed && attacks_possible != true\n end", "def solved?(challenge, solution)\n challenge == encrypt(solution)\n end", "def query_yields_solutions?\n true\n end", "def is_solution?\n self.post_type == 'solution'\n end", "def suitable_for_any?\n \treturn self.disciplines.count > 0\n end", "def complete?\n if @puzzle.include? \".\"\n return false\n else\n return true\n end\n end", "def solved? (guesses, word)\n\tsolved = true\n\thits = []\n\tword.length.times do |i|\n\t\thits << word[i]\n\tend\n\thits.each do |hit|\n\t\tunless guesses.include? hit\n\t\t\tsolved = false\n\t\tend\n\tend\n\tsolved\n\n\n\t\nend", "def suitable?\n unless defined? @suitable\n @suitable = ! @confines.detect { |confine| ! confine.true? }\n end\n\n return @suitable\n end", "def suitable?\n unless defined? @suitable\n @suitable = ! @confines.detect { |confine| ! confine.true? }\n end\n\n return @suitable\n end", "def solved sol\n\tfor i in 0...sol.size\n\t\tfor j in 0...sol[i].size\n\t\t\tif sol[i][j].ord < 'a'.ord\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\n\treturn true\nend", "def solved?\n\t\treturn @blocks.clues == showingClues\n\tend", "def solution_correct?\n current = params[:solution].strip\n current.gsub!(/\\/\\*[\\w\\s]*\\*\\//,\"\") \n current.gsub!(/--.*\\n/,\"\")\n existing = format_str(@lesson.solution.strip)\n current = format_str(current.strip)\n if existing == current\n return true\n else\n existing_arr = existing.split\n current_arr = current.split\n len= existing_arr.length\n err =[]\n j=0 \n for i in 0..len\n if existing_arr[i]!=current_arr[i]\n err[j]= existing_arr[i]\n j=j+1 \n end\n end\n return err\n end \n end", "def solved?\n letter = won_across?\n return letter if letter\n letter = won_up_and_down?\n return letter if letter\n letter = won_diagonally?\n return letter if letter\n false\n end", "def resivo?\n \n if pogodci < 17\n return false\n end\n \n kopiraj = self.dup\n kopiraj.solve!\n \n return kopiraj.reseno?\n end", "def is_codeword_solved?\n\t\t!@codeword_hash.include?(\"_\") ? true : false\n end", "def usable?\n\n @trajectory.each do |a_point|\n if a_point.alt > 1000000.0\n return false\n end\n end\n\n return true\n\n end", "def done?\n puts \"iteration: #{@iterations += 1}\"\n return true if @iterations >= @max_iterations\n return false unless @simplex.permutation(2).map { |e|\n l = Math.sqrt((e[0] - e[1]).to_a.map{ |f| f**2 }.inject(&:+))\n l <= 0.5\n }.all?\n\n _f = 1/3 * @simplex.map(&:result).inject(&:+)\n _d = 1/3 * @simplex.map{ |e| (e.result - _f)**2 }.inject(&:+)\n _d <= TOLERANCE**2\n end", "def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end", "def validity?\n solve_until_complete unless @solved\n return :ambiguous if !@truth_table.values.grep(nil).empty?\n @program.left.each do |clause|\n return false if clause.type == :statement && !eval_stmt(clause.left)\n return :ambiguous if clause.type == :statement && eval_stmt(clause.left).nil?\n end\n true\n end", "def allquantors_inside?(problem)\n problem.constraints.each do |constraint|\n return true if constraint.expression.is_a? Yarpler::Models::Forall\n end\n false\n end", "def board_solved?\r\n # Check that all the cells are filled with values\r\n #\r\n (0 .. 8).each do |row|\r\n (0 .. 8).each do |col|\r\n return false unless board[row][col] > 0\r\n end\r\n end\r\n \r\n # Check column constraints\r\n #\r\n @board.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check row constraints\r\n #\r\n @board.transpose.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check box constraints\r\n #\r\n (0 .. 2).each do |box_x|\r\n (0 .. 2).each do |box_y|\r\n box_vals = []\r\n \r\n (0 .. 2).each do |i|\r\n (0 .. 2).each do |j|\r\n box_vals << @board[3 * box_x + i][3 * box_y + j]\r\n end\r\n end\r\n \r\n return false unless box_vals.uniq.size == 9\r\n end\r\n end\r\n \r\n true\r\n end", "def test_solve_sudoku\n assert_equal(false, @sudoku_1.sudoku_complete?(@sudoku_1))\n @sudoku_1.solve_sudoku(@sudoku_1)\n assert_equal(true, @sudoku_1.sudoku_complete?(@sudoku_1))\n end", "def set_solution\r\n @solutions = true\r\n end", "def done?(assignments)\n \tassignments.size == problem.vars.size\n end", "def solved_check\n ->() { true }\n end", "def bruteforce?\n return (bruteforce != nil)\n end", "def guessed_all_correct?\n end", "def solve\n\t\t\n\t\tcell_index = 0\n\t\t# move to the right position..\n\t\t# puts @unsolved.length.to_s + \" unknown cells!\"\n\n\t\twhile cell_index >= 0 && cell_index < @unsolved.length do\n\t\t\tcell = @unsolved[cell_index];\n\t\t\t\n\t\t\tpossible = cell.nextPossible()\t\n\n\t\t\tif possible > 9 || possible <= 0\n\t\t\t\tcell.set(0)\n\t\t\t\tcell_index -= 1\n\t\t\telse\n\t\t\t\tcell.set(possible)\n\t\t\t\tcell_index += 1\n\t\t\tend\t\t\t\t\t\t\t\n\t\tend\n\n\t\tif cell_index < 0\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def feasible?\n return true if source.nil? || source.enable_gateway?\n transfer_items.each do |item|\n return false unless item.feasible?\n end\n true\n end", "def solved?(user)\n\t\tif SolvedProblem.find_by(user_id: user.id, problem_id: self.id)\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def good_guess?\n @code_word.include?(@word_guesser.guess)\n end", "def known? x, y\n [:hit,:sunk,:miss].include? @known[x,y]\n end", "def candidate?\n !!candidate\n end", "def ok?\n @specs.all? do |spec|\n spec.runtime_dependencies.all? do |dep|\n @specs.find { |s| s.satisfies_requirement? dep }\n end\n end\n end", "def found_exact?\n @found_exact\n end", "def query_yields_solutions?\n !(query_yields_boolean? || query_yields_statements?)\n end", "def solution\n solve unless solved?\n @solution\n end", "def is_in_mc?(position)\n @minimal_solution[position]\n end", "def solve(begX, begY, endX, endY)\n\t\tis = trace(begX,begY,endX,endY)\n\t\treturn false if is.nil?\n\t\treturn false if is.empty?\n\t\ttrue\n\tend", "def satisfied?(assignments)\n \tproblem.constraint.satisfied?(new_assigns)\n end", "def one_candidate?\n @candidates.count == 1\n end", "def same?(puzzle, target)\n if puzzle == target\n return true\n else\n return false\n end\nend", "def integrity_check\n start_values = condition.start_values\n generations.each do |g|\n # FIXME -- use the registered fitness function\n if IterativeLearning::FunctionLearning.sum_of_error(g.start_values, start_values) != 0\n return false\n end\n start_values = g.best_task_response\n end\n return true\n end", "def solve!\n return false unless valid?\n return @board.join if solved?\n\n unsolved = @board.index(\"0\")\n\n (1..9).each do |possible|\n @board[unsolved] = possible\n solution = Sudoku.new(@board.join).solve!\n return solution if solution\n end\n\n false\n end", "def find_solution(currently_satisfied, remaining_mappings)\n currently_satisfied = currently_satisfied.dup\n # Note that we will not be modifying the Sets that are the values of remaining_mappings so dup will work well enough\n remaining_mappings = remaining_mappings.dup\n\n # Base case:\n if remaining_mappings.size.zero?\n return currently_satisfied\n end\n\n target_opcode, target_opnames = remaining_mappings.sort_by { |k, v| v.size }.first\n\n opname_options = target_opnames - currently_satisfied.values\n # If no opname options left (and still have remaining mappings), then this branch is not valid\n if opname_options.size.zero?\n return false\n end\n\n # Try out each opname that is not currently in use\n opname_options.each do |opname|\n currently_satisfied[target_opcode] = opname\n remaining_mappings.delete(target_opcode)\n\n # Result will be false if there is no solution\n result = find_solution(currently_satisfied, remaining_mappings)\n return result if result\n end\n\n false\nend", "def return_solution_found\n @open.select(&:goal).first\n end", "def feasible?(x)\n feas = true\n @constraints.each do |c|\n feas = false if is_violated?(c,x)\n end\n #puts inspect_constraints(x) if @options[:debug] > 4\n info(inspect_constraints(x), 4, __method__, __LINE__)\n return feas\n end", "def optimal_answer?\n \tanswer_value == optimal_value\n end", "def truth_table\n solve_until_complete unless @solved\n @truth_table\n end", "def solved?(board)\n if\n board.each do |row|\n end\n else\n false\n end\n\nend", "def candidates_exist_for_all_forced_changes?\n forced_packages_missing_candidates.empty?\n end", "def\tgood_guess?(g)\n\t\t@word_array.include?(g)\n\tend", "def\tgood_guess?(g)\n\t\t@word_array.include?(g)\n\tend", "def infeasible?(x)\n cnt = []\n @constraints.each do |c|\n cnt << is_violated?(c,x)\n end\n puts inspect_constraints(x) if @options[:debug] > 4\n return cnt.include? true\n end", "def test_solve_empty_3x3\n square = MagicSquare.new(3)\n square.solve\n assert square.solved?\n assert_equal @@solutions.first, square.solution\n end", "def suitable?\n false\n end", "def suitable?\n false\n end", "def is_stable?\n # Every person's partner should match up\n @matches.all? { |k,v| is_matched?(k, v) }\n end", "def is_known?\n describe ? true : false\n end", "def correction?\n false\n end", "def solution\n\n return self if solved?\n\n while [hidden_singles, naked_singles].any?\n end\n\n return self if solved?\n\n\n # Brute force\n i = each_empty_cell.sort_by { |cell, n| legal_values(n).size }.first.try :last\n\n legal_values(i).map do |value|\n fill(i, value).solution\n end.compact.select { |n| n.solved? }.first\n end", "def goal_cell_guarded?\n guard_mission.squads.each do |squad|\n return true if squad.current_point.equal?(fortress_goal_point)\n end\n return false\n end", "def fixed?\n @fixed == 'yes'\n end", "def working?\n true\n end" ]
[ "0.84955007", "0.81102115", "0.7680278", "0.7619418", "0.75706595", "0.7540106", "0.7427209", "0.7371596", "0.73556125", "0.72861457", "0.7272406", "0.7228054", "0.7219366", "0.7217833", "0.71855605", "0.71657884", "0.7137711", "0.70877004", "0.7023573", "0.70227915", "0.7018684", "0.69860864", "0.68879086", "0.6868551", "0.68683803", "0.685922", "0.6848179", "0.67429566", "0.67275196", "0.6675816", "0.66041034", "0.660304", "0.65746623", "0.6572823", "0.6523242", "0.6522662", "0.65092856", "0.65045655", "0.6478143", "0.64402246", "0.64376664", "0.6417481", "0.641628", "0.6385573", "0.6385573", "0.6377127", "0.6374743", "0.6339493", "0.6309287", "0.63044256", "0.628134", "0.6277643", "0.6259838", "0.6248616", "0.6221415", "0.6217328", "0.6212882", "0.62101614", "0.62051487", "0.62002933", "0.61639553", "0.6155585", "0.61478984", "0.614222", "0.6128838", "0.61286694", "0.6125818", "0.6123928", "0.61185426", "0.61165017", "0.6113452", "0.6112942", "0.61127776", "0.6112638", "0.6110588", "0.6095926", "0.6085357", "0.60678846", "0.6066214", "0.60657537", "0.6065502", "0.60569066", "0.6055625", "0.6053514", "0.60424167", "0.6035021", "0.6034202", "0.6022074", "0.6022074", "0.60199845", "0.60191", "0.60084635", "0.60084635", "0.59786606", "0.5978123", "0.59763104", "0.5969828", "0.5966256", "0.59572816", "0.59486896" ]
0.7299594
9
How many more Words in the dictionary are candidates?
def possibilities @dictionary.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_count\n @tried_solutions.length\n end", "def number_of_unique_words\n @frequencies.keys.length\n end", "def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end", "def num_unique_words\n @frequencies.keys.length\n end", "def word_sizes(words)\n length_arr = []\n hash_words = {}\n words.gsub(/[^[:word:]\\s]/, '').split(' ').each do |word| \n length_arr << word.length\n end\n length_arr.uniq.each do |element|\n hash_words[element] = length_arr.count(element)\n end\n hash_words\nend", "def word_sizes(text)\n word_size = Hash.new(0)\n words = text.split\n words.each { |word| word_size[word.size] += 1 }\n word_size\nend", "def length_finder(words)\n lengths = {}\n words.each do |word|\n lengths[word] = word.length\n end\n lengths.values\nend", "def words_count\n get_at_words_count + \n get_ata_words_count + \n get_noun_words_count + \n get_adjective_words_count\n end", "def categories_with_word_count(word)\n return 0 unless @word_list[word] && @word_list[word][:categories]\n @word_list[word][:categories].length \n end", "def phraseLength\n\t\treturn @dictionaries.length\n\tend", "def word_count\n\t\tputs \"There are #{@dictionary_analyzer.word_count(@dictionary)} words in this dictionary.\"\n\tend", "def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n clean_word = word.delete('^a-zA-Z')\n count_hash[clean_word.size] += 1\n end\n count_hash\nend", "def get_adjective_words_count\n @redis.llen(\"store:adjectives\").to_i\n end", "def word_count\n words = @input.downcase.scan(/\\b[\\w']+\\b/)\n\n words.each_with_object(Hash.new(0)) do |word, result|\n result[word] += 1\n end\n end", "def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) { |word, obj| obj[word.size] += 1 } \nend", "def word_count\n weighted(:count, :word).to_i\n end", "def word_sizes(words)\n word_count = Hash.new(0)\n words = words.delete \"^a-zA-Z \"\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend", "def collect_words_of_length\n\t\t@dictionary.select! { |el| el.length == @word_length + 1 }\n\t\tmake_smart_dictionary\n\tend", "def word_count\n return words.size\n end", "def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend", "def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end", "def count_words\n Hash.new(0).tap do |word_counts|\n words.each { |word| word_counts[word] += 1 }\n @words_counted = true\n end\n end", "def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend", "def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend", "def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend", "def word_sizes(sentence)\n hash = Hash.new(0)\n words = sentence.split(\" \")\n words.map! { |word| word.gsub(/[^a-zA-Z]/, ' ')}\n words.map! { |word| word.delete(\" \")}\n words.each { |word| hash[word.length] += 1 }\n hash\nend", "def word_count\n result = {}\n words.each do |word|\n result[word] = words.count(word)\n end\n result # return result\n end", "def word_sizes(words)\n word_count = Hash.new(0) #this initializes default values as 0\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend", "def word_sizes(sentence)\n hash = Hash.new(0)\n sentence.split.each do |word|\n hash[word.size] += 1\n end\n hash\nend", "def defect_count( dict_word, word )\n\n\tdict_letters = Hash.new \t# Characters in dictionary word\n\tword_letters = Hash.new \t# Characters in test word\n\n\t# Add the characters to hash, add the values if character is already present.\n\tdict_word.length.times do |i|\n\t\tif dict_letters[dict_word[i]].nil?\n\t\t\tdict_letters[dict_word[i]] = 1\n\t\telse\n\t\t\tdict_letters[dict_word[i]] += 1\n\t\tend\n\tend\n\n\t# Do the same thing for the other word\n\tword.length.times do |i|\n\t\tif word_letters[word[i]].nil?\n\t\t\tword_letters[word[i]] = 1\n\t\telse\n\t\t\tword_letters[word[i]] += 1\n\t\tend\n\tend\n\n\tdefects = 0 # Defect count to return\n\t\n\t# Compare the two words unique characters, for each non-matching character, add number of \n\t# characters present as defects\n\tif dict_letters.size > word_letters.size\n\t\tdict_letters.each do |key, val|\n\t\t\tdefects += val if word_letters[key].nil?\t\t\n\t\tend\n\telse\n\t\tword_letters.each do |key, val|\n\t\t\tdefects += val if dict_letters[key].nil?\t\t\n\t\tend\n\tend\n\n\t# For the matching unique characters, add the difference in quantity as defects\n\tdict_letters.each do |kd, vd|\n\t\tword_letters.each do |kw, vw|\n\n\t\t\tdefects += (vd - vw).abs if kd.eql? kw\n\t\tend\n\tend\n\n\t# Get the smallest word length\n\tbound = (dict_word.length < word.length)? dict_word.length : word.length\n\n\t# To reward words which have very similar sequences of characters, we add defects for\n\t# each character that does not match sequentially with other word.\n\tbound.times do |i|\n\n\t\t# add defect for each unmatching character\n\t\tdefects += 1 unless dict_word[i].eql? word[i]\n\tend\n\n\t# return score\n\treturn defects\nend", "def word_sizes(string)\n\tword_count = {}\n\tstring.split.each do |word|\n\t\tword_s = word.size\n\t\tif word_count[word_s]\n\t\t\tword_count[word_s] += 1\n\t\telse\n\t\t\tword_count[word_s] = 1\n\t\tend\n\tend\n\tword_count\nend", "def word_sizes(text)\n word_size = Hash.new(0)\n text.split.map do |word|\n word.delete \"^A-Za-z\"\n word_size[word.size] += 1\n end\n word_size\nend", "def count_occurrences(words)\n hash ={}\n words.each do |word|\n if hash.has_key?(word)\n hash[word] += 1\n else\n hash[word] = 1\n end\n end\n \n hash.each {|k, v| puts \"#{k} => #{v}\"}\nend", "def word_count\n words.size\n end", "def word_count\n words.size\n end", "def wordCount\n count = 0\n\n if (@word.to_s != '')\n count += 1\n end\n\n if @children.size\n @children.each do |key, val|\n count += val.wordCount\n end\n end\n\n count\n end", "def substrings(phrase,dictionary)\n word_freq = Hash.new(0)\n phrase.split().each do |word|\n dictionary.each do |dict|\n if word.downcase.include?(dict)\n word_freq[dict]+=1\n end\n end\n end\n puts word_freq\nend", "def numWords\n @words\n end", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n count_hash[word.size] += 1\n end\n p count_hash\nend", "def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend", "def word_count\n result = { }\n words = @input.downcase.split(/[,\\s]/)\n words.each do |word|\n next if word.empty?\n word.gsub!(/\\W/, '') unless word.include?(\"'t\")\n\n if !result.key?(word)\n # puts \"new key: #{word}\"\n result[word] = 1\n else\n # puts \"Accumulating on #{word}: #{result[word]} + 1\n result[word] += 1\n end\n end\n result\n end", "def top_scoring_words\n @dictionary.each_with_object([]) do |cur_word, words_found|\n return words_found if words_found.length >= WORDS_TO_FIND\n\n words_found << cur_word if letters_present_for cur_word\n end\n end", "def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend", "def word_sizes(input)\n hash = {}\n input .split.each do |word|\n num_of_letters = word.chars.count\n if hash.has_key?(num_of_letters)\n hash[num_of_letters] += 1\n else\n hash[num_of_letters] = 1\n end\n end\n hash\nend", "def categories_with_word_count(word)\n return 0 unless @word_list[word] && @word_list[word][:categories]\n @word_list[word][:categories].length\n end", "def word_sizes(string)\n keys =[]\n words = string.split.each do |word|\n keys << word.length\n end\n keys = keys.uniq\n size = {}\n keys.each do |key|\n size[key] = words.count{|wordies| key == wordies.length}\n end\n size\nend", "def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend", "def num_words\n @words.length\n end", "def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > count\n count = repeats\n most = word\n end\n \n end\n \n return most\n \nend", "def substrings(word, dict)\n print \"List of words: \",dict,\"\\n\"\n puts \"Key word: \" + word\n print \"\\nHash: \"\n print(dict.reduce( {} ) do |count, str|\n if word.include?(str)\n if count[str] == nil\n count[str] = 1\n else\n count[str]+=1\n end\n end\n count\n end)\n puts\nend", "def word_sizes(input)\n\n occurrences = Hash.new(0)\n\n input.split.each do |element|\n occurrences[element.size] += 1\n end\n \n occurrences\nend", "def nouns\n i = 0\n @synsets.each do |key, values|\n i += values.length\n end\n i\n end", "def checkSearchTerms(wordHash, searchTermsArray, documentCounter, resultsHash, wordArray)\n documentCounter;\n documentNumber = \"Document \" + documentCounter.to_s\n searchTermsArray.each do |word|\n resultsHash.merge!(word => { documentNumber => wordHash[word]})\n # need to figure out the frequency based on the wordHash[word] and the wordArray.length\n end\n # puts wordArray.length\n # puts resultsHash\nend", "def words\n @words ||= dictionary.select { |word| word.length > 3 }\n end", "def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end", "def word_instances(text)\n instances = Hash.new(0)\n normalized_words = normalize(text)\n unique(text).each do |word|\n instances[word] = normalized_words.count(word)\n end\n instances\nend", "def substrings words, dictionary\n hits = Hash.new\n dictionary.each do |lookup|\n hits[lookup] = words.scan(/#{lookup}/i).length\n end\n hits.delete_if {|k,v| v == 0} # squeeze out the empties\nend", "def find_word_lengths(word_list)\n word_list.reduce(Hash.new(0)) do |hash, el|\n hash[el] += el.size\n hash\n end\nend", "def total_word_count\n @_total_word_count ||= words.values.reduce(:+)\n end", "def word_sizes(word_string)\n word_sizes = Hash.new(0)\n array = word_string.split.each { |string| string.slice!(/[^a-zA-Z]/) }\n array.each { |word| word_sizes[word.size] += 1 }\n word_sizes\nend", "def word_counter(mots,dictionnaire)\n words = word_counter.downcase.split(\" \")\n #puts words => [\"howdy\",....\"going?\"]\n frequencies = Hash.new(0)\n words.each{ |mot| \n if mot.include?(dictionnaire) #si le mot est dans le dictionnaire\n frequencies[mot] += 1 #si oui\n end\n \n }\n puts frequencies\nend", "def letter_count limit\n letters = Hash[0, 0, 1, 3, 2, 3, 6, 3, 10, 3, 4, 4, 5, 4, 9, 4, 3, 5, 7, 5, 8, 5, 40, 5, 50, 5, 60, 5, 11, 6, 12, 6, 20, 6, 30, 6, 80, 6, 90, 6, 15, 7, 16, 7, 70, 7, 13, 8, 14, 8, 18, 8, 19, 8, 17, 9]\n words = Hash[\"and\", 3, \"hundred\", 7, \"thousand\", 8]\n num = 1\n digits = []\n count = 0\n i = 0\n\n letters.each do |k, v|\n # puts \"#{k}, #{v}\"\n end\n\n # puts \"HASH: #{letters[13]}\"\n\n\n while num <= limit\n count_for_word = 0\n\n if num > 9\n digits = num.to_s.reverse.split(//)\n \n # puts \"DIGITS[0]: #{digits[0]}, #{i}\"\n \n if digits[1] == \"1\"\n count_for_word = letters[[digits[0], digits[1]].join.reverse.to_i]\n\n else\n count_for_word = letters[digits[0].to_i] +\n letters[digits[1].to_i * 10]\n end\n count_for_word += letters[digits.fetch(2, 0).to_i] +\n letters[digits.fetch(3, 0).to_i]\n\n if digits[2] != nil && digits[2] != \"0\"\n # if letters[[digits[0], digits[1]].join.reverse.to_i] != 0 \n if [digits[0], digits[1]].join.reverse != \"00\" \n puts count_for_word\n\n count_for_word += words[\"hundred\"] + words[\"and\"]\n else\n count_for_word += words[\"hundred\"]\n end\n end\n\n puts count_for_word\n\n if digits[3] != nil\n count_for_word += words[\"thousand\"]\n end\n\n else\n count_for_word = letters[num].to_i\n end\n\n count += count_for_word\n num += 1\n end\n\n count \nend", "def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "def word_sizes(str)\n hsh = {}\n new_str = str.gsub(/[^a-z ]/i, '')\n arry = new_str.split.map(&:size)\n arry.map { |word| hsh[word] = arry.count(word) }\n hsh\nend", "def total_words\n words.size\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 word_count\n @@word_count\n end", "def good_word(wordlist)\n # letter frequency\n freqs = Hash.new { |h,k| h[k] = 0 }\n wordlist.each do |w|\n w.chars.each { |c| freqs[c] += 1 }\n end\n\n # score = number of unique chars X sum of letter frequencies\n wordlist.max_by do |w|\n chars = w.chars.to_a.uniq\n chars.length * chars.map{|c| freqs[c]}.inject{|sum,n| sum + n}\n end\nend", "def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend", "def word_sizes(str)\n word_count = Hash.new(0)\n\n str.split(' ').each do |word|\n word_count[word.size] += 1\n end\n\n word_count\n\nend", "def count\n self.wordcounts.map(&:count).inject(0, :+)\n end", "def analyze_words(words)\n pos_count = 0\n neg_count = 0\n neu_count = 0\n search_dictionary(words).each do |w|\n case w\n when 1\n pos_count +=1\n when -1\n neg_count +=1\n when 0\n neu_count +=1\n end\n end\n {positive: pos_count, negative: neg_count, neutral: neu_count}\n end", "def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend", "def intelligent_guesses(num)\n word_options = File.readlines('dictionary.txt').select do |word|\n word.length == num\n end\n\n most_common_letters = {}\n word_options.join(\"\").split(\"\\n\").join(\"\").each_char do |letter|\n if most_common_letters.has_key?(letter)\n most_common_letters[letter] += 1\n else\n most_common_letters[letter] = 1\n end\n end\n\n @most_common_letters = most_common_letters\n\n end", "def count_words(str)\n\n frase = str.gsub!(/\\W|\\_\\d/,\" \").split(\" \")\n frase.each do |palabra|\n\n veces = frase.count(palabra)\n hash[palabra] = veces\n\n end\n hash\n\n\n\n end", "def word_count_engine(document)\n document = document.gsub(/[^ 0-9A-Za-z]/, '').downcase.split(' ')\n\n store = {}\n max = 0\n\n document.each do |element|\n if store[element]\n store[element] += 1\n max = [store[element], max].max\n else\n store[element] = 1\n max = 1 if max == 0\n end\n end\n\n buckets = Array.new(max) { [] }\n\n store.each do |key, value|\n buckets[max - value].push([key, value.to_s])\n end\n\n buckets.flatten(1)\nend", "def words_longer_than(array,num)\n new_array = []\n array.map{ |w|\n new_array.push(w.count(\"e\"))\n }\n letter_per_word(new_array, new_array.length)\nend", "def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end", "def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend", "def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend", "def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend", "def word_sizes(string)\n word_count = Hash.new(0)\n\n string.split.each do |element|\n word_count[element.size] += 1\n end\n word_count\nend", "def solve( n = 1_000 )\n (1..n).inject( 0 ) {|sum, i| sum + i.in_words.delete(' -').length}\n end", "def word_sizes(string)\n split_string_array = string.split(\" \")\n keys = []\n results = {}\n\n split_string_array.each do |word|\n keys << word.length\n end\n\n keys.each do |key|\n results[key] = keys.count(key)\n end\n\n results.sort_by {|k,v| k}.to_h\nend", "def substrings(input, dictionary)\n\thash = {}\t\t\t\t\t# Initialize empty hash\n\tdictionary.each do |word|\n\t\t# For each word, count the number of times it appears\n\t\tcount = input.downcase.scan(word.downcase).length\n\t\tif count > 0\n\t\t\t# If greater than 0:\n\t\t\thash[word] = count\t# Add word => count to hash\n\t\tend\n\tend\n\thash\nend", "def word_sizes(str)\n\n\tcounts = Hash.new(0)\n\n\tstr.split.each do |word|\n\tcounts[word.size] += 1\n\tend\t\n\tcounts\nend", "def word_sizes(str)\n str.split.each_with_object({}) do |word, hsh|\n hsh[word.size] ||= 0\n hsh[word.size] += 1\n end\nend", "def count_words(words)\r\n word_hash = Hash.new(0)\r\n words.downcase.split.each do |word|\r\n word_hash[word] += 1\r\n end\r\n return word_hash\r\n\r\n\r\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 word_count(statement)\n words = {}\n wordsArr = statement.split(\" \")\n\n wordsArr.each do |word_key|\n words[word_key] ||= 0\n words[word_key] += 1\n end\n words\nend", "def substrings(phrase, dictionary)\n words = phrase.split(/\\W+/)\n \n counts = Hash.new(0)\n \n words.each do |w|\n dictionary.each do |d|\n if w.downcase.include?(d.downcase)\n counts[d] += 1\n end\n end\n end\n \n return counts\nend", "def word_sizes(string)\n\n arr_words = string.split \n hash_counts = Hash.new(0)\n\n arr_words.each do |word|\n size = word.size\n hash_counts[size] += 1\n end\n\n hash_counts\nend", "def word_sizes(str)\n length_hsh = {}\n\n str.split(' ').each do |word|\n if length_hsh.key?(word.length)\n length_hsh[word.length] += 1\n else\n length_hsh[word.length] = 1\n end\n end\n\n length_hsh\nend", "def word_sizes(sentence)\n cleaned = sentence.gsub(/[^0-9a-z]/i, ' ')\n grouped = cleaned.split.group_by {|x| x.length }\n results = grouped.each {|x, i| grouped[x] = i.length}\n end", "def word_sizes(str)\n ary = str.split\n # Create array of word lengths\n num_array = ary.map do |word|\n word.length\n end\n rtn_hsh = ary.each_with_object({}) do |word, hsh|\n hsh[word.length] = num_array.count(word.length)\n end\n rtn_hsh\nend", "def substrings(word_string, dictionary)\r\n results = {}\r\n count = 0\r\n word_array = (word_string.downcase).split(' ')\r\n dictionary.each do |search_phrase|\r\n word_array.each do |word|\r\n count+=1 if (word.include? search_phrase)\r\n end\r\n results[search_phrase] = count if count > 0\r\n count = 0\r\n end\r\n return results\r\nend", "def word_sizes(words_string)\n counts = Hash.new(0)\n words_string.split.each do |word|\n clean_word = word.delete('^A-Za-z')\n counts[clean_word.size] += 1\n end\n counts\nend", "def word_count(n=10)\n\t@word_count ||= sorted_word_count\t\n\t@word_count[0...n]\n\t \n end", "def word_counts(text)\n\tword_list = text.split(WORD_SPLIT)\n\tcounts = Hash.new(0)\n\tword_list.each { |word| counts[word] += 1 }\n\treturn counts\nend" ]
[ "0.72568667", "0.7204654", "0.71964574", "0.70637035", "0.6987363", "0.69575816", "0.6952126", "0.6943471", "0.6933816", "0.69300556", "0.6913659", "0.690781", "0.6889534", "0.6889459", "0.68821585", "0.6879063", "0.6877012", "0.6874214", "0.685833", "0.68466985", "0.68408954", "0.6800903", "0.6795427", "0.67924666", "0.67880315", "0.6780653", "0.67704374", "0.67565703", "0.6746093", "0.6722156", "0.67069405", "0.6700775", "0.67001677", "0.66988164", "0.66988164", "0.66951096", "0.66924393", "0.66848606", "0.6681837", "0.6679374", "0.6678769", "0.66740686", "0.6664865", "0.66574496", "0.6657183", "0.66530675", "0.66527295", "0.66499126", "0.6647384", "0.66441923", "0.6643023", "0.66428125", "0.66414624", "0.6638763", "0.6634741", "0.6634539", "0.66337717", "0.663118", "0.6621427", "0.66198593", "0.66187847", "0.66039675", "0.6601957", "0.65980965", "0.65910906", "0.65891933", "0.6584567", "0.6568442", "0.65642756", "0.65624416", "0.6560798", "0.65588504", "0.6551993", "0.65494794", "0.653791", "0.65259016", "0.6512939", "0.651038", "0.6509387", "0.6498025", "0.6497249", "0.6497163", "0.6496064", "0.64795524", "0.64782006", "0.6477804", "0.64709204", "0.6449741", "0.6449694", "0.64491", "0.6448806", "0.64474165", "0.64406395", "0.64262104", "0.642017", "0.64190453", "0.6418604", "0.6411992", "0.64075446", "0.6402786" ]
0.70758224
3
Returns the letter that the solver guesses Uses the strategy to determine the letter with the lowest score
def guess letters = @possible_letters.collect {|letter| [ score_for(letter),letter ]} letter = letters.min {|letter1,letter2| letter1 <=> letter2 } letter[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_letter\n\t\t# move the 'a' and 'b' jokers \n\t\tmove_joker_a\n\t\tmove_joker_b\n\n\t\t# get their new positons\n\t\tnew_a = @deck_of_cards.index(Card.new(:joker, 1))\n\t\tnew_b = @deck_of_cards.index(Card.new(:joker, 2))\n\n\t\t# perform a triple split around the positions of the jokers\n\t\ttriple_split(new_a, new_b) if new_a < new_b\n\t\ttriple_split(new_b, new_a) if new_b < new_a\n\n\t\t# perform a count cut with the value of the bottom card\n\t\tcount_cut(@deck_of_cards[53].value)\n\n\t\t# now that the deck has been properly mutated, we can now\n\t\t# get the output lettere by getting the value of the top card in the deck\n\t\t# and stepping down that many cards (including the top) and converting\n\t\t# the value of the ending card to a letter\n\t\tfinal_val = @deck_of_cards[@deck_of_cards[0].value].value\n\tend", "def get_starting_letter\n random_number = @random_number_generator.rand(0.0..1.0)\n\n @pair_probability_table.frequencies.select do |k, v|\n k[0] == ' ' && k[1] != ' ' && v >= random_number\n end.keys.sort.first[1]\n end", "def score_letter(ver, letter)\n ver.map do |point, list| \n if list.include?(letter.to_s)\n return point\n end\n end\n return 0 \n end", "def get_starting_letter\t\n\t\trandom_number = @random_number_generator.rand(0.0..1.0)\n\n @pair_probability_table.frequencies.select {|k, v| k[0] == ' ' &&\n k[1] != ' ' &&\n v >= random_number}.keys.sort.first[1]\n\tend", "def guess_letter(letter)\n won = false\n failed_guess = feedback(letter)\n if failed_guess\n @tries_left -= 1\n else\n won = won?(@display_word.split(\" \").join(\"\"))\n end\n won\n end", "def get_letter\n\n puts \"What percent did oyu score on your test/assignment?\"\n print \"> \"\n score = gets.chomp.to_i\n\n grades = {\n :F+ (0 ... 49),\n D: (50 ... 59),\n C: (60 ... 69),\n B: (70 ... 79),\n A: (80 ... 100)\n }\n\n grades.each do |grade, percent|\n if percent.to_a.include?(score)\n return grade\n end\n end\nend", "def guess_letter(letter)\n\t\tif @ans_word.include?(letter)\n\t\t\ti = @ans_word.index(letter)\n\t\t\t@guess.insert(i, letter)\n\t\t\t@guess.pop\n\t\t\tputs \"Good! You are getting closer: #{@guess*\"\"}\"\n\t\telse\n\t\t\tputs \"sorry, guess again\"\n\t\tend\n\tend", "def letter_guess\n letter = get_letter_player()\n check_letter_in_random_word(@guess_letter)\n if @correct_guess == false\n @failed_attempts += 1\n if @failed_attempts == 10\n @lose = true\n end\n end\n guess_word_status_string = @guess_word_status.join()\n if guess_word_status_string == @random_word\n @win = true\n end\n end", "def make_guess\n\t\tbegin\n\t\t\thighest_letter_left = freq_hash\n\t\t\t\t.sort_by{|k, v| v}\n\t\t\t\t.reverse\n\t\t\t\t.map{|char, freq| char}\n\t\t\t\t.detect{|char| !@guessed_letters.include?(char)}\n\n\t\t\traise \"Aw, damn! Got nothin' left. Let's start a new game.\" unless highest_letter_left\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\t\texit\n\t\telse\n\t\t\t@guessed_letters << highest_letter_left\n\t\t\thighest_letter_left\n\t\tend\n\tend", "def high(x)\n\n x = ('abcdefghijklmnopqrstuvwxyz')\n\n letterScore = {\n 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8,\n 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, 'n' => 14, 'o' => 15, 'p' => 16,\n 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24,\n 'y' => 25, 'z' => 26\n\n }\n\n end", "def guess letter\n raise InvalidGuessError if letter.strip.empty? || letter.length > 1\n letter = letter[0].upcase\n if @guesses.include?(letter)\n return {advance: false, message: \"#{letter} has already been played, silly!\"}\n else\n @guesses << letter\n end\n @guessed.each_with_index do |guessed_pos, index|\n if guessed_pos\n if letter == secret[index]\n return {advance: false, message: \"#{letter} has already been played, silly!\"}\n end\n else\n if letter == secret[index]\n reveal_all(letter)\n return {advance: true, message: \"We found #{letter}!\"}\n end\n end\n end\n {advance: true, message: \"Sorry, we did not find #{letter}!\"}\n end", "def highestRemainLetterOf word\n word.gsub!('*','.').downcase!\n @incorrectWord = @missingWord - word.chars\n getHighestAbilityLetterFrom(Regexp.compile('^'+word+'$')).pop[0]\nend", "def best_letter string\n alphabet = ('a'..'z').to_a\n frequency_hash = Hash['a' => 1]\n alphabet.each do |x|\n frequency_hash[x] = alphabet_frequency(string, x)\n end\n #puts frequency_hash\n number_alphabet [(alphabet_number(frequency_hash.min_by{|k,v| v}.first.split(\"\")).first + 1) % 26]\nend", "def guess(letter)\r\n if word_has?(letter)\r\n \tput_letter_on_board(letter)\r\n else\r\n wrong_letter(letter) if !@guesses.include? letter\r\n end\r\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 first_word player, board\n\t\t\twords = DICTIONARY.get_all(player.tiles)\n\t\t\tbest = ScrabbleWord.new('', 0, 0 ,0, :down)\n\t\t\twords.each do |word|\n\t\t\t\trow = board.row_size/2\n\t\t\t\tcol = board.row_size/2\n\t\t\t\tword.length.times do\n\t\t\t\t\tscore = 0\n\t\t\t\t\tif (0..14).cover?(row) && (0..14).cover?(col)\n\t\t\t\t\t\tscore = attempt_score(word, board, row, col, :down)[0]\n\t\t\t\t\tend\n\t\t\t\t\tif score and score > best[1]\n\t\t\t\t\t\tif rand > 0.5\n\t\t\t\t\t\t\tbest = ScrabbleWord.new(word, score, row, col, :down)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbest = ScrabbleWord.new(word, score, col, row, :across)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\trow -=1\n\t\t\t\tend\n\t\t\tend\n\t\t\t[best, best.score]\n\t\tend", "def guess_letter\n\t\tprint \"Your guess: \"\n\t\tguess = gets.chomp.downcase\n\t\treturn guess if guess == \"save\"\n\t\tif (guess.between?('a','z') && !(@guessed_letters.include? guess)\\\n\t\t\t&& guess.length == 1)\n\t\t\tprocess_guess(guess)\n\t\t\t@guessed_letters << guess\n\t\t\t@turns += 1\n\t\telse\n\t\t\tif guess.between?('a','z')\n\t\t\t\tputs \"\\nYour guess must be ONE letter\" unless guess.length == 1\n\t\t\t\tputs \"\\nYou've already guessed that!\" if @guessed_letters.include? guess\n\t\t\telse\n\t\t\t\tputs \"\\nYour guess must be a letter!\" unless guess.between?('a','z')\n\t\t\tend\n\t\t\tputs \"Try again!\\n\\n\"\n\t\t\tguess = guess_letter\n\t\tend\n\t\tguess\n\tend", "def guess_letter\n @unused_letters.pop\n end", "def alphabet_score(string)\n alpha = ('a'..'z').to_a\n\n words_with_points = string.split(' ').map { |word| [word.chars.map { |char| alpha.index(char) + 1 }.sum, word] }\n words_with_points.max_by { |inner| inner[0] }.last\nend", "def get_guess\n\t\twhile true\n\t\t\tguess = gets.chomp.upcase\n\t\t\treturn :save if guess == \"SAVE\" || guess == \"'SAVE'\"\n\t\t\tif guess.between?('A', 'Z') && guess.length == 1\n\t\t\t\tif @hits.include?(guess) || @misses.include?(guess)\n\t\t\t\t\tprint \"You guessed '#{ guess }' already. Select another letter: \"\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\treturn guess\n\t\t\tend\n\t\t\tprint \"Enter one letter for guess (or 'save' to save game): \"\n\t\tend\n\tend", "def guess!(letter)\n end", "def get_guess\n puts \"#{@name}'s turn!\"\n print \"Enter 1 to guess a letter, or 2 to guess a word: \"\n choice = gets.chomp.downcase\n if choice == \"1\"\n print \"Guess a letter: \"\n guess = gets.chomp.downcase\n if valid_letter_guess?(guess)\n return guess\n else\n self.get_guess\n end\n elsif choice == \"2\"\n print \"Guess a word: \"\n guess = gets.chomp.downcase\n if valid_word_guess?(guess)\n return guess\n else\n self.get_guess\n end\n end\n end", "def get_letter_player\n print \"Please give a letter: \"\n @guess_letter = gets.chomp.upcase\n puts \"\\nYou chose #{@guess_letter}\"\n end", "def letter_grade(score)\n if score >= 90\n return \"A\"\n elsif score >= 80 && score <= 89\n return \"B\"\n elsif score >= 70 && score <= 79\n return \"C\"\n elsif score >= 60 && score <= 69\n return \"D\"\n else\n return \"F\"\n end\nend", "def evaluate_players_letter()\n letter= @player1.give_letter()\n if @hiddenword1.determine_if_correct_letter_given(letter)\n p @hiddenword1.obscured_word\n @guessed_letters.push(letter)\n else\n @player1.lives-=1\n p \"Please try again\"\n p @guessed_letters\n p @hiddenword1.obscured_word\n end\n end", "def letter_grade(score)\n if score >= 90 \n return \"A\"\n elsif score >= 80\n \"B\"\n elsif score >= 70\n \"C\"\n elsif score >= 60\n \"D\"\n else \n \"F\"\nend\nend", "def highest_scoring_word\n return Scrabble::Scoring.highest_score_from(@plays)\n end", "def highest_scoring_word\n word = Scrabble::Scoring.highest_score_from(plays)\n return word\n end", "def guess_letter\n guess = \"\"\n if @letters_guessed.size > 0\n puts \"\\nSo far, you have already guessed the following letters:\"\n puts \"(\" + @letters_guessed.join(\", \") + \")\"\n end\n begin\n puts \"\\n\\nPlease enter a letter for your guess: \"\n puts \"(or type the entire keyword: 'SAVE' or 'EXIT')\"\n guess = gets.chomp.strip.upcase\n if guess == \"SAVE\"\n save_game\n elsif guess == \"EXIT\"\n puts \"\\nExiting the current round...\"\n puts \"\\n=================================================\"\n else\n error_msg1 = \"Selected letter was not of the correct format.\"\n raise ArgumentError.new(error_msg1) unless guess =~ /^[A-Z]$/\n error_msg2 = \"Selected letter has already been guessed.\"\n raise ArgumentError.new(error_msg2) if @letters_guessed.include?(guess)\n end\n rescue ArgumentError=>e\n puts \"Error: #{e.message}\"\n retry\n end\n return guess\n end", "def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend", "def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend", "def score_word (word)\n score = 0\n word = word.downcase\n word = word.split('')\n\n # award additional points per game rules\n if word.length >= 7 && word.length <= 10\n score =+ 8\n end\n\n # iterates over the input to assign score based on alphabet library\n letters = [\n { character: \"a\", quantity: 9, score: 1 },\n { character: \"b\", quantity: 2, score: 3 },\n { character: \"c\", quantity: 2, score: 3 },\n { character: \"d\", quantity: 4, score: 2 },\n { character: \"e\", quantity: 12, score: 1 },\n { character: \"f\", quantity: 2, score: 4 },\n { character: \"g\", quantity: 3, score: 2 },\n { character: \"h\", quantity: 2, score: 4 },\n { character: \"i\", quantity: 9, score: 1 },\n { character: \"j\", quantity: 1, score: 8 },\n { character: \"k\", quantity: 1, score: 5 },\n { character: \"l\", quantity: 4, score: 1 },\n { character: \"m\", quantity: 2, score: 3 },\n { character: \"n\", quantity: 6, score: 1 },\n { character: \"o\", quantity: 8, score: 1 },\n { character: \"p\", quantity: 2, score: 3 },\n { character: \"q\", quantity: 1, score: 10 },\n { character: \"r\", quantity: 6, score: 1 },\n { character: \"s\", quantity: 4, score: 1 },\n { character: \"t\", quantity: 6, score: 1 },\n { character: \"u\", quantity: 4, score: 1 },\n { character: \"v\", quantity: 2, score: 4 },\n { character: \"w\", quantity: 2, score: 4 },\n { character: \"x\", quantity: 1, score: 8 },\n { character: \"y\", quantity: 2, score: 4 },\n { character: \"z\", quantity: 1, score: 10 },\n ]\n word.each do |character|\n letters.each do |letter_ref|\n if character == letter_ref[:character]\n score = score + letter_ref[:score]\n end\n end\n end\n return score\nend", "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 score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, y: 4,\n z: 10}\n\n# Need to use @word with something to get the value of the letters combined \n\n\n return score\n end", "def get_new_letter\n loop do\n puts \"What letter would you like to guess?\"\n @guess = gets.chomp.downcase\n break if valid_letter?(@guess)\n end\n end", "def get_guess\n\t\t# There are turns left...\n\t\tif @turn < 9\n\t\t\tshow_board\n\t\t\tputs \"Enter your letter guess...\"\n\t\t\tletter = gets.chomp.downcase\n\t\t\tvalidate_letter(letter)\n\t\t# No turns left, show losing message and delete game if it was previously saved\n\t\telse\n\t\t\tputs\n\t\t\tshow_board\n\t\t\tputs \"Dangit, you ran out of turns!\"\n\t\t\tputs \"The word was #{@word.join}...\"\n\t\t\tif @running_saved_game != nil\n\t\t\t\tover_write_data\n\t\t\tend\n\t\t\tgo_again\n\t\tend\n\tend", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score >= 80\n \"B\"\n elsif score >= 70\n \"C\"\n elsif score >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def highest_scoring_word\n Scrabble::Scoring.highest_score_from(@plays_array)\n end", "def get_player_guess\n puts \"Guess a letter that has not been chosen yet or type 'save' to save game\"\n @input = gets.chomp.downcase\n @guess = (input.match(/[a-z]/) && input.length == 1) || input == 'save' ? input : '-'\n end", "def get_grade(scores)\n score_total = 0\n\n scores.each { |x| score_total = x + score_total }\n\n average = score_total / (scores.length)\n\n case\n when average >= 90\n letter = 'A'\n when average >= 80\n letter = 'B'\n when average >= 70\n letter = 'C'\n when average >= 60\n letter = 'D'\n else\n letter = 'F'\n end\n \n return letter\nend", "def character_score(character)\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n alphabet.index(character) + 1\nend", "def high(string)\n letter_scores = ('a'..'z').to_a\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores.index(char}\n score \n end\n words[word_scores.index(word_scores.max)]\nend", "def letters_to_guess\n @letters.map do |letter|\n if @user_guesses.include?(normalize_letter(letter))\n letter\n else\n nil\n end\n end\n end", "def getguess guess\r\n\t\t\t\t\t@spin_flag = false\r\n\t\t\t\t if guess.length == 1\r\n\t\t\t\t if check_repeated_choice guess\r\n\t\t\t\t @message = \"Already guessed this letter!\"\r\n\t\t\t\t if @console\r\n\t\t\t\t\t\t\t\t@output.puts \"#{@message}\"\r\n\t\t\t\t\t\t\t\tword_input = take_user_word_input\r\n\t\t\t\t\t\t\t\tvalid = false\r\n\t\t\t\t\t\t\t while !valid do\r\n\t\t if validate_input word_input\r\n\t\t valid = true\r\n\t\t else\r\n\t\t @output.puts \"Invalid input\"\r\n\t\t word_input = take_user_word_input\r\n\t\t end\r\n\t\t\t\t\t\t\t end\r\n\t\t\t\t\t\t\t\tif check_enter word_input\r\n\t\t\t\t\t\t\t\t\t\t@break_flag = true\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t getguess word_input\r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t@spin_flag = true\r\n\t\t\t\t end\r\n\t\t\t\t else\r\n\t\t\t\t \t@message=\"Guess a letter from the word/phrase.\"\r\n\t\t\t\t @guess_counter+=1\r\n\t\t\t\t check_guess guess\r\n\t\t\t\t set_guess_analysis guess\r\n\t\t\t\t end\r\n\t\t\t\t success = check_phrase @resulta.join(',').gsub(\",\",\"\")\r\n\t\t\t\t return success ? true : false\r\n\t\t\t\telse\r\n\t\t\t\t\t if check_phrase guess\r\n\t\t\t\t\t\t phrase = @secretword.chars\r\n\t\t\t\t\t\t i = 0\r\n\t\t\t\t\t\t while i < phrase.length do\r\n\t\t\t\t\t\t\t\t\t\t@resulta[i] = phrase[i]\r\n\t\t\t\t\t\t\t\t\t\ti += 1\r\n\t\t\t\t\t\t end\r\n\t\t\t\t\t\t return true\r\n\t\t\t\t\t else\r\n\t\t\t\t\t\t @num_guessed = 0\r\n\t\t\t\t\t\t incrementturn\r\n\t\t\t\t\t\t @guess_counter+=1\r\n\t\t\t\t\t\t set_guess_analysis guess\r\n\t\t\t\t\t\t return false\r\n\t\t\t\t\t end\r\n\t\t\t\tend\r\n\t\t\t\tend", "def next_unused_letter sol\n\n\tx = 'a'.ord\n\n\tfor i in 0...sol.size\n\t\tfor j in 0...sol[0].size\n\t\t\tif sol[i][j].ord > x\n\t\t\t\tx = sol[i][j].ord\n\t\t\tend\n\t\tend\n\tend\n\n\treturn (x + 1).chr\nend", "def guess(letter)\n # raise an execption\n # raise will 'break' the method if valid_guess? == false\n raise InvalidGuessException.new(\"Invalid guess!\") unless valid_guess?(letter)\n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def letter_grade(score)\n output = case score\n when 0...60\n 'F'\n when 60..69\n 'D'\n when 70..79\n 'C'\n when 80..89\n 'B'\n when 90..100\n 'A'\n end\n\n return output\nend", "def high(string)\n letter_scores = ('a'..'z').zip(1..26).to_h\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores[char]}\n score \n end\n words[word_scores.index(word_scores.max)]\nend", "def get_guess\n @guess = \"\"\n until @guess.match(/^[a-z]$/) && !@already_guessed.include?(@guess)\n print \"Please enter a letter. \"\n @guess = gets.chomp.downcase\n if @guess == 'save'\n save_game\n elsif @already_guessed.include?(@guess)\n puts \"You have already guessed that letter. Please try again.\"\n elsif !@guess.match(/^[a-z]$/)\n puts \"That is not a valid guess. Please enter a single letter.\"\n end\n end\n @guess\n end", "def letter_grade(score)\n if score>90\n \"A\"\n elsif score>=80 && score<=89\n \"B\"\n elsif score>=70 && score<=79\n \"C\"\n elsif score>=60 && score<=69\n \"D\"\n else\n \"F\"\n end\nend", "def scrabble(word)\n\npoints = {\n \t\"a\" => 1,\n \t\"e\" => 1,\n \t\"i\" => 1,\n \t\"o\" => 1,\n \t\"u\" => 1,\n \t\"l\" => 1,\n \t\"n\" => 1,\n \t\"r\" => 1,\n \t\"s\" => 1,\n \t\"t\" => 1,\n \t\"d\" => 2,\n \t\"g\" => 2,\n \t\"b\" => 3,\n \t\"c\" => 3,\n \t\"m\" => 3,\n \t\"p\" => 3,\n \t\"f\" => 4,\n \t\"h\" => 4,\n \t\"v\" => 4,\n \t\"w\" => 4,\n \t\"y\" => 4,\n \t\"k\" => 5,\n \t\"j\" => 8,\n \t\"x\" => 8,\n \t\"q\" => 10,\n \t\"z\" => 10,\n }\n puts word\n\n #create a varialbe to store a Score\n score =0\n #go to letter by letter througth word\n word.each_char do |letter|\n #check in proint for a key that matches letter from word\n #take it's value add it to word\n score += points[letter] #try with puts = points[letter] !access to points\n #output message with the full score result\n\nend\n puts \"#{word} is worth #{score} points\" # TRY TO PUT THIS BEFORE END!!\nend", "def scrabble(word)\n\tpoints = {\n\t\t1 => [A,E,I,O,U,L,N,R,S,T],\n\t\t2 => [D,G],\n\t\t3 => [B,C,M,P],\n\t\t4 => [F,H,V,W,Y],\n\t\t5 => [K],\n\t\t8 => [J, X],\n\t\t10 => [Q, Z]\n\t}\n \n def self.score(word)\n \ttotal_score = 0\n \tword.each_char do |char|\n \t\tSCORES.each do |score, letters|\n \t\t\tif letters.include? char.upcase\n \t\t\t\ttotal_score += score\n \t\t\tend\n \t\tend\n \tend\t\n\nend", "def guess(letter)\n raise InvalidGuessException.new(\"Invalid Guess!\") unless valid_guess?(letter)\n \n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score >= 80 && score <= 89\n \"B\"\n elsif score >= 70 && score <= 79\n \"C\"\n elsif score >= 60 && score <= 69\n \"D\"\n else\n \"F\"\n end\nend", "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 letter_grade(score)\n if score >= 90\n \"A\"\n elsif score >= 80 && score <= 89\n \"B\"\n elsif score >= 70 && score <= 79\n \"C\"\n elsif score >= 60 && score <= 69\n \"D\"\n else \n \"F\"\n end\nend", "def first_guess\n unmatched_pos || random_guess\n end", "def letter\n case @letter\n when \"q\"\n return \"qu\"\n else\n return @letter\n end\n end", "def get_word\n @word_to_guess.join\n end", "def score\n\n letters = word.split(//) #can also be typed .split(\"\")\n\n symbols = letters.map do|letter|\n letter.to_sym\n end\n\n word_score = symbols.reduce(0) do |sum, sym|\n sum + @letter_score[sym]\n end\n\n return word_score\n\n end", "def guess_letter\n \tloop do \n \t puts \"Guess a letter or type 'save' to save the game and continue later.\"\n \t letter = gets.chomp.downcase.strip\n \t if letter == \"save\"\n \t \tsave\n \t else\n if letter.match(/[a-z]/) && letter.length == 1\n \t\t return letter\n else\n \t puts \"Invalid Character - Try Again\"\n \t end\n end\n end\n end", "def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end", "def score_string(guess)\n results = Array.new()\n guess.split('').each_with_index do |char, index|\n if char == @code[index]\n results[index] = :h\n elsif @code.include? char\n results[index] = :n\n else\n results[index] = :m\n end\n end\n results\n end", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score <= 89 && score >= 80\n \"B\"\n elsif score <= 79 && score >= 70\n \"C\"\n elsif score <= 69 && score >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def get_map_letter_index(x_value)\n\tif x_value >= 0 && x_value <= 50\n\t\treturn 'A'\n\telsif x_value >= 50 && x_value <= 100\n\t\treturn 'B'\n\telsif x_value >= 100 && x_value <= 150\n\t\treturn 'C'\n\telsif x_value >= 150 && x_value <= 200\n\t\treturn 'D'\n\telsif x_value >= 200 && x_value <= 250\n\t\treturn 'E'\n\telsif x_value >= 250 && x_value <= 300\n\t\treturn 'F'\n\telsif x_value >= 300 && x_value <= 350\n\t\treturn 'G'\n\telsif x_value >= 350 && x_value <= 400\n\t\treturn 'H'\n\telsif x_value >= 400 && x_value <= 450\n\t\treturn 'I'\n\telsif x_value >= 450 && x_value <= 500\n\t\treturn 'J'\t\t\n\telse\n\t\treturn '?'\n\tend\nend", "def guess(letter)\r\n letter = letter.downcase\r\n num = 0\r\n #iterate through word comparing guessed letter to letter's in the word\r\n @word_arr.each_index do |i| \r\n if @word_arr[i] == letter\r\n #if the letter matches update the game board in the equivalent spot\r\n @gameboard[i] = letter\r\n num += 1\r\n end\r\n end\r\n #add letter to guessed database, and lower amount of guesses by one\r\n @guessed_letters << letter\r\n @guesses -= 1\r\n return num\r\n end", "def highest_word_score\n word = highest_scoring_word\n highest_score = Scrabble::Scoring.score(word)\n return highest_score\n end", "def guess\n\t\tputs \"Pick a letter. (enter 'save' at anytime to save the game)\"\n\t\tinput = gets.chomp.downcase\n\t\treturn input if input.size == 1\n\t\tif input == 'save'\n\t\t\tsave_game\n\t\t\treturn menu\n\t\tend\n\t\tputs \"That doesn't make sense. Try again.\"\n\t\treturn guess\n\tend", "def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\n end", "def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend", "def _LETTER\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ALPHA)\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"_\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_LETTER unless _tmp\n return _tmp\n end", "def score\n word_score = 0\n self.word.each_char do |letter|\n word_score += @letter_scores[letter.to_sym]\n end\n return word_score\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 letter_scores\n { \"A\"=>1, \"B\"=>3, \"C\"=>3, \"D\"=>2,\n \"E\"=>1, \"F\"=>4, \"G\"=>2, \"H\"=>4,\n \"I\"=>1, \"J\"=>8, \"K\"=>5, \"L\"=>1,\n \"M\"=>3, \"N\"=>1, \"O\"=>1, \"P\"=>3,\n \"Q\"=>10, \"R\"=>1, \"S\"=>1, \"T\"=>1,\n \"U\"=>1, \"V\"=>4, \"W\"=>4, \"X\"=>8,\n \"Y\"=>4, \"Z\"=>10\n }\n end", "def letter(freq)\n\tvals = $letter_frequency.values\n\tif vals.index(freq) != nil\n\t\treturn $letter_frequency.key(freq)\n\telse\n\t\tdifferences = []\n\t\tvals.each do |x|\n\t\t\tdifferences << (x - freq).abs\n\t\tend\n\t\tmin = differences.min\n\t\tindex_of_min = differences.index(min)\n\t\tfreq = vals[index_of_min]\n\t\treturn $letter_frequency.key(freq)\n\tend\nend", "def score\n # string\n answer = params[:answer]\n # also string now\n letters = params[:letters].gsub(/\\s+/, '')\n\n if check_letters(answer, letters)\n if check_dictionary(answer)\n @answer = 'Well done! Here is your score: XXXX'\n else @answer = 'This is not even an English word, loser!'\n end\n else\n @answer = 'Sorry, your word is not contained in the letters grid'\n end\n end", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score.between?(80,89)\n \"B\"\n elsif score.between?(70,79)\n \"C\"\n elsif score.between?(60,69)\n \"D\"\n else\n \"F\"\n end\nend", "def chosen_plaintext(cipher)\n letter = cipher.encrypt(@alphabet.at(0)[0])\n return @alphabet.index(letter)\n end", "def current_letter\n @letters[self.position]\n end", "def get_guess\n puts('type letter or whole capital:')\n guessed = gets.chomp\n unless valid_guess(guessed)\n puts 'only letters or spaces allowed'\n get_guess\n end\n guessed.upcase\n end", "def get_word( letter )\n\t\t# Try to find a word that starts with parameter\n\t\tword = @sorted_list.select{|l| l[0] == letter ? true : false }[0]\n\t\t# If no luck, pass nil back up\n\t\treturn nil if word == nil\n\t\t\n\t\t#TODO:appen || lenght\n\t\t@sorted_list.delete_at( @sorted_list.index( word ) )\n\n\t\t# Update the start/end counts in the maps\n\t\t@start_map[letter] -= 1\n\t\t@end_map[ word[word.length-1] ] -= 1\n\t\tputs \"next word is #{word}\"\n\t\t\n\t\treturn word\n end", "def letterGrade(average)\r\n case average\r\n \twhen 90..100 then\r\n \t\treturn 'A'\r\n \twhen 80..89 then\r\n \t\treturn 'B'\r\n \twhen 70..79 then\r\n \t\treturn 'C'\r\n \twhen 60..69 then\r\n \t\treturn 'D'\r\n \telse\r\n \t\treturn 'F' \t\r\n end\r\nend", "def guess char\n #get 1st char\n \n if char.nil?\n raise ArgumentError, 'Argument is not string' \n return false\n end\n if char.length != 1\n raise ArgumentError, 'Argument is not string'\n return false\n end \n if char.match(/[a-zA-Z]/) == nil\n raise ArgumentError, 'Argument is not string' \n return false\n end\n \n pick = char.chr.downcase\n\n #catch replicant entries\n if @guesses.match(\"#{pick}\") != nil\n # @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n if @wrong_guesses.match(\"#{pick}\") != nil\n# @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n #actual match\n if @word.match(\"#{pick}\") != nil\n guesses << pick # 1st char\n else\n wrong_guesses << pick # \n @attempt += 1\n end\n \n # build up guess string i.e. \"----a-e\"\n @word_with_guesses = '';\n @check_win_or_lose = :win\n word.each_char { |a|\n if @guesses.match(\"#{a}\") != nil \n @word_with_guesses << a\n else\n @word_with_guesses << '-'\n @check_win_or_lose = :play\n end\n }\n \n #check game status\n if @attempt > 6\n @check_win_or_lose = :lose\n end\n \n return true\n end", "def closest_character_index(position)\n\t\t\t# Move caret into position\n\t\t\t# Try to get as close to the position of the cursor as possible\n\t\t\twidth = @font.width(@string, @height)\n\t\t\tx = @position.x\n\t\t\tmouse_x = $window.mouse.position_in_world.x\n\t\t\t\n\t\t\t# Figure out where mouse_x is along the continuum from x to x+width\n\t\t\t# Use that to guess what the closest letter is\n\t\t\t# * basically, this algorithm is assuming fixed width, but it works pretty well\n\t\t\tpercent = (mouse_x - x)/width.to_f\n\t\t\ti = (percent * (@string.length)).to_i\n\t\t\t\n\t\t\ti = 0 if i < 0\n\t\t\ti = @string.length if i > @string.length\n\t\t\t\n\t\t\treturn i\n\t\tend", "def guess(letter)\r\n\t\t\r\n\t\tif(@word.include?(letter))\r\n\t\t @good_guesses.add(letter)\r\n\t end\r\n\t\r\n\tend", "def guess\n # takes human input and stores guess\n puts 'Pick a letter'\n self.human_guess = gets.chomp\n end", "def highest_word_score\n return Scrabble::Scoring.score(highest_scoring_word)\n end", "def get_most_used_letter(word)\n\t\tletter_counts = Hash.new(0)\n\t\tword.each do |letter|\n\t\t\tletter_counts[letter] += 1\n\t\tend\n\n\t\tmax_letter = \"\"\n\t\tmax_letter_count = 0\n\t\tletter_counts.each do |letter, count| \n\t\t\tif(count > max_letter_count)\n\t\t\t\tmax_letter_count = count\n\t\t\t\tmax_letter = letter\n\t\t\tend\n\t\tend\n\n\t\tmax_letter\t\t\n\tend", "def computer_letter_choice(current_word, turn_number)\n puts \"Computer is thinking...\"\n\n # node = @t.root\n # next_letter = \"\"\n\n # # Searches down the trie changing the node of the current word\n # current_word.split('').each do |char|\n # break unless node.walk!(char)\n # end\n\n # winning_node = recursive_winning_node_search(node)\n # unless winning_node.nil? # Winning node exists\n # next_letter = winning_node.state\n # else\n # words_array = []\n # @t.children(current_word).each do |word|\n # words_array << word\n # end\n\n # words_array = words_array.sort_by(&:length) # Sort words by length\n # longest_word = words_array[-1] # Choose longest word given current_word prefix\n\n # # Debugging output\n # puts \"Computer chose longest word: #{longest_word}\"\n\n # next_letter = longest_word[turn_number]\n # end\n\n # return next_letter\n\n # Old method of selecting winning words\n win_words = @t.children(current_word) \n odd_length_words = []\n even_length_words = []\n\n # Go through all winning words and separate into odd and even length strings\n win_words.each do |word|\n if word.length % 2 == 0\n even_length_words << word\n else\n odd_length_words << word if self.is_winning_word?(word)\n end\n end\n\n # Debugging output for 'n'\n # puts \"Winning player words\"\n # even_length_words.each do |word|\n # puts word if self.is_winning_word?(word)\n # end\n\n optimal_word = ''\n if odd_length_words.length > 0 # Winning word/strategy exists, choose randomly from\n optimal_word = odd_length_words.sample\n\n # Not sure about this line\n # if optimal_word.length == (turn_number + 1)\n # optimal_word = odd_length_words.sample\n # end\n elsif even_length_words.length > 0 # No winning word exists, stall\n even_length_words = even_length_words.sort_by(&:length) # Sort even length words by length\n optimal_word = even_length_words[-1] # Select last element of even length words (invariance guarantees longest string)\n else # No words left to choose from, admit defeat\n optimal_word = \"x\"\n end\n\n # Debugging output\n puts \"Computer chose word #{optimal_word}\"\n\n next_letter = (optimal_word.length > 1 ? optimal_word[turn_number] : optimal_word[0])\n\n return next_letter\n end", "def guess(letter)\n # STEP 1: check to make sure the letter is not any non-letter character and\n # raises an error if it is\n if /^[a-zA-Z]+$/.match(letter)\n letter.downcase!\n else raise_error(\"Invalid letter\")\n end\n\n # STEP 2: check to make sure the user does not guess the same letter more\n # than once\n if @guesses.include? letter; return false; end\n if @wrong_guesses.include? letter; return false; end\n\n # STEP 3: check to see if the guessed letter matches any letters in the \n # word\n if @word.include? letter\n @guesses += letter\n # if there is a match, update the word_with_guesses to show where\n # in the string the letter was matched\n @word.each_char.with_index do |c, i|\n if c == letter\n @word_with_guesses[i] = c\n end\n end \n else \n @wrong_guesses += letter\n @attempts += 1\n end\n # update the number of attempts and call the function to check if\n # the user won, lost, or continues playing\n check_win_or_lose\n end", "def letter_grade(score)\n if score >= 90\n grade = \"A\"\n elsif score >= 80\n grade = \"B\"\n elsif score >= 70\n grade = \"C\"\n elsif score >= 60\n grade = \"D\"\n else\n grade = \"F\"\n end\nend", "def getGradeLetter(grade)\n if grade >= 0.9 && grade <= 1.0 then\n \"A\"\n elsif grade >= 0.8 && grade < 0.9 then\n \"B\"\n elsif grade >= 0.7 && grade < 0.8 then\n \"C\"\n elsif grade >= 0.6 && grade < 0.7 then\n \"D\"\n else\n \"F\"\n end\n end", "def getHighestAbilityLetterFrom pattern\n remainWords = []\n @currentBucket.each {|bucketWord|\n remainWords += [bucketWord] if pattern.match(bucketWord)\n }\n remainWords.each{|word|\n remainWords.delete word if (word.chars - @incorrectWord) != word.chars\n }\n remainWords = checkNewWords {|word| pattern.match(word)} if remainWords == []\n @currentBucket = remainWords\n\n dict = statisticLetter remainWords\n @missingWord.each {|letter| dict.delete letter}\n getSortListFrom dict\nend", "def next_greatest_letter(letters, target)\n letters.each do |letter|\n return letter if letter > target\n end\n letters[0]\nend", "def scrabble_calc( word )\n\n\tletters = {\n\t\t\"A\" => 1,\n\t\t\"E\" => 1,\n\t\t\"I\" => 1,\n\t\t\"O\" => 1,\n\t\t\"U\" => 1,\n\t\t\"L\" => 1,\n\t\t\"N\" => 1,\n\t\t\"R\" => 1,\n\t\t\"S\" => 1,\n\t\t\"T\" => 1,\n\t\t\"D\" => 2,\n\t\t\"G\" => 2,\n\t\t\"B\" => 3,\n\t\t\"C\" => 3,\n\t\t\"M\" => 3,\n\t\t\"P\" => 3,\n\t\t\"F\" => 4,\n\t\t\"H\" => 4,\n\t\t\"V\" => 4,\n\t\t\"W\" => 4,\n\t\t\"Y\" => 4,\n\t\t\"K\" => 5,\n\t\t\"J\" => 8,\n\t\t\"X\" => 8,\n\t\t\"Q\" => 10,\n\t\t\"Z\" => 10,\n\t}\n\n\tword_total = 0\n\tword.upcase.each_char do |key|\n\t\tword_total += letters[key]\n\tend\n\n\tputs \"The total score for \\\"#{word}\\\" is #{word_total}.\"\n\treturn word_total\nend", "def highest_scoring_word\n Scoring.highest_score_from(plays)\n end", "def guess?(letter)\n if @guessed_letter.include?(letter)\n puts \"You already guessed that letter!\"\n return\n end\n @guessed_letter << letter\n ​\n found = false\n if @characters.include?(letter)\n found = true \n puts \"Yes that letter is in the word!\"\n else\n puts \"Wrong answer!\"\n end \n ​\n @characters.each_with_index do |char, index|\n if char == letter\n @displayed_character[index] = letter\n end\n end\n found\n end", "def score\n @attempt = params[:word]\n @letters_list = params[:letters]\n @not_in_grid = \"Sorry but #{@attempt} can't be built out of #{@letters_list}\"\n @not_english = \"Sorry but #{@attempt} does not seem to be a valid English word...\"\n @success = \"Congratulation! #{@attempt} is a valid English word!\"\n @result = nil\n\n @word_check = english_word(@attempt)\n\n if grid_include?(@attempt, @letters_list) && @word_check[:found]\n @result = @success\n elsif grid_include?(@attempt, @letters_list) == false\n @result = @not_in_grid\n elsif @word_check[:found] == false\n @result = @not_english\n end\n end", "def guess(letter)\r\n\t\t@guessed << letter.downcase\r\n\t\t@word[0].each_index do |i| #Iterate through indexes instead of values\r\n\t\t\tif @word.dig(0,i) == letter #since @word is an array inside an array, dig helps us look in word ([0]) each index for the letter.\r\n\t\t\t\t@hidden_word[i] = letter #if found, substitute \"_\" for the letter guessed in the same index for @hidden_word\r\n\t\t\tend\r\n\t\tend\r\n\t\tp @hidden_word #give feedback of results\r\n\tend", "def highest_word_score\n Scrabble::Scoring.score(Scrabble::Scoring.highest_score_from(@plays_array))\n end" ]
[ "0.6716559", "0.6707428", "0.6695332", "0.6690874", "0.66757935", "0.66717863", "0.66715163", "0.66393197", "0.6610986", "0.65861034", "0.65775305", "0.65690815", "0.65652484", "0.65220696", "0.6504551", "0.647341", "0.6461107", "0.6450771", "0.6450236", "0.64088917", "0.6381632", "0.6350771", "0.6317797", "0.63019407", "0.6299162", "0.62770075", "0.62709326", "0.62535644", "0.6245784", "0.62412167", "0.62412167", "0.62360394", "0.62288916", "0.6214324", "0.6207461", "0.62043625", "0.61937904", "0.61833763", "0.61812294", "0.6181005", "0.6172394", "0.61714274", "0.6160684", "0.61407655", "0.61335105", "0.61305887", "0.6116712", "0.6116098", "0.6114272", "0.61079204", "0.61010677", "0.6092718", "0.6089068", "0.6078205", "0.60709876", "0.6066145", "0.6065894", "0.6056588", "0.60428894", "0.60407406", "0.602585", "0.6023114", "0.60223794", "0.6021284", "0.601804", "0.60175085", "0.60094595", "0.6002807", "0.6002351", "0.6001357", "0.5999874", "0.5994145", "0.598568", "0.59830725", "0.5976638", "0.5970205", "0.596356", "0.59616", "0.59549844", "0.5954518", "0.59494543", "0.5947539", "0.5942239", "0.59346545", "0.59288067", "0.59271866", "0.5924389", "0.5919439", "0.5918642", "0.5917786", "0.5911206", "0.5909242", "0.5905594", "0.589008", "0.58873904", "0.58857894", "0.5873985", "0.5870975", "0.58641183", "0.5859752" ]
0.8592044
0
Tell the solver that the letter does not appear in the solution
def wrong_guess(letter) @possible_letters.delete(letter) @dictionary.reject_words_that_contain(letter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end", "def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end", "def no_indices(guess)\n @candidate_words.reject! { |word| word.include?(guess) }\n end", "def show_wrong_letters\n puts \"These letters are not in the word: #{@wrong_letters.join(\", \")}\"\n puts \"\\n\"\n end", "def nonpoint?(letter)\n index = @layout.index(letter)\n [0, 1, 2, 9, 10, 11, 3, 6, 18, 21, 24].include?(index)\n end", "def guess_letter\n @unused_letters.pop\n end", "def good_guess(pattern)\n merge(pattern)\n @dictionary.keep_only_words_that_match(@solution)\n @possible_letters.delete(letter_in(pattern))\n end", "def failed_attemps\n\t\tselected_letters.select {|letter| !word.include?(letter)}.size\n\tend", "def missing_letter(word)\n # your code goes here\n alpha = ('a'..'z').to_a\n index = alpha.index word.first.downcase\n word.each do |letter|\n if letter.downcase != alpha[index]\n alpha[index] < letter ? (return alpha[index]) : (return alpha[index].upcase)\n end\n index +=1\n end\n\nend", "def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end", "def check_letters(letter)\n progress(letter)\n count = 0\n @word_to_guess.each do |char|\n if char == letter\n @hidden_word[count] = letter\n else\n @hidden_word \n end\n count +=1 \n end\n puts @hidden_word\n @hidden_word\n end", "def missing_letters\n missing = Array.new\n ('a'..'z').each {|l| missing << l if @hist[l] == 0}\n missing\n end", "def wrong_letter(letter)\r\n \t@chances -= 1\r\n @guesses << letter\r\n end", "def wrong_letter(letter)\n @chances -= 1\n @guesses << letter\n end", "def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end", "def wrong_guess(letter)\n\t\tif !@attempted_letters.include?(letter)\n\t\t\tputs \"WRONG....\"\n\t\t\t@attempted_letters << letter\n\t\t\t@number_of_guesses -= 1 \n\t\t\tp @number_of_guesses\n\t\t\tp @display\n\t\t\tp \"you have #{@number_of_guesses} guesses left...\"\n\t\t\treturn true\n\t\tend\n\tend", "def check_guessed_letter(word,letter,available_letters)\n\n\tif word.include?(letter)\n\t\treturn 0\n\telsif !available_letters.include?(letter)\n\t\treturn 0\n\telse\n\t\t$missed_letters.push(letter)\n\t\treturn -1\n\tend\nend", "def guess(letter)\r\n\t\t@guessed << letter.downcase\r\n\t\t@word[0].each_index do |i| #Iterate through indexes instead of values\r\n\t\t\tif @word.dig(0,i) == letter #since @word is an array inside an array, dig helps us look in word ([0]) each index for the letter.\r\n\t\t\t\t@hidden_word[i] = letter #if found, substitute \"_\" for the letter guessed in the same index for @hidden_word\r\n\t\t\tend\r\n\t\tend\r\n\t\tp @hidden_word #give feedback of results\r\n\tend", "def check_guess(letter)\n @indices = gameboard[0].each_index.select { |i| gameboard[0][i].downcase == letter }\n if @indices.empty?\n incorrect_guesses << letter\n puts 'Sorry, the secret word does not contain that letter'\n else\n @indices.each do |index|\n gameboard[1][index] = gameboard[0][index] # letter\n end\n puts 'Good guess!'\n end\n end", "def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end", "def letter_check(letter)\n @word.chars.each_with_index do |letter_in_word, index|\n if letter == letter_in_word\n @result_str[index] = letter\n end\n end\n if !@word.include?(letter)\n puts \"Sorry try again\"\n end\n @result_str\n end", "def missing_letters(string)\n alphabet='a'..'z'\n alphabet.reject {|el|string.downcase.include?(el)}\nend", "def missing_letters(string)\nend", "def check_guess(word, char)\n if word.downcase.include?(char.downcase) && AVAILABLE_LETTERS.include?(char.downcase)\n AVAILABLE_LETTERS.delete(char.downcase)\n else\n AVAILABLE_LETTERS.delete(char.downcase)\n $incorrect_guesses += 1\n end\n puts display_word(word)\nend", "def missing_letter(word)\n word.each_with_index do |letter, i|\n return letter.next if word[i + 1] != letter.next\n end\nend", "def invalid?(guess)\n\t\t@guessed_letters.include?(guess)\n\tend", "def missing_from_letters\n word.chars.uniq.inject(\"\") do |memo, l|\n difference = word.count(l) - letters.count(l)\n if difference > 0\n memo += l * difference\n end\n memo\n end\n end", "def test_index word, guess, index\r\n (word[index] == guess)? \"!\" : \"?\" #if the indexes match it means outputs a \"!\", else it means the letter exists in the word but not in that exact index and outputs a \"?\" \r\nend", "def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\n end", "def guess(letter)\r\n\t\t\r\n\t\tif(@word.include?(letter))\r\n\t\t @good_guesses.add(letter)\r\n\t end\r\n\t\r\n\tend", "def exclude_letters\n if @options[:exclude]\n @letters.tr!(@options[:exclude],'')\n end\n end", "def guess(letter)\r\n if word_has?(letter)\r\n \tput_letter_on_board(letter)\r\n else\r\n wrong_letter(letter) if !@guesses.include? letter\r\n end\r\n end", "def missing_letters(string)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.reject { |x| string.downcase.include?(x) }\nend", "def print_puzzle(word,guessed_letters = [])\n word.each_char do |char|\n if guessed_letters.include?(char)\n print \"#{char}\"\n else\n print \"-\"\n end\n end\nend", "def find_missing_letter(range)\n letters = range.split(\"\")\n full_letters = (letters[0]..letters[-1]).to_a\n full_letters.each do |letter|\n if letters.include?(letter) \n\n elsif not letters.include?(letter)\n return letter\n end\n if letters == full_letters\n return nil\n end\n end\n \n \n\nend", "def missing_letters(string)\n letters = ('a'..'z').to_a\n letters.reject { |char| string.downcase.include?(char) }\nend", "def missing_letters(string)\n string = string.downcase\n (\"a\"..\"z\").to_a.reject {|letter| string.include?(letter) }\nend", "def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\n end", "def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end", "def compare_letter(letter)\n \tif @wrong.include?(letter) || @right.include?(letter)\n \tputs \"You already guessed that letter\"\n \treturn \"\"\n\telsif word.include? letter\n\t\t@right << letter \n\telse \n\t\tputs \"Letter not in the word.\"\n\t\t@lives-=1\n\t\t@wrong << letter\n\tend\n\n end", "def guess!(letter)\n end", "def find_missing_letter(range)\n missing_letters = []\n user_input = range.split('')\n alphabet = user_input[0].upto(user_input.last).to_a\n\n alphabet.each do |letter|\n missing_letters << letter unless user_input.include? letter\n # missing_letters << letter\n # end\n end\n\n # if missing_letters.empty?\n # return nil\n # else\n # missing_letters.join\n # end\n\n missing_letters.join if missing_letters.empty?\nend", "def missing_letters(string)\n letters = %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]\n letters.select { |c| c unless string.include?(c) }\nend", "def missing_letters(string)\n ('a'..'z').reject { |letter| string.downcase.include? letter }\nend", "def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end", "def presence_of_letter(user_guess)\n\t\tif @game_word.include? user_guess \n\t\t\tputs \"Nice! Your letter appears #{@presence_counter} times. Here is an update on your progress: \"\n\t\t\tp @current_state.join\n\t\t\t# return @current_state.join\n\t\telse\n\t\t\tputs \"Too bad! \\\"#{user_guess}\\\" is not in the mystery word! Here is your progress so far: \"\n\t\t\tp @current_state.join\n\t\t\t# return \"Too bad!\"\n\t\tend\n\n\t\tif @current_state.include?(\" _ \" )\n\t\t\tputs \"You have #{@total_guesses} guesses remaining.\"\n\t\tend\n\tend", "def game_over()\n if $hidden_word_arr.exclude?(\"_\")\n puts \"You win the game! Well done!\"\n $end_game = true\n elsif $turns == 0\n puts \"It looks like you weren't able to guess the right letters. The word was #{$word}. Better luck next time!\"\n $end_game = true\n end\n end", "def get_incorrect\n @mismatches = @solution.crossword.get_mismatches(params[:letters])\n if @mismatches.empty?\n @solution.update_attributes(is_complete: true)\n end\n end", "def guess(letter)\n is_letter = /^[a-zA-Z]$/\n if letter.nil? or letter.empty? or not letter.match(is_letter)\n throw ArgumentError \n end\n letter.downcase!\n if self.guesses.include? letter or self.wrong_guesses.include? letter\n return false\n end\n if self.word.include? letter\n self.guesses = self.guesses + letter\n else\n self.wrong_guesses = self.wrong_guesses + letter\n end\n return true\n end", "def missing_letters(string)\n ('a'..'z').to_a.reject { |letter| string.include?(letter) }\nend", "def include_letter(word, letter)\n index = 0 \n if @letter_bank.include?(letter) \n puts \"You already tried this letter\"\n else \n word.each_char do |l|\n if l == letter\n @blanks[index] = letter\n end \n index += 1\n end \n @guess_count -= 1 \n @letter_bank << letter\n end \n puts \"You have #{guess_count} guesses left\"\n p @blanks\n end", "def uses_available_letters?(input, letters_in_hand)\n\n input_array = input.upcase.chars\n\n letters_in_hand.each do |letter|\n\n if input_array.include? letter\n index = input_array.index(letter)\n input_array.delete_at(index)\n end\n end\n\n return input_array.length == 0\n\nend", "def show_wrong_letters\n\t\t@wrong_letters.sort.join(\", \")\n\tend", "def guess(letters)\n raise ArgumentError if letters == \"\"\n raise ArgumentError if letters !~ %r{\\w}\n letters.downcase!\n if @word.include?(letters) \n !@guesses.include?(letters) ? @guesses << letters : false\n\n else\n @wrong_guesses.include?(letters) ? false : wrong_guesses << letters \n end\n end", "def find_missing_letter(range)\n start_index = 0\n reference = \"abcdefghijklmnopqrstuvwxyz\".split(\"\")\n sorted_range = range.split(\"\").sort\n missing_letters = []\n\n reference.each_with_index do |letter, index|\n if sorted_range[0] == letter\n start_index = index\n end\n end\n\n sorted_range.each do |letter|\n unless letter == reference[start_index]\n missing_letters << reference[start_index]\n start_index+=1 #If a letter is missing, need to add twice to skip over to the next one\n end\n start_index+=1\n end\n\n if missing_letters.any?\n return missing_letters.join(\"\")\n else\n return nil\n end\n\nend", "def missing_letters(string)\n ('a'..'z').reject {|letter| string.include?(letter)}\nend", "def uses_available_letters? (input, drawn_letters)\n is_valid = \"default\"\n word_letters = make_word_array(input)\n word_letters.each do |letter|\n if drawn_letters.include?letter\n is_valid = true\n puts \"letter valid \" + \"#{is_valid}\"\n letter_index = drawn_letters.index(letter)\n drawn_letters.delete_at(letter_index)\n else\n is_valid = false\n puts \"letter not valid \" + \"#{is_valid}\"\n return is_valid\n end\n end\n return is_valid\nend", "def evaluate_players_letter()\n letter= @player1.give_letter()\n if @hiddenword1.determine_if_correct_letter_given(letter)\n p @hiddenword1.obscured_word\n @guessed_letters.push(letter)\n else\n @player1.lives-=1\n p \"Please try again\"\n p @guessed_letters\n p @hiddenword1.obscured_word\n end\n end", "def missing_letters(phrase)\n counts = Hash.new(0)\n phrase.chars.each do |character|\n counts[character] += 1\n end\n missing = []\n ('a'..'z').each do |letter|\n missing << letter if counts[letter] == 0\n end\n missing\nend", "def reject?(word)\n config.rejects.include?(word)\n end", "def find_missing_letter(arr)\n missing_letter = ''\n (arr[0]...arr[-1]).each do |x|\n if !arr.include?(x)\n print x\n end\n end\n\nend", "def not_in_alphabet?(letter)\n !UPPERCASE.include?(letter) && !LOWERCASE.include?(letter)\nend", "def errorHandler(letter)\r\n if letter == \"N\" or letter == \"S\" or letter == \"E\" or letter == \"W\" or letter == \"U\" or letter == \"D\" or letter == \"I\" or letter == \"Q\" or letter == \"C\" or letter == \"L\" or letter == \"P\" or letter == \"F\" or letter == \"R\" or letter == \"M\" or letter == \"H\" or letter == \"T\" \r\n return letter\r\n else\r\n puts(\"\\n\\nI DONT KNOW WHAT YOU ARE TELLING ME TO DO:\\n\")\r\n return \"H\"\r\n end\r\nend", "def guess_letter(letter)\n\t\tif @ans_word.include?(letter)\n\t\t\ti = @ans_word.index(letter)\n\t\t\t@guess.insert(i, letter)\n\t\t\t@guess.pop\n\t\t\tputs \"Good! You are getting closer: #{@guess*\"\"}\"\n\t\telse\n\t\t\tputs \"sorry, guess again\"\n\t\tend\n\tend", "def letter_test(letter)\n # If it is in the word pass it to find_locations(), if not pass it to wrong_letter()\n $word.include?(letter) ? find_locations(letter) : wrong_letter(letter)\nend", "def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend", "def missing_letters(string)\n return ('a'..'z').to_a.select {|e| !string.include?(e)}\nend", "def generate_results\n !(@incomplete_word.include? \"_\") ?\n puts(\"Congratulations, you won.\") :\n puts(\"\\nYou failed to guess the words.\")\n end", "def guess?(letter)\n if @guessed_letter.include?(letter)\n puts \"You already guessed that letter!\"\n return\n end\n @guessed_letter << letter\n ​\n found = false\n if @characters.include?(letter)\n found = true \n puts \"Yes that letter is in the word!\"\n else\n puts \"Wrong answer!\"\n end \n ​\n @characters.each_with_index do |char, index|\n if char == letter\n @displayed_character[index] = letter\n end\n end\n found\n end", "def not_valid?\n tst = @potential_key.split('')\n\n tst.each do |check|\n if @@low_alpha[check].nil? && @@up_alpha[check].nil?\n @result = true\n break\n else \n @result = false\n @valid_key = @potential_key\n end\n end\n\n @result\n end", "def handle_response(letter, indices)\n @dictionary.select! do |w|\n word_still_valid?(w,letter,indices)\n end\n end", "def respond_to_guess(letter)\n letter = letter.clone.downcase\n\n if @incorrect_letters.include?(letter) || @progress.include?(letter) || @progress.include?(letter.upcase)\n puts \"You already guessed that letter!\"\n puts \"\"\n elsif @word.include?(letter) || @word.include?(letter.upcase)\n update_progress(letter)\n unless @progress.include?(\"_\")\n @round_finished = true\n @guessed = true\n end\n else\n @incorrect_letters << letter\n @round_finished = true if @incorrect_letters.size == 6\n end\n print_hangman\n end", "def negative?(word)\n [ 'dull',\n 'boring',\n 'annoying',\n 'chaotic'\n ].include?(word)\nend", "def missing_letters(string)\n missing = []\n ('a'..'z').each do |letter|\n if !string.include?(letter)\n missing << letter\n end\n end\n missing\nend", "def check_for_correct_letters(user_guess)\n @correct_letters << user_guess.count do |guess_char|\n @solution.include?(guess_char)\n end\n end", "def solved?\n @solution !~ /-/\n end", "def get_letter() \n loop do\n puts \"Please enter a letter.\"\n $input = gets.chomp\n $input = $input.downcase\n if $input.count(\"a-z\") == 0\n puts \"\"\n puts \"Sorry, that isn't a letter!\"\n elsif $input.size > 1\n puts \"\"\n puts \"You entered too many letters!\"\n elsif $guessed.exclude?($input) && $hidden_word_arr.exclude?($input)\n break\n else\n puts \"\"\n puts \"You already guessed that one!\"\n end\n end \n end", "def letter!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n \n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n\n end", "def guess\n puts \"Enter a letter\"\n puts\n letter = gets.chomp\n if @word_array.include?(letter)\n @word_array.each_with_index do |char, index|\n if char == letter\n @puzzle_array[index] = letter\n end\n end\n puts \"Correct!\"\n else\n puts \"Try again!\"\n end\n @counter -= 1\n end", "def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end", "def find_missing_letter(range)\n # result = []\n # prev_char = \"\"\n # array = range.split(\"\")\n\n # array.each do |char|\n # if prev_char.next != char\n # result << prev_char.next\n # end\n # prev_char = char\n # end\n # result\n\n first_letter = range[0]\n last_letter = range[-1]\n\n test_range = (first_letter..last_letter).to_a\n result = \"\"\n\n test_range.each do |letter|\n result += letter unless range.include?(letter)\n end\n \n result != \"\" ? result : nil \nend", "def missing_letters(string)\n output = []\n\n ('a'..'z').each do |el|\n if !string.include?(el) \n output << el\n end\n end\n output\nend", "def guess_letter(letter)\n won = false\n failed_guess = feedback(letter)\n if failed_guess\n @tries_left -= 1\n else\n won = won?(@display_word.split(\" \").join(\"\"))\n end\n won\n end", "def letter!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 72 )\n\n\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line \n if @input.peek(1) == 0x24 || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a ) || @input.peek( 1 ).between?( 0xc0, 0xd6 ) || @input.peek( 1 ).between?( 0xd8, 0xf6 ) || @input.peek( 1 ).between?( 0xf8, 0x1fff ) || @input.peek( 1 ).between?( 0x3040, 0x318f ) || @input.peek( 1 ).between?( 0x3300, 0x337f ) || @input.peek( 1 ).between?( 0x3400, 0x3d2d ) || @input.peek( 1 ).between?( 0x4e00, 0x9fff ) || @input.peek( 1 ).between?( 0xf900, 0xfaff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 72 )\n\n\n end", "def not!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 64 )\n\n type = NOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 185:7: '!'\n match( 0x21 )\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__, 64 )\n\n end", "def missing_letters(string)\n missing_letters = []\n str = string.downcase\n ('a'..'z').each do |c|\n missing_letters << c if !str.include?(c)\n end\n missing_letters\nend", "def guess_correct(letter)\n\t\tif @secret_word.include?(letter)\n\t\t\t@secret_word.each_with_index do |correct, index|\n\t\t\tif letter == correct\n\t\t\t\t@display[2*index+1] = letter\n\t\t\t\tputs @display\n\t\t\t\t@attempted_letters << letter\n\t\t\t\tend\n\t\t\tend\n\t\t\t@number_of_guesses -= 1\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend", "def guessed?\n \t(word.split('') - selected_letters).empty?\n\tend", "def not!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 61 )\n\n type = NOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 389:7: '!'\n match( 0x21 )\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__, 61 )\n\n end", "def dangler_situation\n (@i == @len) && !valid_word?(@prefix)\n end", "def get_letters(game)\n game.letters.split(\"\").reject{|letter| game.word.upcase.include?(letter)}.join(\" \")\nend", "def setguessedletter(letter)\n\t\t@letter_exists = false\n\t\t\n\t\t@guessed_letters.each do |char|\n\t\t\tif char == letter\n\t\t\t\t@letter_exists = true\n\t\t\tend\n\t\tend\n\t\treturn @letter_exists\n\tend", "def check_word(word)\n letters = make_letter_array(@tiles)\n w = word.split(\"\")\n for letter in w\n if letters.index(letter)\n letters[letters.index(letter)] = nil\n letters.compact!\n else\n return false\n end\n end\n return true\n end", "def show_letter\n split_blanks = hidden_word.split(\" \")\n occurences = []\n occurences = (0 ... @secret_word.length).find_all { |i| @secret_word[i,1] == @current_guess}\n occurences.each { |i| split_blanks[i] = @current_guess}\n @hidden_word = split_blanks.join(\" \")\n hidden_word\n end", "def handle_guess_response(board)\n\t\t@board = board\n\t\t# remove word if word[i] != board[i]\n\t\t# remove word if letter is right but has it elsewhere too\n\t\t@board.bar.each_with_index do |char, i|\n\t\t\tnext if char.nil?\n\t\t\t@valid_words.delete_if do |word| \n\t\t\t\tword[i] != char || word.count(char) != board.bar.count(char)\n\t\t\tend\n\t\tend\n\t\t\n\t\t@valid_words\n\tend", "def incorrect_guess(game)\n for letter in game.guessed_letters\n unless game.hiddenword.word.split(\"\").include?(letter)\n game.player.lives -= 1\n end\n end\n return game.player.lives\nend", "def show_letter\n split_blanks = hidden_word.split(\"\")\n occurences = []\n occurences = (0 ... secret_word.length).find_all { |i| secret_word[i,1] == current_guess}\n occurences.each { |i| split_blanks[i] = current_guess}\n @hidden_word = split_blanks.join(\"\")\n puts hidden_word\n end", "def blank\n if params[:answer]\n\n # JS: choose\n else\n @letters = @game.available_letters\n end\n end", "def legal(word)\n @illegal_words[word] == nil && @legal_limbo[word] == nil\n end", "def missing_letters(string)\n\n result = []\n\n (\"a\"..\"z\").each do |ch|\n result << ch if string.downcase.include?(ch) == false\n\n end\n result\nend" ]
[ "0.69877553", "0.69462293", "0.6907651", "0.64770323", "0.64410424", "0.64104825", "0.6355883", "0.63545567", "0.63487494", "0.634209", "0.62722474", "0.62282974", "0.62254494", "0.6211572", "0.6199264", "0.6196783", "0.6166386", "0.61600214", "0.6124472", "0.6095786", "0.60662085", "0.6060212", "0.6025421", "0.5998093", "0.59743506", "0.59720045", "0.5969317", "0.5961878", "0.59599406", "0.5959176", "0.59558386", "0.59545743", "0.59459484", "0.5938785", "0.59307355", "0.5904019", "0.5901884", "0.5869747", "0.58510226", "0.5833384", "0.5825832", "0.58169603", "0.5815769", "0.5815029", "0.5795938", "0.57921684", "0.57907903", "0.5784956", "0.5784755", "0.57778287", "0.5773018", "0.5772338", "0.5770624", "0.5768281", "0.57654154", "0.5765049", "0.57631344", "0.575121", "0.57337743", "0.5713939", "0.57088536", "0.570461", "0.568152", "0.5679758", "0.5669022", "0.56585944", "0.56555843", "0.5651146", "0.56406283", "0.56394887", "0.5638923", "0.56381553", "0.5623928", "0.5619233", "0.56019527", "0.55981374", "0.5596262", "0.55930907", "0.5591254", "0.55852765", "0.557528", "0.5568452", "0.5564169", "0.5563337", "0.55545497", "0.55496657", "0.5547268", "0.55456847", "0.5540679", "0.5539353", "0.5539306", "0.55379164", "0.5526049", "0.5524849", "0.55246454", "0.5523842", "0.55221415", "0.5513988", "0.55064684", "0.550285" ]
0.7322945
0
Tell the solver that the letter was a good guess, by placing the letter in the solution e.g. to indicate that 'a' is a good guess for 'hangman' pass 'aa'
def good_guess(pattern) merge(pattern) @dictionary.keep_only_words_that_match(@solution) @possible_letters.delete(letter_in(pattern)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_letter(letter)\n\t\tif @ans_word.include?(letter)\n\t\t\ti = @ans_word.index(letter)\n\t\t\t@guess.insert(i, letter)\n\t\t\t@guess.pop\n\t\t\tputs \"Good! You are getting closer: #{@guess*\"\"}\"\n\t\telse\n\t\t\tputs \"sorry, guess again\"\n\t\tend\n\tend", "def guess(letter)\r\n if word_has?(letter)\r\n \tput_letter_on_board(letter)\r\n else\r\n wrong_letter(letter) if !@guesses.include? letter\r\n end\r\n end", "def guess(letter)\r\n\t\t\r\n\t\tif(@word.include?(letter))\r\n\t\t @good_guesses.add(letter)\r\n\t end\r\n\t\r\n\tend", "def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end", "def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\n end", "def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\n end", "def guess(letter)\r\n\t\t@guessed << letter.downcase\r\n\t\t@word[0].each_index do |i| #Iterate through indexes instead of values\r\n\t\t\tif @word.dig(0,i) == letter #since @word is an array inside an array, dig helps us look in word ([0]) each index for the letter.\r\n\t\t\t\t@hidden_word[i] = letter #if found, substitute \"_\" for the letter guessed in the same index for @hidden_word\r\n\t\t\tend\r\n\t\tend\r\n\t\tp @hidden_word #give feedback of results\r\n\tend", "def guess letter\n raise InvalidGuessError if letter.strip.empty? || letter.length > 1\n letter = letter[0].upcase\n if @guesses.include?(letter)\n return {advance: false, message: \"#{letter} has already been played, silly!\"}\n else\n @guesses << letter\n end\n @guessed.each_with_index do |guessed_pos, index|\n if guessed_pos\n if letter == secret[index]\n return {advance: false, message: \"#{letter} has already been played, silly!\"}\n end\n else\n if letter == secret[index]\n reveal_all(letter)\n return {advance: true, message: \"We found #{letter}!\"}\n end\n end\n end\n {advance: true, message: \"Sorry, we did not find #{letter}!\"}\n end", "def guess(letter)\n # raise an execption\n # raise will 'break' the method if valid_guess? == false\n raise InvalidGuessException.new(\"Invalid guess!\") unless valid_guess?(letter)\n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def guess?(letter)\n if @guessed_letter.include?(letter)\n puts \"You already guessed that letter!\"\n return\n end\n @guessed_letter << letter\n ​\n found = false\n if @characters.include?(letter)\n found = true \n puts \"Yes that letter is in the word!\"\n else\n puts \"Wrong answer!\"\n end \n ​\n @characters.each_with_index do |char, index|\n if char == letter\n @displayed_character[index] = letter\n end\n end\n found\n end", "def respond_to_guess(letter)\n letter = letter.clone.downcase\n\n if @incorrect_letters.include?(letter) || @progress.include?(letter) || @progress.include?(letter.upcase)\n puts \"You already guessed that letter!\"\n puts \"\"\n elsif @word.include?(letter) || @word.include?(letter.upcase)\n update_progress(letter)\n unless @progress.include?(\"_\")\n @round_finished = true\n @guessed = true\n end\n else\n @incorrect_letters << letter\n @round_finished = true if @incorrect_letters.size == 6\n end\n print_hangman\n end", "def guess(letter)\n is_letter = /^[a-zA-Z]$/\n if letter.nil? or letter.empty? or not letter.match(is_letter)\n throw ArgumentError \n end\n letter.downcase!\n if self.guesses.include? letter or self.wrong_guesses.include? letter\n return false\n end\n if self.word.include? letter\n self.guesses = self.guesses + letter\n else\n self.wrong_guesses = self.wrong_guesses + letter\n end\n return true\n end", "def guess(letter)\n raise InvalidGuessException.new(\"Invalid Guess!\") unless valid_guess?(letter)\n \n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def guess!(letter)\n end", "def guess(letter)\n # STEP 1: check to make sure the letter is not any non-letter character and\n # raises an error if it is\n if /^[a-zA-Z]+$/.match(letter)\n letter.downcase!\n else raise_error(\"Invalid letter\")\n end\n\n # STEP 2: check to make sure the user does not guess the same letter more\n # than once\n if @guesses.include? letter; return false; end\n if @wrong_guesses.include? letter; return false; end\n\n # STEP 3: check to see if the guessed letter matches any letters in the \n # word\n if @word.include? letter\n @guesses += letter\n # if there is a match, update the word_with_guesses to show where\n # in the string the letter was matched\n @word.each_char.with_index do |c, i|\n if c == letter\n @word_with_guesses[i] = c\n end\n end \n else \n @wrong_guesses += letter\n @attempts += 1\n end\n # update the number of attempts and call the function to check if\n # the user won, lost, or continues playing\n check_win_or_lose\n end", "def guess_correct(letter)\n\t\tif @secret_word.include?(letter)\n\t\t\t@secret_word.each_with_index do |correct, index|\n\t\t\tif letter == correct\n\t\t\t\t@display[2*index+1] = letter\n\t\t\t\tputs @display\n\t\t\t\t@attempted_letters << letter\n\t\t\t\tend\n\t\t\tend\n\t\t\t@number_of_guesses -= 1\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend", "def guess_letter(letter)\n won = false\n failed_guess = feedback(letter)\n if failed_guess\n @tries_left -= 1\n else\n won = won?(@display_word.split(\" \").join(\"\"))\n end\n won\n end", "def guess(letters)\n raise ArgumentError if letters == \"\"\n raise ArgumentError if letters !~ %r{\\w}\n letters.downcase!\n if @word.include?(letters) \n !@guesses.include?(letters) ? @guesses << letters : false\n\n else\n @wrong_guesses.include?(letters) ? false : wrong_guesses << letters \n end\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 guess\n puts \"Enter a letter\"\n puts\n letter = gets.chomp\n if @word_array.include?(letter)\n @word_array.each_with_index do |char, index|\n if char == letter\n @puzzle_array[index] = letter\n end\n end\n puts \"Correct!\"\n else\n puts \"Try again!\"\n end\n @counter -= 1\n end", "def guess\n letters = @possible_letters.collect {|letter| [ score_for(letter),letter ]}\n letter = letters.min {|letter1,letter2| letter1 <=> letter2 }\n letter[1]\n end", "def check_letter(guess)\n if @word.include? guess\n puts \"You chose wisely!\"\n #find which position(s) the guess is in the word array\n correct_index_arr = @word.each_index.select { |i| @word[i] == guess }\n # rebuild @game_status with the correct letter guessed into that position of the word\n correct_index_arr.each do |index|\n @game_status[index] = guess\n end\n # if they don't make guess and put an empty response\n elsif guess.empty?\n puts \"You didn't make a guess. Try again.\"\n # if the user guesses the same wrong letter again\n elsif @wrong_guesses.include? guess\n puts \"You guessed that before! Try again.\"\n else\n @guesses_remaining -= 1\n puts \"wrong guess, the guesses remaining: #{@guesses_remaining}\"\n @wrong_guesses.push(guess)\n end\n end", "def setguessmatch(letter)\n\t\t@guess_count +=1\t\n\t\t@guessed_letters << letter\n\n\t\t@starting_word.each_with_index do |char,index|\n\t\t\tif char == letter\n\t\t\t\t@guessing_word[index] = char\n\t\t\t\tif starting_word == guessing_word\n\t\t\t\t\t@game_status = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def letter_guess\n letter = get_letter_player()\n check_letter_in_random_word(@guess_letter)\n if @correct_guess == false\n @failed_attempts += 1\n if @failed_attempts == 10\n @lose = true\n end\n end\n guess_word_status_string = @guess_word_status.join()\n if guess_word_status_string == @random_word\n @win = true\n end\n end", "def guess(letter)\n \n raise ArgumentError if letter.nil? ## Raise an error if the letter is null.\n raise ArgumentError if letter == '' ## Raise an error if the user entered an empty string. \n raise ArgumentError if !letter.match(/[a-zA-Z]/) ## Raise an error is the user entered a letter that is not in the alphabet.\n\n \n letter.downcase!\n \n # If word includes letter\n if(word.include? letter)\n # And the letter isnt already in guess\n unless (guesses.include? letter)\n # Add guessed word to guesses\n guesses.concat(letter)\n \n # For test case 14\n for i in 0..word.length do\n # If the guessedLetter is in the string, replace it with the guessed letter\n if(letter == word[i])\n word_with_guesses[i] = letter\n end\n \n end\n \n # If guessed letters match word set to win\n if(word_with_guesses == word)\n @check_win_or_lose = :win\n end\n \n return true # return true valid guess\n end #end unless\n return false # invalid guess false\n else\n unless (wrong_guesses.include? letter)\n # Add the guessed letter to the list of incorrected guesses\n wrong_guesses.concat(letter)\n \n # Wrong guesses greater than 7 set win or loose to loose\n if(@wrong_guesses.length>=7)\n @check_win_or_lose = :lose\n end\n \n return true\n end # end unless\n return false # invalid guess\n end # end for \n end", "def check_letters(letter)\n progress(letter)\n count = 0\n @word_to_guess.each do |char|\n if char == letter\n @hidden_word[count] = letter\n else\n @hidden_word \n end\n count +=1 \n end\n puts @hidden_word\n @hidden_word\n end", "def check_guess(letter)\n @indices = gameboard[0].each_index.select { |i| gameboard[0][i].downcase == letter }\n if @indices.empty?\n incorrect_guesses << letter\n puts 'Sorry, the secret word does not contain that letter'\n else\n @indices.each do |index|\n gameboard[1][index] = gameboard[0][index] # letter\n end\n puts 'Good guess!'\n end\n end", "def evaluate_players_letter()\n letter= @player1.give_letter()\n if @hiddenword1.determine_if_correct_letter_given(letter)\n p @hiddenword1.obscured_word\n @guessed_letters.push(letter)\n else\n @player1.lives-=1\n p \"Please try again\"\n p @guessed_letters\n p @hiddenword1.obscured_word\n end\n end", "def test_guess_passes_letter\n\t\tword = \"hello\"\n\t\tchar = \"e\"\n\t\th= Hangman.new(word)\n\t\tassert_equal true, h.guess?(char)\n\tend", "def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end", "def guess?(letter)\n correct = false\n @@secret.length.times do |i|\n if (@@secret[i] == letter && @@progress[i] == '_')\n @@progress[i] = letter\n correct = true\n end\n end\n @@incorrect << letter if !correct\n @@guesses += 1\n puts(\"secret: #{@@secret}\")\n correct\n end", "def guess char\n #get 1st char\n \n if char.nil?\n raise ArgumentError, 'Argument is not string' \n return false\n end\n if char.length != 1\n raise ArgumentError, 'Argument is not string'\n return false\n end \n if char.match(/[a-zA-Z]/) == nil\n raise ArgumentError, 'Argument is not string' \n return false\n end\n \n pick = char.chr.downcase\n\n #catch replicant entries\n if @guesses.match(\"#{pick}\") != nil\n # @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n if @wrong_guesses.match(\"#{pick}\") != nil\n# @word_with_guesses << \"You have already used that letter\"\n return false\n end \n \n #actual match\n if @word.match(\"#{pick}\") != nil\n guesses << pick # 1st char\n else\n wrong_guesses << pick # \n @attempt += 1\n end\n \n # build up guess string i.e. \"----a-e\"\n @word_with_guesses = '';\n @check_win_or_lose = :win\n word.each_char { |a|\n if @guesses.match(\"#{a}\") != nil \n @word_with_guesses << a\n else\n @word_with_guesses << '-'\n @check_win_or_lose = :play\n end\n }\n \n #check game status\n if @attempt > 6\n @check_win_or_lose = :lose\n end\n \n return true\n end", "def guess_letter\n guess = \"\"\n if @letters_guessed.size > 0\n puts \"\\nSo far, you have already guessed the following letters:\"\n puts \"(\" + @letters_guessed.join(\", \") + \")\"\n end\n begin\n puts \"\\n\\nPlease enter a letter for your guess: \"\n puts \"(or type the entire keyword: 'SAVE' or 'EXIT')\"\n guess = gets.chomp.strip.upcase\n if guess == \"SAVE\"\n save_game\n elsif guess == \"EXIT\"\n puts \"\\nExiting the current round...\"\n puts \"\\n=================================================\"\n else\n error_msg1 = \"Selected letter was not of the correct format.\"\n raise ArgumentError.new(error_msg1) unless guess =~ /^[A-Z]$/\n error_msg2 = \"Selected letter has already been guessed.\"\n raise ArgumentError.new(error_msg2) if @letters_guessed.include?(guess)\n end\n rescue ArgumentError=>e\n puts \"Error: #{e.message}\"\n retry\n end\n return guess\n end", "def guess_letter\n\t\tprint \"Your guess: \"\n\t\tguess = gets.chomp.downcase\n\t\treturn guess if guess == \"save\"\n\t\tif (guess.between?('a','z') && !(@guessed_letters.include? guess)\\\n\t\t\t&& guess.length == 1)\n\t\t\tprocess_guess(guess)\n\t\t\t@guessed_letters << guess\n\t\t\t@turns += 1\n\t\telse\n\t\t\tif guess.between?('a','z')\n\t\t\t\tputs \"\\nYour guess must be ONE letter\" unless guess.length == 1\n\t\t\t\tputs \"\\nYou've already guessed that!\" if @guessed_letters.include? guess\n\t\t\telse\n\t\t\t\tputs \"\\nYour guess must be a letter!\" unless guess.between?('a','z')\n\t\t\tend\n\t\t\tputs \"Try again!\\n\\n\"\n\t\t\tguess = guess_letter\n\t\tend\n\t\tguess\n\tend", "def wrong_guess(letter)\n\t\tif !@attempted_letters.include?(letter)\n\t\t\tputs \"WRONG....\"\n\t\t\t@attempted_letters << letter\n\t\t\t@number_of_guesses -= 1 \n\t\t\tp @number_of_guesses\n\t\t\tp @display\n\t\t\tp \"you have #{@number_of_guesses} guesses left...\"\n\t\t\treturn true\n\t\tend\n\tend", "def letter_guess(input,dead_man)\n if @letters_guessed_array.include?(input) || dead_man.wrong_letters.include?(input)\n puts \"You have already guessed this letter!\"\n display(dead_man)\n elsif @correct_word_array.include?(input)\n @letters_guessed_array.each_with_index do |letter, index|\n @letters_guessed_array[index] = input if @correct_word_array[index] == input\n end\n puts \"The letter #{input} is in the word.\"\n if @letters_guessed_array.include?(\"__\")\n display(dead_man)\n else\n win\n end\n else\n puts \"The letter #{input} is not in the word.\"\n dead_man.wrong_letters.push(input)\n dead_man.wrong_guesses += 1\n display(dead_man)\n end\n end", "def guess(letter)\r\n letter = letter.downcase\r\n #find the guess\r\n returnValue = @word.count(letter) \r\n case returnValue\r\n when 0\r\n #Meaning this was an invalid guess\r\n @count-=1\r\n #maybe for debugging purposes\r\n @guessedFalse << letter\r\n else\r\n #maybe for debugging purposes\r\n @guessedTrue << letter\r\n #get all index of a matching letter\r\n arryOfMatchesIndexs = (0 ... @word.length).find_all { |i| @word[i,1] == letter }\r\n #iterate through the matches and replace the shadow word\r\n arryOfMatchesIndexs.each { |x| \r\n @shadowWord[x] = letter \r\n }\r\n \r\n #if the shadowWord array does not have any underscroes then we win \r\n if (@shadowWord.index(\"_\")).nil? \r\n @win = true\r\n end\r\n end\r\n #return the value of found\r\n returnValue\r\n end", "def guess? (letter)\n \t\tif word.include?(letter)==true\n \t\tvalid_guess(letter)\n \telse\n \t\tinvalid_guess(letter)\n \tend\n end", "def add_to_guess\n @guess = @guess.map!.with_index do |character, index|\n @word.downcase[index] == @letter ? @word[index] : character\n end\n end", "def guessing_for_the_win(letter)\n\t\tif repeat_guess(letter)\n\t\telsif guess_correct(letter)\n\t\telse wrong_guess(letter)\n\t\tend \n\n\t\tif @secret_word == @display\n\t\t\tcongrats\n\t\telsif @number_of_guesses > 0 \n\n\t\t\tp \"Keep guessing\"\n\t\telse\n\t\t\tfailure\n\t\tend\n\tend", "def correct_guess?(letter)\n if @word_selected.include?(letter)\n if @correct_guesses.empty?\n @correct_guesses << letter\n elsif @correct_guesses.include?(letter)\n puts 'Letter already guessed! try another one!'\n else\n @correct_guesses << letter\n end\n return true\n end\n false\n end", "def check_guess(guess)\n # checks human guess, displays discovered, and return if letter found\n letter_found = false\n self.secret_word.split('').each_with_index do |chr, ind|\n if chr == guess\n self.currently_discovered[ind] = chr\n letter_found = true\n end\n end\n p self.currently_discovered\n letter_found\n end", "def print_puzzle(word,guessed_letters = [])\n word.each_char do |char|\n if guessed_letters.include?(char)\n print \"#{char}\"\n else\n print \"-\"\n end\n end\nend", "def guess(guess)\r\n\t\t# Make sure the guess is either a letter or the whole word\r\n\t\tif guess.length != 1 && guess.length != @win_word.length\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp \"Guess a letter, or the complete word!\"\r\n\t\t# check for repeated guesses\r\n\t\telsif @past_guesses.include? guess\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"You guessed that already!\"\r\n\t\t# check if they guessed the entire word correctly\r\n\t\telsif guess == @win_word\r\n\t\t\twin\r\n\t\t# if the letter is not in the word\r\n\t\telsif !@win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tif @remaining_guesses == 1\r\n\t\t\t\tlose\r\n\t\t\telse\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"Sorry, try again!\"\r\n\t\t\tend\r\n\t\t# if the letter is in the word\r\n\t\telsif @win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tupdate_hint(guess)\r\n\t\t\tif @hint_str == @win_word\r\n\t\t\t\twin\r\n\t\t\telse\r\n\t\t\t\tp \"Nice guess!\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tp \"Error\"\r\n\t\tend\r\n\r\n\tend", "def check_guess(letter)\n\t\t# If the guessed letter is in the word, replace \"_\" in the guess variable with the letter in the right spot\n\t\t@word.each_with_index do |l, i|\n\t\t\tif l == letter\n\t\t\t\t@guess[i] = letter\n\t\t\tend\n\t\tend\n\t\t# If the guessed word and the answer are the same, the user won!\n\t\t# Show message and if the game was previously saved, delete it\n\t\tif @word.join == @guess\n\t\t\tputs \n\t\t\tshow_board\n\t\t\tputs \"You won!!\"\n\t\t\tif @running_saved_game != nil\n\t\t\t\tover_write_data\n\t\t\tend\n\t\t\tgo_again\n\t\t# Got a letter but didn't win. Get another guess\n\t\telsif @word.include?(letter)\n\t\t\tputs\n\t\t\tputs \"You got a letter!\"\n\t\t\tget_guess\n\t\t# Letter wasn't in word, put letter in missed letter variable and guess again\n\t\telse\n\t\t\tputs \n\t\t\tputs \"No #{letter}'s.\"\n\t\t\t@wrong_letters.sub!(\"_\", letter)\n\t\t\t@turn += 1\n\t\t\tget_guess\n\t\tend\n\tend", "def input_evaluation(guess, correct_word)\n if correct_word.word.include?(guess)\n # We learned that .each_with_index can be used to locate each letter corresponding with each spacific index\n # Then if the letter matches it will subsitue the \"_\", at the correct index, with the corresponding letter\n correct_word.word.each_with_index do |letter, index|\n if letter == guess\n correct_word.progress[index] = guess\n end\n end\n else\n # Storing wrong letters into an array and updating max_guesses\n correct_word.wrong_guesses << guess\n correct_word.max_guesses -= 3\n end\nend", "def check_guess\n @guess_count += 1 # Increment guess count\n @guess_feedback = \"\"\n return true if @input == @current_word # Return true value if input is same as chosen word - correctly guessed word\n i = 0\n @input.split('').each do |letter| # Split user input and check if each letter is in exact position as chosen word, or if it is somewhere or not in the word at all\n # Use << to append to string as this is faster and doesn't create new string objects, as opposed to concatenation using a +\n # Below line uses nested ternary operators, where the condition is first evaluated and then if true, the first statement is executed, if false, the second statement is executed\n # This allows the code to be more readable and shorter\n @current_word.index(letter) == i ? (@guess_feedback << \"exact \") : (@current_word.index(letter).nil? ? (@guess_feedback << \"miss \") : (@guess_feedback << \"near \"))\n i += 1\n end\n puts @guess_feedback\n end", "def check_letter(input_letter)\n # Each time we check, the number of guesses is increased \n @guess_count += 1\n \n # Transform the words into arrays for convenience\n arr_word_to_guess = @word_to_guess.split('') \n arr_guessed_word = @guessed_word.split('') \n \n # Search for the input_letter in arr_word_to_guess\n index_found = arr_word_to_guess.each_index.select{|i| arr_word_to_guess[i] == input_letter}\n \n if (index_found == []) then\n return false \n else \n # if the letter is found, update the guessed word\n n_found = index_found.size\n i = 0 \n n_found.times do \n arr_guessed_word[index_found[i]] = input_letter\n i += 1\n end\n @guessed_word = arr_guessed_word.join('')\n return true\n end \n end", "def guess(char)\n \n #Check if letter guessed is nil or empty or not a letter and throw error\n if char == nil \n raise ArgumentError\n elsif char == \"\"\n raise ArgumentError\n elsif !char.match(/[A-Za-z]/)\n raise ArgumentError\n end\n \n #Convert character to downcase to make it case insensitive.\n #Check if letter has already been guessed in correct or wrong guess buckets\n char = char.downcase\n if @guesses.include? char \n return false\n elsif @wrong_guesses.include? char\n return false\n end\n \n #Check if word contains letter. If yes, increment guesses by 1. If not, increment wrong guesses by 1.\n if @word.include? char\n @guesses += char\n return true\n else\n @wrong_guesses += char\n return true\n end\n\n end", "def guess(letter_guessed)\r\n# \ti. Run loop to see if the letter has been guessed yet.\r\n\tif word_split.include? (letter_guessed)\r\n\t\t# a. Iterate through the word characters to see if it includes the letter guessed\r\n\t\t@word_split.each_with_index do |char, index|\r\n\t\t\tif word_split[index] == letter_guessed\r\n\t\t\t\t@guessed[index] = letter_guessed\r\n\t\t\tend #if\r\n\t\tend #do\r\n\t\t# b. If it is right then put you have guessed a letter and then ask for another guess repeat method\r\n\t\tputs \"You guessed correctly. Enter another guess\"\r\n# \t\tc. If it is wrong then put you have guessed wrong and ask for another guess. Maybe return how many guesses you have left?\r\n\telse\r\n\t\t@guess_count +=1\r\n\t\tputs \"You guessed incorrectly. Enter another guess\"\r\n\tend#if\r\nend", "def guess(letter, secret_word)\r\n \t\t\r\n \t\t\r\n \t\tright = false\r\n \t\r\n \t\tsecret_word.each do|char| \r\n\r\n \t\t\tif char == letter\r\n \t\t\t\tright = true\r\n \t\t\tend\r\n \t\tend\r\n \t\t\r\n \t\tif right == true\r\n \t\t\tputs \"correct!\"\r\n \t\t\t\r\n \t\telse\r\n \t\t\tputs \"wrong!\"\r\n \t\tend\r\n \t\t@guess_count -= 1\r\n\r\n \t\tputs \"Guesses remaining #{guess_count}\"\r\n \t\t\r\n\r\n\r\n \tend", "def guess(letter)\r\n letter = letter.downcase\r\n num = 0\r\n #iterate through word comparing guessed letter to letter's in the word\r\n @word_arr.each_index do |i| \r\n if @word_arr[i] == letter\r\n #if the letter matches update the game board in the equivalent spot\r\n @gameboard[i] = letter\r\n num += 1\r\n end\r\n end\r\n #add letter to guessed database, and lower amount of guesses by one\r\n @guessed_letters << letter\r\n @guesses -= 1\r\n return num\r\n end", "def check_for_correct_letters(user_guess)\n @correct_letters << user_guess.count do |guess_char|\n @solution.include?(guess_char)\n end\n end", "def guess(input,dead_man)\n input.upcase!\n if input.length == 1\n letter_guess(input,dead_man) \n else\n whole_word_guess(input,dead_man)\n end\n end", "def getguess guess\r\n\t\t\t\t\t@spin_flag = false\r\n\t\t\t\t if guess.length == 1\r\n\t\t\t\t if check_repeated_choice guess\r\n\t\t\t\t @message = \"Already guessed this letter!\"\r\n\t\t\t\t if @console\r\n\t\t\t\t\t\t\t\t@output.puts \"#{@message}\"\r\n\t\t\t\t\t\t\t\tword_input = take_user_word_input\r\n\t\t\t\t\t\t\t\tvalid = false\r\n\t\t\t\t\t\t\t while !valid do\r\n\t\t if validate_input word_input\r\n\t\t valid = true\r\n\t\t else\r\n\t\t @output.puts \"Invalid input\"\r\n\t\t word_input = take_user_word_input\r\n\t\t end\r\n\t\t\t\t\t\t\t end\r\n\t\t\t\t\t\t\t\tif check_enter word_input\r\n\t\t\t\t\t\t\t\t\t\t@break_flag = true\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t getguess word_input\r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t@spin_flag = true\r\n\t\t\t\t end\r\n\t\t\t\t else\r\n\t\t\t\t \t@message=\"Guess a letter from the word/phrase.\"\r\n\t\t\t\t @guess_counter+=1\r\n\t\t\t\t check_guess guess\r\n\t\t\t\t set_guess_analysis guess\r\n\t\t\t\t end\r\n\t\t\t\t success = check_phrase @resulta.join(',').gsub(\",\",\"\")\r\n\t\t\t\t return success ? true : false\r\n\t\t\t\telse\r\n\t\t\t\t\t if check_phrase guess\r\n\t\t\t\t\t\t phrase = @secretword.chars\r\n\t\t\t\t\t\t i = 0\r\n\t\t\t\t\t\t while i < phrase.length do\r\n\t\t\t\t\t\t\t\t\t\t@resulta[i] = phrase[i]\r\n\t\t\t\t\t\t\t\t\t\ti += 1\r\n\t\t\t\t\t\t end\r\n\t\t\t\t\t\t return true\r\n\t\t\t\t\t else\r\n\t\t\t\t\t\t @num_guessed = 0\r\n\t\t\t\t\t\t incrementturn\r\n\t\t\t\t\t\t @guess_counter+=1\r\n\t\t\t\t\t\t set_guess_analysis guess\r\n\t\t\t\t\t\t return false\r\n\t\t\t\t\t end\r\n\t\t\t\tend\r\n\t\t\t\tend", "def check_guess(player_guess, display)\n letter_found = false\n @secret_word.chars.each_with_index do |char, index|\n if char.downcase == player_guess\n display[index] = char\n letter_found = true\n end\n end\n letter_found\n end", "def check_letter_in_random_word(guess_letter)\n position_letter = 0\n @correct_guess = false\n @random_word.each_char do |letter_random_word|\n if letter_random_word == guess_letter\n change_guess_word_status(position_letter)\n @correct_guess = true\n end\n position_letter += 1\n end\n if @correct_guess == true\n line_of_30_stars\n puts \"WhoopWhoop: Letter '#{guess_letter}' is in the word!\\n\"\n else\n line_of_30_stars\n puts \"No, sorry, '#{guess_letter}' isn't in the word.\"\n end\n end", "def wrong_letter(letter)\r\n \t@chances -= 1\r\n @guesses << letter\r\n end", "def start_guess\r\n\t\tuntil @is_over == true\r\n\t#player enters 1 letter string\r\n\r\n\t\t\tputs \"guess a letter you've already guessed #{@used}. #{@tries-@guess_count} attempts remain\"\r\n\t\t\tputs @blanks.join\r\n\t\t\tletter = gets.chomp\r\n\t#if letter is not in guessed box take a turn away\r\n\t\t\tif @used.include?(letter) == false\r\n\t\t\t\t@guess_count += 1\r\n\t\t\t\tif @tries == @guess_count \r\n\t\t\t\t\t@is_over = true\r\n\t\t\t\tend\r\n\t\t#if letter is in the world replace the blank\r\n\t\t\t\tif @word.include?(letter)\r\n\t\t\t\t\twordindex = @word.index(letter)\r\n\t\t\t\t\t@blanks[wordindex] = letter\r\n\t\t\t\t\tif @blanks.include?(\"_ \") == false\r\n\t\t\t\t\t\t@is_over = true\r\n\t\t\t\t\tend\r\n\t\t#if letter is not in the world add to guessed box\r\n\t\t\t\telse\r\n\t\t\t\t\t@used << letter\r\n\t\t\t\tend\r\n\t#if letter is in guessed box don't consume a turn\r\n\t\t\telse\r\n\t\t\t\tputs \"you already tried that letter\"\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t#end:\r\n\t#if word is guessed correctly print congrants\r\n\t\tif @blanks.include?(\"_ \")\r\n\t\t\tputs \"haha try harder next time\"\r\n\t#if word is guessed wrong print taunt\r\n\t\telse\r\n\t\t\tputs \"well done! you guessed the word\"\r\n\t\tend\r\n\tend", "def try_guess(char)\n if self.already_attempted?(char)\n p \"that has already been attempted\"\n return false\n else\n matching_indices = self.get_matching_indices(char)\n self.fill_indices(char, matching_indices)\n\n @remaining_incorrect_guesses -= 1 if matching_indices.empty?\n \n @attempted_chars << char\n return true\n end\n end", "def feedback(guess_word)\n guessword_array=guess_word.split(\"\")\n word_array=@word.split(\"\")\n guessword_array.each do |letter|\n if word_array.include?(letter)\n @result[word.index(letter)]=letter\n end\n end\n puts \"here is your feedback: #{@result}\"\n end", "def guess_letter?(letter)\r\n\r\n\t\t#Add 1 to the total number of guesses in game IF not already guessed (in the guesses array)\r\n\t\tif @guesses.index(letter) == nil\r\n\t\t\t@guesses << letter\r\n\t\t\t@num_of_guesses += 1\r\n\t\tend\r\n\r\n\t\t#If the letter exists (aka returns valid index)\r\n\t\t# 1. Loop through letters in word and compare to the guessed letter\r\n\t\t# 2. If guessed letter = original letter in word, set board = to letter in that index\r\n\t\t# 3. Return True\r\n\t\t#Else if the letter does not exist in word array\r\n\t\t# 1. Return False\r\n\t\tif @word_array.index(letter)\r\n\t\t\tindex = 0\r\n\t\t\t@word_array.each do|i|\r\n\t\t\t\tif letter == i\r\n\t\t\t\t\t@board_array[index] = letter\r\n\t\t\t\tend\r\n\t\t\t\tindex+=1\r\n\t\t\tend\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend", "def wrong_letter(letter)\n @chances -= 1\n @guesses << letter\n end", "def checkLetter(letter)\n @word.split(\"\").each_with_index do |item, index|\n if item == letter\n @guess[index] = letter\n end\n end\n puts @guess\nend", "def guess_progress(user_guess)\n @letter_found = false\n check_letter(user_guess)\n\n @secret_array.each_index do |i|\n if !@letter\n puts \"Invalid input. Please input a letter\"\n @letter_found = true\n break\n elsif @secret_array[i] == user_guess \n @display_array[i] = \" #{user_guess} \"\n @letter_found = true\n end\n end\n\n puts \"Sorry. '#{user_guess}' is not in the secret word\" if !@letter_found\n\n if !check_finish\n increment_guess(user_guess)\n end \n\n @display_array\n @is_over\n end", "def check_letters(letter_guessed)\n if @secret_word.include?(letter_guessed)\n @characters_guessed_correctly << letter_guessed\n puts 'you guessed correctly'\n puts replace_correct_letters\n else\n puts 'you guessed wrong'\n @guess_count -= 1\n end\n end", "def process_guess(letter)\n\n\t\tletter = letter.downcase\n\n\t\tif @prev_guesses.include? letter\n\t\t\tputs \"\\\"#{letter}\\\" has already been guessed\"\n\t\t\tprint_status\n\t\t\treturn false \n\t\telse\n\t\t\t@prev_guesses << letter\n\t\t\tdecrement_guesses\n\t\tend\n\n\t\tif @original_word.include? letter\n\t\t\tupdate_gameboard(letter)\n\t\t\tprint_status\n\t\t\ttrue\n\t\telse\n\t\t\tprint_status\n\t\t\tfalse\n\t\tend\n\tend", "def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end", "def match_letters #handle_guess\n\t\tindexes_matched = @word_array.each_index.select { |i| @word_array[i] == @guess}\n\n\t\tfor x in indexes_matched do\n\t\t\t@result_array[x] = guess\n\t\tend\n\n\t\tputs @result_array\n\tend", "def match_letters #handle_guess\n\t\tindexes_matched = @word_array.each_index.select { |i| @word_array[i] == @guess}\n\n\t\tfor x in indexes_matched do\n\t\t\t@result_array[x] = guess\n\t\tend\n\n\t\tputs @result_array\n\tend", "def check_guess(input)\n @guessed_letters.push(input)\n if @secret_word.match?(input)\n @secret_word.split(//).each_with_index { |char, index| @guessed_word[index] = char if char == input }\n else\n puts 'Incorrect'\n @guesses_left -= 1\n @wrong_letters.push(input)\n end\n end", "def failed_guess(letter)\r\n @failed_guesses << letter\r\n @attempts_left -= 1\r\n end", "def guess(char)\n if char==''||!(char=~/[A-Za-z]/)\n raise ArgumentError\n else\n char = char.downcase\n if @guesses.include?(char)||@wrong_guesses.include?(char)\n return false\n else\n if @word.include?(char)\n @guesses+=char\n for i in 0..@word.length-1\n if @word[i]==char\n @word_with_guesses[i]=char\n end\n end\n if !@word_with_guesses.include?('-')\n @check_win_or_lose=:win\n end\n else\n @wrong_guesses+=char\n if @wrong_guesses.length>=7\n @check_win_or_lose=:lose\n end\n end\n return true\n end\n end\n end", "def make_guess\n\t\tbegin\n\t\t\thighest_letter_left = freq_hash\n\t\t\t\t.sort_by{|k, v| v}\n\t\t\t\t.reverse\n\t\t\t\t.map{|char, freq| char}\n\t\t\t\t.detect{|char| !@guessed_letters.include?(char)}\n\n\t\t\traise \"Aw, damn! Got nothin' left. Let's start a new game.\" unless highest_letter_left\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\t\texit\n\t\telse\n\t\t\t@guessed_letters << highest_letter_left\n\t\t\thighest_letter_left\n\t\tend\n\tend", "def get_new_letter\n loop do\n puts \"What letter would you like to guess?\"\n @guess = gets.chomp.downcase\n break if valid_letter?(@guess)\n end\n end", "def letter_check(letter)\n @word.chars.each_with_index do |letter_in_word, index|\n if letter == letter_in_word\n @result_str[index] = letter\n end\n end\n if !@word.include?(letter)\n puts \"Sorry try again\"\n end\n @result_str\n end", "def guess_char=(char)\n # First want to check if a character is in the word and has not been guessed\n # beforhand\n if @word.include?(char) && !@guess_history.include?(char)\n # defining an array of indices of the word string that tells us the\n # position of where the character matches the character of the word\n char_index = (0 ... @word.length).find_all { |i| @word[i,1] == char}\n # loop through the character index array to redefine the prompt with the \n # correctly guessed character\n char_index.each{|elment| @prompt[elment] = char}\n @guess_history << char # Store the guess in the guess history\n @is_correct = false # the guess is not correct because the user hasn't\n # guessed the whole word\n @guess_count -= 1 # loose an attempt to guess the word\n\n # next we want to check if the guess has been guessed before\n elsif @guess_history.include?(char)\n @is_correct = false # guess is not correct because the user hasn't guessed\n # the whole word\n # note the counter will not be increased if it matches guess history\n # For all other incorrect guesses do the following:\n else\n @guess_history << char # store char in the guess history\n @is_correct = false # the guess is incorrect\n @guess_count -= 1 # loose an attempt to guess the word\n end\n end", "def respond_to_letter_guess(letter)\n indices_matching_letter = []\n i = 0\n while i < @secret_word.length\n if @secret_word[i] == letter\n indices_matching_letter << i\n end\n\n i += 1\n end\n\n indices_matching_letter\n end", "def make_guess(guess)\n @previous_guesses << guess \n display_string = show_progress()\n if !goal_word.include?(guess) \n guess_counter()\n end \n if display_string == @goal_word\n @player_won = true \n end\n end", "def guess_compare(guess)\n # Defining correct_guess as a guess where the letter is properly included\n correct_guess = @secret_word.include? guess\n if correct_guess == true\n puts \"The letter #{guess} is correct! Good job!\"\n print_teaser guess\n else\n @lives -= 1\n puts \"The letter #{guess} is incorrect!\"\n puts \"The hangman has #{@lives} lives left!\"\n end\n player_guess\n end", "def is_a_letter?(guess)\n return true if @word.include?(guess)\n return false\n end", "def game_board(guess_letter)\r\n\t puts \"\"\t \r\n\t result_index_array = (0 ... @secret_word.length).find_all { |i| @secret_word[i,1] == guess_letter }\r\n\t \r\n\t # Change the output to show a successful guess\r\n\t if result_index_array.size == 0\r\n\t @incorrect_letters += guess_letter\r\n\t\t@incorrect_letters += \", \"\r\n\t else \r\n\t result_index_array.each { |index| @correct_letters[2*index] = guess_letter }\r\n end\r\n\t \r\n\t # Update variables and check if the game has been won\r\n\t @turn_count -= 1\r\n\t puts @correct_letters\r\n\t #@incorrect_letters.each {|letter| print \"#{letter}, \"}\r\n\t puts \"\\nIncorrect Guesses: #{@incorrect_letters}\"\r\n\t win_game if @correct_letters.count('_') == 0\r\n\t end_turn\r\n\tend", "def ask_letter\n letter = Display.ask\n if letter == 'save'\n save_game\n ask_letter\n end\n word_check = @word.map(&:clone)\n check_if_correct(word_check, letter)\n end", "def correct_guess?(guess)\n if guess.length == 1\n if @secret_word.include?(guess)\n puts \"That letter is in the secret word!\"\n (0..@secret_word.length).each do |index|\n if @secret_word[index] == guess\n @game_word[index * 2] = guess\n end\n end\n else\n puts \"That letter is not in the secret word.\"\n end\n else\n phrase = @secret_word.split(\" \")\n game_phrase = @game_word.split(\" \")\n\n if phrase.include?(guess)\n puts \"That word is correct!\"\n phrase.each_with_index do |word,idx|\n if word == guess\n game_phrase[idx] = guess.split(\"\").join(\" \")\n @game_word = game_phrase.join(\" \")\n end\n end\n else\n puts \"That word is not a correct guess.\"\n end \n end\n end", "def presence_of_letter(user_guess)\n\t\tif @game_word.include? user_guess \n\t\t\tputs \"Nice! Your letter appears #{@presence_counter} times. Here is an update on your progress: \"\n\t\t\tp @current_state.join\n\t\t\t# return @current_state.join\n\t\telse\n\t\t\tputs \"Too bad! \\\"#{user_guess}\\\" is not in the mystery word! Here is your progress so far: \"\n\t\t\tp @current_state.join\n\t\t\t# return \"Too bad!\"\n\t\tend\n\n\t\tif @current_state.include?(\" _ \" )\n\t\t\tputs \"You have #{@total_guesses} guesses remaining.\"\n\t\tend\n\tend", "def get_guess\n\t\t# There are turns left...\n\t\tif @turn < 9\n\t\t\tshow_board\n\t\t\tputs \"Enter your letter guess...\"\n\t\t\tletter = gets.chomp.downcase\n\t\t\tvalidate_letter(letter)\n\t\t# No turns left, show losing message and delete game if it was previously saved\n\t\telse\n\t\t\tputs\n\t\t\tshow_board\n\t\t\tputs \"Dangit, you ran out of turns!\"\n\t\t\tputs \"The word was #{@word.join}...\"\n\t\t\tif @running_saved_game != nil\n\t\t\t\tover_write_data\n\t\t\tend\n\t\t\tgo_again\n\t\tend\n\tend", "def compare_letter(letter)\n \tif @wrong.include?(letter) || @right.include?(letter)\n \tputs \"You already guessed that letter\"\n \treturn \"\"\n\telsif word.include? letter\n\t\t@right << letter \n\telse \n\t\tputs \"Letter not in the word.\"\n\t\t@lives-=1\n\t\t@wrong << letter\n\tend\n\n end", "def prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants.push(vowel) #To make things easy, add the vowel to the\r\n #list of consonants\r\n\r\n wordArray = word.split(\" \") #Split the secret word into an array\r\n\r\n i = 0 #Initialize index variable to zero\r\n\r\n #Loop once for each letter in the word (stored in an array)\r\n wordArray.each do |letter|\r\n\r\n match = false #Initialize the variable with a starting value of false\r\n\r\n #Loop once for each consonant stored in the consonants array\r\n consonants.each do |character|\r\n\r\n #Compare the current character from the consonants array to the\r\n #current letter in the wordArray array\r\n if character == letter then\r\n match = true #Set variable value to indicate a match\r\n break #Terminate loop execution when a match occurs\r\n end\r\n\r\n end\r\n\r\n #If there is no matching character in the consonants array for the\r\n #current letter in the wordArray array, replace that letter in the\r\n #wordArray with an underscore character\r\n if match == false then\r\n wordArray[i] = \"_\" #Replace the current character with an\r\n end #underscore\r\n\r\n i = i + 1 #Increment the variable's value by 1\r\n\r\n end\r\n\r\n #Once the contents of the array have been formatted with underscores,\r\n #convert the contents of the array back into a word\r\n word = wordArray.join(\" \")\r\n\r\n #Allow the player up to three guesses\r\n 3.times do |i| #i equals 0 on the first iteration of the loop\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Prompt the player to try to guess the secret word\r\n puts \"I am thinking of a word.\\n\\n\\n\\n\\n\\n\"\r\n print \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"What do you think this word is? \"\r\n reply = STDIN.gets #Collect the player's reply\r\n reply.chop! #Remove the end of line marker\r\n reply = reply.upcase #Convert the reply to all uppercase\r\n\r\n #Analyze the players guess\r\n if reply == shortWord then #The player's guessed the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n print \"Correct! Press Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Terminate the execution of the loop\r\n\r\n else #The player did not guess the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Display a message based on how many turns remain\r\n if i == 1 then\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! You have one guess left. Press Enter to \" +\r\n \"try again.\"\r\n elsif i == 2\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n shortWord = shortWord.downcase #converts word to lowercase\r\n print \"Sorry, you lose.\\n\\n\"\r\n print \"The word was \" + shortWord.sub(/^./) {$&.upcase} +\r\n #regex reads as follows: substitute \"beginning\" for \"anything\"\r\n #'contains complete matched text of uppercase= $&.upcase'\r\n #method .capitalize would accomplish this as well\r\n \". Press Enter to continue.\"\r\n else\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! Press Enter to try again.\"\r\n end\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n end\r\n\r\n end\r\n\r\n end", "def good_letter(letter)\n if $bucket.include? letter # check to see if letter has already been guessed and reprompt if so\n $prompt = \"You already guessed that one - TRY AGAIN!\"\n elsif letter[/[a-zA-Z]+/] and letter.length == 1 # check is a single -letter- has been entered\n $bucket.push(letter) # if so, add it to the bucket array\n letter_test(letter) # then pass it to letter_test()\n else # if multiple letters, non-alpha characters or nothing has been entered\n $prompt = \"Enter a single letter - TRY AGAIN!\" # reprompt user to try again\n end\nend", "def already_guessed? (letter)\r\n letter = letter.downcase\r\n @guessed_letters.include? letter\r\n end", "def check_guessed_letter(word,letter,available_letters)\n\n\tif word.include?(letter)\n\t\treturn 0\n\telsif !available_letters.include?(letter)\n\t\treturn 0\n\telse\n\t\t$missed_letters.push(letter)\n\t\treturn -1\n\tend\nend", "def include_letter(word, letter)\n index = 0 \n if @letter_bank.include?(letter) \n puts \"You already tried this letter\"\n else \n word.each_char do |l|\n if l == letter\n @blanks[index] = letter\n end \n index += 1\n end \n @guess_count -= 1 \n @letter_bank << letter\n end \n puts \"You have #{guess_count} guesses left\"\n p @blanks\n end", "def wrong_guess(letter)\n @possible_letters.delete(letter)\n @dictionary.reject_words_that_contain(letter)\n end", "def check_guess(word, char)\n if word.downcase.include?(char.downcase) && AVAILABLE_LETTERS.include?(char.downcase)\n AVAILABLE_LETTERS.delete(char.downcase)\n else\n AVAILABLE_LETTERS.delete(char.downcase)\n $incorrect_guesses += 1\n end\n puts display_word(word)\nend", "def letter_guessed(user_guess)\n\t\tif @guessed_letters.length == 0\n\t\t\t@guessed_letters << user_guess\n\t\telse \n\t\t\tif @guessed_letters.include?(user_guess)\n\t\t\t\tputs \"--You already guessed that letter! Try again!--\"\n\t\t\t\t@guess_count -= 1\n\t\t\telse\n\t\t\t\t@guessed_letters << user_guess\n\t\t\tend\n\t\tend\n\tend", "def correct_guess(guess)\n end", "def setguessedletter(letter)\n\t\t@letter_exists = false\n\t\t\n\t\t@guessed_letters.each do |char|\n\t\t\tif char == letter\n\t\t\t\t@letter_exists = true\n\t\t\tend\n\t\tend\n\t\treturn @letter_exists\n\tend", "def make_guess(word)\n guess = word.upcase\n \n # If the game is over, let the player know.\n if @guesses_left == 0\n p \"This game is over!\"\n\n # Congratulatory message if they got it.\n elsif guess == @secret_word\n @number_of_guesses += 1\n p \"Congratulations! You got the word in #{@number_of_guesses} guesses!\"\n \n # If they already guessed the word:\n elsif @guessed_words.index(guess) != nil\n p \"You already guessed that word!\"\n p \"The secret word is: \" + feedback(guess)\n return \"You already guessed that word!\"\n\n # Count the guess and provide feedback on it.\n else\n\n @guessed_words.push(guess)\n @number_of_guesses += 1\n @guesses_left -= 1\n \n p \"Correct letters:\"\n p feedback(guess)\n\n # If that was the last guess, let the player know.\n if @guesses_left == 0\n p \"That was your last guess! Game over.\"\n\n else\n get_guesses_left\n \n end # control flow/guessed_word\n end # end control flow/make_guess\n end", "def letters_to_guess\n @letters.map do |letter|\n if @user_guesses.include?(normalize_letter(letter))\n letter\n else\n nil\n end\n end\n end", "def check_letter(in_letter)\n # find out if this is a correct guess\n correct_status = false\n if word_to_guess.include? in_letter\n correct_status=true\n else\n # bad guess; decrement number_guesses_left\n @number_guesses_left -= 1\n end\n # put letter in letters_tried with correct/wrong status\n new_letter_combo = {\n letter: in_letter,\n correct: correct_status\n }\n letters_tried.push(new_letter_combo)\n return correct_status\n end" ]
[ "0.8103037", "0.80593646", "0.798573", "0.7870861", "0.7827445", "0.78170556", "0.78134185", "0.7810618", "0.7770833", "0.77543175", "0.77365285", "0.77143675", "0.77130395", "0.7702382", "0.76999325", "0.7684928", "0.7657378", "0.7634103", "0.7627849", "0.7557668", "0.75294507", "0.75231826", "0.7496401", "0.7484668", "0.7476779", "0.74689996", "0.74529773", "0.7431795", "0.7409499", "0.7407554", "0.7388976", "0.7382786", "0.73803866", "0.73691845", "0.7360366", "0.7329315", "0.73219144", "0.73041356", "0.7303055", "0.730146", "0.72853976", "0.72248733", "0.7219982", "0.72174704", "0.721696", "0.72156787", "0.7211367", "0.7207377", "0.71935487", "0.7161258", "0.71430665", "0.71399754", "0.7135827", "0.71351105", "0.71347696", "0.71342117", "0.7133438", "0.71125054", "0.7109071", "0.70963794", "0.7092896", "0.7031707", "0.70313764", "0.7011899", "0.70056176", "0.69959676", "0.69596726", "0.69581336", "0.6955494", "0.6955494", "0.69453907", "0.69441825", "0.6922788", "0.6921703", "0.6919184", "0.69179463", "0.69120085", "0.69069695", "0.6900218", "0.68990576", "0.68925506", "0.68911815", "0.6890432", "0.68855375", "0.6876226", "0.6872145", "0.6864407", "0.6807129", "0.68041855", "0.6801579", "0.6790178", "0.6789197", "0.6774553", "0.67720836", "0.6762811", "0.6752643", "0.67517257", "0.67401606", "0.6734705", "0.67322326" ]
0.68511397
87
GET /ramais GET /ramais.json
def index @ramais = Ramal.all respond_to do |format| format.html # index.html.erb format.json { render json: @ramais } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ramal = Ramal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ramal }\n end\n end", "def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aromas }\n end\n end", "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end", "def index\n @arles = Arl.search(params[:search]).page(params[:page]).per_page(12)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end", "def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\n end\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end", "def index\n @normas = Norma.all\n render json: @normas\n end", "def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end", "def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end", "def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end", "def index\n @natulangs = Natulang.all\n\n @text = History.last.content\n\n @msg = Moji.type(\"漢\")\n \n nlp = NLP.new()\n \n #@msg = nlp.cut_morph(@text)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @natulangs }\n end\n end", "def display\n @json = Rma.search(params[:rmaName])\n # render :text => @json.inspect\n end", "def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end", "def index\n respond_to do |format|\n format.json { render :json => Phrase.all }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @dramas = Drama.all\n end", "def show\n @manga = Manga.find(params[:id])\n @chapters = @manga.ordered_chapters.page(params[:page]).per 15\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manga }\n end\n end", "def new\n @ramal = Ramal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ramal }\n end\n end", "def show\n @lsa_test_word = LsaTestWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_test_word }\n end\n end", "def index\n @anagramas = Anagrama.all\n end", "def index\n @search = params[:tag]\n tags = Tag.select('aa_id').where(\"tag LIKE ?\", \"%#{@search}%\").order('updated_at desc')\n @asciiArts = Aa.page(params[:page]).per(50).where(id: tags).order(\"updated_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end", "def show\n @busqueda = Busqueda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @busqueda }\n end\n end", "def index\n @mypage = \"タレント一覧\"\n @talents = Talent.all\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end", "def index\n @search = MicrornaPatient.search do\n fulltext params[:query_microrna_patient]\n end\n \n @microrna_patients = @search.results\n \n \n respond_to do |format|\n format.html\n format.json { render :json => @microrna_patients.map(&:attributes) }\n end\nend", "def index\n @alternativas = Alternativa.all\n end", "def index\n @query = params[:query] || {\n search: '',\n }\n @theorems = Theorem.all.where(root: true).limit(50)\n @theorems = @theorems.order('views desc')\n @theorems = @theorems.where('text ILIKE ?', \"%#{@query[:search]}%\") if @query[:search] && @query[:search].length > 0\n respond_to do |f|\n f.html { render 'index' }\n f.json { render json: @theorems }\n end\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def index\n @human_names = HumanName.search(params)\n\t\t@letters = get_turkish_alphabet()\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render :json => @human_names }\n end\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def index\n\t\t@antibiograms = Antibiogram.all\n\tend", "def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end", "def index\n @arles = Arl.all\n end", "def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\n end\n end", "def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end", "def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end", "def show\n @book = Book.find(params[:id])\n @chapters = @book.chapters\n wl = WhatLanguage.new(:all)\n @lang = \"\"\n @book.chapters.each do\n @lang = wl.language(@book.chapters[0].content).to_s.capitalize\n end\n\n do_response @book.to_json(:include => :chapters)\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 view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end", "def index\n @languages = Language.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @languages }\n end\n end", "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end", "def show\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end", "def index\n @armazenas = Armazena.all\n end", "def index\n @grams = Gram.all # added 12 jul 17 for uploading images (lesson/challenge 16)\n end", "def show\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end", "def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end", "def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end", "def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end", "def detect text, format = :plain\n request = URI.encode \"#{@api_uri}/detect?text=#{text}&format=#{format}\"\n response = open request\n json_hash = JSON.parse response.read\n code = json_hash[\"code\"].to_i\n lang = json_hash[\"lang\"]\n result = Hash.new\n result = {\"code\" => code, \"lang\" => lang}\n return result\n end", "def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end", "def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end", "def show\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spanish_vocab }\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def show\n @english_entry = EnglishEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @english_entry }\n end\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end", "def corona_virus\n # endpoint = \"https://corona.lmao.ninja/all\"\n endpoint = 'https://corona.lmao.ninja/v2/all'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result = []\n result<<{\n country: \"world\",\n cases: res[\"cases\"],\n todayCases: res[\"todayCases\"],\n deaths: res[\"deaths\"],\n todayDeaths: res[\"todayDeaths\"],\n recovered: res[\"recovered\"],\n active: res[\"active\"],\n critical: res[\"critical\"],\n casesPerOneMillion: res[\"casesPerOneMillion\"],\n deathsPerOneMillion: res[\"deathsPerOneMillion\"],\n tests: res[\"tests\"],\n testsPerOneMillion: res[\"testsPerOneMillion\"],\n affectedCountries: res[\"affectedCountries\"]\n }\n render json: result\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", "def index\n \n\t@search = Auditoria.order('id desc').search(params[:search])\n @auditorias = @search.paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @auditorias }\n end\n end", "def index\n @announcaments = Announcament.all\n end", "def show\n render json: @spellbook\n end", "def index\n @akas = Aka.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @representante_athlete }\n end\n end", "def search\n terms = @authority.search(url_search)\n render json: terms\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end", "def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end", "def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end", "def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end", "def show\n @archetype = Archetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @archetype }\n end\n end", "def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end", "def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end", "def japonais\n @symboles = Symbole.jp\n case params[:type]\n when \"kanas\"\n @symboles = @symboles.kanas\n when \"kanjis\"\n @symboles = @symboles.kanjis\n end\n render \"index\"\n end", "def show\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adocao_animal }\n end\n end", "def index\n @texto_palabras = TextoPalabra.all\n end", "def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end", "def english?(word)\n url = \"https://wagon-dictionary.herokuapp.com/#{word}\"\n check_english = open(url).read\n english = JSON.parse(check_english)\n english['found']\n end", "def index\n @foams = Foam.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foams }\n end\n end", "def index\n @surveys = Survey.paginate(:page => params[:page])\n @title = \"Тесты\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @surveys }\n end\n end", "def index\n @phrasebooks = Phrasebook.all\n\n render json: @phrasebooks\n end", "def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "def show\n @anrede = Anrede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anrede }\n end\n end", "def show\n @finding_aural = FindingAural.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_aural }\n end\n end", "def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end", "def show\r\n @antenne = Antenne.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @antenne }\r\n end\r\n end" ]
[ "0.6646255", "0.6568274", "0.6403144", "0.6287112", "0.6228843", "0.6134788", "0.61119664", "0.6027192", "0.5993213", "0.59868544", "0.59693426", "0.5902116", "0.5892363", "0.58351934", "0.58291405", "0.57919765", "0.57794243", "0.5742897", "0.57412696", "0.57402396", "0.57356596", "0.5722991", "0.5708771", "0.57041717", "0.56926554", "0.5687403", "0.5683396", "0.56322557", "0.5630162", "0.5628995", "0.5616677", "0.55802435", "0.5579954", "0.5575288", "0.55718166", "0.55662054", "0.55518", "0.5537708", "0.55313647", "0.5524119", "0.55144507", "0.5513499", "0.55122876", "0.5507386", "0.55069345", "0.5504708", "0.5497867", "0.54912835", "0.5488495", "0.54839665", "0.5469727", "0.54690564", "0.5466247", "0.5465976", "0.5462238", "0.54606736", "0.5459802", "0.5457238", "0.54544383", "0.54534507", "0.54509354", "0.5450922", "0.54482603", "0.5447168", "0.5446314", "0.5442317", "0.54370415", "0.5430781", "0.54298", "0.5426885", "0.5426138", "0.5424411", "0.5420575", "0.54177827", "0.5415023", "0.5414225", "0.541015", "0.54069114", "0.54069114", "0.54029584", "0.5394415", "0.5390556", "0.5390556", "0.53886354", "0.5386929", "0.53815556", "0.538153", "0.53791636", "0.5377239", "0.53769314", "0.53759605", "0.537585", "0.5373576", "0.5372271", "0.5370336", "0.53662705", "0.53599834", "0.5358981", "0.5358755", "0.53578913" ]
0.7563953
0
GET /ramais/1 GET /ramais/1.json
def show @ramal = Ramal.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @ramal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end", "def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\n end\n end", "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end", "def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aromas }\n end\n end", "def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end", "def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end", "def new\n @ramal = Ramal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ramal }\n end\n end", "def show\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end", "def index\n @normas = Norma.all\n render json: @normas\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def index\n @arles = Arl.search(params[:search]).page(params[:page]).per_page(12)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\n end\n end", "def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end", "def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end", "def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "def display\n @json = Rma.search(params[:rmaName])\n # render :text => @json.inspect\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @dramas = Drama.all\n end", "def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end", "def show\n @manga = Manga.find(params[:id])\n @chapters = @manga.ordered_chapters.page(params[:page]).per 15\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manga }\n end\n end", "def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def show\n @repa = Repa.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end", "def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end", "def show\n @busqueda = Busqueda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @busqueda }\n end\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def show\n @lsa_test_word = LsaTestWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_test_word }\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end", "def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end", "def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end", "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end", "def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end", "def index\n respond_to do |format|\n format.json { render :json => Phrase.all }\n end\n end", "def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end", "def index\n @anagramas = Anagrama.all\n end", "def show\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end", "def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end", "def show\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end", "def show\n @reltramovano = Reltramovano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reltramovano }\n end\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def index\n @natulangs = Natulang.all\n\n @text = History.last.content\n\n @msg = Moji.type(\"漢\")\n \n nlp = NLP.new()\n \n #@msg = nlp.cut_morph(@text)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @natulangs }\n end\n end", "def show\n @spirit = Spirit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spirit }\n end\n end", "def show\r\n @antenne = Antenne.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @antenne }\r\n end\r\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end", "def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end", "def show\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def show\n render json: Alien.find(params[\"id\"])\n end", "def show\n @anrede = Anrede.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anrede }\n end\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end", "def show\n @natulang = Natulang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @natulang }\n end\n end", "def show\n @jam = Jam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jam }\n end\n end", "def show\n @archetype = Archetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @archetype }\n end\n end", "def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end", "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "def show\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adocao_animal }\n end\n end", "def get_razor()\n file = File.read('/Users/devlon.d/src/obsidian_utils-master/razors.json')\n razors = JSON.parse(file)\n\n random_razor = razors[\"razors\"].sample\n\n razor_content = random_razor[\"title\"]\n razor_content.concat(\"\\n\")\n\n random_razor[\"lines\"].each do |content|\n razor_content.concat(content[\"line\"])\n razor_content.concat(\"\\n\")\n end\n\n return razor_content\nend", "def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end", "def index\n @grams = Gram.all # added 12 jul 17 for uploading images (lesson/challenge 16)\n end", "def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end", "def show\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_noun }\n end\n end", "def index\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalles = @recibo.renglon_recdetalles.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_recdetalles }\n end\n end", "def show\n @finding_aural = FindingAural.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_aural }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def show\n @lbaa = Lbaa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbaa }\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def index\n @search = params[:tag]\n tags = Tag.select('aa_id').where(\"tag LIKE ?\", \"%#{@search}%\").order('updated_at desc')\n @asciiArts = Aa.page(params[:page]).per(50).where(id: tags).order(\"updated_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end", "def show\n @microfilm_reel = MicrofilmReel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microfilm_reel }\n end\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end", "def show\n @immigrant = Immigrant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @immigrant }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def show\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @auditoria }\n end\n end", "def index\n @arles = Arl.all\n end", "def corona_virus\n # endpoint = \"https://corona.lmao.ninja/all\"\n endpoint = 'https://corona.lmao.ninja/v2/all'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result = []\n result<<{\n country: \"world\",\n cases: res[\"cases\"],\n todayCases: res[\"todayCases\"],\n deaths: res[\"deaths\"],\n todayDeaths: res[\"todayDeaths\"],\n recovered: res[\"recovered\"],\n active: res[\"active\"],\n critical: res[\"critical\"],\n casesPerOneMillion: res[\"casesPerOneMillion\"],\n deathsPerOneMillion: res[\"deathsPerOneMillion\"],\n tests: res[\"tests\"],\n testsPerOneMillion: res[\"testsPerOneMillion\"],\n affectedCountries: res[\"affectedCountries\"]\n }\n render json: result\n end", "def show\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def show\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spanish_vocab }\n end\n end", "def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end", "def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end", "def new\n @rua = Rua.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rua }\n end\n end", "def show\n @aquarium = Aquarium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aquarium }\n end\n end", "def show\n @roadcrime = Roadcrime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roadcrime }\n end\n end", "def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end", "def show\n\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @renglon_recdetalle }\n end\n end", "def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end" ]
[ "0.7652828", "0.67463803", "0.67453396", "0.6592756", "0.6397033", "0.6381231", "0.63730806", "0.6246838", "0.61505014", "0.61438894", "0.6119072", "0.6096222", "0.6085872", "0.6079914", "0.6038352", "0.6031311", "0.60115117", "0.5999089", "0.5972969", "0.59366596", "0.5916519", "0.5887675", "0.586417", "0.58601785", "0.58465946", "0.58364284", "0.58329445", "0.58216107", "0.5821279", "0.5793477", "0.57822937", "0.57813984", "0.5780509", "0.5768825", "0.5759249", "0.57529473", "0.5749809", "0.5749809", "0.5745209", "0.5740489", "0.5738483", "0.57313067", "0.5712396", "0.5702265", "0.5696258", "0.5692472", "0.56911457", "0.5690781", "0.56853426", "0.5682881", "0.56820446", "0.56769586", "0.5676601", "0.56765205", "0.5666821", "0.56665355", "0.566335", "0.56601834", "0.56573856", "0.56524736", "0.5647691", "0.563864", "0.5638309", "0.56382877", "0.5636303", "0.5628788", "0.56267947", "0.56232023", "0.56231666", "0.5620174", "0.5618191", "0.5615802", "0.56157714", "0.5614662", "0.5613431", "0.56124294", "0.56110024", "0.5609597", "0.5607449", "0.5596913", "0.55933636", "0.55907506", "0.5587965", "0.5587459", "0.5582574", "0.558022", "0.5577373", "0.55760634", "0.55744267", "0.5573302", "0.5571139", "0.55693656", "0.55624264", "0.55624264", "0.55563414", "0.55544835", "0.5552676", "0.5550773", "0.5550505", "0.55491656" ]
0.7124369
1
GET /ramais/new GET /ramais/new.json
def new @ramal = Ramal.new respond_to do |format| format.html # new.html.erb format.json { render json: @ramal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def new\n @rua = Rua.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rua }\n end\n end", "def new\n @repa = Repa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repa }\n end\n end", "def create\n @ramal = Ramal.new(params[:ramal])\n\n respond_to do |format|\n if @ramal.save\n format.html { redirect_to @ramal, notice: 'Ramal criado com sucesso!' }\n format.json { render json: @ramal, status: :created, location: @ramal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ramal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @laundromat = Laundromat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laundromat }\n end\n end", "def new\n @arma = Arma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arma }\n end\n end", "def new\n @tarefa = Tarefa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tarefa }\n end\n end", "def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end", "def new\n @atracao = Atracao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @atracao }\n end\n end", "def new\n @turma = Turma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @turma }\n end\n end", "def new\r\n @antenne = Antenne.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @antenne }\r\n end\r\n end", "def new\n @atr = Atr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atr }\n end\n end", "def new\n @lbaa = Lbaa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lbaa }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cita }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n @tea = Tea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tea }\n end\n end", "def new\n @tea = Tea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tea }\n end\n end", "def new\n @natulang = Natulang.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @natulang }\n end\n end", "def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end", "def new\n @rayon = Rayon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rayon }\n end\n end", "def new\n @lugar = Lugar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lugar }\n end\n end", "def new\n @finding_aural = FindingAural.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finding_aural }\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 @busqueda = Busqueda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @busqueda }\n end\n end", "def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def new\n @arbitro = Arbitro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arbitro }\n end\n end", "def new\n @arcone = Arcone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arcone }\n end\n end", "def new\n @retroalimentacion = Retroalimentacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retroalimentacion }\n end\n end", "def new\n @chaine = Chaine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chaine }\n end\n end", "def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end", "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end", "def new\n @reltramovano = Reltramovano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reltramovano }\n end\n end", "def new\n @pichanga = Pichanga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pichanga }\n end\n end", "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "def new\n @aactio = Aactio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aactio }\n end\n end", "def new\n @sala = Sala.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sala }\n end\n end", "def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end", "def new\n @stanza = Stanza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stanza }\n end\n end", "def create\n @ram = Ram.new(params[:ram])\n\n respond_to do |format|\n if @ram.save\n format.html { redirect_to @ram, notice: 'Ram was successfully created.' }\n format.json { render json: @ram, status: :created, location: @ram }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @imp_raman = ImpRaman.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imp_raman }\n end\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "def new\n @quiniela = Quiniela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quiniela }\n end\n end", "def new\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aviso }\n end\n end", "def new\n @immigrant = Immigrant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @immigrant }\n end\n end", "def new\n @causale = Causale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @causale }\n end\n end", "def new\n @auditoria = Auditoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @auditoria }\n end\n end", "def new\n @brain = Brain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brain }\n end\n end", "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end", "def new\n @hasil = Hasil.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasil }\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def new\n @anrede = Anrede.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anrede }\n end\n end", "def new\n @lsa_training_unique_word = LsaTrainingUniqueWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end", "def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end", "def new\n @spanish_vocab = SpanishVocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spanish_vocab }\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 @lsa_test_word = LsaTestWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lsa_test_word }\n end\n end", "def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end", "def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end", "def new\n @assunto = Assunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assunto }\n end\n end", "def new\n @gram = current_user.grams.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gram }\n end\n end", "def new\n @papel = Papel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @papel }\n end\n end", "def new\n @archetype = Archetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @archetype }\n end\n end", "def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end", "def new\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matricula }\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 @jam = Jam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jam }\n end\n end", "def new\n @jamaat = Jamaat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jamaat }\n end\n end", "def new\n @passage = Passage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @passage }\n end\n end", "def new\n @situacao_avaliacao = SituacaoAvaliacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @situacao_avaliacao }\n end\n end", "def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end", "def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sentence }\n end\n end", "def new\n @cancha = Cancha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cancha }\n end\n end", "def new\n @ruby = Ruby.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ruby }\n end\n end", "def new\n @vachana = Vachana.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vachana }\n end\n end", "def new\n @vachana = Vachana.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vachana }\n end\n end", "def new\n @annex = Annex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annex }\n end\n end", "def new\n @imp2_raman = Imp2Raman.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imp2_raman }\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 @amplicon = Amplicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @amplicon }\n end\n end", "def new\n @marina = Marina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @marina }\n end\n end", "def new\n @ca = Ca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ca }\n end\n end", "def new\n @monnaie = Monnaie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monnaie }\n end\n end", "def new\n @bitacora = Bitacora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bitacora }\n end\n end", "def new\n @lei = Lei.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lei }\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 @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\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 @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 @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 @programa = Programa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programa }\n end\n end", "def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end", "def new\n @nave = Nave.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nave }\n end\n end", "def new\n @reprogramacion = Reprogramacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reprogramacion }\n end\n end", "def new\n\tadd_breadcrumb \"Nueva librería\", :new_libreria_path\n @libreria = Libreria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @libreria }\n end\n end", "def new\n @ais_attribute = AisAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ais_attribute }\n end\n end", "def new\n @dilemma = Dilemma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dilemma }\n end\n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end" ]
[ "0.7631171", "0.74667746", "0.7383068", "0.72372484", "0.71745837", "0.7076995", "0.70463544", "0.70446837", "0.7036847", "0.7028083", "0.70137024", "0.70087147", "0.70011216", "0.6983756", "0.69739485", "0.6967141", "0.6957078", "0.69258124", "0.6918733", "0.6918733", "0.69037265", "0.6878804", "0.68786883", "0.6878367", "0.68559873", "0.68504035", "0.6844023", "0.68359745", "0.6825304", "0.6823442", "0.6822421", "0.6821362", "0.6817215", "0.6812368", "0.6806431", "0.6804683", "0.6803123", "0.6797971", "0.67942345", "0.67926526", "0.67863756", "0.6772362", "0.6761837", "0.6755855", "0.6750076", "0.67497593", "0.6749561", "0.6746238", "0.6745019", "0.6742996", "0.67401826", "0.6736004", "0.67353374", "0.67343885", "0.67272234", "0.67258567", "0.6707411", "0.67043424", "0.6703559", "0.67003953", "0.6700376", "0.6697199", "0.66965073", "0.66951895", "0.668806", "0.66843516", "0.6682006", "0.6679422", "0.66792315", "0.6675819", "0.66749084", "0.6674094", "0.66693103", "0.66613215", "0.6649961", "0.66496366", "0.6649586", "0.6649586", "0.6647304", "0.66449344", "0.6643484", "0.6640889", "0.6639887", "0.66360366", "0.6632992", "0.6631118", "0.6629437", "0.66277254", "0.6626991", "0.66226923", "0.6620027", "0.66196054", "0.6615375", "0.66126645", "0.6610204", "0.66064966", "0.66054845", "0.660405", "0.66033065", "0.6602661" ]
0.76395696
0
POST /ramais POST /ramais.json
def create @ramal = Ramal.new(params[:ramal]) respond_to do |format| if @ramal.save format.html { redirect_to @ramal, notice: 'Ramal criado com sucesso!' } format.json { render json: @ramal, status: :created, location: @ramal } else format.html { render action: "new" } format.json { render json: @ramal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @alram_test = AlramTest.new(alram_test_params)\n\n respond_to do |format|\n if @alram_test.save\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully created.' }\n format.json { render :show, status: :created, location: @alram_test }\n else\n format.html { render :new }\n format.json { render json: @alram_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end", "def create\n @ram = Ram.new(params[:ram])\n\n respond_to do |format|\n if @ram.save\n format.html { redirect_to @ram, notice: 'Ram was successfully created.' }\n format.json { render json: @ram, status: :created, location: @ram }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@antibiogram = Antibiogram.new(antibiogram_params)\n\n\t\trespond_to do |format|\n\t\t\tif @antibiogram.save\n\t\t\t\tformat.html { redirect_to @antibiogram, notice: 'Antibiogram was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @antibiogram }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @antibiogram.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @aroma = Aroma.new(params[:aroma])\n\n respond_to do |format|\n if @aroma.save\n format.html { redirect_to @aroma, notice: 'Aroma was successfully created.' }\n format.json { render json: @aroma, status: :created, location: @aroma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @arma = Arma.new(params[:arma])\n\n respond_to do |format|\n if @arma.save\n format.html { redirect_to @arma, notice: 'Arma was successfully created.' }\n format.json { render json: @arma, status: :created, location: @arma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ram_post = RamPost.new(ram_post_params)\n\n respond_to do |format|\n if @ram_post.save\n format.html { redirect_to @ram_post, notice: 'Ram post was successfully created.' }\n format.json { render :show, status: :created, location: @ram_post }\n else\n format.html { render :new }\n format.json { render json: @ram_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @word_praat = WordPraat.new(word_praat_params[:word_praat])\n\n respond_to do |format|\n if @word_praat.save\n format.html { redirect_to @word_praat, notice: 'Word praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @word_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gram = Gram.new(gram_params)\n\n respond_to do |format|\n if @gram.save\n format.html { redirect_to @gram, notice: 'Gram was successfully created.' }\n format.json { render :show, status: :created, location: @gram }\n else\n format.html { render :new }\n format.json { render json: @gram.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @armazena = Armazena.new(armazena_params)\n\n respond_to do |format|\n if @armazena.save\n format.html { redirect_to @armazena, notice: 'Armazena was successfully created.' }\n format.json { render :show, status: :created, location: @armazena }\n else\n format.html { render :new }\n format.json { render json: @armazena.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rua = Rua.new(params[:rua])\n\n respond_to do |format|\n if @rua.save\n format.html { redirect_to @rua, notice: 'Rua was successfully created.' }\n format.json { render json: @rua, status: :created, location: @rua }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rua.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apertura_moneda = AperturaMoneda.new(apertura_moneda_params)\n\n respond_to do |format|\n if @apertura_moneda.save\n format.html { redirect_to @apertura_moneda, notice: 'Apertura moneda was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_moneda }\n else\n format.html { render :new }\n format.json { render json: @apertura_moneda.errors, status: :unprocessable_entity }\n end\n end\n end", "def analyzer_params\n params.require(:analyzer).permit(:cadena, :resultado)\n end", "def create\n @sanskrit_term = SanskritTerm.new(sanskrit_term_params)\n\n respond_to do |format|\n if @sanskrit_term.save\n format.html { redirect_to @sanskrit_term, notice: 'Sanskrit term was successfully created.' }\n format.json { render :show, status: :created, location: @sanskrit_term }\n else\n format.html { render :new }\n format.json { render json: @sanskrit_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params == [:usuario_id,:tweet_id,:texto_id,:id]\n @usuario = Usuario.find(params[:usuario_id])\n @tweet = Tweet.find(params[:tweet_id])\n @textos = Texto.find(params[:texto_id])\n end\n if params == [:palabra_bolsa_id,:id]\n @palabra_bolsa = PalabraBolsa.find(params[:palabra_bolsa_id])\n end\n @texto_palabra = TextoPalabra.new(texto_palabra_params, :id_texto => @textos.id_texto)\n respond_to do |format|\n if @texto_palabra.save\n format.html { redirect_to @texto_palabras, notice: 'Texto palabra was successfully created.' }\n format.json { render :show, status: :created, location: @texto_palabra }\n else\n format.html { render :new }\n format.json { render json: @texto_palabra.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ramal = Ramal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ramal }\n end\n end", "def create\n @busqueda = Busqueda.new(params[:busqueda])\n\n respond_to do |format|\n if @busqueda.save\n format.html { redirect_to @busqueda, notice: 'Busqueda was successfully created.' }\n format.json { render json: @busqueda, status: :created, location: @busqueda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @busqueda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @natulangs = Natulang.all\n\n @text = History.last.content\n\n @msg = Moji.type(\"漢\")\n \n nlp = NLP.new()\n \n #@msg = nlp.cut_morph(@text)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @natulangs }\n end\n end", "def create\n @lsa_test_word = LsaTestWord.new(params[:lsa_test_word])\n\n respond_to do |format|\n if @lsa_test_word.save\n format.html { redirect_to @lsa_test_word, notice: 'Lsa test word was successfully created.' }\n format.json { render json: @lsa_test_word, status: :created, location: @lsa_test_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lsa_test_word.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @analyzer = Analyzer.new(analyzer_params)\n\n respond_to do |format|\n if @analyzer.save\n format.html { redirect_to @analyzer, notice: 'Analyzer was successfully created.' }\n format.json { render :show, status: :created, location: @analyzer }\n else\n format.html { render :new }\n format.json { render json: @analyzer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @batale_text = authorize Batale::Text.new(batale_text_params)\n @batale_text.cria_codigo_texto\n\n respond_to do |format|\n if @batale_text.save\n format.html { redirect_to @batale_text, notice: 'Texto criado com sucesso.' }\n format.json { render :show, status: :created, location: @batale_text }\n else\n format.html { render :new }\n format.json { render json: @batale_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @manga = Manga.new(manga_params)\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def ram_post_params\n params.require(:ram_post).permit(:words)\n end", "def create\n @frase = Frase.new(frase_params)\n\n respond_to do |format|\n if @frase.save\n format.html { redirect_to @frase, notice: 'Frase was successfully created.' }\n format.json { render :show, status: :created, location: @frase }\n else\n format.html { render :new }\n format.json { render json: @frase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alternativa = Alternativa.new(alternativa_params)\n\n respond_to do |format|\n if @alternativa.save\n format.html { redirect_to @alternativa, notice: 'Alternativa was successfully created.' }\n format.json { render :show, status: :created, location: @alternativa }\n else\n format.html { render :new }\n format.json { render json: @alternativa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alejandro = Alejandro.new(alejandro_params)\n\n respond_to do |format|\n if @alejandro.save\n format.html { redirect_to @alejandro, notice: 'Alejandro was successfully created.' }\n format.json { render :show, status: :created, location: @alejandro }\n else\n format.html { render :new }\n format.json { render json: @alejandro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @theloaisach = Theloaisach.new(theloaisach_params)\n\n respond_to do |format|\n if @theloaisach.save\n format.html { redirect_to @theloaisach, notice: \"Theloaisach was successfully created.\" }\n format.json { render :show, status: :created, location: @theloaisach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @theloaisach.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asana = Asana.new(asana_params)\n\n respond_to do |format|\n if @asana.save\n format.html { redirect_to @asana, notice: 'Asana criado com sucesso.' }\n format.json { render :show, status: :created, location: @asana }\n else\n format.html { render :new }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anagram = Anagram.new(anagram_params)\n word1 = anagram_params[:firstword]\n word2 = anagram_params[:secondword]\n matchingresult = AnagramsChecker.anagrams?(word1, word2)\n @anagram.matching = matchingresult\n\n # byebug\n\n respond_to do |format|\n if @anagram.save\n format.html { redirect_to @anagram, notice: 'Anagram was successfully created.' }\n format.json { render :show, status: :created, location: @anagram }\n else\n format.html { render :new }\n format.json { render json: @anagram.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jra = Jra.new(jra_params)\n\n respond_to do |format|\n if @jra.save\n format.html { redirect_to @jra, notice: 'Jra was successfully created.' }\n format.json { render :show, status: :created, location: @jra }\n else\n format.html { render :new }\n format.json { render json: @jra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ra = Ra.new(ra_params)\n\n respond_to do |format|\n if @ra.save\n format.html { redirect_to @ra, notice: 'Ra was successfully created.' }\n format.json { render :show, status: :created, location: @ra }\n else\n format.html { render :new }\n format.json { render json: @ra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rayon = Rayon.new(params[:rayon])\n\n respond_to do |format|\n if @rayon.save\n format.html { redirect_to @rayon, notice: 'Rayon was successfully created.' }\n format.json { render json: @rayon, status: :created, location: @rayon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end", "def frase_params\n params.require(:frase).permit(:cita, :autor, :cita_eng)\n end", "def create\n @moneda = Moneda.new(params[:moneda])\n\n respond_to do |format|\n if @moneda.save\n format.html { redirect_to(@moneda, :notice => 'Moneda ha sido creada satisfactoriamente.') }\n format.xml { render :xml => @moneda, :status => :created, :location => @moneda }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moneda.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end", "def create\n @pharma = Pharma.new(pharma_params)\n\n respond_to do |format|\n if @pharma.save\n format.html { redirect_to @pharma, notice: 'Pharma was successfully created.' }\n format.json { render :show, status: :created, location: @pharma }\n else\n format.html { render :new }\n format.json { render json: @pharma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @texttocorrect = Texttocorrect.new(texttocorrect_params)\n\n respond_to do |format|\n if @texttocorrect.save\n format.html { redirect_to @texttocorrect, notice: 'Texttocorrect was successfully created.' }\n format.json { render :show, status: :created, location: @texttocorrect }\n else\n format.html { render :new }\n format.json { render json: @texttocorrect.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @norma = Norma.new(norma_params)\n\n if @norma.save\n render :show, status: :created, location: @norma\n else\n render json: @norma.errors, status: :unprocessable_entity\n end\n end", "def create\n @sanchaypatra = current_user.sanchaypatras.new(sanchaypatra_params)\n @sanchaypatra.generate_tokens\n\n respond_to do |format|\n if @sanchaypatra.save\n format.html { redirect_to sanchaypatras_url, notice: 'Sanchaypatra was successfully created.' }\n format.json { render :show, status: :created, location: @sanchaypatra }\n else\n format.html { render :new }\n format.json { render json: @sanchaypatra.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end", "def create\n @asama_tanim = AsamaTanim.new(asama_tanim_params)\n\n respond_to do |format|\n if @asama_tanim.save\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully created.' }\n format.json { render :show, status: :created, location: @asama_tanim }\n else\n format.html { render :new }\n format.json { render json: @asama_tanim.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aka = Aka.new(aka_params)\n\n respond_to do |format|\n if @aka.save\n format.html { redirect_to @aka, notice: 'Aka was successfully created.' }\n format.json { render :show, status: :created, location: @aka }\n else\n format.html { render :new }\n format.json { render json: @aka.errors, status: :unprocessable_entity }\n end\n end\n end", "def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end", "def create\n @alternativo = Alternativo.new(alternativo_params)\n\n respond_to do |format|\n if @alternativo.save\n format.html { redirect_to @alternativo, notice: 'Alternativo was successfully created.' }\n format.json { render :show, status: :created, location: @alternativo }\n else\n format.html { render :new }\n format.json { render json: @alternativo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vocabulaire = Vocabulaire.new(vocabulaire_params)\n\n respond_to do |format|\n if @vocabulaire.save\n format.html { redirect_to @vocabulaire, notice: 'Vocabulaire was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vocabulaire }\n else\n format.html { render action: 'new' }\n format.json { render json: @vocabulaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @announcament = Announcament.new(announcament_params)\r\n\r\n respond_to do |format|\r\n if @announcament.save\r\n format.html { redirect_to @announcament, notice: 'İlan başarılı bir şekilde oluşturuldu.' }\r\n format.json { render :show, status: :created, location: @announcament }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @announcament.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @announcament = Announcament.new(announcament_params)\n\n respond_to do |format|\n if @announcament.save\n format.html { redirect_to @announcament, notice: 'Announcament was successfully created.' }\n format.json { render :show, status: :created, location: @announcament }\n else\n format.html { render :new }\n format.json { render json: @announcament.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "def drama_params\n params.require(:drama).permit(:title, :description, :episode, :director, :actor, :rating, :image)\n end", "def restricao_params\n params.require(:restricao).permit(:palavra)\n end", "def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render json: @tarefa, status: :created, location: @tarefa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def create\n @tea = Tea.new(params[:tea])\n\n respond_to do |format|\n if @tea.save\n format.html { redirect_to @tea, notice: 'Tea was successfully created.' }\n format.json { render json: @tea, status: :created, location: @tea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questao = Questao.new(questao_params)\n\n respond_to do |format|\n if @questao.save\n format.html { redirect_to @questao, notice: 'Questao was successfully created.' }\n format.json { render :show, status: :created, location: @questao }\n else\n format.html { render :new }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_create_palindrome_message\n body = {\n \tdata: {\n \t\ttype: 'messages',\n \t\tattributes: {\n \t\t\tcontent: 'racecar'\n \t\t}\n \t}\n }\n\n post '/messages', body.to_json, 'CONTENT_TYPE' => AppConstants::CONTENT_TYPE\n assert last_response.created?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['data']\n\n assert_equal 'messages', data['type']\n assert_equal body[:data][:attributes][:content], data['attributes']['content']\n assert data['attributes']['is_palindrome']\n assert_equal \"localhost:4567/messages/#{data['id']}\", last_response.headers['Location']\n end", "def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lsa_training_unique_word = LsaTrainingUniqueWord.new(params[:lsa_training_unique_word])\n\n respond_to do |format|\n if @lsa_training_unique_word.save\n format.html { redirect_to @lsa_training_unique_word, notice: 'Lsa training unique word was successfully created.' }\n format.json { render json: @lsa_training_unique_word, status: :created, location: @lsa_training_unique_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lsa_training_unique_word.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rphrase = Rphrase.new(rphrase_params)\n\n respond_to do |format|\n if @rphrase.save\n format.html { redirect_to @rphrase, notice: 'Rphrase was successfully created.' }\n format.json { render :show, status: :created, location: @rphrase }\n else\n format.html { render :new }\n format.json { render json: @rphrase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey = Survey.new(params[:survey])\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Тест добавлен.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def rhyming\n if !params[:word].empty?\n rhymes = Rhymes.new\n \n begin \n rhyming_words = rhymes.rhyme(params[:word])\n rescue StandardError => e \n json_response({ err: e }, :not_found)\n else\n json_response({rhyming_words: rhyming_words}, :ok)\n end\n else\n json_response({ message: 'Sorry, we couldn\\'t process your submission' }, :unprocessable_entity)\n end\n end", "def texto_palabra_params\n params.require(:texto_palabra).permit(:id_tp, :id_texto, :id_palabrab)\n end", "def create\n @phrase = Phrase.new(phrase_params)\n respond_to do |format|\n if @phrase.save\n format.html { redirect_to @phrase, notice: 'Phrase was successfully created.' }\n format.json { render :show, status: :created, location: @phrase }\n else\n format.html { render :new }\n format.json { render json: @phrase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @natulang = Natulang.new(params[:natulang])\n\n respond_to do |format|\n if @natulang.save\n format.html { redirect_to @natulang, notice: 'Natulang was successfully created.' }\n format.json { render json: @natulang, status: :created, location: @natulang }\n else\n format.html { render action: \"new\" }\n format.json { render json: @natulang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@alejandro = Alejandro.new(alejandro_params)\n\n\t\trespond_to do |format|\n\t\t\tif @alejandro.save\n\t\t\t\tformat.html { redirect_to alejandros_path, notice: 'Alejandro was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @alejandro }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @alejandro.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def anagram_params\n params.require(:anagram_detector).permit(:first_text, :second_text)\n end", "def create\n @sentifourgram = Sentifourgram.new(sentifourgram_params)\n\n respond_to do |format|\n if @sentifourgram.save\n format.html { redirect_to @sentifourgram, notice: 'Sentifourgram was successfully created.' }\n format.json { render :show, status: :created, location: @sentifourgram }\n else\n format.html { render :new }\n format.json { render json: @sentifourgram.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @textanswer = Textanswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @textanswer }\n end\n end", "def create\n @thema = Thema.new(thema_params)\n\n respond_to do |format|\n if @thema.save\n format.html { redirect_to @thema, notice: 'Thema was successfully created.' }\n format.json { render action: 'show', status: :created, location: @thema }\n else\n format.html { render action: 'new' }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lsa_test_word = LsaTestWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lsa_test_word }\n end\n end", "def create\n @hero_phrase = HeroPhrase.new(hero_phrase_params)\n\n respond_to do |format|\n if @hero_phrase.save\n format.html { redirect_to @hero_phrase, notice: 'Hero phrase was successfully created.' }\n format.json { render :show, status: :created, location: @hero_phrase }\n else\n format.html { render :new }\n format.json { render json: @hero_phrase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @text = Text.new(text_params)\n @text.reader_id = current_reader.id \n @text.readability_index = @text.difficulty_method \n @text.flesh_index = @text.rudolf_flesh_method\n #@text.speed_index = '1'\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: \"Text was successfully created.\" }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lensa = Lensa.new(lensa_params)\n\n respond_to do |format|\n if @lensa.save\n format.html { redirect_to @lensa, notice: 'Lensa was successfully created.' }\n format.json { render :show, status: :created, location: @lensa }\n else\n format.html { render :new }\n format.json { render json: @lensa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gram = current_user.grams.new(params[:gram])\n\n respond_to do |format|\n if @gram.save\n format.html { redirect_to @gram, notice: 'Gram was successfully created.' }\n format.json { render json: @gram, status: :created, location: @gram }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gram.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @word = Word.find_or_create_by_text(params[:text])\n\n respond_to do |format|\n if @word.save\n format.json { render json: @word, status: :created,\n location: @word}\n else\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to(@turma, :notice => 'Turma was successfully created.') }\n format.xml { render :xml => @turma, :status => :created, :location => @turma }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @turma.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @prenda = Prenda.new(prenda_params)\n\n respond_to do |format|\n if @prenda.save\n format.html { redirect_to @prenda, notice: 'Prenda was successfully created.' }\n format.json { render :show, status: :created, location: @prenda }\n else\n format.html { render :new }\n format.json { render json: @prenda.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "def anagrama_params\n params.require(:anagrama).permit(:word1, :word2, :check)\n end", "def create\n @imp_raman = ImpRaman.new(params[:imp_raman])\n\n respond_to do |format|\n if @imp_raman.save\n format.html { redirect_to @imp_raman, notice: 'Imp raman was successfully created.' }\n format.json { render json: @imp_raman, status: :created, location: @imp_raman }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imp_raman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chinese_phrase = ChinesePhrase.new(chinese_phrase_params)\n\n respond_to do |format|\n if @chinese_phrase.save\n format.html { redirect_to @chinese_phrase, notice: 'Chinese phrase was successfully created.' }\n format.json { render :show, status: :created, location: @chinese_phrase }\n else\n format.html { render :new }\n format.json { render json: @chinese_phrase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @raffle = Raffle.new(raffle_params)\n @raffle.update(user_id: current_user.id)\n respond_to do |format|\n if @raffle.save\n status = 'Participa en la rifa ' + @raffle.name + '. Para visitarla ingresa a https://rifapp-web.herokuapp.com/raffles/' + @raffle.id.to_s\n access_token = prepare_access_token(ENV[\"TWITTER_ACCESS_TOKEN\"], ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"])\n url = '/1.1/statuses/update.json?status=' + URI::escape(status)\n response = access_token.post(url)\n puts response\n #url = 'graph.facebook.com/v2.9/100019068038209/feed?message=' + URI::escape(status) + '&access_token=' + ENV[\"FB_ACCESS_TOKEN\"]\n #RestClient.post url, {}\n format.html { redirect_to created_user_path(current_user.id), notice: 'Raffle was successfully created.' }\n format.json { render :show, status: :created, location: @raffle }\n else\n format.html { render :new }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @typerelsequence = Typerelsequence.new(typerelsequence_params)\n\n respond_to do |format|\n if @typerelsequence.save\n format.html { redirect_to @typerelsequence, notice: 'Typerelsequence was successfully created.' }\n format.json { render :show, status: :created, location: @typerelsequence }\n else\n format.html { render :new }\n format.json { render json: @typerelsequence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kela = Kela.new(kela_params)\n\n respond_to do |format|\n if @kela.save\n format.html { redirect_to @kela, notice: 'Kela was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kela }\n else\n format.html { render action: 'new' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @razdel = Razdel.new(razdel_params)\n\n respond_to do |format|\n if @razdel.save\n format.html { redirect_to @razdel, notice: 'Razdel was successfully created.' }\n format.json { render :show, status: :created, location: @razdel }\n else\n format.html { render :new }\n format.json { render json: @razdel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @auditoria = Auditoria.new(params[:auditoria])\n\n respond_to do |format|\n if @auditoria.save\n format.html { redirect_to @auditoria, :notice => 'Auditoria was successfully created.' }\n format.json { render :json => @auditoria, :status => :created, :location => @auditoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @auditoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end", "def create\n @ulasan = Ulasan.new(ulasan_params)\n\n if @ulasan.save\n render :show, status: :created, location: @ulasan\n else\n render json: @ulasan.errors, status: :unprocessable_entity\n end\n end", "def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end", "def create\n @sentitrigram = Sentitrigram.new(sentitrigram_params)\n\n respond_to do |format|\n if @sentitrigram.save\n format.html { redirect_to @sentitrigram, notice: 'Sentitrigram was successfully created.' }\n format.json { render :show, status: :created, location: @sentitrigram }\n else\n format.html { render :new }\n format.json { render json: @sentitrigram.errors, status: :unprocessable_entity }\n end\n end\n end", "def gram_params\n params.require(:gram).permit(:text, :image_url)\n end", "def turma_params\n params.require(:turma).permit(:serie, :turno, :ensino, :colegio_id)\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def rayon_params\n params.require(:rayon).permit(:code, :nom, :is_active)\n end", "def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida was successfully created.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.62647176", "0.6159127", "0.6139747", "0.5904928", "0.58909833", "0.57144237", "0.5689884", "0.56723607", "0.56678516", "0.56566787", "0.5625265", "0.56249714", "0.5581306", "0.5573407", "0.55617315", "0.55544114", "0.55317545", "0.55237716", "0.55073404", "0.5501883", "0.5498964", "0.5496764", "0.54961723", "0.5492348", "0.5483459", "0.5468319", "0.54522365", "0.54508233", "0.54334235", "0.541662", "0.54085964", "0.54069865", "0.5403861", "0.5382603", "0.53788203", "0.53558093", "0.5354792", "0.53408724", "0.53401774", "0.5332332", "0.53299487", "0.5325147", "0.532117", "0.53190625", "0.531273", "0.53052974", "0.53000015", "0.52783537", "0.5277919", "0.52763766", "0.5276008", "0.52705604", "0.52647275", "0.52621937", "0.526105", "0.5260687", "0.52603954", "0.5249125", "0.52410316", "0.5240621", "0.5236734", "0.5231785", "0.52282554", "0.5226874", "0.5224905", "0.52223027", "0.52205807", "0.52191156", "0.5216016", "0.52151656", "0.52073485", "0.52042925", "0.5201921", "0.51914257", "0.5189091", "0.5189065", "0.5176196", "0.51727635", "0.5172072", "0.51681894", "0.51638013", "0.51567036", "0.51541096", "0.5152778", "0.5149643", "0.5149539", "0.51485777", "0.51438373", "0.51416916", "0.51366943", "0.51329887", "0.51325536", "0.513205", "0.51267815", "0.5124297", "0.5121461", "0.5120736", "0.51205677", "0.5117271", "0.5116371" ]
0.6398049
0
PUT /ramais/1 PUT /ramais/1.json
def update @ramal = Ramal.find(params[:id]) respond_to do |format| if @ramal.update_attributes(params[:ramal]) format.html { redirect_to @ramal, notice: 'Ramal alterado com sucesso!' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @ramal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n if @ram.update_attributes(params[:ram])\n format.html { redirect_to @ram, notice: 'Ram was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @arma = Arma.find(params[:id])\n\n respond_to do |format|\n if @arma.update_attributes(params[:arma])\n format.html { redirect_to @arma, notice: 'Arma was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n if @rayon.update_attributes(params[:rayon])\n format.html { redirect_to @rayon, notice: 'Rayon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def update\n @manga = Manga.find(params[:id])\n\n respond_to do |format|\n if @manga.update_attributes(params[:manga])\n format.html { redirect_to @manga, notice: 'Manga was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end", "def update\n @amenity = Amenity.find(params[:id])\n if @amenity.update_attributes(:name=>params[:body][:amenity])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@amenity.errors)\n end \n end", "def update\n word = Word.find(params[:id])\n word.gender = params[:gender]\n if word.save\n head :ok\n end\n end", "def update\n @anuncio = Anuncio.find params[:id]\n if @anuncio.update(anuncio_params)\n render :show, status: :ok, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end", "def update\n if @norma.update(norma_params)\n render :show, status: :ok, location: @norma\n else\n render json: @norma.errors, status: :unprocessable_entity\n end\n end", "def update\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n if @rua.update_attributes(params[:rua])\n format.html { redirect_to @rua, notice: 'Rua was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rua.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asama_tanim.update(asama_tanim_params)\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully updated.' }\n format.json { render :show, status: :ok, location: @asama_tanim }\n else\n format.html { render :edit }\n format.json { render json: @asama_tanim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anagrama.update(anagrama_params)\n format.html { redirect_to @anagrama, notice: 'Anagrama was successfully updated.' }\n format.json { render :show, status: :ok, location: @anagrama }\n else\n format.html { render :edit }\n format.json { render json: @anagrama.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n if @adocao_animal.update_attributes(params[:adocao_animal])\n format.html { redirect_to @adocao_animal, notice: 'Adocao animal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @adocao_animal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @arthicle.update(arthicle_params)\n format.html { redirect_to @arthicle, notice: 'Arthicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @arthicle }\n else\n format.html { render :edit }\n format.json { render json: @arthicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n if @agronomiaquimica.update_attributes(params[:agronomiaquimica])\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @antibiogram.update(antibiogram_params)\n\t\t\t\tformat.html { redirect_to @antibiogram, notice: 'Antibiogram was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @antibiogram }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @antibiogram.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @asana.update(asana_params)\n format.html { redirect_to @asana, notice: 'Asana atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @asana }\n else\n format.html { render :edit }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manga.update(manga_params)\n format.html { redirect_to @manga, notice: 'Manga was successfully updated.' }\n format.json { render :show, status: :ok, location: @manga }\n else\n format.html { render :edit }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @young_americana.update(young_americana_params)\n format.html { redirect_to @young_americana, notice: 'Young americana was successfully updated.' }\n format.json { render :show, status: :ok, location: @young_americana }\n else\n format.html { render :edit }\n format.json { render json: @young_americana.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n AudioData.update!(\n audio: \"aaaa\"#audioURL\n )\n\n audio = AudioData.find_by(2);\n\n render :json => audio;\n end", "def update\n respond_to do |format|\n if @atricle.update(atricle_params)\n format.html { redirect_to @atricle, notice: \"Atricle was successfully updated.\" }\n format.json { render :show, status: :ok, location: @atricle }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @atricle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @atricle.update(atricle_params)\n format.html { redirect_to @atricle, notice: 'Atricle was successfully updated.' }\n format.json { render :show, status: :ok, location: @atricle }\n else\n format.html { render :edit }\n format.json { render json: @atricle.errors, status: :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @alejandro.update(alejandro_params)\n format.html { redirect_to @alejandro, notice: 'Alejandro was successfully updated.' }\n format.json { render :show, status: :ok, location: @alejandro }\n else\n format.html { render :edit }\n format.json { render json: @alejandro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @armazena.update(armazena_params)\n format.html { redirect_to @armazena, notice: 'Armazena was successfully updated.' }\n format.json { render :show, status: :ok, location: @armazena }\n else\n format.html { render :edit }\n format.json { render json: @armazena.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alram_test.update(alram_test_params_for_update)\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully updated.' }\n format.json { render :show, status: :ok, location: @alram_test }\n else\n format.html { render :edit }\n format.json { render json: @alram_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @norma = Norma.find(params[:id])\n\n respond_to do |format|\n if @norma.update_attributes(params[:norma])\n format.html { redirect_to(@norma, :notice => 'Norma was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @norma.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\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 @text.readability_index = @text.difficulty_method\n @text.flesh_index = @text.rudolf_flesh_method\n #@text.speed_index = '15'\n\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: \"Text was successfully updated.\" }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n if @lsa_training_unique_word.update_attributes(params[:lsa_training_unique_word])\n format.html { redirect_to @lsa_training_unique_word, notice: 'Lsa training unique word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lsa_training_unique_word.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lsa_test_word = LsaTestWord.find(params[:id])\n\n respond_to do |format|\n if @lsa_test_word.update_attributes(params[:lsa_test_word])\n format.html { redirect_to @lsa_test_word, notice: 'Lsa test word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lsa_test_word.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ra.update(ra_params)\n format.html { redirect_to @ra, notice: 'Ra was successfully updated.' }\n format.json { render :show, status: :ok, location: @ra }\n else\n format.html { render :edit }\n format.json { render json: @ra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lugar = Lugar.find(params[:id])\n\n if @lugar.update(lugar_params)\n head :no_content\n else\n render json: @lugar.errors, status: :unprocessable_entity\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", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n if @imp2_raman.update_attributes(params[:imp2_raman])\n format.html { redirect_to @imp2_raman, notice: 'Imp2 raman was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imp2_raman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n if @safra.update_attributes(params[:safra])\n format.html { redirect_to @safra}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anio.update(anio_params)\n format.html { redirect_to @anio, notice: 'Anio was successfully updated.' }\n format.json { render :show, status: :ok, location: @anio }\n else\n format.html { render :edit }\n format.json { render json: @anio.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rayon\n @rayon = Rayon.find(params[:id])\n @rayon.nom=@rayon.nom.force_encoding(\"UTF-8\")\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @alejandro.update(alejandro_params)\n\t\t\t\tformat.html { redirect_to alejandros_path, notice: 'Alejandro was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @alejandro }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @alejandro.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @musica.update(musica_params)\n format.html { redirect_to @musica, notice: 'Álbum atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @musica }\n else\n format.html { render :edit }\n format.json { render json: @musica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n if @turma.update_attributes(params[:turma])\n format.html { redirect_to @turma, notice: 'Turma was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stanza = Stanza.find_by_no(params[:id])\n\n respond_to do |format|\n if @stanza.update_attributes(params[:stanza])\n format.html { redirect_to @stanza, notice: 'Stanza was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stanza.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @vocabulaire.update(vocabulaire_params)\n format.html { redirect_to @vocabulaire, notice: 'Vocabulaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vocabulaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n if @quiniela.update_attributes(params[:quiniela])\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @analyzer.update(analyzer_params)\n format.html { redirect_to @analyzer, notice: 'Analyzer was successfully updated.' }\n format.json { render :show, status: :ok, location: @analyzer }\n else\n format.html { render :edit }\n format.json { render json: @analyzer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n if @imp_raman.update_attributes(params[:imp_raman])\n format.html { redirect_to @imp_raman, notice: 'Imp raman was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imp_raman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aka.update(aka_params)\n format.html { redirect_to @aka, notice: 'Aka was successfully updated.' }\n format.json { render :show, status: :ok, location: @aka }\n else\n format.html { render :edit }\n format.json { render json: @aka.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @lensa.update(lensa_params)\n format.html { redirect_to @lensa, notice: 'Lensa was successfully updated.' }\n format.json { render :show, status: :ok, location: @lensa }\n else\n format.html { render :edit }\n format.json { render json: @lensa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n if @arcone.update_attributes(params[:arcone])\n format.html { redirect_to @arcone, notice: 'Arcone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arcone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apology.update(apology_params)\n format.html { redirect_to @apology, notice: 'Apology was successfully updated.' }\n format.json { render :show, status: :ok, location: @apology }\n else\n format.html { render :edit }\n format.json { render json: @apology.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @animai.update(animai_params)\n format.html { redirect_to @animai, notice: 'Animai was successfully updated.' }\n format.json { render :show, status: :ok, location: @animai }\n else\n format.html { render :edit }\n format.json { render json: @animai.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end", "def update\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n if @ano.update_attributes(params[:ano])\n format.html { redirect_to @ano, notice: 'Ano was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ano.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @arbitro = Arbitro.find(params[:id])\n\n respond_to do |format|\n if @arbitro.update_attributes(params[:arbitro])\n format.html { redirect_to @arbitro, notice: 'El Arbitro se ha modificado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arbitro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ambience.update(ambience_params)\n format.html { redirect_to @ambience, notice: 'Ambience was successfully updated.' }\n format.json { render :show, status: :ok, location: @ambience }\n else\n format.html { render :edit }\n format.json { render json: @ambience.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n \n respond_to do |format|\n if @quinto.update(quinto_params)\n format.html { redirect_to @quinto, notice: 'Quinto was successfully updated.' }\n format.json { render :show, status: :ok, location: @quinto }\n else\n format.html { render :edit }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n if @ambito.update_attributes(params[:ambito])\n format.html { redirect_to(@ambito, :notice => 'Ambito was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambito.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @spirit = Spirit.find(params[:id])\n\n respond_to do |format|\n if @spirit.update_attributes(params[:spirit])\n format.html { redirect_to @spirit, notice: 'Spirit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spirit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ram_post.update(ram_post_params)\n format.html { redirect_to @ram_post, notice: 'Ram post was successfully updated.' }\n format.json { render :show, status: :ok, location: @ram_post }\n else\n format.html { render :edit }\n format.json { render json: @ram_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ramal = Ramal.new(params[:ramal])\n\n respond_to do |format|\n if @ramal.save\n format.html { redirect_to @ramal, notice: 'Ramal criado com sucesso!' }\n format.json { render json: @ramal, status: :created, location: @ramal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ramal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n word1 = anagram_params[:firstword]\n word2 = anagram_params[:secondword]\n matchingresult = AnagramsChecker.anagrams?(word1, word2)\n @anagram.matching = matchingresult\n\n respond_to do |format|\n if @anagram.update(anagram_params)\n format.html { redirect_to @anagram, notice: 'Anagram was successfully updated.' }\n format.json { render :show, status: :ok, location: @anagram }\n else\n format.html { render :edit }\n format.json { render json: @anagram.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @materia = Materia.find(params[:id])\n\n if @materia.update(params[:materia])\n head :no_content\n else\n render json: @materia.errors, status: :unprocessable_entity\n end\n end", "def update\n @auditoria = Auditoria.find(params[:id])\n\n respond_to do |format|\n if @auditoria.update_attributes(params[:auditoria])\n format.html { redirect_to @auditoria, :notice => 'Auditoria was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @auditoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @athlete.altered_by = current_user.id\n namesplit = @athlete.name.split(' ')\n @athlete.short_name = \"#{namesplit.first} #{namesplit.last}\" if namesplit.length > 1\n @athlete.short_name = \"#{namesplit.first}\" if namesplit.length == 1\n\n respond_to do |format|\n\n if @athlete.update(athlete_params)\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n format.html { redirect_to club_path(@athlete.club_id), notice: 'Atleta criado com sucesso.' }\n else\n format.html { redirect_to @athlete, notice: 'Atleta actualizado com sucesso.' }\n end\n format.json { head :no_content }\n else\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n flash[:error] = @athlete.errors.full_messages.join(\".<br>\").html_safe\n format.html { redirect_to club_path(@athlete.club_id) }\n else\n format.html { render action: 'edit' }\n end\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "def update\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n if @jamaat.update_attributes(params[:jamaat])\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alternativa.update(alternativa_params)\n format.html { redirect_to @alternativa, notice: 'Alternativa was successfully updated.' }\n format.json { render :show, status: :ok, location: @alternativa }\n else\n format.html { render :edit }\n format.json { render json: @alternativa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @annonce.update(annonce_params)\n format.html { redirect_to @annonce, notice: 'L\\'annonce a été correctement édité.' }\n format.json { render :show, status: :ok, location: @annonce }\n else\n format.html { render :edit }\n format.json { render json: @annonce.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n if @vachana.update_attributes(params[:vachana])\n format.html { redirect_to @vachana, notice: 'Vachana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n if @vachana.update_attributes(params[:vachana])\n format.html { redirect_to @vachana, notice: 'Vachana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saida.update(saida_params)\n format.html { redirect_to @saida, notice: 'Saida was successfully updated.' }\n format.json { render :show, status: :ok, location: @saida }\n else\n format.html { render :edit }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @audiovisuai = Audiovisuai.find(params[:id])\n\n respond_to do |format|\n if @audiovisuai.update_attributes(params[:audiovisuai])\n flash[:notice] = 'Audiovisuai was successfully updated.'\n format.html { redirect_to(@audiovisuai) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @audiovisuai.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questao.update(questao_params)\n format.html { redirect_to @questao, notice: 'Questao was successfully updated.' }\n format.json { render :show, status: :ok, location: @questao }\n else\n format.html { render :edit }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ambiance = Ambiance.find(params[:id])\n\n respond_to do |format|\n if @ambiance.update_attributes(params[:ambiance])\n format.html { redirect_to(@ambiance, :notice => 'L ambiance a ete modifiee.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambiance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @academia.update(academia_params)\n format.html { redirect_to @academia, notice: 'Academia was successfully updated.' }\n format.json { render :show, status: :ok, location: @academia }\n else\n format.html { render :edit }\n format.json { render json: @academia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n @questao = Questao.find(params[:id])\n\n respond_to do |format|\n if @questao.update_attributes(params[:questao])\n format.html { redirect_to(@questao, :notice => 'Questao was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @questao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jra.update(jra_params)\n format.html { redirect_to @jra, notice: 'Jra was successfully updated.' }\n format.json { render :show, status: :ok, location: @jra }\n else\n format.html { render :edit }\n format.json { render json: @jra.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alram_test\n @alram_test = AlramTest.find(params[:id])\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aroma = Aroma.new(params[:aroma])\n\n respond_to do |format|\n if @aroma.save\n format.html { redirect_to @aroma, notice: 'Aroma was successfully created.' }\n format.json { render json: @aroma, status: :created, location: @aroma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n if @tea.update_attributes(params[:tea])\n format.html { redirect_to @tea, notice: 'Tea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aquarium = Aquarium.find(params[:id])\n\n respond_to do |format|\n if @aquarium.update_attributes(params[:aquarium])\n format.html { redirect_to @aquarium, notice: 'Aquarium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aquarium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @galactic_arm.update(galactic_arm_params)\n format.html { redirect_to @galactic_arm, notice: 'Galactic arm was successfully updated.' }\n format.json { render :show, status: :ok, location: @galactic_arm }\n else\n format.html { render :edit }\n format.json { render json: @galactic_arm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n if @causale.update_attributes(params[:causale])\n format.html { redirect_to @causale, notice: 'Causale aggiornata con successo.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alola.update(alola_params)\n format.html { redirect_to @alola, notice: 'Alola was successfully updated.' }\n format.json { render :show, status: :ok, location: @alola }\n else\n format.html { render :edit }\n format.json { render json: @alola.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63633907", "0.62695473", "0.60082513", "0.5815193", "0.5811508", "0.5806587", "0.5780349", "0.575386", "0.5732287", "0.56992644", "0.5680876", "0.5667151", "0.56266034", "0.5614791", "0.56132", "0.55970705", "0.55903393", "0.55894816", "0.5581456", "0.55806786", "0.5567762", "0.5558193", "0.55529654", "0.5546012", "0.5543854", "0.5536718", "0.5526423", "0.5505805", "0.5495136", "0.5494596", "0.5493967", "0.5489742", "0.54852307", "0.54843324", "0.54771847", "0.5471112", "0.54672253", "0.5465001", "0.54641014", "0.5453796", "0.5442415", "0.5439945", "0.54395527", "0.5431483", "0.54295766", "0.54286563", "0.5426103", "0.5425396", "0.54172087", "0.5412564", "0.541161", "0.54103166", "0.5396339", "0.53960973", "0.5396071", "0.53946906", "0.5389759", "0.5383506", "0.53819865", "0.53789854", "0.5378291", "0.5374035", "0.53713256", "0.5365569", "0.53642654", "0.53580433", "0.5357136", "0.53445166", "0.5343534", "0.5331346", "0.5328888", "0.53287405", "0.5327118", "0.5325941", "0.5323532", "0.53161323", "0.53149635", "0.53147835", "0.5311447", "0.5307527", "0.53068584", "0.53068584", "0.53068244", "0.53049433", "0.5304356", "0.5300568", "0.52936494", "0.5293321", "0.52922124", "0.52915347", "0.52898884", "0.5289236", "0.5285876", "0.5285801", "0.52852535", "0.5279697", "0.52667075", "0.52640355", "0.5263934", "0.5260265" ]
0.64180064
0
DELETE /ramais/1 DELETE /ramais/1.json
def destroy @ramal = Ramal.find(params[:id]) @ramal.destroy respond_to do |format| format.html { redirect_to ramais_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @ram = Ram.find(params[:id])\n @ram.destroy\n\n respond_to do |format|\n format.html { redirect_to rams_url }\n format.json { head :no_content }\n end\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\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aroma = Aroma.find(params[:id])\n @aroma.destroy\n\n respond_to do |format|\n format.html { redirect_to aromas_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @causale = Causale.find(params[:id])\n @causale.destroy\n\n respond_to do |format|\n format.html { redirect_to causali_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @busqueda = Busqueda.find(params[:id])\n @busqueda.destroy\n\n respond_to do |format|\n format.html { redirect_to busquedas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anagrama.destroy\n respond_to do |format|\n format.html { redirect_to anagramas_url, notice: 'Anagrama was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aquarium = Aquarium.find(params[:id])\n @aquarium.destroy\n\n respond_to do |format|\n format.html { redirect_to aquaria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @analise.destroy\n respond_to do |format|\n format.html { redirect_to analises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\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 @apertura_moneda.destroy\n respond_to do |format|\n format.html { redirect_to apertura_monedas_url, notice: 'Apertura moneda was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @anagram.destroy\n respond_to do |format|\n format.html { redirect_to anagrams_url, notice: 'Anagram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @drama.destroy\n respond_to do |format|\n format.html { redirect_to dramas_url, notice: 'Drama 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 @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @antenne = Antenne.find(params[:id])\r\n @antenne.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to antennes_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @arcone = Arcone.find(params[:id])\n @arcone.destroy\n\n respond_to do |format|\n format.html { redirect_to arcones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kela.destroy\n respond_to do |format|\n format.html { redirect_to kelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alram_test.destroy\n respond_to do |format|\n format.html { redirect_to alram_tests_url, notice: 'Alram test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_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\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def 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 delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @adotando_animal = AdotandoAnimal.find(params[:id])\n @adotando_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adotando_animais_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rb.destroy\n respond_to do |format|\n format.html { redirect_to rbs_url, notice: 'Erfolgreich gelöscht.' }\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 @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @astronomium.destroy\n respond_to do |format|\n format.html { redirect_to astronomia_url, notice: 'Astronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aka.destroy\n respond_to do |format|\n format.html { redirect_to akas_url, notice: 'Aka was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\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 @oferta_academica = OfertaAcademica.find(params[:id])\n @oferta_academica.destroy\n\n head :no_content\n end", "def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end", "def destroy\n string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @caixa = Caixa.find(params[:id])\n @caixa.destroy\n\n respond_to do |format|\n format.html { redirect_to caixas_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 @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alejandro.destroy\n respond_to do |format|\n format.html { redirect_to alejandros_url, notice: 'Alejandro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auditoria = Auditoria.find(params[:id])\n @auditoria.destroy\n\n respond_to do |format|\n format.html { redirect_to auditorias_url }\n format.json { head :ok }\n end\n end", "def destroy\n @aream.destroy\n respond_to do |format|\n format.html { redirect_to areams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cafeterium.destroy\n respond_to do |format|\n format.html { redirect_to cafeteria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alola.destroy\n respond_to do |format|\n format.html { redirect_to alolas_url, notice: 'Alola was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ano = Ano.find(params[:id])\n @ano.destroy\n\n respond_to do |format|\n format.html { redirect_to anos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asana.destroy\n respond_to do |format|\n format.html { redirect_to asanas_url, notice: 'Asana excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @arma = Arma.find(params[:id])\n @arma.destroy\n\n respond_to do |format|\n format.html { redirect_to armas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @norma = Norma.find(params[:id])\n @norma.destroy\n\n respond_to do |format|\n format.html { redirect_to(normas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lsa_test_word = LsaTestWord.find(params[:id])\n @lsa_test_word.destroy\n\n respond_to do |format|\n format.html { redirect_to lsa_test_words_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alternativa.destroy\n respond_to do |format|\n format.html { redirect_to alternativas_url, notice: 'Alternativa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tarefa = Tarefa.find(params[:id])\n @tarefa.destroy\n\n respond_to do |format|\n format.html { redirect_to tarefas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { redirect_to word_praats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kanri_daicho.destroy\n respond_to do |format|\n format.html { redirect_to kanri_daichos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lensa.destroy\n respond_to do |format|\n format.html { redirect_to lensas_url, notice: 'Lensa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @racquet.destroy\n respond_to do |format|\n format.html { redirect_to racquets_url, notice: t('racquets.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anrede = Anrede.find(params[:id])\n @anrede.destroy\n\n respond_to do |format|\n format.html { redirect_to anredes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saida.destroy\n respond_to do |format|\n format.html { redirect_to saidas_url, notice: 'Saida foi apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @iglesia.destroy\n respond_to do |format|\n format.html { redirect_to iglesias_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @quiniela = Quiniela.find(params[:id])\n @quiniela.destroy\n\n respond_to do |format|\n format.html { redirect_to quinielas_url }\n format.json { head :ok }\n end\n end", "def destroy\n @moneda = Moneda.find(params[:id])\n @moneda.destroy\n\n respond_to do |format|\n format.html { redirect_to(monedas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alternativo.destroy\n respond_to do |format|\n format.html { redirect_to alternativos_url, notice: 'Alternativo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questao.destroy\n respond_to do |format|\n format.html { redirect_to questaos_url, notice: 'Questao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @stanza = Stanza.find_by_no(params[:id])\n @stanza.destroy\n\n respond_to do |format|\n format.html { redirect_to stanzas_url }\n format.json { head :no_content }\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\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @annonce.destroy\n respond_to do |format|\n format.html { redirect_to annonces_url, notice: 'Votre annonce à été supprimé avec succès.' }\n format.json { head :no_content }\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @status_animal = StatusAnimal.find(params[:id])\n @status_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to status_animais_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6928334", "0.68618", "0.6830498", "0.6805777", "0.67912847", "0.6765914", "0.67633367", "0.67621964", "0.6705493", "0.6700462", "0.6693336", "0.6690087", "0.66743857", "0.66685414", "0.6666086", "0.6650989", "0.6650645", "0.6637559", "0.6612084", "0.6610384", "0.6609764", "0.66090834", "0.65938175", "0.65846634", "0.6574926", "0.6566117", "0.65585244", "0.6558389", "0.65534955", "0.65398616", "0.6539215", "0.6529489", "0.6528756", "0.6521719", "0.65158397", "0.65155214", "0.6510657", "0.6510507", "0.65097594", "0.6507373", "0.6504031", "0.6503388", "0.65016395", "0.64988697", "0.6498352", "0.64962775", "0.6495335", "0.6494912", "0.6494379", "0.6493345", "0.6493068", "0.64892405", "0.64892405", "0.64891976", "0.64887106", "0.6487036", "0.6484232", "0.6475659", "0.6472915", "0.64703965", "0.64690167", "0.6467761", "0.6467028", "0.6463471", "0.64607596", "0.64607596", "0.6458576", "0.64576745", "0.64565194", "0.6456188", "0.6454532", "0.64543825", "0.645344", "0.64511263", "0.6450929", "0.6450325", "0.6448258", "0.6447199", "0.64435416", "0.6437656", "0.643475", "0.6434673", "0.6434004", "0.64321345", "0.64320916", "0.64317966", "0.64317024", "0.6431277", "0.6430931", "0.6428548", "0.64280474", "0.6426939", "0.6426143", "0.6424069", "0.64224213", "0.64204085", "0.6419288", "0.6417165", "0.64158463", "0.64136076" ]
0.71264106
0
Roundcurrent_card returns the current card to be answered.
def current_card @deck.cards[@turns.count] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_card\n deck.cards[@number_correct]\n end", "def current_card\n @deck.cards[0]\n end", "def current_card\n @deck.cards[count]\n end", "def current_value\n @top_card.value\n end", "def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round\") )\n end", "def round_result\n interface.show_cards_evident(player.cards, croupier.cards)\n interface.current_points(player.amt_points, croupier.amt_points)\n\n return interface.draw if player.amt_points == croupier.amt_points\n return interface.draw if player.excess? && croupier.excess?\n return win_round if croupier.excess?\n return lose_round if player.excess?\n return win_round if player.amt_points > croupier.amt_points\n lose_round\n end", "def current_round\r\n self.rounds.last\r\n end", "def initial_round\n total = deal_card + deal_card\n display_card_total(total)\n return total\nend", "def current_round\n Round.where(\"user_id = #{current_user.id}\").last\n end", "def last_guessed_card\n current_round.guesses.last.card_id\nend", "def current_total_amount\n\n if calculate_total(session[:player_cards]).to_i == BLACKJACK\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:player_cards]).to_i > BLACKJACK\n session[:player_pot] -= session[:player_bet].to_i\n elsif calculate_total(session[:dealer_cards]).to_i > BLACKJACK\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:dealer_cards]).to_i == BLACKJACK\n session[:player_pot] -= session[:player_bet].to_i\n elsif calculate_total(session[:player_cards]).to_i > calculate_total(session[:dealer_cards]).to_i\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:dealer_cards]).to_i > calculate_total(session[:player_cards]).to_i\n session[:player_pot] -= session[:player_bet].to_i \n else\n session[:player_pot]\n end # ends if statement\n end", "def initial_round\n total = deal_card + deal_card\n display_card_total(total)\n total\nend", "def current_round; (@current_turn / 2).floor end", "def initial_round\n card_total = deal_card + deal_card\n display_card_total(card_total)\n card_total\nend", "def amount_current_round\n fract = has_integer_consumptions_only? ? 1 : 2\n truncate_number(amount_current, fract)\n end", "def get_current_currency\r\r\n $game_party.current_currency[:sym]\r\r\n end", "def current_suit\n @current_suit\n end", "def current_repetition\n @cards = current_user.cards_due\n @card = @cards.sample\n end", "def current_player(board)\n turn_count(board).even? ? \"X\" : turn_count(board).odd? ? \"O\" : \"X\"\n end", "def current_player()\n # Assume player X goes first\n return turn_count() % 2 == 0 ? \"X\" : \"O\"\n end", "def displayCurrentHand\n\t\t\theader = \"\\nCurrentBoard:\\n\"\n\t\t\t@board.length().times do |i|\n\t\t\t\tputs \"\\n\\t\"\n\t\t\t\tputs \"\\tCard #{i+1}\"\n\t\t\t\tputs @board[i]\n\t\t\tend\n\t\tend", "def current_player\n player = nil\n if turn_count() % 2 == 0\n player = 'X'\n else\n player = 'O'\n end\n return player\n end", "def playCard()\n if (@hand.length == 0)\n puts \"#{@name} RAN OUT OF CARDS\"\n return false\n end\n topCard = @hand.shift\n return topCard\n end", "def current_score\n\t\treturn @game_stack\n\tend", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end", "def current_player(board)\n #is turn count divisible by 2 then return X, if not, return O. \n turn_count(@board) % 2 == 0? \"X\" : \"O\"\n end", "def get_card_value(card)\n card_number = get_card_number(card)\n if card_number == 'K' || card_number == 'J' || card_number == 'Q'\n card_number = 10\n elsif card_number == 1\n card_number = 11\n end\n return card_number\nend", "def get_card\n all_cards = self.deck.cards\n correct_cards = self.guesses.where(correct: true).map { |guess| guess.card }\n (all_cards - correct_cards).shuffle.sample\n end", "def winner\n if finished?\n if fold = @hand_history.all_actions.find(&:fold?)\n winner = (fold.player == small_blind) ? big_blind : small_blind\n else\n winner = if PokerHand.new( small_blind.hole_cards + @community_cards ) > PokerHand.new( big_blind.hole_cards + @community_cards )\n small_blind\n else\n big_blind\n end\n end\n else\n nil\n end\n end", "def correct?\n @card.answer == @guess\n end", "def current_player(board)\n turn_count(board) % 2 == 0 ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player()\n current_turn = turn_count()\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def up_card\n return @cards[0]\n end", "def get_card\n @card ||= @user.get_valid_card\n end", "def current_player\n return turn_count.even? ? \"X\" : \"O\"\n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def current_points(game)\n game_cards ? game_cards.where(game: game).map(&:card).map(&:value).sum : 0\n end", "def current_player\r\n if self.turn_count == 0\r\n return \"X\"\r\n elsif self.turn_count.odd?\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_player\n turns_played = turn_count()\n if turns_played % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def correct?\n @guess == @card.answer\n end", "def round(player)\n # if black jack from first 2 cards\n if player.score == 21\n case_black_jack(player)\n unless play_again\n return\n end\n end\n\n while true\n print_scores(player)\n if player.score == 21\n dealer_game(player)\n unless play_again\n break\n end\n end\n print_options_choosing(player)\n option = gets.chomp\n if option.match('1|Hit')\n player.open_new_card\n # if player got > 21 - game is over\n if player.score > WINNER_SCORE\n if player.has_ace and player.ace_score <= WINNER_SCORE\n player.score, player.ace_score = player.ace_score, player.score\n next\n end\n puts \"Your score is: #{player.score}\"\n puts 'YOU LOSE! DEALER WIN'\n player.update_money(false, false)\n else\n next\n end\n elsif option.match('2|Stand')\n dealer_game(player)\n elsif option.match('3|Double_down')\n option_double_down(player)\n elsif option.match('4|Surrender')\n puts \"House returned #{player.bet}$ to you!\"\n player.update_money(false, true)\n elsif option.match('5|Split')\n option_split(player)\n else\n puts 'You entered wrong option! Try again!'\n next\n end\n unless play_again\n break\n end\n end\n end", "def current_symbol\n if current_player < 1 || current_player > 2\n raise \"Impossible value for current_player #{current_player}\"\n end\n return PLAYER_SYMBOLS[current_player - 1]\n end", "def runner\n welcome\n # initial_round\n cardTotal = initial_round\n until cardTotal > 21\n cardTotal = hit? cardTotal\n display_card_total cardTotal\n end\n end_game cardTotal\nend", "def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end", "def get_rounds_cards\n # get all the cards from this round's deck\n @cards = self.deck.cards\n end", "def round_result\n @round += 1\n puts \"Round #{format('%02d', @round)}: #{@board.format(@board.breaker)}\nYou got #{@board.matches} matches and #{@board.correct_matches} correct guesses\"\n puts 'Careful, the next one is your last chance!'.red if @round == 11\n end", "def current_cart\n if current_user.current_cart\n current_user.current_cart\n else\n return nil\n end\n end", "def current_player(board)\n counter_turn = turn_count(board)\n if counter_turn % 2 == 0\n \"X\"\n else\n \"O\"\n end\n end", "def runner\r\n welcome\r\n num = initial_round\r\n numAfter = hit?(num)\r\n display_card_total(numAfter)\r\n end_game(numAfter)\r\nend", "def retrieve_card\n card = @cards.pop\n if card.nil?\n self.reset\n card = @cards.pop\n end\n return card\n end", "def current_player\n turn = turn_count\n if turn%2 == 0\n return \"X\"\n else\n return 'O'\n end\n end", "def current_player\n @board.turn_count.even? ? @player_1 : @player_2\n end", "def runner(current_card_total)\n welcome\n initial_round\n until current_card_total>21\n hit?(sum)\n display_card_total(card_total)\n end\n end_game\nend", "def current_player\n\tif $turn == 0\n\t\tplayerone\n\telse\n\t\tplayertwo\n\tend\nend", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player\n turn_count.even? ? \"X\" : \"O\"\n end", "def current_player(board)\n return (turn_count(board).even? ? \"X\" : \"O\")\nend", "def current_cart\n @current_cart ||= ShoppingCart.new(token: cart_token)\n end", "def current_player(board)\n count = turn_count(board)\n return count.odd? ? \"O\" : \"X\"\nend", "def current_board\n @current_board\n end", "def current_player\r\n turn_count\r\n if turn_count % 2 == 0\r\n return \"X\"\r\n else\r\n return \"O\"\r\n end\r\n end", "def current_player\n return turn_count%2==0 ? \"X\" : \"O\"\n end", "def current_player(board)\n count = turn_count(board)\n \n player = count.even? ? \"X\" : \"O\"\n \n return player\nend", "def current_player\n @board.turn_count.even? ? @player_1 : @player_2;\n end", "def play_like_a_master\r\n card = nil\r\n @log.debug \"Cards on hand \" + @cards_on_hand.inject(\"\"){|res, card| res + \"#{card.to_s} \"}\r\n \r\n case @card_played.size\r\n when 0\r\n card = play_as_master_first\r\n when 1\r\n card = play_as_master_second\r\n end\r\n return card\r\n end", "def whoWinRound(num_player_start)\n cont = 0\n card_win = @players[num_player_start].card_thrown\n while cont <= (@players.length - 1)\n card = @players[cont].card_thrown\n if card_win != card\n if card.type.to_s == @trump_card.type.to_s || card_win.type.to_s == @trump_card.type.to_s\n aux_card = validate_card_with_trump(card, card_win)\n else\n aux_card = validate_card_without_trump(card, card_win)\n end\n if save_card_win(aux_card).nil?\n else\n card_win = save_card_win(aux_card)\n end\n end\n cont += 1\n end\n cont_player = 0\n while cont_player <= (@players.length - 1)\n return cont_player if @players[cont_player].card_thrown == card_win\n cont_player += 1\n end\n end", "def flip_to_next_card\n @flashcard_deck.next_card\n @current_card = @flashcard_deck.current_card\n end", "def to_s\n @current_cards.to_s\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\r\n if turn_count % 2 != 0\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_turn()\n @players[@turn]\n end", "def round()\n\t\t#array of used cards\n\t\t@used = []\n\t\t#loop through players array\n\t\tfor i in 0...@num_players\n\t\t\t#reset player variables\n\t\t\t@players[i].reset()\t\n\t\t\t#populate hand\n\t\t\t@players[i].populate(@used,52,5)\n\t\t\t#get hand rank\n\t\t\t@players[i].get_rank()\n\t\t\t#add hand to array of used cards\n\t\t\t@used += @players[i].hand\n\t\tend\n\t\t#increment round number\n\t\t@roundnum += 1 \n\tend", "def current_player\n if @board.turn_count.even?\n @player_1\n else\n @player_2\n end\n end", "def current\n self.players[self.current_turn]\n end", "def get_new_card\r\n\r\n #Assign a random number between 1 and 13 as the value of the card being\r\n #created\r\n card = 1 + rand(13)\r\n\r\n #A value of 1 is an ace, so reassign the card a value of 11\r\n return 11 if card == 1\r\n\r\n #A value of 10 or more equals a face card so reassign the card a value\r\n #of 10\r\n return 10 if card >= 10\r\n\r\n return card #Return the value assigned to the new card\r\n\r\n end", "def current_player(board)\n\tcount = turn_count(board)\n\tcount % 2 == 0 ? \"X\" : \"O\"\nend", "def current_user\n if cookies.signed[:user_id]\n user_id = cookies.signed[:user_id]\n user = User.find_by(id: user_id)\n token = find_token user.sp_card\n if user && token\n @current_user = user\n end\n end\n end", "def number_correct\n number_correct = 0\n if current_card.answer == turns[turns.length - 1].guess\n number_correct + 1\n end\n end", "def random_card\n return @deck[rand(@deck.length)]\n end", "def correct?\n # checks if the guess is equivalent to the cards answer and return a bool\n @guess == @card.answer\n end", "def remaining_number\n card.remaining_number\n end", "def active_credit_card\n if organization && (organization.owner_id != id) && organization.owner\n return organization.owner.active_credit_card\n else\n customer.card\n end\n end", "def current_player\n board.turn_count.even? ? @player_1 : @player_2\n end", "def get_default_card(customer)\n default_card = nil\n\n customer.cards.each do |card|\n if card.id == customer.default_card\n default_card = card\n end\n end\n\n return default_card\n end", "def get_new_card\n \n #Assign a random number between 1 and 13 as the value of the card being \n #created\n card = 1 + rand(13)\n \n #A value of 1 is an ace, so reassign the card a value of 11\n return 11 if card == 1 \n\n #A value of 10 or more equals a face card so reassign the card a value\n #of 10 \n return 10 if card >= 10\n \n return card #Return the value assigned to the new card\n \n end", "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_account\n ENV['CURRENT_ACCOUNT']\n #BlOCKCHAIN_CLIENT.eth_accounts['result'][0]\n #'0x1f9334BAE0acC7a86834f60488d0C6Fa89B4590b'\n end", "def find_winner()\n\t\tingame_players = 0\n\t\tlast_cards = []\n\n\t\t#puts \"In find winner method\"\n\t\tputs to_s\n\n\t\t@players.each do |player|\n\t\t\n\n\t\t\tif !player.is_fold\n\t\t\t\tlast_cards << player.get_cards\n\t\t\t\t\n\t\t\tend\n\n\t\tend\n\t\t@players.each do |player|\n\t\t\t\n\n\t\t\tif !player.is_fold\n\t\t\t\t\n\t\t\t\tputs\n\t\t\t\tplayer.increase_game\n\t\t\t\t#i = last_cards.index(player.get_cards)\n\t\t\t\t#last_cards.insert(0, last_cards.delete_at(i)) \n\t\t\t\tcards_of_players = \"#{last_cards.join(\"\")}\"\n\t\t\t\t#puts \"Order of cards: \" + cards_in_order\n\t\t\t\t#puts \"get cards: \" + get_cards\n\t\t\t\twinner = @pokeroddsproxy.get_winnercards(cards_of_players, get_cards)\n\t\t\t\t#odds = @pokeroddsproxy.get_odds(cards_in_order, get_cards, ingame_players)\n\t\t\t\t#puts odds\n\n\t\t\t\tif winner == player.get_cards #If winner's cards are same with the player\n\t\t\t\t\tputs \"#{player.get_name} is the winner\"\n\t\t\t\t\tplayer.addmoney(@pot)\n\t\t\t\t\tplayer.increase_win\n\t\t\t\telse\n\t\t\t\t\tputs \"#{player.get_name} is the loser\"\n\t\t\t\t\tplayer.increase_lose\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\n\tend", "def current_player\n turn_count % 2 == 0 ? \"X\" : \"O\"\n end", "def runner\n welcome\n cards_counter = initial_round\n\n until cards_counter > 21\n compare = hit?(cards_counter)\n compare == cards_counter ? display_card_total(cards_counter):display_card_total(compare)\n cards_counter = compare\n end\nend_game(cards_counter)\nend", "def runner\n welcome\n cardTotal= initial_round\n until cardTotal > 21\n cardTotal = hit?(cardTotal)\n display_card_total(cardTotal)\n end\n end_game(cardTotal)\nend", "def current_player\n\n @number = turn_count\n\n if (@number % 2 == 0)\n return \"X\"\n else\n return \"O\"\n end\n\n end" ]
[ "0.71274006", "0.684506", "0.67001146", "0.6378743", "0.6365905", "0.626723", "0.6143609", "0.6140993", "0.6101522", "0.6064676", "0.5985079", "0.59462166", "0.59124285", "0.5901385", "0.58638436", "0.5729679", "0.5653972", "0.56150085", "0.5512238", "0.54952383", "0.5477524", "0.54659075", "0.5414674", "0.5409139", "0.5376213", "0.53759795", "0.5374611", "0.53736943", "0.5358223", "0.5356151", "0.5350196", "0.53470993", "0.53419214", "0.53419214", "0.5337644", "0.53317255", "0.5311059", "0.5302932", "0.52795523", "0.52795523", "0.5279211", "0.5274266", "0.526357", "0.5253134", "0.5250678", "0.5248729", "0.524821", "0.52391875", "0.52358127", "0.52352", "0.5224464", "0.52162564", "0.52110153", "0.5202675", "0.5199921", "0.5183454", "0.5183055", "0.5181968", "0.5176347", "0.5176347", "0.5176347", "0.51702076", "0.51676077", "0.5163194", "0.5161624", "0.5157214", "0.5155823", "0.515161", "0.51477814", "0.51427996", "0.51387966", "0.51360977", "0.5134544", "0.5126193", "0.5126193", "0.5126193", "0.5126193", "0.5120423", "0.5117711", "0.51109403", "0.51055384", "0.5105475", "0.5096669", "0.5091713", "0.5091332", "0.5090115", "0.50866246", "0.5080739", "0.5069443", "0.5066606", "0.50639576", "0.5063406", "0.5061403", "0.5060107", "0.50576437", "0.50536424", "0.50513244", "0.50477684", "0.50468355", "0.50454867" ]
0.6961884
1
Roundnumber_correct returns the amount of correct turns.
def number_correct @turns.count do |turn| turn.correct? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def number_correct\n number_correct = 0\n if current_card.answer == turns[turns.length - 1].guess\n number_correct + 1\n end\n end", "def number_correct\n turns.count do |each_turn|\n each_turn.correct?\n end\n end", "def number_correct\n @correct_answers = []\n\n @turns.each do |turn|\n @correct_answers << turn.correct?\n end\n @correct_answers.count(true)\n end", "def test_correct_number_user_answer_1\n assert_equal @round.number_correct, 0\n result = @round.record_guess(\"Juneau\")\n assert_equal @round.number_correct, 1\n end", "def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end", "def round_result\n @round += 1\n puts \"Round #{format('%02d', @round)}: #{@board.format(@board.breaker)}\nYou got #{@board.matches} matches and #{@board.correct_matches} correct guesses\"\n puts 'Careful, the next one is your last chance!'.red if @round == 11\n end", "def correct_ratio\n all = stats.where(\"answer_id >= 0\").size.to_f\n all > 0 ? correct_count.to_f/all : 0\n end", "def percent_correct\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0\n 0.0\n else\n # Calculate percentage, truncate value to one decimal place.\n ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)\n end\n end", "def success\n (correct_answers_count*100.0/answers_count).round.to_i if answers_count > 0\n end", "def if_correct(ok_guess, number_guesses, secret_number) \n\tnumber_guesses = number_guesses - 1\t# STEP 6 - Subtracts one of the player's guesses\n\t\tif ok_guess == secret_number\n\t\t\tputs \"Congratulations! You got it right! You win!!!\"\n\t\telsif ok_guess < secret_number \n\t\t\tputs \"Good try, but guess a little higher.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\telse ok_guess > secret_number\n\t\t\tputs \"Good try, but guess a little lower.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\tend\nend", "def guess_correct?(guess)\n # logic to adjust plural and verb tense\n turns = @current_guess_count > 1 ? \"turns\" : \"turn\"\n\n # Begin testing player's guess against secret number\n if guess == @secret_number.secret_number\n puts @@messages[:win]\n puts \"You guessed in #{@current_guess_count} #{turns}!\"\n return true\n elsif guess > @secret_number.secret_number\n puts @@messages[:too_high]\n # puts \"You have \" + @guesses_allowed.to_s + \" guesses left.\"\n return false\n elsif guess < @secret_number.secret_number\n puts @@messages[:too_low]\n # puts \"You have \" + @guesses_allowed.to_s + \" guesses left.\"\n return false\n end \n end", "def round( num )\n h = get_matches\n matches = h[ 'rounds' ][ num-1 ] ## note: rounds hash starts with zero (not 1)\n matches\n end", "def test_number_correct_still_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 50.0, round.percent_correct\nend", "def total_rounds\n matches_per_round = users.count / 2\n total_matches = (users.count - 1) * matches_per_round\n total_rounds = total_matches / matches_per_round\n\n total_rounds\n end", "def recalculate_incorrect_num_participants(rounds_to_ignore)\n rd = select{|d| d.num_participants != d.results.select{|t| t.round_complete}.count} - rounds_to_ignore\n \n unless rd.empty?\n puts 'Updating ' + rd.length.to_s + ' Round records where num_participants != # of round_complete Results'\n rd.each{|d| d.update(num_participants: d.results.select{|t| t.round_complete}.count)}\n end\n return rd\n end", "def round_had_activity(round_id)\n return false if (round_id == 0 || round_id.nil?)\n\n round_results = Result.all.where(\"round_id = ?\",round_id)\n round_answers = round_results.reduce(0){ |answers,rt| answers + rt.num_correct + rt.num_skipped + rt.num_incorrect}\n return (round_answers > 0)\n end", "def num_of_correct(crct)\n if self.total.nil?\n self.total = 1\n else\n self.total += 1\n end\n \n if crct == 1\n if self.correct.nil?\n self.correct = 1\n else\n self.correct += 1\n end \n else\n self.correct = 0\n end\n end", "def guess_correct?(guess)\n if guess == @secret_number.mynumber then return true end\n return false\n end", "def difficulty\n 1-correct.to_f/(correct+incorrect)\n end", "def rounded_number\n\t\t(number * 20).ceil / 20.to_f\n\tend", "def round_result\n interface.show_cards_evident(player.cards, croupier.cards)\n interface.current_points(player.amt_points, croupier.amt_points)\n\n return interface.draw if player.amt_points == croupier.amt_points\n return interface.draw if player.excess? && croupier.excess?\n return win_round if croupier.excess?\n return lose_round if player.excess?\n return win_round if player.amt_points > croupier.amt_points\n lose_round\n end", "def number_correct_by_category(category)\n correct_count = 0\n @turns.each do |turn|\n if turn.correct? == true && turn.card.category == category\n correct_count = correct_count + 1\n end\n end\n correct_count\n end", "def end_of_game(round)\n puts \"****** GAME OVER ******\"\n puts \"You had #{round.number_correct} correct guesses out of #{round.deck.count} for a total score of #{round.percent_correct}%.\"\n puts \"STEM - #{round.percent_correct_by_category(:STEM)}% correct\"\n puts \"Turing Staff - #{round.percent_correct_by_category('Turing Staff')}% correct\"\n puts \"Pop Culture - #{round.percent_correct_by_category('Pop Culture')}% correct\"\nend", "def guess_correct?(guess)\n if guesses_left <= 0 && !(guess == @secret_numb.secret_number)\n messaging(:lose, @current_guess_count)\n false\n elsif guess == @secret_numb.secret_number\n messaging(:win, @current_guess_count)\n false\n elsif guess > @secret_numb.secret_number\n messaging(:too_high, @current_guess_count)\n true\n elsif guess < @secret_numb.secret_number\n messaging(:too_low, @current_guess_count)\n true\n else\n messaging(:error, @current_guess_count) \n false\n end\n end", "def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end", "def rounds_won_percentage\n (@rounds_played > 0) ? @rounds_won.to_f / @rounds_played : 0\n end", "def check_lost\n if @guess_count == MAX_GUESS\n puts \"\\tYou lost! You've used up all your guesses!\"\n self.new_round\n end\n end", "def is_guess_correct(guess)\n\t\t# Convert guess to an int so that it can be compared\n\t\tguess = guess.to_i\n\n\t\t# Catch case where the player's guess is not in range\n\t\tif guess <= 0 || guess > @range\n\t\t\treturn \"Out of range\"\n\n\t\t# Catch if the user has guessed correctly and won the game\n\t\telsif guess == self.secret_number.to_i\n\t\t\treturn true\n\n\t\t# If the user has guessed incorrectly, respond accordingly\n\t\telsif guess < self.secret_number.to_i\n\t\t\treturn \"low\"\n\t\t\n\t\telsif guess > self.secret_number.to_i\n\t\t\treturn \"high\"\n\t\tend\n\tend", "def number_correct_by_category(category_select)\n # Count the cards that are in the selected category and are guessed correct.\n @turns.count do |turn|\n turn.correct? && turn.card.category == category_select\n end\n end", "def correct?\n @correct ||= (answer == correct_answer)\n end", "def correct?\n # checks if the guess is equivalent to the cards answer and return a bool\n @guess == @card.answer\n end", "def guess_correct?\n card = Card.new(\"10\", \"Hearts\")\n guess = Guess.new(\"10 of Hearts\", card)\n assert_equal true, guess.correct?\n assert_equal \"Correct!\", guess.feedback\n end", "def test_number_correct_still_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 1, round.number_correct\nend", "def current_round; (@current_turn / 2).floor end", "def total_pass_rate\n if self.all_correct_answers.count == 0\n return 0\n else\n return (self.all_correct_answers.count.to_f / self.all_answered_options.count.to_f * 100).round\n end\n end", "def total_rounds\n self.count_wins + self.count_losses\n end", "def correct?\n\n if @guess == @card.answer #returned false. Fixed it.\n p true\n elsif @guess != @card.answer\n p false\n end\n end", "def correct?\n @correct || false\n end", "def guessing_game\n\tputs \"Guess a number between 1 and 100\"\n\tcorrect = Random.new.rand(1..100)\n\tnum_guesses = 1\n\tcurrent_guess = gets.chomp.to_i\n\n\twhile current_guess != correct\n\t\tif current_guess > correct \n\t\t\tputs \"The number is lower than #{current_guess}. Guess again\"\n\t\telsif current_guess < correct\n\t\t\tputs \"The number is higher than #{current_guess}. Guess again\"\n\t\tend\n\t\tcurrent_guess = gets.chomp.to_i\n\t\tnum_guesses = num_guesses + 1\n\tend\n\tputs \"You guessed #{correct} in #{num_guesses} tries!\"\nend", "def valid_rounds?(rounds)\n rounds % 2 == 1\n end", "def num_funding_rounds\n self.funding_rounds.count\n end", "def num_funding_rounds\n self.funding_rounds.count\n end", "def correct?\n @guess == @card.answer\n end", "def test_number_correct_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess = round.record_guess({value: \"3\", suit: \"Hearts\"})\n assert_equal 1, round.number_correct\nend", "def play_round\n\t\t# Initialize a secret number\n\t\tself.get_secret_number\n\n\t\t# Create a local variable for guesses so that we can pay multiple rounds\n\t\t# Reset self.solved for similar reasons\n\t\tguesses_left = self.guesses\n\t\tself.solved = false\n\n\t\t# Loop through asking the player for a guess and checking it against the secret number\n\t\twhile self.solved != true && guesses_left > 0\n\t\t\t# Get another guess from the player\n\t\t\tputs \"\\nWhat is your guess!?\"\n\t\t\tself.solved = self.is_guess_correct(gets)\n\n\t\t\t# If the player input a number out of range, tell them\n\t\t\tif self.solved == \"Out of range\"\n\t\t\t\t# This mistake does not cost the player a guess\n\t\t\t\tputs \"\\nThe number is between 1 and #{@range}, please guess again\"\n\n\t\t\t# If player's guess is wrong tell them in which direction they were wrong\n\t\t\telsif self.solved == \"high\"\n\t\t\t\tguesses_left -= 1\n\t\t\t\tputs \"\\nYour guess was too high! You have #{guesses_left} guesses left!\"\n\n\t\t\telsif self.solved == \"low\"\n\t\t\t\tguesses_left -= 1\n\t\t\t\tputs \"\\nYour guess was too low! You have #{guesses_left} guesses left!\"\n\t\t\tend\n\n\t\tend\n\n\t\t# See if the player has won or lost\n\t\tif self.solved == true\n\t\t\tself.player_won\n\t\telse\n\t\t\tself.player_lost\n\t\tend\n\n\t\treturn self.play_another_round\n\tend", "def correct?\n if self.guess == Card.find(self.card_id).response && !self.first_time_correct\n self.ever_correct = true\n else\n self.ever_correct = false\n end\n end", "def evaluate_guess\n\t\t# How many were right\n\t\tright_guesses = 0\n\t\t# How many were close\n\t\talmost_guesses = 0\n\t\t# Put answer and guess in a temporary array for modifying\n\t\ttemp_answer = []\n\t\ttemp_guess = []\n\t\t@answer.each { |n| temp_answer << n }\n\t\t@board[-1].each { |n| temp_guess << n }\n\t\t# Go through each digit in answer to see how many were correct\n\t\ttemp_answer.each_with_index do |num, i|\n\t\t\t# If corresponding digit in guess is correct...\n\t\t\tif temp_guess[i] == num\n\t\t\t\t# Increase right variable\n\t\t\t\tright_guesses += 1\n\t\t\t\t# And change both numbers in temporary array to invalid numbers so they don't get counted in the next step\n\t\t\t\ttemp_guess[i] = 9\n\t\t\t\ttemp_answer[i] = 8\n\t\t\tend\n\t\tend\n\t\t# Go through each digit in answer to see how many were close\n\t\t# The arrays now have correct digits taken out so they don't get counted again\n\t\ttemp_answer.each_with_index do |num, i|\n\t\t\tnext_num = 0\n\t\t\t# Step through each digit in guess\n\t\t\t4.times do |x|\n\t\t\t\t# If guess is the same\n\t\t\t\tif temp_guess[x] == num && next_num == 0\n\t\t\t\t\t# Increase almost variable and take out digits\n\t\t\t\t\talmost_guesses += 1\n\t\t\t\t\ttemp_guess[x] = 9\n\t\t\t\t\ttemp_answer[i] = 8\n\t\t\t\t\t# Move on to next number in answer array so it doesn't get counted again\n\t\t\t\t\tnext_num = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Add how many were right and close to the evaluate array\n\t\t@evaluate << \"#{right_guesses} right, #{almost_guesses} close\"\n\t\t# Let user guess again\n\t\tif @master == \"comp\"\n\t\t\tguess_again\n\t\t# If computer is guessing, use feedback to narrow down its options\n\t\telsif @master == \"user\"\n\t\t\t# Nothing was right or close, so take all numbers in last guess out of options\n\t\t\tif almost_guesses == 0 && right_guesses == 0\n\t\t\t\t@board[-1].each do |num_to_delete|\n\t\t\t\t\t4.times do |pot_ans_index|\n\t\t\t\t\t\tarr = @potential_numbers[pot_ans_index]\n\t\t\t\t\t\tarr.delete(num_to_delete)\n\t\t\t\t\t\t@potential_numbers[pot_ans_index] = arr\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t# None were right but some were close, so take each number out of its options for JUST that index\n\t\t\telsif right_guesses == 0 && almost_guesses > 0\n\t\t\t\t@board[-1].each_with_index do |num_to_delete, i|\n\t\t\t\t\tarr = @potential_numbers[i]\n\t\t\t\t\tarr.delete(num_to_delete)\n\t\t\t\t\t@potential_numbers[i] = arr\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def final_round()\n d = value(@dealer)\n puts \"--- Check Round --- \"\n puts \"Dealers' cards are #{@dealer.join(',')} for a value #{d}\"\n\n # Iterate over all players who are still in the game,\n # as in they haven't lost in the initial round doing 'hits'\n #\n # Precondition: forall p in players where p.cur_playing == false, value(p.cards) <= 21\n @players.find_all{|p| p.cur_playing}.each do |p|\n if value(p.cards) < d && d <= 21 # Dealer Wins\n puts \"Player #{p.index} has deck worth #{value p.cards}, and loses to the dealer...\"\n debit_player(p)\n elsif (value(p.cards) > d && d <= 21) || d > 21 # Player Wins\n puts \"Player #{p.index} has deck worth #{value p.cards}, and wins with the dealer...\"\n credit_player(p)\n elsif value(p.cards) == d\n puts \"Player #{p.index} has deck worth #{value p.cards}, and draws with the dealer...\"\n end\n end\n end", "def num_funding_rounds\n funding_rounds.size\n end", "def correct?(guess)\n guess == @back\n end", "def calculate_average(correct_answers, total_answers)\n #this is an average. uses floats to get decimals, *100 because thats what a percentage is, and converts to an integer. '%.2f' % to round the float off to 2 decimal places\n if Helper.check_for_zero?(total_answers) == true\n puts \"You haven't taken any quizzes!!!\"\n return -1\n else\n average = (correct_answers.to_f * 100) / (total_answers.to_f * 100)\n average = average * 100\n return average.to_i\n end\n\n end", "def guess_round(driver)\n driver.team_matches_hash.values.map(&:length).max || 0\n end", "def total_guess_count()\r\n\t\t# TODO: fill in method body\r\n\t\treturn -1\r\n\tend", "def guess_round(driver)\n Algorithm::PagePlayoff.guess_round(driver.matches.length)\n end", "def round\n @round || (to ? to.round - 1 : 0)\n end", "def is_correct?\n\t\tself.correctness\n\tend", "def eval_num(secret_num, guess, tries)\n\tif guess == secret_num\n\t\tcongrats(secret_num, tries)\n\telsif tries >= 3\n\t\tputs \"\\nSorry that was your last try. Better luck next time!\"\n\telse\n\t\tif guess > 10\n\t\t\tputs \"\\nWhoa whoa whoa.. your guess is way too large! Remember it's a number from 1-10.\"\n\t\telsif guess < 1\n\t\t\tputs \"\\nOkay.. let me jog your memory.. Remember it's a number from 1-10.\"\n\t\telse\n\t\t\tif guess > secret_num\n\t\t\t\tputs \"\\nA little lower.. Almost there.\"\n\t\t\telsif guess < secret_num\n\t\t\t\tputs \"\\nA little higher.. You got this.\"\n\t\t\tend\n\t\tend\n\t\ttry_again(secret_num, tries)\n\tend\nend", "def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end", "def is_correct?(answer)\r\n self.answer.to_s == answer\r\n end", "def rounder5(to_round)\n to_round.round(5)\n end", "def answered_correctly?(answer)\n answer.to_f > (correct_answer * (1 - @error_margin)) &&\n answer.to_f < (correct_answer * (1 + @error_margin))\n end", "def finished?\n @round_counter >= @croupier.rules[:rounds]\n end", "def guess_number_3\n tries = 1\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n while answer != random_number\n puts \"Please guess again. You have had #{tries} tries so far.\"\n tries += 1\n answer = gets.chomp.to_i\n end\n puts \"You guessed correctly! The random number is #{random_number}.\"\n puts \"It took you #{tries} tries to guess the number correctly.\"\nend", "def continue?\n @round <= 10 && @guess != @secret_code\n end", "def test_guess_is_incorrect\n card = Card.new(\"Which planet is closest to the sun?\", \"Mercury\", :STEM)\n turn = Turn.new(\"Saturn\", card)\n\n refute turn.correct?\n end", "def guess_round(driver)\n Algorithm::SingleBracket.guess_round(driver.seeded_teams.length,\n driver.matches.length)\n end", "def count_correct_colors\r\n total_correct_color_count = Hash.new(0)\r\n guess.length.times do |i|\r\n total_correct_color_count[guess[i]] += 1 if total_correct_color_count[guess[i]] < code_count[guess[i]]\r\n end\r\n total_correct_sum = 0\r\n total_correct_color_count.each { |k,v| total_correct_sum += v }\r\n total_correct_sum\r\n end", "def calculate_result_ranks(round_id)\n puts \"calculate_result_ranks(#{round_id})\"\n\n rank = 1\n num_ties = 0\n prev_score = -1\n results = Result.all.where(round_complete: true).where(\"round_id = ?\",round_id).order(points: :desc).each{ \n |t| \n if (t.points == prev_score)\n num_ties += 1\n else\n num_ties = 0\n end\n t.update(rank: rank - num_ties); \n rank += 1; \n prev_score = t.points\n }\n end", "def correct?\n self.game.correct?(self)\n end", "def correct_guess(guess)\n end", "def red_correct\n if @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 1\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 2\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 2\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 3\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 3\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 3\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 4\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 4\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 4\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 4\n total = 3\n else @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 4\n total = 4\n end\n end", "def total_rounds(driver)\n Algorithm::SingleBracket.total_rounds(driver.seeded_teams.length)\n end", "def get_rounds\n puts \"How many rounds?\"\n @rounds = gets.chomp.to_i\n end", "def answer_correct?(answer)\n @correct_answer == answer\n end", "def tricks_taken \n \t\tself.score-(self.correct*10)\n \tend", "def getPoints(result, guess)\n return 0 if guess.empty? or guess == \"-\" or guess == \"n/a\" or result.empty?\n\n if result == guess\n 3\n elsif winning_team(result) == winning_team(guess)\n 1\n else\n 0\n end\n end", "def correct?\n @card.answer == @guess\n end", "def total_rounds(_ = nil)\n Algorithm::PagePlayoff::TOTAL_ROUNDS\n end", "def correct\n @correct\n end", "def guess(number)\n @number = number\n solved? ? :correct : @number > @answer ? :high : :low\n end", "def amount_current_round\n fract = has_integer_consumptions_only? ? 1 : 2\n truncate_number(amount_current, fract)\n end", "def total_rounds(teams_count)\n Math.log2(teams_count).ceil\n end", "def total_rounds(teams_count)\n Math.log2(teams_count).ceil\n end", "def run_round\n increment_round!\n switch_player!\n question = Question.new(@question_cap)\n puts \"________ Question #{@which_round} ________\"\n puts \"#{@active_player.name}, you have #{@active_player.lives} #{(@active_player.lives) == 1 ? \"life\" : \"lives\"} remaining.\\n\"\n print \"#{@active_player.name}, #{question.display_question} \"\n answer = gets.chomp.to_i\n\n if question.correct?(answer)\n puts \"Well done, #{@active_player.name}! #{answer} was the correct answer. You don't die today.\\n...So, let's make the questions HARDER.\\n\\n\"\n @question_cap = (@question_cap*rand(1.0..2.5)).to_i\n else\n puts \"Yegads, #{answer}?! Nope, nope, nope. It was #{question.correct_answer}. You DIE! (Once.)\\n\\n\"\n @active_player.lose_life\n end\n end", "def rounds(n)\n\t\tm1 = self.s1.next(nil)\n\t\tn.times do\n\t\t\tm1 = game(m1)\n\t\tend\n\t\tnumbers = self.scores << self.rp\n\t\tnames = self.hash.keys << :Rounds\n\t\treturn Hash[names.zip(numbers)] \n\tend", "def get_round\n puts 'How many rounds would you like to play? (min. 1, max. 10)'\n input = gets.to_i\n validation = validate_round(input)\n if validation == true\n input\n else\n puts \"I'm sorry, that's an invalid input. Please try again.\"\n get_round\n end\n end", "def round\n puts \"The dealer is showing the #{dealer.first.face} of #{dealer.first.suit}.\"\n puts \"You have the #{player.first.face} of #{player.first.suit} and the #{player.last.face} of #{player.last.suit}, worth\"\n check_player_hand\n if player_hand_value == 21\n puts \"You're at 21-- YOU WIN!\"\n new_game?\n end\n\n end", "def almostwin(my_number, winning_num)\n\n correct_numbers = 0\n\n z = 0\n\n \t winning_num.length.times do\n\n i = 0\n\n \t\twinning_num.length.times do\n\n \t\t\tif my_number[z] == winning_num[i]\n\n \t\t\t\tcorrect_numbers += 1\n\n \t\t \tend\n\n \t\t\t i += 1\n\n\t\tend\n\n\t\tz += 1\n\n\tend \n\n correct_numbers == winning_num.length - 1\n\n end", "def grade_question(round_id, round_question_num, chosen_id)\n dump_round_vars \"Entering grade_question(#{round_id}, #{round_question_num}, #{chosen_id})\"\n round = Round.find(round_id)\n if (round_question_num > round.max_qo_index)\n round.update(max_qo_index: round_question_num)\n end\n\n correct_choice = get_question(round_id, round_question_num).correct_choice\n user = current_user\n diff_lvl = user.difficulty_level_id\n puts \"user_id: #{user.id}, round_question_num: #{round_question_num}, diff_lvl: #{diff_lvl}, chosen_id: #{chosen_id}\"\n\n result = Result.where(\"user_id = ?\", user.id).where(\"round_id = ?\", round_id).first\n if !result\n result = Result.new(user_id: user.id, round_id: round_id, round_complete: false)\n end\n\n if chosen_id == CHOICE_ID_SKIP # \n puts \"Q#{round_question_num} [diff {diff_lvl}]: skipped. #{correct_choice.id} (#{correct_choice.prompt}) is correct.\"\n outcome = POINTS_FOR_SKIP\n result.num_skipped += 1 \n elsif chosen_id.to_i == correct_choice.id\n puts \"Q#{round_question_num} [diff {diff_lvl}]: #{chosen_id} (#{correct_choice.prompt}). Correct!!\"\n outcome = POINTS_FOR_CORRECT\n result.num_correct += 1 \n else\n puts \"Q#{round_question_num} [diff {diff_lvl}]: #{chosen_id} (#{Choice.find(chosen_id).prompt}). Unfortunately #{correct_choice.id} (#{correct_choice.prompt}) is correct.\"\n outcome = POINTS_FOR_INCORRECT\n result.num_incorrect += 1 \n end\n result.points = [result.points + outcome, 0].max\n result.save\n dump_round_vars '', 'Exiting grade_question()'\n return {outcome: outcome, points: result.points, correct_id: correct_choice.id, correct_prompt: correct_choice.prompt}\n end", "def finalize_round(round_id)\n dump_round_vars 'Entering finalize_round()'\n \n num_gamers_complete_round = Result.all.where(round_complete: true).where(\"round_id = ?\",round_id).count\n Round.find(round_id).update(num_participants: num_gamers_complete_round)\n \n prune_question_set(round_id)\n prune_results(round_id)\n calculate_result_ranks(round_id)\n round_id = prune_round(round_id)\n \n dump_round_vars '','Exiting finalize_round()'\n return round_id\n end", "def round_to_nearest_cash_value; end", "def get_win_percentage(strategy)\n score = 0\n @turns.each do |t|\n score += t.result.to_i if t.strategy.include?(strategy)\n end\n score\n end", "def correct_answer\n answers.find_by_correctness(true)\n end", "def results(guess)\n if guess == @number\n puts 'Congratulations you guessed the right number!'\n else\n puts \"Correct answer was #{@number}. You ran out of guesses.\"\n end\n end", "def total_number_of_rounds\n case player_count\n when 2..4\n 2\n when 5..8\n 3\n when 9..16\n 4\n when 17..32\n 5\n else\n 6\n end\n end", "def number_solution(value)\n value.round(2)\nend", "def num_rounds\n (Math.log(teams.size) / Math.log(2)).to_i\n end", "def round_of(no,n=0)\n (no * (10.0 ** n)).round * (10.0 ** (-n))\n end", "def run\n #handle invalid input\n guess = gets\n guess.strip!\n unless guess =~ /\\d/ and guess.length == 4\n puts 'Please retry with a valid combination of 4 digits, e.g. 1234'\n run\n end\n\n response = {correct_digits: 0, correct_place: 0}\n guess.each_char do |char|\n if @result.include? char.to_i\n response[:correct_digits] += 1\n end\n end\n\n guess.each_char.to_a.each_with_index do |char, index|\n if char == @result[index].to_s\n response[:correct_place] += 1\n end\n end\n\n if response[:correct_place] == 4 && response[:correct_digits] == 4\n puts \"You got it! The result is #{@result.join}\"\n else\n puts \"Your have #{response[:correct_digits]} digits correct, and #{response[:correct_place]} are in the right place.\"\n run\n end\nend" ]
[ "0.757332", "0.7473761", "0.7086687", "0.69440126", "0.6674602", "0.6547134", "0.64087373", "0.628252", "0.6149824", "0.60328215", "0.5950912", "0.5891189", "0.58656573", "0.58065164", "0.5745382", "0.5727601", "0.5712349", "0.5680065", "0.5617594", "0.5581847", "0.5558201", "0.5484096", "0.5480863", "0.5427612", "0.54273796", "0.5409672", "0.5406679", "0.54063576", "0.5405985", "0.5399672", "0.5395815", "0.53374475", "0.5329263", "0.53230274", "0.5318501", "0.53122455", "0.53029764", "0.5273737", "0.527178", "0.5266624", "0.5255082", "0.52431244", "0.52431244", "0.5237894", "0.5230465", "0.52202564", "0.5218775", "0.52097106", "0.520385", "0.5202125", "0.5184706", "0.51829475", "0.5181378", "0.51589525", "0.51441896", "0.51346105", "0.51343644", "0.51309365", "0.51164174", "0.5113118", "0.51047426", "0.5097492", "0.5080403", "0.50637436", "0.5063517", "0.50535554", "0.5049731", "0.5043967", "0.5040782", "0.50407046", "0.5036295", "0.5034818", "0.5030841", "0.5030073", "0.50292295", "0.5028014", "0.5024192", "0.50234073", "0.5016632", "0.5013394", "0.5011153", "0.50107205", "0.50002843", "0.50002843", "0.4993097", "0.4972511", "0.49654794", "0.49646384", "0.4951729", "0.49506587", "0.4949133", "0.4944187", "0.49428663", "0.49340412", "0.49329022", "0.49328604", "0.49286827", "0.49230054", "0.49219143", "0.49200737" ]
0.7239176
2
Roundnumber_correct_by_category returns the amount of correct turns for a category.
def number_correct_by_category(category_select) # Count the cards that are in the selected category and are guessed correct. @turns.count do |turn| turn.correct? && turn.card.category == category_select end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_correct_by_category(category)\n correct_count = 0\n @turns.each do |turn|\n if turn.correct? == true && turn.card.category == category\n correct_count = correct_count + 1\n end\n end\n correct_count\n end", "def number_correct_by_category(card_category)\n correct_guesses = []\n correct_by_category = []\n @turns.each do |card|\n if card.correct?\n correct_guesses << card\n end\n end\n correct_guesses.each do |card|\n if card.card.category == card_category\n correct_by_category << card\n end\n end\n correct_by_category.count\n end", "def number_correct_by_category(category_arg)\n # correct_category = []\n #\n # @turns.each do {|turn|turn.card.category == category_arg}\n #\n # correct_category << turn\n\n # end\n # correct_category.count\n\n # correct_guess = []\n\n # correct_guesses_in_category = @turns.each { |turn| turn.correct? && turn.card.category == category_arg}.count\n correct_guesses_in_category = []\n @turns.each do |turn|\n correct_guesses_in_category << turn if turn.correct? && turn.card.category == category_arg\n end\n correct_guesses_in_category.count\n\n end", "def percent_correct_by_category(category)\n if deck.cards_in_category(category).length == 0\n return 0.0\n end\n ((number_correct_by_category(category) / deck.cards_in_category(category).length) * 100).to_f\n end", "def percent_correct_by_category(card_category)\n total_by_category = []\n @turns.each do |card|\n if card.card.category == card_category\n total_by_category << card\n end\n end\n number_correct_by_category(card_category).fdiv(total_by_category.count) * 100\n end", "def percent_correct_by_category(category_select)\n # Count the current cards in the turns that match the category selected. \n current_cards_category = @turns.count do |element|\n element.card.category == category_select\n end\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0 || current_cards_category == 0\n 0.0\n else\n # Create numerator and denominator values.\n numerator = number_correct_by_category(category_select).to_f \n denominator = current_cards_category.to_f\n \n # Calculate percentage, truncate value to one decimal place.\n ((numerator / denominator) * 100.0).truncate(1)\n end\n end", "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def num_of_correct(crct)\n if self.total.nil?\n self.total = 1\n else\n self.total += 1\n end\n \n if crct == 1\n if self.correct.nil?\n self.correct = 1\n else\n self.correct += 1\n end \n else\n self.correct = 0\n end\n end", "def number_correct\n number_correct = 0\n if current_card.answer == turns[turns.length - 1].guess\n number_correct + 1\n end\n end", "def number_correct\n @correct_answers = []\n\n @turns.each do |turn|\n @correct_answers << turn.correct?\n end\n @correct_answers.count(true)\n end", "def number_correct\n @turns.count do |turn|\n turn.correct?\n end\n end", "def number_correct\n turns.count do |each_turn|\n each_turn.correct?\n end\n end", "def correct_ratio\n all = stats.where(\"answer_id >= 0\").size.to_f\n all > 0 ? correct_count.to_f/all : 0\n end", "def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end", "def count_correct_colors\r\n total_correct_color_count = Hash.new(0)\r\n guess.length.times do |i|\r\n total_correct_color_count[guess[i]] += 1 if total_correct_color_count[guess[i]] < code_count[guess[i]]\r\n end\r\n total_correct_sum = 0\r\n total_correct_color_count.each { |k,v| total_correct_sum += v }\r\n total_correct_sum\r\n end", "def success\n (correct_answers_count*100.0/answers_count).round.to_i if answers_count > 0\n end", "def cat_count(category)\n @category_list[category][:_count] ? @category_list[category][:_count].to_f : 0.0\n end", "def cat_count(category)\n @category_list[category][:_count] ? @category_list[category][:_count].to_f : 0.0\n end", "def round_result\n @round += 1\n puts \"Round #{format('%02d', @round)}: #{@board.format(@board.breaker)}\nYou got #{@board.matches} matches and #{@board.correct_matches} correct guesses\"\n puts 'Careful, the next one is your last chance!'.red if @round == 11\n end", "def test_correct_number_user_answer_1\n assert_equal @round.number_correct, 0\n result = @round.record_guess(\"Juneau\")\n assert_equal @round.number_correct, 1\n end", "def normalized_counts(category)\n counts = categories.map { |c| c.points }.flatten.map { |point| point.count }\n max = counts.max\n category.points.map { |p| p.count }.map { |count| max == 0 ? 0 : (count.to_f / max * 100).to_i }\n end", "def recall category\n\t\tsend(category).values.sum > 0 ? send(category)[category].fdiv(send(category).values.sum) : 0\n\tend", "def round_had_activity(round_id)\n return false if (round_id == 0 || round_id.nil?)\n\n round_results = Result.all.where(\"round_id = ?\",round_id)\n round_answers = round_results.reduce(0){ |answers,rt| answers + rt.num_correct + rt.num_skipped + rt.num_incorrect}\n return (round_answers > 0)\n end", "def total_pass_rate\n if self.all_correct_answers.count == 0\n return 0\n else\n return (self.all_correct_answers.count.to_f / self.all_answered_options.count.to_f * 100).round\n end\n end", "def round_result\n interface.show_cards_evident(player.cards, croupier.cards)\n interface.current_points(player.amt_points, croupier.amt_points)\n\n return interface.draw if player.amt_points == croupier.amt_points\n return interface.draw if player.excess? && croupier.excess?\n return win_round if croupier.excess?\n return lose_round if player.excess?\n return win_round if player.amt_points > croupier.amt_points\n lose_round\n end", "def total_rounds\n matches_per_round = users.count / 2\n total_matches = (users.count - 1) * matches_per_round\n total_rounds = total_matches / matches_per_round\n\n total_rounds\n end", "def count(category = :all)\n SpiceRub::Native.ktotal(category)\n end", "def end_of_game(round)\n puts \"****** GAME OVER ******\"\n puts \"You had #{round.number_correct} correct guesses out of #{round.deck.count} for a total score of #{round.percent_correct}%.\"\n puts \"STEM - #{round.percent_correct_by_category(:STEM)}% correct\"\n puts \"Turing Staff - #{round.percent_correct_by_category('Turing Staff')}% correct\"\n puts \"Pop Culture - #{round.percent_correct_by_category('Pop Culture')}% correct\"\nend", "def accuracy(classifier, test_set)\n \tcorrect = 0.0\n \ttest_set.each { |e| correct += 1.0 if e.label == classifier.guess_for(e) }\n \tcorrect / test_set.size.to_f\n end", "def percent_correct\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0\n 0.0\n else\n # Calculate percentage, truncate value to one decimal place.\n ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)\n end\n end", "def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end", "def score_upper_category(value)\n \tvalue * @dice.inject(0) { |count, die| die == value ? count + 1 : count }\n end", "def determine_correctness\n answer = self.question.answer\n \t#Upcase to take care of all capitalization issues\n \tresponse = self.content.upcase\n\n \tanswer = answer.split(', ')\n\n \t#Score Keeping\n \tscore = 0\n \tscore_incremental = 1.0/answer.length\n \t\n \t#Determining how many of keywords are in response\n \tanswer.each do |correct_word|\n \t\tcorrect_word = correct_word.upcase\n \t\tif response.include?(correct_word)\n \t\t\tscore += score_incremental\n \t\tend\n \tend\n \tself.correctness = score\n end", "def count(category)\n count = 0\n self.votes.each do |v|\n if v.category == category\n count+=1\n end\n end\n count\n end", "def total_number_of_rounds\n case player_count\n when 2..4\n 2\n when 5..8\n 3\n when 9..16\n 4\n when 17..32\n 5\n else\n 6\n end\n end", "def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend", "def precision category\n\t\tpositive[category] + negative[category] + neutral[category] > 0 ? send(category)[category].fdiv(positive[category] + negative[category] + neutral[category]) : 0\n\tend", "def difficulty\n 1-correct.to_f/(correct+incorrect)\n end", "def red_correct\n if @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 1\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 2\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 2\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 3\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 3\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 3\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 4\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 4\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 4\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 4\n total = 3\n else @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 4\n total = 4\n end\n end", "def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end", "def calculate_quality_correct(attempt)\n case attempt\n when 1 then 5\n when 2 then 4\n else 3\n end\n end", "def number_of_operating_rounds(phase)\n @config.fetch('operating_rounds').find do |round|\n round.fetch('phase').equal?(phase)\n end.fetch('count')\n end", "def calculate_result_ranks(round_id)\n puts \"calculate_result_ranks(#{round_id})\"\n\n rank = 1\n num_ties = 0\n prev_score = -1\n results = Result.all.where(round_complete: true).where(\"round_id = ?\",round_id).order(points: :desc).each{ \n |t| \n if (t.points == prev_score)\n num_ties += 1\n else\n num_ties = 0\n end\n t.update(rank: rank - num_ties); \n rank += 1; \n prev_score = t.points\n }\n end", "def calculate_average(correct_answers, total_answers)\n #this is an average. uses floats to get decimals, *100 because thats what a percentage is, and converts to an integer. '%.2f' % to round the float off to 2 decimal places\n if Helper.check_for_zero?(total_answers) == true\n puts \"You haven't taken any quizzes!!!\"\n return -1\n else\n average = (correct_answers.to_f * 100) / (total_answers.to_f * 100)\n average = average * 100\n return average.to_i\n end\n\n end", "def round\n @recipe_hash[:total_prot] = @recipe_hash[:total_prot].round(2)\n @recipe_hash[:total_cal] = @recipe_hash[:total_cal].round(2)\n @recipe_hash[:total_fat] = @recipe_hash[:total_fat].round(2)\n @recipe_hash[:total_carbs] = @recipe_hash[:total_carbs].round(2)\n end", "def test_number_correct_still_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 50.0, round.percent_correct\nend", "def compute_comment_score(c)\n upcount = (c['up'] ? c['up'].length : 0)\n downcount = (c['down'] ? c['down'].length : 0)\n upcount-downcount\n end", "def total_rounds\n self.count_wins + self.count_losses\n end", "def discount_round\n num = self.round_count\n num -= 1\n self.update_attribute(:round_count, num) if self.round_count > 0\n self\n end", "def correct_test_case_scoring(test_case_id)\n if test_case_id.nil? || !test_case_id.is_a?(Integer)\n puts \"Invalid test case ID\"\n return false\n end\n \n faulty_test_case = TestCase.find(test_case_id)\n \n if faulty_test_case.coding_prompt.specific.exercise_version != self\n puts \"Test case is not from the same exercise\"\n return false\n end\n \n # Neutalizing the test case henceforth\n faulty_test_case.weight = 0.0\n faulty_test_case.save!\n \n attempts.each do |attempt|\n delta = 0.0\n related_test_cases = faulty_test_case.coding_prompt.specific.test_cases\n total = 0.0\n correct = 0.0\n # Re-calculating the score for this exercise based on recorded results\n related_test_cases.each do |test_case|\n if TestCaseResult.where(test_case: test_case, user: attempt.user).last.pass\n correct += 1.0 * test_case.weight\n end\n total += test_case.weight\n end\n \n old_score = attempt.score \n \n if attempt.workout_score\n multiplier = ExerciseWorkout.find_by(exercise: exercise, workout: attempt.workout_score.workout).points\n new_score = correct * multiplier / total\n delta = new_score - old_score\n \n if attempt.active_score\n attempt.active_score.rescore(delta)\n end\n else\n multiplier = 10.0\n new_score = correct * multiplier / total\n delta = new_score - old_score\n end\n puts attempt.id,\"\\n DELTA: \\n\", delta\n attempt.rescore(delta)\n end\n return true\n end", "def user_score\n total_score = 0\n score.each do |_phase, categories|\n total_score += categories.reject { |category| category.include? \"oath\" }.count { |category| category[1] >= 80 }\n end\n total_score\n end", "def count_sub_percen(category)\n\t\tselect=self.user_program_form_values.where(:form_key_category=>category, :check=>true ).count\n\t\tall=self.user_program_form_values.where(:form_key_category=>category).count\n\t\tif all > 0\n\t\t\t(select*100) / all\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def score(dice)\n n = 0\n (1..9).each do |i|\n amount = dice.find_all{|d| d == i}.size\n case i\n when 1\n if amount > 2\n n += 1000 + (amount - 3) * 100\n else\n n += amount * 100\n end\n when 5\n if amount > 2\n n += 500 + (amount - 3) * 50\n else\n n += amount * 50\n end\n else\n if amount > 2\n n += i * 100\n end\n end\n end\n\n return n\nend", "def increment_correct_color(guess, code, clues)\n correct_colors = [] # To prevent duplicate colors from giving clues\n guess.each_with_index do |color, index|\n if !color.nil? && code.include?(color) && \n !correct_colors.include?(color)\n clues[:correct_color] += 1\n correct_colors << color\n end\n end\n\n clues\n end", "def get_win_percentage(strategy)\n score = 0\n @turns.each do |t|\n score += t.result.to_i if t.strategy.include?(strategy)\n end\n score\n end", "def count_of(category)\n @transactions.select {|transaction| transaction.category.to_sym == category}.size\n end", "def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end", "def get_total_word_count_for_category(category)\n ret = @redis.get sum_key(category)\n # create :total key for this category if it doesn't already exist\n if !ret\n words_with_count_for_category = get_words_with_count_for_category category\n total_word_count_sum_for_category = words_with_count_for_category.values.reduce(0){|sum, count| sum += count.to_i}\n @redis.set sum_key(category), total_word_count_sum_for_category\n end\n ret\n end", "def round_to_nearest_cash_value; end", "def number_of_kcal_per_meal\n kcal_per_recipe = recipe_ingredients.each.sum do |recipe_ingredient|\n calories_per_gram = recipe_ingredient.ingredient.calories / 100 \n kilograms_of_ingredient = recipe_ingredient.calculated_weight_in_grams / 1000\n (calories_per_gram * kilograms_of_ingredient) #kcal\n end\n kcal_per_recipe / num_people\n end", "def calculate_total_card_rating(wrestler)\n\t\t\n\t\toc_roll_probability = wrestler.points[:oc_probability]\n\t\tpoints_per_round = calculate_card_points_per_round(wrestler.points)\n\t\tdq_probability_per_round = calculate_dq_probability_per_round(wrestler.points)\n\t\tpa_probability_per_round = calculate_pa_probability_per_round(wrestler.points)\n\t\tsub_probability_per_round = calculate_sub_probability_per_round(wrestler.points)\n\t\txx_probability_per_round = calculate_xx_probability_per_round(wrestler.points)\n\t\t\n\t\t# Double P/A per round and divide XX per round for total card value\n\t\t# to increase relative value of pin attempts.\n\t\ttotal_card_points = (points_per_round / 2) + \n\t\t\t(oc_roll_probability * 10) +\n\t\t\t(dq_probability_per_round * 5) + \n\t\t\t(pa_probability_per_round * 20) +\n\t\t\t(sub_probability_per_round * 10) + \n\t\t\t(xx_probability_per_round * 5)\n\n\t\tsingles_priority = wrestler.points[:prioritys]\n\t\tsubmission_loss_probabilty = wrestler.points[:sub_prob]\n\n\t\ttotal_card_rating = total_card_points + 10 + \n\t\t\tsingles_priority - (submission_loss_probabilty * 10)\n\n\n\t\t@statistics[:total_card_rating] = total_card_rating\n\t\t@statistics[:total_card_points] = total_card_points\n\t\t@statistics[:total_card_points_per_round] = points_per_round\n\t\t@statistics[:dq_probability_per_round] = dq_probability_per_round\n\t\t@statistics[:pa_probability_per_round] = pa_probability_per_round\n\t\t@statistics[:sub_probability_per_round] = sub_probability_per_round\n\t\t@statistics[:xx_probability_per_round] = xx_probability_per_round\n\n\t\treturn total_card_rating\n\tend", "def clean_round round\n valid_categories = round.categories.map do |category|\n valid_clues = category.clues.select { |clue| !invalid_clue? clue }\n category = Category.new(category.name, valid_clues)\n end.select { |category| category.clues.size >= 3 }\n\n Round.new(valid_categories)\n end", "def category(num=(0...round.categories.count).to_a.sample)\n round.categories[num]\n end", "def num_funding_rounds\n self.funding_rounds.count\n end", "def num_funding_rounds\n self.funding_rounds.count\n end", "def tricks_taken \n \t\tself.score-(self.correct*10)\n \tend", "def calculate_round_score(match)\n round_score = 0\n scores = Holescore.where(user: current_user, match: match)\n scores.each do |score|\n round_score += score.gross_score\n end\n round_score\n end", "def finished?\n @round_counter >= @croupier.rules[:rounds]\n end", "def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end", "def initial_round\n total = deal_card + deal_card\n display_card_total(total)\n return total\nend", "def total_rounds(teams_count)\n Math.log2(teams_count).ceil\n end", "def total_rounds(teams_count)\n Math.log2(teams_count).ceil\n end", "def recalculate_incorrect_num_participants(rounds_to_ignore)\n rd = select{|d| d.num_participants != d.results.select{|t| t.round_complete}.count} - rounds_to_ignore\n \n unless rd.empty?\n puts 'Updating ' + rd.length.to_s + ' Round records where num_participants != # of round_complete Results'\n rd.each{|d| d.update(num_participants: d.results.select{|t| t.round_complete}.count)}\n end\n return rd\n end", "def total\n sum = 0\n hand.each do |card|\n sum += card.find_face_value\n end\n sum = correct_for_aces(sum)\n end", "def all_answered_questions_per_category(category)\n self.all_answered_questions.select{|question| question.category === category}\n end", "def check_correctness(question, auto_grading)\n check_test_types = ['public_test', 'private_test'].freeze\n test_count = question.test_cases.reject(&:evaluation_test?).size\n passed_test_count = count_passed_test_cases(auto_grading, check_test_types)\n passed_test_count == test_count\n end", "def check_correctness(question, auto_grading)\n check_test_types = ['public_test', 'private_test'].freeze\n test_count = question.test_cases.reject(&:evaluation_test?).size\n passed_test_count = count_passed_test_cases(auto_grading, check_test_types)\n passed_test_count == test_count\n end", "def total_rounds(_ = nil)\n Algorithm::PagePlayoff::TOTAL_ROUNDS\n end", "def percentage_completed_by_user user\n question_ids = questions.collect &:id\n return 1.0 if question_ids.count == 0\n \n question_count = question_ids.count\n correctly_answered_questions = Question.joins(:in_reply_to_posts).where('questions.id' => question_ids).where('posts.user_id' => user.id, 'posts.correct' => true).group('questions.id')\n correctly_answered_questions.to_a.count / question_count.to_f\n end", "def count_correct_colors\n colors_by_difficulty.each do |color|\n if @code_guess.count(color) < @secret_code.count(color)\n @white_peg += @code_guess.count(color)\n else\n @white_peg += @secret_code.count(color)\n end\n end\n end", "def calculate_dc_points_per_round_total(wrestler, oc_sub_total)\n\t\t# DC Points\n\t\tdc_hash = get_dc_card_hash(wrestler)\n\t\t\n\t\tdc_points_per_round_subtotal = \n\t\t\tcalculate_dc_points_per_round_subtotal(\n\t\t\t\tdc_hash, wrestler[:dc])\n\n\t\t# TODO: replace hard coded number with\n\t\t# total points variable\n\t\trev_prob = return_rational(wrestler[:reverse])\n\n\t\treverse_points_per_round = calculate_reverse_points(wrestler, oc_sub_total)\n\t\t# DC points per round total\n\t\tdc_points_per_round_total = \n\t\t\tdc_points_per_round_subtotal +\n\t\t\treverse_points_per_round\n\n\t\treturn dc_points_per_round_total\n\tend", "def final_round()\n d = value(@dealer)\n puts \"--- Check Round --- \"\n puts \"Dealers' cards are #{@dealer.join(',')} for a value #{d}\"\n\n # Iterate over all players who are still in the game,\n # as in they haven't lost in the initial round doing 'hits'\n #\n # Precondition: forall p in players where p.cur_playing == false, value(p.cards) <= 21\n @players.find_all{|p| p.cur_playing}.each do |p|\n if value(p.cards) < d && d <= 21 # Dealer Wins\n puts \"Player #{p.index} has deck worth #{value p.cards}, and loses to the dealer...\"\n debit_player(p)\n elsif (value(p.cards) > d && d <= 21) || d > 21 # Player Wins\n puts \"Player #{p.index} has deck worth #{value p.cards}, and wins with the dealer...\"\n credit_player(p)\n elsif value(p.cards) == d\n puts \"Player #{p.index} has deck worth #{value p.cards}, and draws with the dealer...\"\n end\n end\n end", "def calculate_oc_points_per_round_total(wrestler)\n\n\t\toc_points_subtotal = \n\t\t\tcalculate_oc_points_subtotal(wrestler)\n\n\t\toc_specialty_points_per_round = \n\t\t\tcalculate_oc_specialty_points_per_round(wrestler)\n\n\t\tropes_points_total = \n\t\t\tcalculate_ropes_points_total(wrestler)\n\n\t\toc_points_per_round_total = oc_points_subtotal +\n\t\t\toc_specialty_points_per_round + ropes_points_total\n\n\t\treturn oc_points_per_round_total\n\tend", "def finalize_round(round_id)\n dump_round_vars 'Entering finalize_round()'\n \n num_gamers_complete_round = Result.all.where(round_complete: true).where(\"round_id = ?\",round_id).count\n Round.find(round_id).update(num_participants: num_gamers_complete_round)\n \n prune_question_set(round_id)\n prune_results(round_id)\n calculate_result_ranks(round_id)\n round_id = prune_round(round_id)\n \n dump_round_vars '','Exiting finalize_round()'\n return round_id\n end", "def calculate_winnings\n result = 0\n self.bookings.each do |booking|\n if booking.match.status == \"FINISHED\"\n if booking.won\n result += booking.stake * booking.odd.odds\n else\n booking.stake ? result -= booking.stake : result\n end\n end\n end\n return result.round(2)\n end", "def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end", "def score( dice )\n total_score = 0\n hash = Hash.new(0)\n dice.each {|x| hash[x] += 1}\n total_score += hash[1] < 3 ? hash[1] * 100 : 1000 + (hash[1] - 3) * 100\n total_score += hash[5] < 3 ? hash[5] * 50 : 500 + (hash[5] -3) * 50\n total_score += hash[6] > 2 ? 600 : 0\n total_score += hash[4] > 2 ? 400 : 0\n total_score += hash[3] > 2 ? 300 : 0\n total_score += hash[2] > 2 ? 200 : 0\n total_score\n end", "def score(dice)\n dice.sort\n\n if !dice.any?\n return 0\n end\n\n arr = Array.new (6)\n count = 1\n 6.times do\n arr[count-1] = dice.count(count)\n count +=1\n end\n\n sum = 0\n count = 1\n arr.each do |item|\n p \" #{count + 1} = #{item} :\"\n if item == 0 || item == nil\n count += 1\n next\n end\n\n if item >= 3 && count == 1\n sum += 1000 + 100 * (item - 3)\n elsif item >= 3 && count == 5\n sum += 5 * 100 + 50 * (item - 3)\n elsif item >= 3\n sum += count * 100\n end\n\n if item < 3 && count == 1\n sum += item * 100\n elsif item < 3 && count == 5\n sum += item * 50\n end\n\n count +=1\n end\n sum\nend", "def number_of_places_in_categories_within_bounds(categories, bounds)\n one.number_of_places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude])['number_of_places_in_categories_within_bounds'].to_i\n end", "def apply_roll_to_total(roll_reason, roll_result)\n case roll_reason\n when :basic, :reroll_new_die, :reroll_new_keeper, :reroll_replace\n @total = roll_result\n when :reroll_add\n @total += roll_result\n when :reroll_subtract\n @total -= roll_result\n when :reroll_use_best\n @total = [@value, roll_result].max\n when :reroll_use_worst\n @total = [@value, roll_result].min\n end\n end", "def total_word_count_in_cat(cat)\n return 0.0 unless @category_list[cat] && @category_list[cat][:_total_word]\n @category_list[cat][:_total_word].to_f\n end", "def total_word_count_in_cat(cat)\n return 0.0 unless @category_list[cat] && @category_list[cat][:_total_word]\n @category_list[cat][:_total_word].to_f\n end", "def initial_round\n total = deal_card + deal_card\n display_card_total(total)\n total\nend", "def coach_win_percent_in_season(coach, game_ids)\n (total_wins_of_coach_in_season(coach, game_ids) / total_coach_games_in_season(coach, game_ids).to_f).round(2)\n end", "def average_score\n numbers_without_zeros = self.comments.map{|comment| comment.overall_score}.reject{|n| n==0}\n return 0 if numbers_without_zeros == []\n preround = numbers_without_zeros.inject(:+)/numbers_without_zeros.count.to_f\n return preround.round\n end", "def sum_of_test_fee_based_on_category\n patient_test_info ={}\n self.user.test_categories.each do |test_category|\n patient_test_info[test_category.id.to_s] = line_tests.find_all{|line_item| line_item.test_category_id == test_category.id}.inject(0){|sum,line_test| (sum + line_test.test_fee)}\n end\n patient_test_info\n end", "def get_category_balance(category_name)\n category = CategoriesHelper.get_category(session[:current_user_id],\n session[:account_name], category_name)\n CategoriesHelper.get_category_entries_total category[:id]\n end", "def rounded_rating\n return nil unless rating_average\n\n floor = rating_average.floor\n\n decimal_part = rating_average % 1\n\n decimal_part = if decimal_part < 0.33\n 0\n elsif decimal_part < 0.66\n 0.5\n else\n 1\n end\n\n floor + decimal_part\n end", "def play_round\n scorer = BeingLucky.new(Array.new(5, Die.new))\n\n while scorer.can_roll?\n roll_score = scorer.score\n puts \"Score for this roll: #{roll_score}\"\n puts \"Score for this round: #{scorer.turn_score}\"\n puts \"Dice left to roll: #{scorer.dice_count}\"\n\n unless scorer.can_roll?\n puts \"You lose! No more dice means no points this round\"\n return 0\n end\n\n puts \"roll again? (Y/N): \"\n if STDIN.gets.chomp.downcase == \"n\"\n # cash out the points and break the loop\n return scorer.turn_score\n end\n\n end\n\n end", "def rank_open_categories(roll)\n debug = false\n open_cats = RankedCategories.new\n puts(\"roll is #{roll.dice}\") if debug\n @points.each { |cat, value| \n if value == nil\n score = roll.score_category(cat)\n puts(\"category #{cat} scores #{score}\") if debug\n open_cats.add(cat, score) \n end\n }\n open_cats.sort_descending\n puts(\"ranked categories (2) are #{open_cats}\") if debug\n open_cats\n end" ]
[ "0.8018888", "0.72253853", "0.7200633", "0.70389026", "0.69238466", "0.6730223", "0.63557994", "0.58161545", "0.5798303", "0.57859015", "0.5777151", "0.5755112", "0.5684646", "0.55789167", "0.51984125", "0.5192126", "0.51919246", "0.51919246", "0.50753385", "0.50016093", "0.4994991", "0.49742445", "0.4946492", "0.4919026", "0.49169374", "0.48793608", "0.4868842", "0.48631686", "0.4861306", "0.47882342", "0.4778546", "0.47590038", "0.47381794", "0.47168678", "0.46480206", "0.46436954", "0.46421757", "0.4615416", "0.46125335", "0.4602873", "0.46026438", "0.46006373", "0.45995325", "0.4572065", "0.45636806", "0.45575067", "0.45540413", "0.45471874", "0.45445448", "0.45336157", "0.45218292", "0.45108506", "0.4487971", "0.44816276", "0.4476529", "0.44748273", "0.44652995", "0.44639078", "0.4455755", "0.4454358", "0.44519895", "0.44461808", "0.443617", "0.44327006", "0.44327006", "0.44297722", "0.44293246", "0.44162154", "0.44117388", "0.4399174", "0.43988642", "0.43988642", "0.43943706", "0.43918929", "0.4390561", "0.43863782", "0.43863782", "0.43823496", "0.43794805", "0.43708563", "0.43708327", "0.4365199", "0.4358674", "0.43492046", "0.43473265", "0.43444094", "0.43431836", "0.4338584", "0.4325245", "0.43232617", "0.43166286", "0.43166286", "0.43151376", "0.4312187", "0.4311341", "0.4297673", "0.42975864", "0.4293076", "0.42888784", "0.42850542" ]
0.7555791
1
Roundpercent_correct returns the percentage of correct turns.
def percent_correct # Check for divide by zero. Than calculate the percentage otherwise. if @turns.size == 0 0.0 else # Calculate percentage, truncate value to one decimal place. ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end", "def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "def percent_answered\n percent_answered_int.to_s + \"%\"\n end", "def answered_percentage\n answered = num_answered_calls\n missed = num_missed_calls\n return 100.0 if (answered + missed) == 0\n (answered.to_f / (answered + missed) * 100).round(1)\n end", "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "def success\n (correct_answers_count*100.0/answers_count).round.to_i if answers_count > 0\n end", "def correct_ratio\n all = stats.where(\"answer_id >= 0\").size.to_f\n all > 0 ? correct_count.to_f/all : 0\n end", "def rounds_won_percentage\n (@rounds_played > 0) ? @rounds_won.to_f / @rounds_played : 0\n end", "def percentage_for(count, total, round=2)\n begin\n percentage = ((count.to_f / total.to_f) * 100).round(round)\n return 100.round(round) if percentage.round > 100\n percentage\n rescue FloatDomainError\n 0\n end\n end", "def get_percent_of_vote\n\t\t(@votes.count(@winner).to_f / @votes.count.to_f * 100).round\n\tend", "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def percent_correct_by_category(category_select)\n # Count the current cards in the turns that match the category selected. \n current_cards_category = @turns.count do |element|\n element.card.category == category_select\n end\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0 || current_cards_category == 0\n 0.0\n else\n # Create numerator and denominator values.\n numerator = number_correct_by_category(category_select).to_f \n denominator = current_cards_category.to_f\n \n # Calculate percentage, truncate value to one decimal place.\n ((numerator / denominator) * 100.0).truncate(1)\n end\n end", "def percent_wins(wins)\n ((wins.to_f / @num_games.to_f) * 100).round(4)\n end", "def grade_percentage\n passed_tests = boating_tests.select { |tests| tests.test_status == \"Pass\" }\n (passed_tests.count.to_f / boating_tests.count.to_f) * 100\n end", "def grade_percentage\n (self.passed_tests.length.to_f / self.tests.length * 100).round(2)\n end", "def percent_of_total\n # Prevents a error caused by attempting to round the value NaN\n poll.total_points == 0 ? 0 : (score.to_f/poll.total_points.to_f * 100).round\n end", "def grade_percentage\n # get the number of passing tests as a float\n passing_tests = tests.select { |test| test.test_status == \"passed\" }.length.to_f\n # get total number of all that students tests\n all_tests = tests.length.to_f\n # calculate their passing_tests as a % of their total tests\n passing_tests / all_tests * 100\n end", "def percent_of_goal_raised\n ( ( 100.0 * self.funds_raised ) / self.fundraising_goal ).round\n end", "def covered_percent\n # Make sure that weird rounding error from #15, #23 and #24 does not occur again!\n total_lines.zero? ? 0 : 100.0 * covered_lines / total_lines\n end", "def grade_percentage\n # This is the total number of tests a student (self) has taken.\n student_tests = BoatingTest.all.select do |test|\n test.student == self\n end\n\n # From the total number of tests taken by that student (self), we just want\n # the one's that have passed.\n passed_test = student_tests.select do |test|\n test.status == \"passed\"\n end\n # From the total number of tests taken by that student (self), we just want\n # the one's that have failed.\n failed_test = student_tests.select do |test|\n test.status == \"failed\"\n end\n\n # Now we need to find the percent of tests that this student (self) has\n # passed compared to the total number of tests they have taken.\n # Multiply by 100 to get a % value instead of decimal.\n # ratio = (passed_test.length.to_f)/(student_tests.length)\n # ratio * 100 SAME AS BELOW\n ratio = \"%.2f\" % (passed_test.length.fdiv(student_tests.length)*100).to_s + \"%\"\n # The \"%.2f\"\n end", "def win_percent\n matchmade_games < 1 ? 0 : ((total_exp.to_f/matchmade_games.to_f) * 100).to_d\n end", "def percent_for\n (votes_for.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "def percentage_yes\n return 0 if yes_count == 0\n\n ((yes_count.to_f / replies_count) * 100).to_i\n end", "def round_result\n @round += 1\n puts \"Round #{format('%02d', @round)}: #{@board.format(@board.breaker)}\nYou got #{@board.matches} matches and #{@board.correct_matches} correct guesses\"\n puts 'Careful, the next one is your last chance!'.red if @round == 11\n end", "def percent_correct_by_category(category)\n if deck.cards_in_category(category).length == 0\n return 0.0\n end\n ((number_correct_by_category(category) / deck.cards_in_category(category).length) * 100).to_f\n end", "def total_pass_rate\n if self.all_correct_answers.count == 0\n return 0\n else\n return (self.all_correct_answers.count.to_f / self.all_answered_options.count.to_f * 100).round\n end\n end", "def remaining_percent\n (remaining_pints.to_f)/(124.to_f)\n end", "def formatted_covered_percent\n covered_percent.round(2)\n end", "def percentage_yes\n return 0 if yes_count == 0\n \n ((yes_count.to_f / replies_count) * 100).to_i\n end", "def percent_complete\n (accepted_points.to_f / total_points * 100.0).round(1)\n end", "def coach_win_percent_in_season(coach, game_ids)\n (total_wins_of_coach_in_season(coach, game_ids) / total_coach_games_in_season(coach, game_ids).to_f).round(2)\n end", "def rectified_percent\n percent = ((self.rectified_maps_count.to_f / self.maps_count.to_f) * 100).to_f\n percent.nan? ? 0 : percent\n end", "def grade_percentage\n passed_tests.count / my_tests.count\n end", "def grade_percentage\n #Count all tests this student has passed\n tests_passed = BoatingTest.all.select {|test| test.student == self && test.test_status == \"passed\" }.length.to_f\n #Count all tests with this student\n all_tests = BoatingTest.all.select {|test| test.student == self}.length.to_f\n #Calculate percentage as float\n grade_percentage = tests_passed/all_tests\n grade_percentage.round(2)\n end", "def pick_percentage\n self.score.to_f / Matchup.amount_finished.to_f\n end", "def percentage_of_votes\n if total_votes > 0\n 100 * (number_of_votes.to_f / total_votes.to_f)\n else\n 0\n end\n end", "def grade_percentage\n studentTests= BoatingTest.all.find_all{|test| test.student.first_name == self.first_name}\n totalTests= studentTests.length.to_f\n totalPassed= studentTests.find_all{|test| test.status == \"passed\"}\n numPassed= totalPassed.length.to_f\n percent= (numPassed/totalTests)*100\n end", "def percentage_completed_by_user user\n question_ids = questions.collect &:id\n return 1.0 if question_ids.count == 0\n \n question_count = question_ids.count\n correctly_answered_questions = Question.joins(:in_reply_to_posts).where('questions.id' => question_ids).where('posts.user_id' => user.id, 'posts.correct' => true).group('questions.id')\n correctly_answered_questions.to_a.count / question_count.to_f\n end", "def grade_percentage\n\t\t#1. Collect all of the tests a student has taken \n\t\t#2. Find the percentage of tests the student has passed.\n\t\t#3. Return the amount as a float.\n\t\tgrade_arr = BoatingTest.all.select do |test|\n\t\t\ttest.student == self\n\t\tend\n\t\t\n\t\tgrade_arr = grade_arr.collect do |test|\n\t\t\ttest.status\n\t\tend\n\t\t(grade_arr.count(\"passed\").to_f/grade_arr.count.to_f) * 100\n\tend", "def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end", "def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end", "def vote_percentage \n if self.filed? || self.finished? # Makes sure the threshold hasn't already been hit. \n return 100 # Return 100, meaning 100% goal. \n elsif self.pending? # PEtition is pending still \n petition_votes = self.votes_for.count\n petition_votes.to_f\n percentage = petition_votes / 500.00 # Finds percentage of the vote goal \n percentage *= 100 # Turns the float percentage into a whole number percentage.\n return percentage.round(1) \n else \n puts \"Something is wrong with this petition.\"\n end \n end", "def grade_percentage\n tests = BoatingTest.all.select {|test| test.student.first_name == self.first_name}\n passed_tests = tests.select {|test| test.test_status == \"passed\"}\n per = (passed_tests.length.to_f / tests.length.to_f)*100\n \n end", "def get_win_percentage(strategy)\n score = 0\n @turns.each do |t|\n score += t.result.to_i if t.strategy.include?(strategy)\n end\n score\n end", "def peer_percent_complete\n if !self.peer_check_count.blank?\n if self.auditor_completed_checks <= self.peer_check_count\n self.auditor_completed_checks * 100.0 / self.peer_check_count\n else\n 100.0\n end\n else\n 0\n end\n end", "def covered_percent\n return 100.0 if no_lines?\n\n return 0.0 if relevant_lines.zero?\n\n Float(covered_lines.size * 100.0 / relevant_lines.to_f)\n end", "def number_correct\n @correct_answers = []\n\n @turns.each do |turn|\n @correct_answers << turn.correct?\n end\n @correct_answers.count(true)\n end", "def covered_percent\n return 100.0 if empty? || lines_of_code.zero?\n\n Float(covered_lines * 100.0 / lines_of_code)\n end", "def number_correct\n @turns.count do |turn|\n turn.correct?\n end\n end", "def pct()\n\t (self.wins()==0) ? 0 : self.wins().to_f/(self.wins()+self.losses()) \n\tend", "def self_percent_complete\n if !self.self_check_count.blank?\n if self.designer_completed_checks <= self.self_check_count\n self.designer_completed_checks * 100.0 / self.self_check_count\n else\n 100.0\n end\n else\n 0\n end\n end", "def percent_complete(user)\n\t\tcompletedWorth = 0.0\n\t\ttotalWorth = 0.0\n\t\t\n\t\tself.assignments.each do |assignment|\n\t\t\ttotalWorth += assignment.worth\n\t\t\t\n\t\t\tif assignment.user_grade(user)\n\t\t\t\tcompletedWorth += assignment.worth\n\t\t\tend\n\t\tend\n\t\t\n\t\tif totalWorth != 0\n\t\t\treturn completedWorth / totalWorth\n\t\tend\n\tend", "def percent_ptn(kcal)\n (kcal * 100 / tee(kcal)).round(2)\n end", "def percentage(problems_solved, problems_count)\n\t\tif problems_count == 0\n\t\t\treturn 0\n\t\telse\n\t\t\tperc = (problems_solved.to_f / problems_count) * 100\n\t\tend\n\t\treturn perc\n\tend", "def number_correct\n turns.count do |each_turn|\n each_turn.correct?\n end\n end", "def percent_complete\n # return 0 if there is no tasks\n return 0 if tasks.none?\n ((total_complete.to_f / total_tasks) * 100).round\n end", "def grade_percentage\n total = 0\n student_tests = BoatingTest.all.select {|test| test.student == self}\n student_tests.each do |test|\n if test.test_status == \"passed\"\n total += 1\n end\n end\n average = total.to_f / student_tests.length\n average * 100\n end", "def end_of_game(round)\n puts \"****** GAME OVER ******\"\n puts \"You had #{round.number_correct} correct guesses out of #{round.deck.count} for a total score of #{round.percent_correct}%.\"\n puts \"STEM - #{round.percent_correct_by_category(:STEM)}% correct\"\n puts \"Turing Staff - #{round.percent_correct_by_category('Turing Staff')}% correct\"\n puts \"Pop Culture - #{round.percent_correct_by_category('Pop Culture')}% correct\"\nend", "def problem_percentage\n @summary[:total_score].to_f / Constants::THRESHOLDS[\"Project\"].to_f\n end", "def calculate_average(correct_answers, total_answers)\n #this is an average. uses floats to get decimals, *100 because thats what a percentage is, and converts to an integer. '%.2f' % to round the float off to 2 decimal places\n if Helper.check_for_zero?(total_answers) == true\n puts \"You haven't taken any quizzes!!!\"\n return -1\n else\n average = (correct_answers.to_f * 100) / (total_answers.to_f * 100)\n average = average * 100\n return average.to_i\n end\n\n end", "def percentage\n 0.0\n end", "def percentagize(average)\n number_with_precision(((average / 10) * 100), precision: 1)\n end", "def common_percent\n return 0 if @preferred\n\n @percent\n end", "def percent_high_ranking\n number_of_high_cards = self.high_ranking_cards.length.to_f\n number_of_all_cards = self.cards.length.to_f\n\n percentage = number_of_high_cards / number_of_all_cards\n percentage_rounded = (percentage * 100).round(2)\n\n return percentage_rounded\n end", "def next_percent_complete\n (self.completeness_score.to_f + self.failed_checks.first[:weighting]) / self.class.max_completeness_score.to_f * 100\n end", "def percent_complete\n self.completeness_score.to_f / self.class.max_completeness_score.to_f * 100\n end", "def percent_complete\n self.completeness_score.to_f / self.class.max_completeness_score.to_f * 100\n end", "def percent_passes\n 100 - percent_skips - percent_errors_failures\n end", "def problem_percentage\n score.to_f / Constants::THRESHOLDS[@class_type].to_f\n end", "def percentage_off\n\t\t(you_save > 0) ? (you_save/100).round(2) : 0\n\tend", "def get_percentage(report)\n percent = (report[:position] / report[:length]) * 100\n percent.round\n end", "def get_remaining_ratio(logged_ratio, done_ratio)\n if logged_ratio > 0\n Integer(logged_ratio.to_f/done_ratio.to_f*(100-done_ratio))\n else\n Integer(100-done_ratio)\n end\n end", "def difficulty\n 1-correct.to_f/(correct+incorrect)\n end", "def compute_percent(rcount, qcount)\n return 100 if qcount.zero?\n (rcount * 100.0 / qcount).to_i\n end", "def test_correct_number_user_answer_1\n assert_equal @round.number_correct, 0\n result = @round.record_guess(\"Juneau\")\n assert_equal @round.number_correct, 1\n end", "def guess_round(driver)\n Algorithm::PagePlayoff.guess_round(driver.matches.length)\n end", "def percentage_no\n return 0 if no_count == 0\n\n 100 - percentage_yes\n end", "def percentage_no\n return 0 if no_count == 0\n\n 100 - percentage_yes\n end", "def percent(version = @spec.version)\n matching = @comments.select do |comment|\n comment['version'] == version\n end\n\n works = matching.select do |comment| comment['works_for_me'] end.length\n\n percent = (matching.length.to_f / works * 100)\n percent = 0 if percent.nan?\n percent = 100 if percent > 100\n\n \"%2.0f%%\" % percent\n end", "def percent(version = @spec.version)\n matching = @comments.select do |comment|\n comment['version'] == version\n end\n\n works = matching.select do |comment| comment['works_for_me'] end.length\n\n percent = (matching.length.to_f / works * 100)\n percent = 0 if percent.nan?\n percent = 100 if percent > 100\n\n \"%2.0f%%\" % percent\n end", "def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end", "def percentage(percent, total)\n percent.to_f / total * 100\nend", "def player_win_percentage\n (games_won/user_games)\n end", "def format_pct_value(ror)\n (ror * 100).round(1)\n end", "def vote_percent\n Vote.percent(vote_cache)\n end", "def top_n_to_percentage(percent)\n top = top_n\n total = top.map(&:last).sum\n cumulative_count = 0.0\n top_to_percentage = []\n\n while (cumulative_count / total) * 100 < percent\n result = top.shift\n top_to_percentage << result\n cumulative_count += result[1]\n end\n top_to_percentage\n end", "def percentage_of_passives\n calculator.percentage_of_passives\n end", "def match_percentage(other_username)\n other_user = User.includes(:answers).find_by(username: other_username)\n my_total = 0\n my_running_total = 0\n their_total = 0\n their_running_total = 0\n\n if other_user\n mutual_answers(other_user).each do |answer_pair|\n mine = answer_pair.first\n theirs = answer_pair.last\n\n my_total += mine.importance\n their_total += theirs.importance\n\n if ids_checker(mine.acceptable_ids, theirs.chosen_ids)\n my_running_total += mine.importance\n end\n\n if ids_checker(theirs.acceptable_ids, mine.chosen_ids)\n their_running_total += theirs.importance\n end\n end\n\n if my_total == 0 || their_total == 0\n return 0\n end\n\n my_ratio = my_running_total.to_f / my_total\n their_ratio = their_running_total.to_f / their_total\n\n Math.sqrt(my_ratio * their_ratio) * 100\n else\n nil\n end\n end", "def percentage_sold\n ((quantity_sold / stock.to_f) * 100).round\n end", "def percent_passes; end", "def percent_passes; end", "def event_percentage_for(type, round_percentage=false)\n @sc ||= host_stats\n if %W(high medium low tcp udp icmp all).include?(type)\n calc = ((@sc[:\"#{type}\"].to_f / (@sc[:all].to_f)) * 100)\n if round_percentage\n return \"#{calc.round}\"\n else\n return \"#{calc}\"\n end\n else\n raise \"Error: #{type} is not an acceptable severity. Possible options include: all, tdp, udp, icmp, high, medium and low.\"\n end\n end", "def covered_percent; end", "def covered_percent; end", "def number_correct\n number_correct = 0\n if current_card.answer == turns[turns.length - 1].guess\n number_correct + 1\n end\n end", "def percent_correct_by_category(card_category)\n total_by_category = []\n @turns.each do |card|\n if card.card.category == card_category\n total_by_category << card\n end\n end\n number_correct_by_category(card_category).fdiv(total_by_category.count) * 100\n end", "def success_rate_stats\n hits = Float(self.quizzes.where(:result => true).length)\n total_quizzes = Float(self.quizzes.length)\n rate = hits / total_quizzes\n rate.round(2) * 100\n end", "def home_shoot_percent\n home_shoot_percent = @schedule.home_score / game_stat.home_sog.to_f * 100\n home_shoot_percent.round(2)\n end", "def profile_completeness_percent\n Cache.get(['profile_c', self], nil, true){\n total = completed = 0.0\n self.profile_elements.each do |element, is_completed|\n total += 1.0\n completed += 1.0 if is_completed\n end\n (completed / total).round(2)\n }.to_f\n end" ]
[ "0.77676356", "0.67909825", "0.6737275", "0.6528511", "0.6500005", "0.6500005", "0.64801145", "0.6464098", "0.6437641", "0.6375033", "0.6352013", "0.631339", "0.62854767", "0.6267044", "0.6248026", "0.62446785", "0.62335867", "0.62019515", "0.61555326", "0.60859907", "0.6075932", "0.605695", "0.6049472", "0.6015623", "0.60114956", "0.59935784", "0.59831536", "0.5982743", "0.5952337", "0.59447074", "0.59305114", "0.5907325", "0.58993363", "0.58912253", "0.5874607", "0.5871168", "0.58542585", "0.5849382", "0.584002", "0.5790944", "0.57855475", "0.57855475", "0.577957", "0.57663435", "0.5754318", "0.57461494", "0.57256436", "0.57218254", "0.571135", "0.57085776", "0.56882393", "0.5668761", "0.56613934", "0.56428814", "0.56369954", "0.5634818", "0.56335765", "0.56314856", "0.56140226", "0.56058913", "0.56015956", "0.5591233", "0.5579722", "0.55737466", "0.5557298", "0.5543547", "0.55288357", "0.55288357", "0.55221725", "0.5490009", "0.5483227", "0.54528975", "0.545148", "0.54453856", "0.54436004", "0.5440985", "0.5418373", "0.54183024", "0.54183024", "0.54136133", "0.54136133", "0.54125416", "0.5410183", "0.5385664", "0.53792864", "0.5376181", "0.53695047", "0.53665245", "0.5358667", "0.5355441", "0.5341799", "0.5341799", "0.5335723", "0.533255", "0.533255", "0.533228", "0.53230876", "0.53221846", "0.53166574", "0.53015065" ]
0.80640006
0
Roundpercent_correct_by_category returns the percentage of correct turns for a category.
def percent_correct_by_category(category_select) # Count the current cards in the turns that match the category selected. current_cards_category = @turns.count do |element| element.card.category == category_select end # Check for divide by zero. Than calculate the percentage otherwise. if @turns.size == 0 || current_cards_category == 0 0.0 else # Create numerator and denominator values. numerator = number_correct_by_category(category_select).to_f denominator = current_cards_category.to_f # Calculate percentage, truncate value to one decimal place. ((numerator / denominator) * 100.0).truncate(1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_correct_by_category(category)\n if deck.cards_in_category(category).length == 0\n return 0.0\n end\n ((number_correct_by_category(category) / deck.cards_in_category(category).length) * 100).to_f\n end", "def percent_correct_by_category(card_category)\n total_by_category = []\n @turns.each do |card|\n if card.card.category == card_category\n total_by_category << card\n end\n end\n number_correct_by_category(card_category).fdiv(total_by_category.count) * 100\n end", "def number_correct_by_category(category)\n correct_count = 0\n @turns.each do |turn|\n if turn.correct? == true && turn.card.category == category\n correct_count = correct_count + 1\n end\n end\n correct_count\n end", "def percent_correct\n division_to_integer = (number_correct.to_f / @count)\n ((number_correct.to_f / @count) * 100).to_i\n end", "def percent_correct\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0\n 0.0\n else\n # Calculate percentage, truncate value to one decimal place.\n ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)\n end\n end", "def number_correct_by_category(category_select)\n # Count the cards that are in the selected category and are guessed correct.\n @turns.count do |turn|\n turn.correct? && turn.card.category == category_select\n end\n end", "def number_correct_by_category(card_category)\n correct_guesses = []\n correct_by_category = []\n @turns.each do |card|\n if card.correct?\n correct_guesses << card\n end\n end\n correct_guesses.each do |card|\n if card.card.category == card_category\n correct_by_category << card\n end\n end\n correct_by_category.count\n end", "def number_correct_by_category(category_arg)\n # correct_category = []\n #\n # @turns.each do {|turn|turn.card.category == category_arg}\n #\n # correct_category << turn\n\n # end\n # correct_category.count\n\n # correct_guess = []\n\n # correct_guesses_in_category = @turns.each { |turn| turn.correct? && turn.card.category == category_arg}.count\n correct_guesses_in_category = []\n @turns.each do |turn|\n correct_guesses_in_category << turn if turn.correct? && turn.card.category == category_arg\n end\n correct_guesses_in_category.count\n\n end", "def percentage_for(count, total, round=2)\n begin\n percentage = ((count.to_f / total.to_f) * 100).round(round)\n return 100.round(round) if percentage.round > 100\n percentage\n rescue FloatDomainError\n 0\n end\n end", "def correct_ratio\n all = stats.where(\"answer_id >= 0\").size.to_f\n all > 0 ? correct_count.to_f/all : 0\n end", "def percent_of_total\n # Prevents a error caused by attempting to round the value NaN\n poll.total_points == 0 ? 0 : (score.to_f/poll.total_points.to_f * 100).round\n end", "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "def percentage_completed_by_user user\n question_ids = questions.collect &:id\n return 1.0 if question_ids.count == 0\n \n question_count = question_ids.count\n correctly_answered_questions = Question.joins(:in_reply_to_posts).where('questions.id' => question_ids).where('posts.user_id' => user.id, 'posts.correct' => true).group('questions.id')\n correctly_answered_questions.to_a.count / question_count.to_f\n end", "def answered_percentage\n answered = num_answered_calls\n missed = num_missed_calls\n return 100.0 if (answered + missed) == 0\n (answered.to_f / (answered + missed) * 100).round(1)\n end", "def percent_answered\n percent_answered_int.to_s + \"%\"\n end", "def success\n (correct_answers_count*100.0/answers_count).round.to_i if answers_count > 0\n end", "def accuracy(classifier, test_set)\n \tcorrect = 0.0\n \ttest_set.each { |e| correct += 1.0 if e.label == classifier.guess_for(e) }\n \tcorrect / test_set.size.to_f\n end", "def normalized_counts(category)\n counts = categories.map { |c| c.points }.flatten.map { |point| point.count }\n max = counts.max\n category.points.map { |p| p.count }.map { |count| max == 0 ? 0 : (count.to_f / max * 100).to_i }\n end", "def coach_win_percent_in_season(coach, game_ids)\n (total_wins_of_coach_in_season(coach, game_ids) / total_coach_games_in_season(coach, game_ids).to_f).round(2)\n end", "def total_pass_rate\n if self.all_correct_answers.count == 0\n return 0\n else\n return (self.all_correct_answers.count.to_f / self.all_answered_options.count.to_f * 100).round\n end\n end", "def event_percentage_for(type, round_percentage=false)\n @sc ||= host_stats\n if %W(high medium low tcp udp icmp all).include?(type)\n calc = ((@sc[:\"#{type}\"].to_f / (@sc[:all].to_f)) * 100)\n if round_percentage\n return \"#{calc.round}\"\n else\n return \"#{calc}\"\n end\n else\n raise \"Error: #{type} is not an acceptable severity. Possible options include: all, tdp, udp, icmp, high, medium and low.\"\n end\n end", "def covered_percent\n # Make sure that weird rounding error from #15, #23 and #24 does not occur again!\n total_lines.zero? ? 0 : 100.0 * covered_lines / total_lines\n end", "def category_probability(category)\r\n @categories_documents[category].to_f/@total_documents.to_f\r\n end", "def grade_percentage\n passed_tests = boating_tests.select { |tests| tests.test_status == \"Pass\" }\n (passed_tests.count.to_f / boating_tests.count.to_f) * 100\n end", "def get_percent_of_vote\n\t\t(@votes.count(@winner).to_f / @votes.count.to_f * 100).round\n\tend", "def problem_percentage\n score.to_f / Constants::THRESHOLDS[@class_type].to_f\n end", "def num_of_correct(crct)\n if self.total.nil?\n self.total = 1\n else\n self.total += 1\n end\n \n if crct == 1\n if self.correct.nil?\n self.correct = 1\n else\n self.correct += 1\n end \n else\n self.correct = 0\n end\n end", "def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\n end", "def recall category\n\t\tsend(category).values.sum > 0 ? send(category)[category].fdiv(send(category).values.sum) : 0\n\tend", "def rectified_percent\n percent = ((self.rectified_maps_count.to_f / self.maps_count.to_f) * 100).to_f\n percent.nan? ? 0 : percent\n end", "def percentage_for(choice)\n vote_choice = self.send(\"total_#{choice}\")\n vote_choice > 0 ? (vote_choice.to_f / total_votes * 100) : 0 \n end", "def grade_percentage\n # get the number of passing tests as a float\n passing_tests = tests.select { |test| test.test_status == \"passed\" }.length.to_f\n # get total number of all that students tests\n all_tests = tests.length.to_f\n # calculate their passing_tests as a % of their total tests\n passing_tests / all_tests * 100\n end", "def grade_percentage\n passed_tests.count / my_tests.count\n end", "def count_sub_percen(category)\n\t\tselect=self.user_program_form_values.where(:form_key_category=>category, :check=>true ).count\n\t\tall=self.user_program_form_values.where(:form_key_category=>category).count\n\t\tif all > 0\n\t\t\t(select*100) / all\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def grade_percentage\n # This is the total number of tests a student (self) has taken.\n student_tests = BoatingTest.all.select do |test|\n test.student == self\n end\n\n # From the total number of tests taken by that student (self), we just want\n # the one's that have passed.\n passed_test = student_tests.select do |test|\n test.status == \"passed\"\n end\n # From the total number of tests taken by that student (self), we just want\n # the one's that have failed.\n failed_test = student_tests.select do |test|\n test.status == \"failed\"\n end\n\n # Now we need to find the percent of tests that this student (self) has\n # passed compared to the total number of tests they have taken.\n # Multiply by 100 to get a % value instead of decimal.\n # ratio = (passed_test.length.to_f)/(student_tests.length)\n # ratio * 100 SAME AS BELOW\n ratio = \"%.2f\" % (passed_test.length.fdiv(student_tests.length)*100).to_s + \"%\"\n # The \"%.2f\"\n end", "def formatted_covered_percent\n covered_percent.round(2)\n end", "def precision category\n\t\tpositive[category] + negative[category] + neutral[category] > 0 ? send(category)[category].fdiv(positive[category] + negative[category] + neutral[category]) : 0\n\tend", "def percentage_of_votes\n if total_votes > 0\n 100 * (number_of_votes.to_f / total_votes.to_f)\n else\n 0\n end\n end", "def percentage_yes\n return 0 if yes_count == 0\n\n ((yes_count.to_f / replies_count) * 100).to_i\n end", "def vote_percentage \n if self.filed? || self.finished? # Makes sure the threshold hasn't already been hit. \n return 100 # Return 100, meaning 100% goal. \n elsif self.pending? # PEtition is pending still \n petition_votes = self.votes_for.count\n petition_votes.to_f\n percentage = petition_votes / 500.00 # Finds percentage of the vote goal \n percentage *= 100 # Turns the float percentage into a whole number percentage.\n return percentage.round(1) \n else \n puts \"Something is wrong with this petition.\"\n end \n end", "def success_rate_stats\n hits = Float(self.quizzes.where(:result => true).length)\n total_quizzes = Float(self.quizzes.length)\n rate = hits / total_quizzes\n rate.round(2) * 100\n end", "def percent_high_ranking\n number_of_high_cards = self.high_ranking_cards.length.to_f\n number_of_all_cards = self.cards.length.to_f\n\n percentage = number_of_high_cards / number_of_all_cards\n percentage_rounded = (percentage * 100).round(2)\n\n return percentage_rounded\n end", "def percent_complete\n (accepted_points.to_f / total_points * 100.0).round(1)\n end", "def percent_ptn(kcal)\n (kcal * 100 / tee(kcal)).round(2)\n end", "def get_win_percentage(strategy)\n score = 0\n @turns.each do |t|\n score += t.result.to_i if t.strategy.include?(strategy)\n end\n score\n end", "def covered_percent\n return 100.0 if empty? || lines_of_code.zero?\n\n Float(covered_lines * 100.0 / lines_of_code)\n end", "def covered_percent\n return 100.0 if no_lines?\n\n return 0.0 if relevant_lines.zero?\n\n Float(covered_lines.size * 100.0 / relevant_lines.to_f)\n end", "def calculate_average(correct_answers, total_answers)\n #this is an average. uses floats to get decimals, *100 because thats what a percentage is, and converts to an integer. '%.2f' % to round the float off to 2 decimal places\n if Helper.check_for_zero?(total_answers) == true\n puts \"You haven't taken any quizzes!!!\"\n return -1\n else\n average = (correct_answers.to_f * 100) / (total_answers.to_f * 100)\n average = average * 100\n return average.to_i\n end\n\n end", "def percent_of_goal_raised\n ( ( 100.0 * self.funds_raised ) / self.fundraising_goal ).round\n end", "def grade_percentage\n (self.passed_tests.length.to_f / self.tests.length * 100).round(2)\n end", "def percentage_yes\n return 0 if yes_count == 0\n \n ((yes_count.to_f / replies_count) * 100).to_i\n end", "def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end", "def end_of_game(round)\n puts \"****** GAME OVER ******\"\n puts \"You had #{round.number_correct} correct guesses out of #{round.deck.count} for a total score of #{round.percent_correct}%.\"\n puts \"STEM - #{round.percent_correct_by_category(:STEM)}% correct\"\n puts \"Turing Staff - #{round.percent_correct_by_category('Turing Staff')}% correct\"\n puts \"Pop Culture - #{round.percent_correct_by_category('Pop Culture')}% correct\"\nend", "def profile_completeness_percent\n Cache.get(['profile_c', self], nil, true){\n total = completed = 0.0\n self.profile_elements.each do |element, is_completed|\n total += 1.0\n completed += 1.0 if is_completed\n end\n (completed / total).round(2)\n }.to_f\n end", "def problem_percentage\n @summary[:total_score].to_f / Constants::THRESHOLDS[\"Project\"].to_f\n end", "def percent_for\n (votes_for.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "def grade_percentage\n studentTests= BoatingTest.all.find_all{|test| test.student.first_name == self.first_name}\n totalTests= studentTests.length.to_f\n totalPassed= studentTests.find_all{|test| test.status == \"passed\"}\n numPassed= totalPassed.length.to_f\n percent= (numPassed/totalTests)*100\n end", "def rounds_won_percentage\n (@rounds_played > 0) ? @rounds_won.to_f / @rounds_played : 0\n end", "def progress_bar_percentage(recipe, user = current_user)\n num_of_ingredients_matched = (recipe.ingredients & get_active_ingredients(user)).length\n percent_of_ingredients_matched = num_of_ingredients_matched.fdiv(recipe.ingredients.length) * 100\n case percent_of_ingredients_matched\n when 0..25\n return \"rgba(255,0,0,0.7)\"\n when 25..50\n return \"rgba(255,165,0,0.7)\"\n when 50..75\n return \"rgba(255,255,0,0.7)\"\n else\n return \"rgba(0,100,0,0.7)\"\n end\n end", "def grade_percentage\n total = 0\n student_tests = BoatingTest.all.select {|test| test.student == self}\n student_tests.each do |test|\n if test.test_status == \"passed\"\n total += 1\n end\n end\n average = total.to_f / student_tests.length\n average * 100\n end", "def grade_percentage\n #Count all tests this student has passed\n tests_passed = BoatingTest.all.select {|test| test.student == self && test.test_status == \"passed\" }.length.to_f\n #Count all tests with this student\n all_tests = BoatingTest.all.select {|test| test.student == self}.length.to_f\n #Calculate percentage as float\n grade_percentage = tests_passed/all_tests\n grade_percentage.round(2)\n end", "def percent_of_total\n VoteCount.total.blank? ? 0 : ((count.to_f / VoteCount.total)*100)\n end", "def match_percentage(other_username)\n other_user = User.includes(:answers).find_by(username: other_username)\n my_total = 0\n my_running_total = 0\n their_total = 0\n their_running_total = 0\n\n if other_user\n mutual_answers(other_user).each do |answer_pair|\n mine = answer_pair.first\n theirs = answer_pair.last\n\n my_total += mine.importance\n their_total += theirs.importance\n\n if ids_checker(mine.acceptable_ids, theirs.chosen_ids)\n my_running_total += mine.importance\n end\n\n if ids_checker(theirs.acceptable_ids, mine.chosen_ids)\n their_running_total += theirs.importance\n end\n end\n\n if my_total == 0 || their_total == 0\n return 0\n end\n\n my_ratio = my_running_total.to_f / my_total\n their_ratio = their_running_total.to_f / their_total\n\n Math.sqrt(my_ratio * their_ratio) * 100\n else\n nil\n end\n end", "def completeness_score\n sum_score = 0\n passed_checks.each { |check| sum_score += check[:weighting] }\n sum_score\n end", "def participation_percentage(question)\n # we launch a exception if the question have not been found\n raise 'Question Not Found' unless questions.include? question\n # Variable to represent the number of question answered\n question_num = 0\n # Iterate the array of responses\n responses.each do |response|\n # For each response, iterate the array with answer\n response.answers.each do |answer|\n # For each answer, check the type of the question\n question_num += 1 if answer.question.eql?(question)\n end\n end\n percentage = (question_num * 100) / responses.count.to_f\n # Round to two decimals\n percentage.to_f.round(2)\n end", "def rating_of(category, item)\n ratings_of = ratings.select{ |r| r.beer.send(category) == item }\n ratings_of.map(&:score).inject(&:+) / ratings_of.count.to_f\n end", "def grade_percentage\n tests = BoatingTest.all.select {|test| test.student.first_name == self.first_name}\n passed_tests = tests.select {|test| test.test_status == \"passed\"}\n per = (passed_tests.length.to_f / tests.length.to_f)*100\n \n end", "def grade_percentage\n\t\t#1. Collect all of the tests a student has taken \n\t\t#2. Find the percentage of tests the student has passed.\n\t\t#3. Return the amount as a float.\n\t\tgrade_arr = BoatingTest.all.select do |test|\n\t\t\ttest.student == self\n\t\tend\n\t\t\n\t\tgrade_arr = grade_arr.collect do |test|\n\t\t\ttest.status\n\t\tend\n\t\t(grade_arr.count(\"passed\").to_f/grade_arr.count.to_f) * 100\n\tend", "def priorprob(category)\n sum = 0\n self.category_count.each do |cat, count|\n sum += count\n end\n return self.category_count[category] / sum\n end", "def percentage_for(choice)\n vote_choice = self.send(choice)\n vote_choice > 0 ? (vote_choice.to_f / votes.count * 100) : 0 \n end", "def percent_complete(user)\n\t\tcompletedWorth = 0.0\n\t\ttotalWorth = 0.0\n\t\t\n\t\tself.assignments.each do |assignment|\n\t\t\ttotalWorth += assignment.worth\n\t\t\t\n\t\t\tif assignment.user_grade(user)\n\t\t\t\tcompletedWorth += assignment.worth\n\t\t\tend\n\t\tend\n\t\t\n\t\tif totalWorth != 0\n\t\t\treturn completedWorth / totalWorth\n\t\tend\n\tend", "def round\n @recipe_hash[:total_prot] = @recipe_hash[:total_prot].round(2)\n @recipe_hash[:total_cal] = @recipe_hash[:total_cal].round(2)\n @recipe_hash[:total_fat] = @recipe_hash[:total_fat].round(2)\n @recipe_hash[:total_carbs] = @recipe_hash[:total_carbs].round(2)\n end", "def common_percent\n return 0 if @preferred\n\n @percent\n end", "def percent_high_ranking\n (high_ranking_cards.count.fdiv(@cards.count) * 100).round(2)\n end", "def calculate_discount_for(total)\n if self.discount_percentage.present? && self.discount_percentage != 0.0\n (total / 100) * self.discount_percentage.round(2)\n else\n 0\n end\n end", "def percentagize(average)\n number_with_precision(((average / 10) * 100), precision: 1)\n end", "def vote_percentage(type)\n animals_votes = @db[\"select * from votes where animal_id in \\\n (select id from animals where type = '#{type}')\"]\n begin\n (animals_votes.count / @db[:votes].count.to_f * 100).round\n rescue FloatDomainError\n 50 # we have no data, it's 50:50\n end\n end", "def covered_percent; end", "def covered_percent; end", "def klass_average(k)\n assignments = self.assignments.select {|a| a.klasses.include?(k)}\n points_possible = assignments.map(&:value).compact.reduce(:+)\n points_earned = self.grades.select {|g| assignments.include?(g.assignment)}.map(&:value).compact.reduce(:+)\n \"#{points_earned.to_f / points_possible.to_f * 100}%\"\n end", "def percent_errors_failures\n ((errors + failures) / count.to_f * 100).to_i\n end", "def all_answered_questions_per_category(category)\n self.all_answered_questions.select{|question| question.category === category}\n end", "def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end", "def percent_complete\n self.completeness_score.to_f / self.class.max_completeness_score.to_f * 100\n end", "def percent_complete\n self.completeness_score.to_f / self.class.max_completeness_score.to_f * 100\n end", "def percentage_discount\n ((1 - (sale_price / original_price)) * 100).round.to_i\n end", "def percent_high_ranking\n ((high_ranking_cards.count.to_f / @cards.count.to_f) * 100).round(2)\n end", "def percentage(percent, total)\n percent.to_f / total * 100\nend", "def percent_of_rec(total_amt, daily_recommended)\n if daily_recommended.to_f == 0\n return \"-\"\n else\n decimal = total_amt.to_f / daily_recommended.to_f\n percent = (decimal * 100).round\n return percent\n end\n end", "def cat_count(category)\n @category_list[category][:_count] ? @category_list[category][:_count].to_f : 0.0\n end", "def cat_count(category)\n @category_list[category][:_count] ? @category_list[category][:_count].to_f : 0.0\n end", "def percentComplete\n totalImages = image_labels.count\n pct = (labelledImagesCount()/totalImages)*100.0\n pct.round(1)\n end", "def calc_progress\n p = 0.25\n unless self.compile_errors.nil?\n p = 0.5\n end\n\n if self.correct\n p = 1.0\n else\n unless self.results.nil?\n p_tc = 0.0\n self.results.each do |id,result|\n unless result['error']\n p_tc = p_tc + 1\n end\n end\n p = p + ((p_tc/self.results.size) * 0.5)\n end\n end\n\n p\n end", "def vote_percent\n Vote.percent(vote_cache)\n end", "def round_result\n interface.show_cards_evident(player.cards, croupier.cards)\n interface.current_points(player.amt_points, croupier.amt_points)\n\n return interface.draw if player.amt_points == croupier.amt_points\n return interface.draw if player.excess? && croupier.excess?\n return win_round if croupier.excess?\n return lose_round if player.excess?\n return win_round if player.amt_points > croupier.amt_points\n lose_round\n end", "def solve(meal_cost, tip_percent, tax_percent)\n total = meal_cost + (meal_cost * tip_percent)/100 + (meal_cost * tax_percent)/100\n puts total.round() \nend", "def categories_report_as_percentage(miscellaneous=false)\n @top_categories = BudgetTransaction.top_transactions_grouped_by_category(limit=nil,miscellaneous_only=miscellaneous)\n if miscellaneous\n @total_spend = BudgetTransaction.total_misc_expenses_for_year(nil)\n else\n @total_spend = BudgetTransaction.total_expenses_for_year(nil)\n end\n\n @top_categories.map do |txn|\n {\n name: txn.name,\n expense: txn.total_expense,\n y: ((txn.total_expense/@total_spend).to_f.round(2) * 100)\n }\n end\n end", "def percent_high_ranking\n percent = high_ranking_cards.length / cards.length.to_f\n end" ]
[ "0.82706606", "0.7738678", "0.6609322", "0.64624184", "0.6341366", "0.62558246", "0.6051206", "0.5940056", "0.5759027", "0.5612803", "0.5532513", "0.5471883", "0.5471883", "0.54557925", "0.5402993", "0.53510064", "0.5346117", "0.534532", "0.52232945", "0.5217081", "0.5202821", "0.5197852", "0.5183278", "0.51390463", "0.5122311", "0.51199365", "0.50737816", "0.5056241", "0.5020664", "0.50126195", "0.5010756", "0.49850747", "0.4961083", "0.49560016", "0.494944", "0.49391535", "0.4933712", "0.49281508", "0.49125764", "0.48893934", "0.48709455", "0.48647416", "0.48627955", "0.4862359", "0.48600367", "0.48581973", "0.48559552", "0.48554567", "0.48509616", "0.48491398", "0.4844607", "0.48398805", "0.48350993", "0.48284975", "0.48246092", "0.4820099", "0.48009527", "0.47836006", "0.47675088", "0.4764003", "0.47448483", "0.47444117", "0.47357014", "0.47333243", "0.4722681", "0.47129583", "0.47120786", "0.4708219", "0.47052205", "0.4668959", "0.46667817", "0.4663989", "0.46587923", "0.4657019", "0.46545917", "0.46443295", "0.46342477", "0.46281222", "0.46165588", "0.46163988", "0.46163988", "0.4616256", "0.4615313", "0.4613745", "0.46119922", "0.46059677", "0.46059677", "0.4602962", "0.45911202", "0.45858213", "0.457963", "0.45768788", "0.45768788", "0.4576085", "0.45657602", "0.45645416", "0.45613822", "0.45581764", "0.4554423", "0.45512006" ]
0.8068352
1
GET a single time entry Return Teamwork::Thing
def time_entry(id) object_from_response(:get, "time_entries/#{id}", "time-entry") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end", "def get_time_entry(xero_tenant_id, project_id, time_entry_id, opts = {})\n data, _status_code, _headers = get_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, opts)\n data\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def retrieve_worktime\n Query.get_time_worktime(@values[:id], @values[:start_time],\n @values[:end_time])\n end", "def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end", "def get(project_id, time_entry_id, opts = {})\n super(project_id, time_entry_id, GetRequest.new(opts))\n end", "def get_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_time_entry ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling ProjectApi.get_time_entry\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ProjectApi.get_time_entry\"\n end\n # verify the required parameter 'time_entry_id' is set\n if @api_client.config.client_side_validation && time_entry_id.nil?\n fail ArgumentError, \"Missing the required parameter 'time_entry_id' when calling ProjectApi.get_time_entry\"\n end\n # resource path\n local_var_path = '/Projects/{projectId}/Time/{timeEntryId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'timeEntryId' + '}', time_entry_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TimeEntry' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, \"ProjectApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_time_entry\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_time_entry\n @time_entry = TimeEntry.find(params[:id])\n end", "def set_time_entry\n @time_entry = TimeEntry.find(params[:id])\n end", "def retrieve_worktime\n Query.get_weekly_worktime(@values[:id], @values[:start_time],\n @values[:end_time])\n end", "def time_track\n @time_track ||= begin\n record = teacher.time_tracks.\n for_date(time_track_params[:clock_out].to_date).\n no_clock_out.first\n\n raise ActiveRecord::RecordNotFound if record.nil?\n\n record\n end\n rescue ActiveRecord::RecordNotFound\n message = 'Time Track not found!'\n\n render json: [message], status: :unprocessable_entity\n end", "def time_entries\n get_ticket_property_list(\"time_entries\" , Unfuddled::TimeEntry)\n end", "def as_of(time)\n self.class.as_of(time).where(:id => self.id).first!\n end", "def get_time_info activity\n return activity.timestamp unless activity.timestamp.nil?\n return activity.time_range.end_time unless activity.time_range.nil?\n\n \"unknown\"\nend", "def show\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def time\n request :public, :get, :time\n end", "def show\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @working_time }\n end\n end", "def show\n @hurdle_time = HurdleTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hurdle_time }\n end\n end", "def get_time_simple()\n unless(@free_time.nil?)\n return @free_time\n else\n return @timelines[0].get_time()\n end\n end", "def retrieve_worktime\n Query.get_monthly_worktime(@values[:id], @values[:start_time],\n @values[:end_time])\n end", "def get_post_hour(post)\n if post\n post.published_at\n else\n Time.now()\n end\n end", "def get_time()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getTime', 'bigint', 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 time\n reply.documents[0][TIME]\n end", "def show\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end", "def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end", "def get_tracked_time_by_task(task_id, options = {})\n options.merge!({task_id: task_id })\n result = Paymo::API.get :entries, :get_tracked_time_by_task, options\n { time: result['time']['_content'] }\n end", "def last_time\n if params[:really_rough] and params[:really_rough] == \"1\"\n @rough_mov = RoughMovement.where(\"really_rough = ?\", true).last\n else\n @rough_mov = RoughMovement.last\n end\n\n respond_to do |format|\n if @rough_mov\n # format.html\n format.text { render :text => @rough_mov.time.to_i }\n else\n # format.html\n format.text { render :text => \"-1\" }\n end\n end\n end", "def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end", "def first_entry\n Entry.find(:first, :conditions => [\"round_id = ?\", self], :order =>[\"created_at DESC\"])\n end", "def get_hourly(response)\n response['hourly']\n end", "def get_date()\n @time\n end", "def get_time\n Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n end", "def show\n @time_clock = TimeClock.find(params[:id])\n end", "def last_time\n last = entries.order(Sequel.desc(:time)).first\n if last.nil?\n last_checked\n else\n last.time\n end\n end", "def chatting_time(*args)\n @client.get \"#{@path}/chatting_time\", Hash[*args]\n end", "def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end", "def time\n\t\tresponse = self.request( :time )\n\t\treturn nil if response.empty?\n\t\treturn Time.at( response.first[:time].to_i )\n\tend", "def get_way(id)\n get_object('way', id)\n end", "def get_last_entry\n @entry = FeedEntry.find(:first, :conditions => {:person_id => self.id})\n end", "def show\n @work_time = WorkTime.find(params[:id])\n # search for employee for the header of the work time view in show.html.erb\n # makes use of the employee ID present in the current work time being seen\n @employee = Employee.find(@work_time.employee_id)\n\n # renders the display according to what format the URL or request was in\n respond_to do |format|\n # HTML requests will render the show.html.erb present in app/views/work_times folder\n # displays the work time in show.html.erb\n format.html { render \"work_times/show\", status: :ok }\n # JSON requests will render the employee profile in json format\n format.json { render json: @work_times, status: :ok }\n # XML requests will render the employee profile in xml format\n format.xml { render xml: @work_times, status: :ok }\n end\n end", "def as_of(time)\n _as_of(time).first\n end", "def as_of(time)\n _as_of(time).first\n end", "def show\n @timesheet_entry = TimesheetEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet_entry }\n end\n end", "def get_time()\n return @noko.css(\"li.g:first-of-type table table\")[0].text\n end", "def get_time\n\t\t@time.inspect\n\tend", "def retrieve_and_print_worktime\n times = retrieve_worktime\n\n puts \"printing new worktime\"\n if (times[:over] > 0)\n puts \"Worktime: #{times[:over]} h\"\n else\n puts \"tasks.over: 0.0 h\"\n puts \"tasks.during: #{times[:during]} h\"\n puts \"tasks.into: #{times[:into]} h\"\n puts \"tasks.beyond: #{times[:beyond]} h\"\n end\n end", "def new\n\t\t# @project = Project.find(params[:project_id])\n\t\t@time_entry = @project.time_entries.new\n\tend", "def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def timestamp\n first(:timestamp)\n end", "def show\n @time_table_entry = TimeTableEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @time_table_entry }\n end\n end", "def specific_time\n parse_calendar_date if self.bucket == \"specific_time\" and self.calendar\n rescue ArgumentError\n errors.add(:calendar, :invalid_date)\n end", "def get_time row \n\ttimes = JSON.parse \"{ #{row[\"opening_times\"]} }\"\n\tdefault = times[\"opening_times\"][\"default\"] rescue nil\n\tif default \n\t\ttime_string = \"\"\n\t\tdefault.each do |tt|\n\t\t\ttime_string += \"#{tt[\"days\"]} #{tt[\"open_in\"]} #{tt[\"open_out\"]} #{tt[\"close_in\"]} #{tt[\"close_out\"]}|\"\t\n\t\tend\n\t\treturn time_string.chop!\n\tend\n\treturn nil\nend", "def new\n @timeentry = Timeentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeentry }\n end\n end", "def timelog_issue\n begin\n if params[:issue_id]\n @issue = Issue.find(params[:issue_id])\n @project = @issue.project\n else\n render_404\n return false\n end\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n\n @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, \n :user => User.find_by_login( params[:user] ), :spent_on => Date.today)\n @time_entry.hours = params[:hours]\n @time_entry.comments = params[:comments]\n @time_entry.activity_id = params[:activity_id]\n \n if @time_entry.save\n render :text => 'ok' \n else\n render :text => @time_entry.errors.full_messages.to_s\n end\n end", "def report_time_spent(entry)\n if Setting.plugin_redmine_spent_time_in_issue_description['time_format'].eql? 'human'\n humanized_time(entry.hours)\n else\n entry.hours\n end\n end", "def getTime(info)\n\treturn Time.at(info[\"currently\"][\"time\"]) + ((info[\"offset\"]+5)*3600)\nend", "def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def getTripTime()\n return Trip.new(getPickUpTime(), getDropOffTime()) ;\n end", "def time\n params['time']\n end", "def recent_goal_item\n @recent_goal.stake_item\n end", "def get_time_swam\r\n Timing.new( @summary.individuals.time_swam )\r\n end", "def find_timeline match_id\n DynamicModel.new perform_request api_url \"timelines/by-match/#{match_id}\"\n end", "def common_get_time_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CommonApi.common_get_time ...'\n end\n # resource path\n local_var_path = '/v2/public/time'\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', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CommonApi#common_get_time\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def type\n 'Edm.Time'\n end", "def retrieve_entry_time_by_type(entry_time_type_code, meeting, event_type, pool_type)\n best_mir = nil\n\n case entry_time_type_code\n when 'U' # Last swam\n best_mir = get_last_mir_for_event(event_type, pool_type)\n when 'G' # Goggle Cup or last swam\n best_mir = nil # TODO: - Use Google cup standard\n best_mir ||= get_last_mir_for_event(event_type, pool_type)\n when 'A' # Previous meeting edition (or Goggle Cup or last swam)\n best_mir = get_best_mir_for_meeting(meeting, event_type, pool_type)\n # TODO: goggle cup if nil\n best_mir ||= get_last_mir_for_event(event_type, pool_type)\n else # Personal best\n best_mir = get_best_mir_for_event(event_type, pool_type)\n end\n\n best_mir\n end", "def update\n e = get('posts/update')\n Time.iso8601(e['time'])\n end", "def get_ebay_time(payload = {})\n request('GeteBayTime', payload)\n end", "def time\n @values['time']\n end", "def get_entry(entry); end", "def get_current_meeting\n meeting = meetings.last\n return nil if meeting&.ended\n\n meeting\n end", "def time\n @time\n end", "def hour() time[0] end", "def set_time_of_day\n @time_of_day = TimeOfDay.find(params[:id])\n end", "def getTripPlannedTime()\n return @tripPlannedTimeList.last() ;\n end", "def show\n @ticket_time = TicketTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket_time }\n end\n end", "def get_trip_time trip_id, otp_response=nil\n\n otp_response = otp_response || self.otp_response\n\n if otp_response.nil? or otp_response['tripTimes'].nil?\n return nil\n end\n trip_times = otp_response['tripTimes']\n return trip_times.detect{|hash| hash['tripId'] == trip_id}\n end", "def get_time_recent(which_q, subreddit, which_to)\n result = which_to.call(subreddit.name, 1)\n result.first.nil? ? time = Time.now.to_f : time = result.first.timestamp \n time \n end", "def time_trackings\n Easybill::Api::TimeTrackings\n end", "def show\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytime }\n end\n end", "def test_can_get_entry\n gable_entry = SEED_ENTRIES.first\n insert_entry(DB.get, gable_entry)\n\n get '/api/entries/Gable'\n assert last_response.ok?\n\n location = \"/api/entries/#{gable_entry[:slug]}\"\n\n parsed_resp = parse_json_resp(last_response)\n assert_instance_of Hash, parsed_resp\n assert_equal gable_entry[:word], parsed_resp['word']\n assert_equal gable_entry[:definition], parsed_resp['definition']\n assert_equal location, parsed_resp['location']\n end", "def show\n @pomodoro = find_pomodoro\n @timelines = @pomodoro.timelines.latest\n @task = @pomodoro.task\n end", "def published_at(time = @time)\n time.try(:[], \"created\")\n end", "def set_time_record\n @time_record = WorkTimeRecord.find(params[:id])\n end", "def show\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_time }\n end\n end", "def accounts_get\n account = call('accounts.get')\n account[:added] = Time.at(account[:added]) if account[:added].is_a?(Fixnum)\n account\n end", "def ticket\n @ticket ||= @api.get_ticket['ticket']\n end", "def common_get_time(opts = {})\n data, _status_code, _headers = common_get_time_with_http_info(opts)\n data\n end", "def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end", "def get_time\n created_at.strftime('%H:%M:%S %d %B %Y')\n end", "def hour\n return @t_hour\n end", "def last_in_time\n In.last(:order => \"time ASC\").time rescue nil\n end", "def get_time_placed\n self.created_at.strftime(\"%m/%d/%Y at %l:%M%p\")\n end", "def pull_time_entries_harvest(user_id)\n harvest_uri = URI(\"https://api.harvestapp.com/v2/time_entries?user_id=#{user_id}&updated_since=#{last_updated_time}\")\n\n Net::HTTP.start(harvest_uri.host, harvest_uri.port, use_ssl: true) do |http|\n harvest_request = Net::HTTP::Get.new harvest_uri\n\n harvest_request[\"Authorization\"] = \"Bearer #{harvest_access_token}\"\n harvest_request[\"Harvest-Account-ID\"] = harvest_account_id\n harvest_request[\"User-Agent\"] = harvest_user_agent\n \n harvest_response = http.request harvest_request\n json_response = JSON.parse(harvest_response.body)\n return json_response[\"time_entries\"]\n end\n end", "def show\n @time_task = TimeTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @time_task }\n end\n end", "def time\n return @time\n end" ]
[ "0.7216528", "0.64349455", "0.6427085", "0.6427085", "0.63918823", "0.6325323", "0.6172379", "0.61543095", "0.59591186", "0.59591186", "0.58810145", "0.5852485", "0.5812675", "0.5774139", "0.57509845", "0.57247037", "0.5698036", "0.5691419", "0.5677621", "0.56744087", "0.5661853", "0.56618494", "0.56345093", "0.5620639", "0.56092703", "0.5606728", "0.55903953", "0.55772704", "0.557305", "0.55567664", "0.55477196", "0.55428994", "0.5517788", "0.5515293", "0.5493336", "0.5493307", "0.5482949", "0.5470614", "0.5456774", "0.5454579", "0.5454574", "0.5439517", "0.5439517", "0.5431693", "0.542647", "0.541614", "0.5414457", "0.5413453", "0.54016495", "0.5392144", "0.5392144", "0.5392144", "0.537651", "0.53723454", "0.5355785", "0.5351207", "0.53501785", "0.5345952", "0.5333513", "0.53317386", "0.5323307", "0.5323307", "0.53156143", "0.53058773", "0.53027946", "0.5302791", "0.52999854", "0.5298707", "0.5290255", "0.5287562", "0.5287149", "0.5286651", "0.5283964", "0.52570814", "0.5254049", "0.52475804", "0.5245335", "0.52359366", "0.52329695", "0.5232744", "0.5232133", "0.52318686", "0.522113", "0.5214255", "0.521094", "0.5210702", "0.5210261", "0.52074826", "0.5206501", "0.51975197", "0.51866174", "0.518495", "0.5178947", "0.51786417", "0.51760876", "0.51734614", "0.516864", "0.5161747", "0.5152626", "0.51487595" ]
0.74449736
0
PUT a single time entry Return Teamwork::Thing
def update_time_entry(options = {}) object_from_response(:put, "time_entries/#{id}", "time-entry", "time-entry" => options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n if @timeentry.update_attributes(params[:timeentry])\n format.html { redirect_to @timeentry, notice: 'Timeentry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timeentry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_time_entry\n @time_entry = TimeEntry.find(params[:id])\n end", "def set_time_entry\n @time_entry = TimeEntry.find(params[:id])\n end", "def update\n params[:thing][:time] = @thing.time + params[:thing][:time].to_f if @thing.time\n\n respond_to do |format|\n if @thing.update(thing_params)\n format.html { redirect_to things_url, notice: 'The thing was updated.' }\n format.json { render :show, status: :ok, location: @thing }\n\n # Realtime push\n message = {:channel => '/things', :data => { :name => @thing.name, :time => @thing.time}}\n uri = URI.parse(\"http://localhost:9292/faye\")\n Net::HTTP.post_form(uri, :message => message.to_json)\n else\n format.html { render :edit }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_entry.update(time_entry_params)\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_entry }\n else\n format.html { render :edit }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n e = get('posts/update')\n Time.iso8601(e['time'])\n end", "def update\n params[:task][:time] = parse_task_time(params[:task][:time], params[:anytime][:anytime])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to [@user, @time_sheet, @entry], notice: 'Hours were successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timing = Timing.find(params[:id])\n\n respond_to do |format|\n if @timing.update_attributes(params[:timing])\n flash[:notice] = 'Timing was successfully updated.'\n format.html { redirect_to(@timing) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @timing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @timing.update(timing_params)\n render :show, status: :ok, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end", "def update\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n if @working_time.update_attributes(params[:working_time])\n format.html { redirect_to time_tables_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, time_entry_create_or_update, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.update_time_entry ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling ProjectApi.update_time_entry\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ProjectApi.update_time_entry\"\n end\n # verify the required parameter 'time_entry_id' is set\n if @api_client.config.client_side_validation && time_entry_id.nil?\n fail ArgumentError, \"Missing the required parameter 'time_entry_id' when calling ProjectApi.update_time_entry\"\n end\n # verify the required parameter 'time_entry_create_or_update' is set\n if @api_client.config.client_side_validation && time_entry_create_or_update.nil?\n fail ArgumentError, \"Missing the required parameter 'time_entry_create_or_update' when calling ProjectApi.update_time_entry\"\n end\n # resource path\n local_var_path = '/Projects/{projectId}/Time/{timeEntryId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'timeEntryId' + '}', time_entry_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(time_entry_create_or_update) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, \"ProjectApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#update_time_entry\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @big_time_entry.update(big_time_entry_params)\n format.html { redirect_to @big_time_entry, notice: 'Big time entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @big_time_entry }\n else\n format.html { render :edit }\n format.json { render json: @big_time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_task = TimeTask.find(params[:id])\n\n respond_to do |format|\n if @time_task.update_attributes(params[:time_task])\n flash[:notice] = 'TimeTask was successfully updated.'\n format.html { redirect_to(@time_task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @time_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n response = client.get(\"/posts/update\")\n Types::Time.deserialize response.fetch(\"update_time\")\n end", "def update\n respond_to do |format|\n if @timetable_entry.update(timetable_entry_params)\n format.html { redirect_to @timetable_entry, notice: 'Timetable entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timetable_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cooking_time.update(cooking_time_params)\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n if @time_track.update_attributes(params[:time_track])\n format.html { redirect_to @time_track, notice: 'Time track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_table_entry = TimeTableEntry.find(params[:id])\n\n respond_to do |format|\n if @time_table_entry.update_attributes(params[:time_table_entry])\n flash[:notice] = 'TimeTableEntry was successfully updated.'\n format.html { redirect_to(@time_table_entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @time_table_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n if @timetable.update_attributes(params[:timetable])\n format.html { redirect_to @timetable, notice: 'Timetable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n @meeting.meeting_time = params[:meeting][:meeting_time]\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to club_meeting_path(params[:club_id],@meeting), notice: 'Meeting was successfully updated.' }\n format.json { head :ok }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n \n end\n end\n end", "def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def time_entry(id)\n object_from_response(:get, \"time_entries/#{id}\", \"time-entry\")\n end", "def update\n @timesheet_entry = TimesheetEntry.find(params[:id])\n\n respond_to do |format|\n if @timesheet_entry.update_attributes(params[:timesheet_entry])\n format.html { redirect_to @timesheet_entry, notice: 'Timesheet entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timesheet_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hurdle_time = HurdleTime.find(params[:id])\n\n time = (params[:time][:minutes].to_i * 60) + params[:time][:seconds].to_i\n if params[:hurdle_time]\n params[:hurdle_time].store :time, time\n else\n params[:hurdle_time] = {}.store :time, time\n end\n\n respond_to do |format|\n if @hurdle_time.update_attributes(params[:hurdle_time])\n format.html { redirect_to hurdle_match_hurdle_times_path(@hurdle_time.hurdle_match), notice: 'Hurdle time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hurdle_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n if @event.update_attributes(params[:event])\n @event.set_time\n @event.save\n flash[:notice] = \"Event Successfully Updated\"\n redirect_to events_path\n end\n end", "def update\n @eventtime = Eventtime.find(params[:id])\n\n respond_to do |format|\n if @eventtime.update_attributes(params[:eventtime])\n format.html { redirect_to(@eventtime, :notice => 'Eventtime was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @eventtime.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @nursing_time = NursingTime.find(params[:id])\n\n respond_to do |format|\n if @nursing_time.update_attributes(params[:nursing_time])\n format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nursing_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n operation = params[:operation]\n case operation\n when 'set_best_time'\n resp = @@serv.set_best_time(params['escape_room_id'], params['best_time'])\n render json: { success: resp.success, message: resp.message }, status: :ok\n else\n render json: { success: false, message: 'Operation can not be preformed' }, status: :bad_request\n end\n end", "def update\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n if @service_time.update_attributes(params[:service_time])\n format.html { redirect_to @service_time, notice: 'Service time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_timetable_entry\n @timetable_entry = TimetableEntry.find(params[:id])\n end", "def update\n respond_to do |format|\n if @timed_task.update(timed_task_params)\n format.html { redirect_to @timed_task, notice: 'Timed task was successfully updated.' }\n format.json { render :show, status: :ok, location: @timed_task }\n else\n format.html { render :edit }\n format.json { render json: @timed_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n if @timetable.update_attributes(params[:timetable])\n format.html { redirect_to @timetable, notice: 'Rozrvh byl úspěšně upraven.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n if @timetable.update_attributes(timetable_params)\n format.html { redirect_to @timetable, notice: 'Timetable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n if @wait_time.update_attributes(params[:wait_time])\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # if @study_spot.is_open\n # # create a new row in the usage_time table\n # UsageTime.create(start: DateTime.now, end: DateTime.now, study_spot_id: @study_spot.id)\n # else\n # # update the end time to be the time the study_spot was made available again\n # UsageTime.where(study_spot_id: @study_spot.id).last.update_attribute(:end, DateTime.now)\n # end\n # status = @study_spot.update_attribute(:is_open, !@study_spot.is_open)\n # respond_to do |format|\n # if status\n # format.html { redirect_to @study_spot.room, notice: 'Study spot was successfully updated.' }\n # format.json { render :show, status: :ok, location: @study_spot }\n # else\n # format.html { render :edit }\n # format.json { render json: @study_spot.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update(project_id, time_entry_id, opts = {})\n super(project_id, time_entry_id, UpdateRequest.new(opts))\n end", "def update\n respond_to do |format|\n if @work_time.update(work_time_params)\n format.html { redirect_to @work_time, notice: 'Work time was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_time }\n else\n format.html { render :edit }\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if UpdateTeaTime.call(@tea_time, tea_time_params)\n format.html { redirect_to profile_path, notice: 'Tea time was successfully updated.' }\n format.json { render json: @tea_time, status: :ok, location: @tea_time }\n else\n format.html { render :edit }\n format.json { render json: @tea_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n if @timer.update_attributes(params[:timer])\n format.html { redirect_to @timer, notice: 'Timer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_of_day.update(time_of_day_params)\n format.html { redirect_to @time_of_day, notice: 'Time of day was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_of_day }\n else\n format.html { render :edit }\n format.json { render json: @time_of_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @time_slot.update(time_slot_params)\n render :show, status: :ok, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end", "def update\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n if @time_slot.update_attributes(params[:time_slot])\n flash[:notice] = 'TimeSlot was successfully updated.'\n format.html { redirect_to(@time_slot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @time_slot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_clock.update(time_clock_params)\n format.html { redirect_to time_sheet_index_path(@time_clock), notice: 'Time clock entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_clock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @member_time = MemberTime.find(params[:id])\n\n respond_to do |format|\n if @member_time.update_attributes(params[:member_time])\n format.html { redirect_to @member_time, notice: 'Member time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n if @meal_time.update_attributes(params[:meal_time])\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @timeslot.update(timeslot_params)\n render :show, status: :ok, location: @timeslot\n else\n render json: @timeslot.errors, status: :unprocessable_entity\n end\n end", "def update\n @work_time = WorkTime.find(params[:id])\n\n # checks if work time is successfully updated in the database\n if @work_time.update(work_time_params)\n # if updated successfully, controller issues a response according to the format given\n respond_to do |format|\n # HTML redirects the user back to the work time index and makes a notice that editing was successful\n format.html { redirect_to api_work_time_path, notice: \"Successfully edited work time!\" }\n # JSON renders the work time updated in JSON\n format.json { render json: @work_time, status: :ok }\n # XML renders the work time updated in XML\n format.xml { render xml: @work_time, status: :ok }\n end\n else\n # if errors occured like wrong information/wrong format and so on, issues a response according to format\n respond_to do |format|\n # HTML redirects the user back to the work time edit page and shows a list of errors encountered\n format.html { redirect_to edit_api_work_time_path, notice: @work_times.errors.full_messages }\n # JSON renders all errors made and shows it in JSON and gives a negative response\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n # XML renders all errors made and shows it in XML and gives a negative response\n format.xml { render xml: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n if @stop_time.update_attributes(params[:stop_time])\n format.html { redirect_to @stop_time, notice: 'Stop time was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stop_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:thing][:time] = 0\n @thing = Thing.new(thing_params)\n\n respond_to do |format|\n if @thing.save\n format.html { redirect_to root_path, notice: 'The thing was created.' }\n else\n format.html { render :new }\n end\n end\n end", "def update\n respond_to do |format|\n if @poi_time.update(poi_time_params)\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_time }\n else\n format.html { render :edit }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moment_entry = MomentEntry.find(params[:id])\n\n respond_to do |format|\n if @moment_entry.update_attributes(params[:moment_entry])\n format.html { redirect_to @moment_entry.aircraft, notice: 'Moment entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moment_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timerecord = TimeRecord.find(params[:id])\n respond_to do |format|\n if @timerecord.update(timerecord_params)\n format.html { redirect_to time_records_url, notice: 'Time Record was successfully updated.' }\n format.json { render :show, status: :ok, location: @timerecord }\n else\n format.html { render :edit }\n format.json { render json: @timerecord.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timerecord = TimeRecord.find(params[:id])\n respond_to do |format|\n if @timerecord.update(timerecord_params)\n format.html { redirect_to time_records_url, notice: 'Time Record was successfully updated.' }\n format.json { render :show, status: :ok, location: @timerecord }\n else\n format.html { render :edit }\n format.json { render json: @timerecord.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_tracker.update(time_tracker_params)\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_tracker }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n if @time_section.update_attributes(params[:time_section])\n format.html { redirect_to @time_section, notice: 'Time section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location_time.update(location_time_params)\n format.html { redirect_to @location_time, notice: 'Location time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @time_record = TimeRecord.find(params[:id])\n @time_record.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @time_record.update_attributes(params[:time_record])\n format.html { redirect_to @time_record,\n notice: (crud_notice('updated', @time_record) + \"#{undo_link(@time_record)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_time_record\n @time_record = WorkTimeRecord.find(params[:id])\n end", "def update\n respond_to do |format|\n if @time_trial.update(time_trial_params)\n format.html { redirect_to @time_trial, notice: 'Time trial was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_trial }\n else\n format.html { render :edit }\n format.json { render json: @time_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @planned_time = PlannedTime.find(params[:id])\n\n respond_to do |format|\n if @planned_time.update_attributes(params[:planned_time])\n format.html { redirect_to @planned_time, notice: 'Planned time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planned_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \trespond_to do |format|\n\t\tformat.html {\n\t\t\tgatherEntries\n\t\t\terrorMsg = nil\n\t\t\tTimeEntry.transaction do\n\t\t\t\tbegin\n\t\t\t\terrorMsg = l(:error_wktime_save_nothing) if @entries.blank?\n\t\t\t\t@entries.each do |entry|\n\t\t\t\t\t\tif entry.hours.blank?\n\t\t\t\t\t\t\t# delete the time_entry\n\t\t\t\t\t\t\t# if the hours is empty but id is valid\n\t\t\t\t\t\t\t# entry.destroy() unless ids[i].blank?\n\t\t\t\t\t\t\tif !entry.id.blank?\n\t\t\t\t\t\t\t\tif !entry.destroy()\n\t\t\t\t\t\t\t\t\terrorMsg = entry.errors.full_messages.join('\\n')\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#if id is there it should be update otherwise create\n\t\t\t\t\t\t\tif !entry.save()\n\t\t\t\t\t\t\t\terrorMsg = entry.errors.full_messages.join('\\n')\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue Exception => e\n\t\t\t\t\terrorMsg = e.message\n\t\t\t\tend\n\t\t\t\tif errorMsg.nil?\n\t\t\t\t\tflash[:notice] = l(:notice_successful_update)\n\t\t\t\t\tredirect_back_or_default :action => 'index'\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = l(:error_wktime_save_failed, errorMsg)\n\t\t\t\t\trender_edit\n\t\t\t\t\traise ActiveRecord::Rollback\n\t\t\t\tend\n\t\t\tend\n\t\t} \n\t\tformat.api {\n\t\t}\n\tend \n end", "def update\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n if @daytime.update_attributes(params[:daytime])\n format.html { redirect_to @daytime, notice: 'Daytime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daytime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n if @clinic_timing.update_attributes(params[:clinic_timing])\n format.html { redirect_to @clinic_timing, notice: 'Clinic timing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinic_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @timing\n else\n render json: { error: 'error: could not update timing' }\n end\n end", "def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end", "def create_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_create_or_update, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_time_entry ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling ProjectApi.create_time_entry\"\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ProjectApi.create_time_entry\"\n end\n # verify the required parameter 'time_entry_create_or_update' is set\n if @api_client.config.client_side_validation && time_entry_create_or_update.nil?\n fail ArgumentError, \"Missing the required parameter 'time_entry_create_or_update' when calling ProjectApi.create_time_entry\"\n end\n # resource path\n local_var_path = '/Projects/{projectId}/Time'.sub('{' + 'projectId' + '}', project_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(time_entry_create_or_update) \n\n # return_type\n return_type = opts[:return_type] || 'TimeEntry' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, \"ProjectApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_time_entry\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @timetable.update(timetable_params)\n format.html { redirect_to request.referer, notice: 'Timetable was successfully updated.' }\n format.json { render :show, status: :ok, location: @timetable }\n else\n format.html { render :edit }\n format.json { render json: @timetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timer = Timer.find(params[:id])\n\n if @timer.update(timer_params)\n head :no_content\n else\n render json: @timer.errors, status: :unprocessable_entity\n end\n end", "def update\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n if @time_log.update_attributes(params[:time_log])\n format.html { redirect_to @time_log, notice: 'Time log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @call = Call.find(params[:id])\n respond_to do |format|\n if @call.update_attributes(time: DateTime.strptime(params[:call][:time], '%m/%d/%Y %H:%M'))\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timeentry = Timeentry.new(params[:timeentry])\n\n respond_to do |format|\n if @timeentry.save\n format.html { redirect_to @timeentry, notice: 'Timeentry was successfully created.' }\n format.json { render json: @timeentry, status: :created, location: @timeentry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timeentry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n if @time_record.update_attributes(params[:time_record])\n format.html { redirect_to time_records_path, notice: 'Time record was successfully updated.' }\n format.json { render json: @time_record.to_json }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @can_edit\n\n # Clear out all other blocks\n @timetable.free_times.destroy_all\n times = JSON::Parser.new(params[:times]).parse\n\n # There's an array for each day of the week\n times.each_with_index do |day, i|\n # Each day of the week then has a list of blocks\n day.each_with_index do |block, j|\n unless block.empty?\n # Each block has a start time and an end time for a free block\n @timetable.free_times.create(:start_time => block[0], :end_time => block[1], :day_of_week => i, :weight => block[2], :css_class => block[3])\n end\n end\n end\n\n @person ||= get_person\n @timetable.update_attributes(:updated_by_person_id => @my.id)\n @timetable.touch\n return if @signup\n\n flash[:notice] = I18n.t('timetable.save_confirm')\n\n elsif !@can_edit\n flash[:notice] = I18n.t('timetable.not_allowed_update')\n end\n\n respond_to do |format|\n format.html { redirect_to(person_timetable_path(@timetable.person, @timetable)) }\n format.js\n format.xml { head :ok }\n end\n end", "def update\n @offset_time = OffsetTime.find(params[:id])\n\n respond_to do |format|\n if @offset_time.update_attributes(params[:offset_time])\n format.html { redirect_to @offset_time, notice: 'Offset time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offset_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Time.xmlschema(get('posts/update', 'update')[0]['time'])\n end", "def update\n @todo = Todo.users(current_user.id).find(params[:id])\n @todo.user_id = current_user.id\n \n\n respond_to do |format|\n params[:todo][:time] = Record::hours_to_numeric(params[:todo][:time])\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to(@todo, :notice => 'Todo was successfully updated.') }\n format.xml { head :ok }\n format.js { @notice = \"Todo #{@todo.title} was successfully updated\"}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @todo.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @time_slot.update(time_slot_params)\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_slot }\n else\n format.html { render :edit }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n format.html { render :new }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @request = args[:request] if args.key?(:request)\n end", "def update\n respond_to do |format|\n if @work_order_time.update(work_order_time_params)\n format.html { redirect_to @work_order_time, notice: 'Work order time was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_order_time }\n else\n format.html { render :edit }\n format.json { render json: @work_order_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timeslot = current_event.timeslots.find(params[:id])\n respond_to do |format|\n @timeslot.start_time_will_change!\n @timeslot.slot_date_will_change!\n if @timeslot.update_attributes(params[:timeslot])\n flash[:notice] = \"Timeslot was successfully updated.\"\n format.html { redirect_to(timeslots_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @timeslot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_big_time_entry\n @big_time_entry = BigTimeEntry.find(params[:id])\n end" ]
[ "0.6965347", "0.6965347", "0.6869413", "0.6804477", "0.67620814", "0.67620814", "0.6738317", "0.67042065", "0.66030246", "0.65654945", "0.64484155", "0.6312628", "0.6235547", "0.622376", "0.62197775", "0.6194042", "0.61843306", "0.6176379", "0.61600506", "0.6133451", "0.6066675", "0.602087", "0.6016954", "0.6006999", "0.60009956", "0.59960455", "0.5992107", "0.5991243", "0.59830266", "0.59791607", "0.59781283", "0.59747046", "0.59633166", "0.5942781", "0.59396625", "0.59251374", "0.5924982", "0.5919932", "0.5906283", "0.5870037", "0.5865199", "0.58638275", "0.5863732", "0.5863549", "0.585078", "0.58488816", "0.5848729", "0.5847664", "0.58450735", "0.5842135", "0.5838709", "0.58380014", "0.58300924", "0.5820304", "0.5814404", "0.5799384", "0.5795608", "0.5795608", "0.5795608", "0.57950294", "0.57846665", "0.5783141", "0.57728845", "0.57728845", "0.5766598", "0.5757191", "0.5754172", "0.5752467", "0.57489836", "0.5741309", "0.5736737", "0.57346886", "0.5722362", "0.57197726", "0.5712308", "0.5708057", "0.5704113", "0.57032484", "0.5698419", "0.5697921", "0.56932735", "0.5689794", "0.5688861", "0.5684042", "0.5676088", "0.5674235", "0.56704706", "0.56696296", "0.5667277", "0.56672", "0.56672", "0.56672", "0.56672", "0.56672", "0.56672", "0.56672", "0.56672", "0.56669855", "0.5664912", "0.5662654" ]
0.70273554
0
DELETE a single time entry Return boolean
def delete_time_entry(id) send(:delete, "time_entries/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_time_entry(time_entry_id)\n response = basecamp_connection.delete(\"/time_entries/#{time_entry_id}.xml\")\n if response.code == '200'\n return true\n else\n return false\n end\n end", "def delete?(entry)\n not(entry.exist?) or model[:older].nil? or model[:older] >= entry.mtime.to_date\n end", "def delete_entry(aliaz)\n\n end", "def delete(entry)\n return true if !entry.id\n\n @lock.synchronize do\n with_index_lock do\n return true if !@machines[entry.id]\n\n # If we don't have the lock, then we need to acquire it.\n if !@machine_locks[entry.id]\n raise \"Unlocked delete on machine: #{entry.id}\"\n end\n\n # Reload so we have the latest data, then delete and save\n unlocked_reload\n @machines.delete(entry.id)\n unlocked_save\n\n # Release access on this machine\n unlocked_release(entry.id)\n end\n end\n\n true\n end", "def rec_delete_single zone, name, content, type = 'A'\n rec = find_single_record(zone, name, content, type) or return false\n rec_delete(zone, rec['rec_id'])\n true\n end", "def delete_loc_time\n delete_loc = user_choice_of_object_in_class(LocationTime)\n try_to_update_database{\n if LocationTime.delete_record(delete_loc.location_id, delete_loc.timeslot_id)\n puts \"Deleted.\"\n else\n puts \"Not deleted. This object id exists in another table.\"\n end\n }\n loc_time_menu\n end", "def delete\n d = DateTime.now.strftime('%Y-%m-%d %H:%M:%S')\n self.update_attribute(:deleted, d)\n end", "def test_for_deleteEntry\n assert_equal( @item1.deleteEntry( \"doesn't exist\" ),\n\t \"Error: 'Doesn't exist' is not logged for '2013-02-01'.\" )\n\tassert_equal( @item1.deleteEntry( \"ham\" ),\n\t \"Success! 'Ham' was deleted for '2013-02-01'.\" )\n end", "def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end", "def delete\n return false\n end", "def delete\n\t\tfalse\n\tend", "def test_ok_to_delete\n assert_equal(false, TimeSlot.ok_to_delete?(1))\n end", "def delete_entry(key, **_options)\n failsafe(:delete_entry, returning: false) do\n res = collection.remove(key)\n @last_mutation_token = res.mutation_token\n true\n end\n end", "def delete(*args)\n delete!(*args)\n rescue *exceptions\n false\n end", "def delete_entry(entry)\n @address_book.entries.delete(entry)\n puts \"#{entry.name} has been deleted\"\n end", "def delete_record(id)\n if ok_to_delete?(id)\n CONNECTION.execute(\"DELETE FROM #{table_name} WHERE id = #{id};\")\n else\n false\n end\n end", "def delete_entry(key, options) # :nodoc:\n @data.where(key: key).delete\n rescue Sequel::Error => e\n logger.error(\"Sequel::Error (#{e}): #{e.message}\") if logger\n false\n end", "def command_delete(name, date)\n if @log.contains(name, date)\n @log.remove_logItem(name, date)\n @logChangedDB = true\n else\n puts \"Item not in log\"\n end\n end", "def destroy\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def can_delete?\n\n entries = TimesheetEntry.count_by_sql(\"select count(*) from timesheet_entries where rate_id = #{id}\")\n \n return entries == 0\n \n end", "def delete_entry(key, options) # :nodoc:\n @data.delete(key, options)\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n false\n end", "def delete_record(name, type, ttl, value, log_errors = true)\n delete_result = true\n begin\n @route53.client.change_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id, \n :change_batch => {\n :changes => [ \n {\n :action => \"DELETE\", \n :resource_record_set => { \n :name => name, \n :type => type,\n :ttl => ttl, \n :resource_records => [ { :value => value } ]\n }\n }\n ]\n }\n })\n rescue StandardError => bang\n @log.error \"Error deleting A record from Route53: #{bang}\" if log_errors\n delete_result = false\n end\n delete_result\n end", "def delete!\n delete_if { true }\n end", "def single_delete(table_name, id=nil)\n status = true\n begin\n sql = \"DELETE FROM #{table_name}\"\n sql << \"WHERE id = #{id}\" unless id.nil?\n @mysql_client.query(sql)\n rescue\n status = false\n end\n return status\n end", "def delete_entry(key, options) # :nodoc:\n response = @data.del(key)\n rescue => e\n logger.error(\"Error deleting cache entry from redis: #{e}\") if logger\n false\n end", "def delete()\n\n client.delete(\"/tasks/#{gid}\") && true\n end", "def delete_location\n if MusicCollection.find_rows(\"location_id\", @id) == []\n self.delete\n else\n false\n end\n end", "def delete\n self.is_deleted = true\n save :validate => false\n true\n end", "def delete!\n delete( nil, true ) \n end", "def deleted?\n false\n end", "def delete_entry(db, id)\r\n\tdb.execute(\"DELETE FROM games WHERE id=?\", id)\r\n\tputs \"Entry deleted.\"\r\nend", "def destroy\n @timeentry = Timeentry.find(params[:id])\n @timeentry.destroy\n\n respond_to do |format|\n format.html { redirect_to timeentries_url }\n format.json { head :no_content }\n end\n end", "def delete_entry(key, options) # :nodoc:\n @client.delete(key)\n rescue Spymemcached::Error => e\n logger.error(\"Spymemcached::Error (#{e}): #{e.message}\") if logger\n false\n end", "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def delete_entry(key, options) # :nodoc:\n @data.remove(key)\n rescue => e\n logger.error(\"KyotoTycoonError (#{e}): #{e.message}\") if logger\n false\n end", "def delete_from_twitter\n self.post_at = nil\n if valid?\n ActiveRecord::Base.transaction do\n self.published = false\n self.published_at = nil\n self.save!\n client.destroy_status(tweet_id) if tweet_id.present?\n end\n return true\n else\n return false\n end\n end", "def ok_to_delete?(id)\n true\n end", "def delete?\n state == STATE_DELETE\n end", "def deleted?\n end", "def deleted?\n end", "def delete(obj)\n true\n end", "def destroy\n @time_entry.destroy\n respond_to do |format|\n format.html { redirect_to time_entries_url, notice: 'Time entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete_statement?\n false\n end", "def test_delete_existing\n @cache.add('Key', 'Data_to_delete', 0, Time.now.to_i + 60)\n result = @cache.delete('Key')\n retrieval = @cache.get('Key')\n\n assert_true result.success\n assert_equal 'SUCCESS', result.message.chomp.split(\"\\s\")[0]\n assert_false retrieval.success\n assert_equal 'NOT_FOUND', retrieval.message.chomp.split(\"\\s\")[0]\n end", "def destroy\n @time_table_entry = TimeTableEntry.find(params[:id])\n @time_table_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_table_entries_url) }\n format.xml { head :ok }\n end\n end", "def test_ok_to_delete\n assert_equal(false, Studio.ok_to_delete?(11))\n end", "def del\n delete\n end", "def delete_entry(key, **options); end", "def del_news(news_id,user_id)\n news = News.find news_id\n return false if !news or news.user_id != user_id.to_i and !user_is_admin?($user)\n return false if !(news.ctime > (Time.now.to_i - NewsEditTime)) and !user_is_admin?($user)\n news.destroy\nend", "def deleted?(name, options = T.unsafe(nil)); end", "def delete(time, date_type=RailsRank::Types::Date::HOURLY, session=nil)\n start_kvs_session(session) do |kvs|\n kvs.delete(key_name(time, date_type))\n end\n end", "def delete(item)\n !!@data.delete(item)\n end", "def delete_entry(key, **options)\n failsafe(:delete_entry, returning: false) do\n with { |c| c.del key }\n end\n end", "def del?(con)\n con.del(unique_check_key) == 1\n end", "def destroy\n return false if destroyed? || new_record?\n\n response = @client.connection.delete(url || path)\n\n @destroyed = true # FIXME always returns true\n end", "def destroy\n false\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def deleted?\n deleted == true\n end", "def deleted?\n deleted == true\n end", "def deleted?\n @deleted ||= new_record? ? false : @data[0, 1] == '*'\n end", "def delete_entry(key, options) # :nodoc:\n with { |c| c.delete(key) }\n rescue Dalli::DalliError => e\n log_dalli_error(e)\n instrument_error(e) if instrument_errors?\n raise if raise_errors?\n false\n end", "def delete\n \n end", "def deleted?\n deleted_at\n end", "def deleted?\n deleted_at\n end", "def deleted?\n return true if !@data and !@id\n return false\n end", "def delete record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n case\n when id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n res = collection_for(record).remove({:_id => id})\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{pointer}\")\n end\n when query = delete_query_for(record)\n pointer = \"/#{db_name}/#{coll_name}\"\n res = collection_for(record).remove(query)\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{res['n']} records from #{pointer}\")\n end\n end\n end", "def delete(entry)\n if index = @cache.delete(entry)\n entries.delete_at(index)\n end\n end", "def delete; update(:status => 'DELETED'); end", "def deleted?\n deleted_at.present?\n end", "def deleted?\n deleted_at.present?\n end", "def test_deleted\n assert_difference('User.count', -1 , \"Delete False\") do\n user = User.find(980190962);\n user.delete\n end\n end", "def delete options\n table = DB.from(@table)\n \n if options[:where]\n result = table.where(options[:where]).delete\n else\n result = table.where(:id => options[:id]).delete\n end\n \n # invalidate a cached range\n @@_cached_range = nil\n \n return true if result == 1\n false\n end", "def test_ok_to_delete\n assert_equal(false, ExerciseType.ok_to_delete?(1))\n assert_equal(true, ExerciseType.ok_to_delete?(0))\n assert_equal(true, ExerciseType.ok_to_delete?(ExerciseType.all.last.id + 10))\n end", "def deleted?\n !!deleted_at\n end", "def delete field\n\t\tbegin\n\t\t\tticket = read ['id'], field\n\t\t\tif ticket.count > 0\n\t\t\t\t@dbh.query \"DELETE FROM #{@table} WHERE #{field[0]}='#{field[1]}'\"\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\trescue Mysql::Error => e\n\t\t\tputs \"Error: #{e.error}\"\n\t\t\tnil\n\t\tend\n\tend", "def delete!\n clear!\n delete\n end", "def delete_task\n\n puts 'Enter task number(ID), please'\n\n entered_id = get_id_input\n\n if @tasks[entered_id]\n\n @tasks.delete(entered_id)\n\n else\n\n no_entry_message\n\n end\n\n end", "def _delete\n marked_for_destruction?\n end", "def destroy\n @entry = @time_sheet.entries.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to user_time_sheet_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy!\n response = perform(:delete, ref)\n @ref = nil\n @last_request_time = response.request_time\n true\n end", "def destroy!\n response = perform(:delete, ref)\n @ref = nil\n @last_request_time = response.request_time\n true\n end", "def destroy\n update(deleted_at: Time.current)\n end", "def deleted?\n deleted_at.present?\n end", "def delete\n end", "def delete_record *rid\n db.delete_record rid\n end", "def delete!\n deleted\n save!\n end", "def delete!\n update_attribute(:dateSuppression, Time.now)\n end", "def delete(key)\n timeout_retry(3, 3){\n write \"DEL #{key}\\r\\n\"\n integer_reply == 1\n }\n end", "def delete\n end", "def delete(id)\n begin\n return false unless exist?(id)\n @@grid.delete(id)\n exist?(id) ? false : true\n rescue\n false\n end\n end", "def delete(params, session)\n if validate_delete(params, session)\n db = connect_to_db()\n db.results_as_hash = true\n db.execute(\"DELETE FROM posts WHERE id=?\", params[\"id\"])\n return true\n else\n return false\n end\n end", "def delete_contact\n\t\tputs \"\\nProvide a contact ID: \"\n\t\tid_entry = gets.chomp.to_i\n\t\t@rolodex.delete_one_contact(id_entry)\n\t\tputs \"\\nContact #{id_entry} is deleted FOREVER!\"\n\tend", "def destroy\n self.run_hook :before_destroy\n result = Driver.client[self.class.coll_name].find({'_id' => self._id}).delete_one\n self.run_hook :after_destroy\n\n result ? true : false\n end", "def destroy\n true\n end", "def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @time_entry = current_firm.all_time_entries.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to params[:ret] || firm_time_entries_path(current_firm) }\n format.json { head :ok }\n end\n end", "def delete(name)\r\n key = convert_key(name)\r\n return false unless has(key)\r\n @p.delete(key)\r\n true\r\n end", "def deleted?\n !!deleted_at\n end" ]
[ "0.7285286", "0.7218297", "0.6979128", "0.6944081", "0.6913666", "0.68569213", "0.6728075", "0.6710097", "0.6662161", "0.6651253", "0.6624753", "0.66049844", "0.65162534", "0.65148455", "0.65144026", "0.65035063", "0.64845365", "0.64588827", "0.6442789", "0.64325124", "0.6424577", "0.6422507", "0.6380982", "0.6368067", "0.63664484", "0.6363182", "0.6358288", "0.63491315", "0.634277", "0.6299863", "0.62866634", "0.6267772", "0.6266475", "0.6265264", "0.6265264", "0.62489194", "0.62460554", "0.62242", "0.62125653", "0.6207342", "0.6207342", "0.6181505", "0.61656666", "0.61504185", "0.61465216", "0.6138119", "0.6129164", "0.6128697", "0.61241263", "0.610991", "0.61000884", "0.60989505", "0.6091206", "0.6076654", "0.60696936", "0.6066934", "0.60303235", "0.60260546", "0.6020312", "0.60114276", "0.60114276", "0.60113406", "0.6009026", "0.60080326", "0.59953535", "0.59953535", "0.59902334", "0.59892416", "0.5972267", "0.59621096", "0.59518135", "0.59518135", "0.5950265", "0.59494495", "0.5947817", "0.5945706", "0.5943416", "0.5941988", "0.5925707", "0.5925385", "0.59202695", "0.59195393", "0.59195393", "0.5912912", "0.5903062", "0.5899734", "0.58996326", "0.5898047", "0.58965653", "0.5896233", "0.5891087", "0.5887872", "0.5884788", "0.5884259", "0.5883824", "0.5883245", "0.5882414", "0.5880387", "0.5878015", "0.5876594" ]
0.65562683
12
Assumption price data starts on 1/1/1993
def call @swings = [{swing_start_date: Date.new(1993,1,8), swing_start_value: 426.88, change_percent: nil}] @trend_direction = :up @swing_start_value = 426.88 # 1/8/93 bottom @swing_start_date = Date.new(1993,1,8) # 1/8/93 bottom @mark = price_history.first[:high] set_threshold(price_history.first) price_history.each do |ph| binding.pry if ph[:timestamp].to_date == Date.new(2009,3,3) || $stop if @trend_direction == :up record_swing(ph) if ph[:low] < @threshold_value elsif @trend_direction == :down record_swing(ph) if ph[:high] > @threshold_value end set_threshold(ph) end swings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_price\n populate_price_data unless @average_price\n @average_price\n end", "def list_price\n support_product_number = type == 'hw' ? 'HA104A' : 'HA107A'\n year1 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 1, :option_number => option_number)\n year3 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 3, :option_number => option_number)\n year4 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 4, :option_number => option_number)\n @list_price = [(year4 - year3)/BigDecimal(\"12.0\"), (year3 - year1)/BigDecimal(\"24.0\")].max\n end", "def get_earnings\n get_historic_eps(1)\n end", "def new_sale_price \n noi(num_years_to_hold + 1) / cap_rate(num_years_to_hold + 1)\n end", "def fixed_price\n data.fixed_price\n end", "def revenue(date)\n end", "def get_cup_price_data\r\n prices = Array.new\r\n self.price_of_coffees.all.each do |p|\r\n price = Array.new\r\n # X-Wert ist Zeitstempel, ab wann der Tassenpreis gültig ist (für Highcharts unformatiert in ms seit 1970, UTC) => Addiere 1 Stunden für Zeitzone Berlin\r\n x_value = p.date.to_time.to_i * 1000 + (1000 * 60 * 60)\r\n price.append(x_value)\r\n # Y-Value ist der Preis\r\n y_value = p.price.to_f\r\n price.append(y_value)\r\n prices.append(price)\r\n end\r\n prices\r\n end", "def total_price\n\t price = listing.price\n\t num_dates = (start_date..end_date).to_a.length\n\t return price * num_dates\n\tend", "def prices\n Array(tariff_data&.fetch('results', nil)).map do |t|\n # skip periods before the current time\n next unless Time.parse(t['valid_to']) >= Time.now\n\n [Time.parse(t['valid_from']).localtime, t['value_inc_vat']]\n end.compact.sort.to_h\n end", "def daily_interest\n @apr / 100.0 / 365\n end", "def sales_price\r\n\t\tmarkup = @aquisition_cost*1.10\r\n\t\tmarkup.to_s\r\n\tend", "def revenue_data(kind = '')\n range = case kind.presence || 'this_year'\n when 'this_year'\n Date.today.beginning_of_year..Date.today\n when 'past_year'\n 1.year.ago.beginning_of_year.to_date..1.year.ago.end_of_year.to_date\n when '6_months_ago'\n 5.months.ago.beginning_of_month.to_date..Date.today\n end\n range.select{|d| d.day == 1}.map{|d| [d.strftime('%Y-%m'), mentor_payments.where(payment_at: d.beginning_of_day..d.end_of_month.end_of_day).sum('payments.amount')] }.to_h\n end", "def get_price_on(date)\n \turl = \"https://s3-us-west-2.amazonaws.com/bloombergrisk/historical_data/SP500/\" + self.symbol + \"+US+Equity_data.txt\"\n \tf = open(url).read().split(\"\\n\")\n\n \ti = 0\n \tf.each do |line|\n \t\tdata_date = line.split(\",\")[0]\n \t\tprice = line.split(\",\")[1].strip.to_f\n\n \t\tif date == data_date\n \t\t\treturn price\n \t\tend\n\n \t\t# If we have already passed the date\n \t\tif Metric.date_gt(data_date, date)\n \t\t\tbreak\n \t\tend\n\n \t\ti += 1\n \tend\n\n \t# Get the closest price\n \tclosest = f[i]\n \treturn closest.split(\",\")[1].strip.to_f\n end", "def usage_price\n data.usage_price\n end", "def data_for(currency, date)\n @euro[date.to_s][currency] || BigDecimal('0')\n end", "def get_product_sold_data start_date=nil, end_date=nil, step=nil\n start_date = (start_date || '2018-01-01').to_datetime.beginning_of_day\n end_date = (end_date || '2018-12-31').to_datetime.end_of_day\n step = (step || 'week').upcase\n\n Lineitem.where(\"created_at >= ? AND created_at <= ?\", start_date, end_date)\n .select(\"sku_id, #{step}(created_at) as period, SUM(quantity) as total\")\n .group('sku_id, period')\n end", "def price\n \n end", "def price(rental)\n car_id = rental[\"car_id\"]\n car = @cars.select{ |car| car[\"id\"] == car_id }[0]\n\n price_per_day = car[\"price_per_day\"]\n price_per_km = car[\"price_per_km\"]\n\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n\n distance = rental[\"distance\"]\n\n # price per day discount : 10% after 1 day, 30% after 4 days, 50% after 10 days\n duration_price = if duration == 1\n price_per_day\n elsif duration > 1 && duration < 5\n price_per_day + price_per_day * (duration - 1) * 90 / 100\n elsif duration > 4 && duration < 11\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * (duration - 4) * 70 / 100\n else\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * 6 * 70 / 100 + price_per_day * (duration - 10) * 50 / 100\n end\n\n rental_price = duration_price + price_per_km * distance\nend", "def price(rental)\n car_id = rental[\"car_id\"]\n car = @cars.select{ |car| car[\"id\"] == car_id }[0]\n\n price_per_day = car[\"price_per_day\"]\n price_per_km = car[\"price_per_km\"]\n\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n\n distance = rental[\"distance\"]\n\n # price per day discount : 10% after 1 day, 30% after 4 days, 50% after 10 days\n duration_price = if duration == 1\n price_per_day\n elsif duration > 1 && duration < 5\n price_per_day + price_per_day * (duration - 1) * 90 / 100\n elsif duration > 4 && duration < 11\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * (duration - 4) * 70 / 100\n else\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * 6 * 70 / 100 + price_per_day * (duration - 10) * 50 / 100\n end\n\n rental_price = duration_price + price_per_km * distance\nend", "def price(rental)\n car_id = rental[\"car_id\"]\n car = @cars.select{ |car| car[\"id\"] == car_id }[0]\n\n price_per_day = car[\"price_per_day\"]\n price_per_km = car[\"price_per_km\"]\n\n start_date = DateTime.parse(rental[\"start_date\"])\n end_date = DateTime.parse(rental[\"end_date\"])\n duration = (end_date - start_date).to_i + 1\n\n distance = rental[\"distance\"]\n\n # price per day discount : 10% after 1 day, 30% after 4 days, 50% after 10 days\n duration_price = if duration == 1\n price_per_day\n elsif duration > 1 && duration < 5\n price_per_day + price_per_day * (duration - 1) * 90 / 100\n elsif duration > 4 && duration < 11\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * (duration - 4) * 70 / 100\n else\n price_per_day + price_per_day * 3 * 90 / 100 + price_per_day * 6 * 70 / 100 + price_per_day * (duration - 10) * 50 / 100\n end\n\n rental_price = duration_price + price_per_km * distance\nend", "def profit(start_date, end_date)\n price(end_date) - price(start_date)\n end", "def calculated_price\n msrp\n end", "def parse_price(stock_data)\n stock_data.map { |price| price.close.to_f.round(2) }\n end", "def price\n \n end", "def special_prices\n prices\n end", "def mid_price\n price\n end", "def current_price; self['CurrentPrice'].to_i; end", "def absolute_price\n return nil if price.blank?\n return price unless SPLITS.keys.include?(instrument&.ticker)\n\n split = SPLITS[instrument.ticker]\n return price if date_record.date >= split[:date]\n\n return price / split[:divide]\n end", "def book_value(period='enddate', basis, exclude)\n salearray = []\n sales = self.book_sales(period, basis, exclude)\n sales.each do |sale|\n salearray << sale.value_by_band.inject(0) { |sum, i| sum + i.to_f unless i.nan? or i.nil? }\n end\n book_value =salearray.inject(0) { |sum, i| sum +i.to_f }\n end", "def earnt(start_date = DateTime.now, end_date = start_date)\n self.timeslips(start_date, end_date).collect do |timeslip|\n if timeslip.project.currency == \"GBP\"\n timeslip.cost\n else\n timeslip.cost / CostAgent.usd_rate\n end\n end.inject(0) { |sum, i| sum += i }\n end", "def sales_price\n Dowstore.priceMarkup(commodity.price,0,2)\n end", "def stock_picker(data) \n\tday1 = 0\n\twhile day1 < data.length - 1\n\t\tday2 = day1 + 1\t\n\t\twhile day2 < data.length\n\t\t\tprofit ||= 0 #initialize profit at 0\n\t\t\tif data[day2] - data[day1] > profit\n\t\t\t\tprofit = data[day2] - data[day1] #update these variables if profit margin is larger than existing\n\t\t\t\tsellDate = day2\n\t\t\t\tbuyDate = day1\n\t\t\tend\n\t\t\tday2 += 1\n\t\tend\n\t\tday1 += 1\n\tend\n\treturn [buyDate, sellDate] \nend", "def prorated_price_for(year,month)\n m_days = amount_of_days_reserved_in(year,month)\n \n return 0 if m_days == 0\n \n if m_days == days_in(month)\n @monthly_price\n elsif m_days == days_in(month).round(-1) / 2\n @monthly_price / 2 # put this in here just to get line 2 of notes to pass ;)\n else\n (@monthly_price / days_in(month)) * m_days\n end\n end", "def price_curve\n load_curve('price.csv')\n end", "def explained_price_for(artno)\n prices_for(artno.to_i).first.explained_price\n end", "def stock_market; end", "def product_analysis\n @start_time = (params[:start_time].to_time rescue nil) || 1.month.ago\n @end_time = (params[:end_time].to_time rescue nil) || 1.second.ago\n @product_data = product_data(@start_time, @end_time) rescue []\n end", "def time_price\n (1..days).map { |x|\n car.price_per_day * (1 - Rental.discount(x) / 100.0)\n }.sum.round\n end", "def price\n MoneyUtils.format(self.price_basis)\n end", "def init_price_policy\n @start_date = start_date_from_params\n\n @price_policy = @product\n .price_policies\n .for_date(@start_date)\n .first\n end", "def start_date\n @start_date ||= existing_prices.map { |x| Date.strptime(x.split(\" \")[1], DATE_FORMAT) }.max || begin\n stats = `ledger stats` # Most compact way to retrieve this data\n date_str = /Time\\speriod:\\s*([\\d\\w\\-]*)\\s*to/.match(stats)[1]\n return Date.strptime(date_str, \"%y-%b-%d\")\n end\n end", "def book_sales(period='enddate', basis, exclude)\n royalty_period = Period.where([\"currentperiod = ? and client_id = ?\", true, self.client_id])\n if period == 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, royalty_period.first.startdate, basis, exclude)\n else #if period isn't 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, \"1900-01-01\", basis, exclude)\n end\n end", "def price(date)\n rand(1..100)\n end", "def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end", "def revenue\n end", "def avg_price\n (open+close+high+low).scale(0.25)\n end", "def book_quantity(period='enddate', basis, exclude)\n volarray = []\n sales = self.book_sales(period, basis, exclude)\n sales.each do |sale|\n volarray << sale.quantities_by_band.inject(0) { |sum, i| sum + i }\n end\n book_quantity = volarray.inject(0) { |sum, i| sum +i.to_f }\n end", "def average_value_per_unit(book)\n if book.book_value(period='enddate', 1, 'true') == 0 || book.book_quantity(period='enddate', 1, 'true') ==0\n return \"-\"\n else\n book.book_value(period='enddate', 1, 'true') / book.book_quantity(period='enddate', 1, 'true')\n end\n end", "def price\n @price\n end", "def price\n @price\n end", "def starting_price\n return 0.0 if course.nil?\n\n price = course.prices.order('amount ASC').first\n price.present? ? price.amount.to_f : 0.0\n end", "def calculate_import_duty\n @import_duty = imported ? (price * 0.05) : 0.0\n end", "def gas_expense\n { amount: 12.50 , comment: 'Gas at Chevron', when: '2013-09-09', expensetype_id: 1 }\n end", "def get_price_change_ytd(stock)\n stock_price = get_stock_price(stock)\n ytd_pct_change = get_pct_change_ytd(stock)\n # Calculate the price at the start of the year\n year_start_price = stock_price - (ytd_pct_change*stock_price)\n # get the price change from the start of year to date\n ytd_price_change = stock_price - year_start_price\n return ytd_price_change.round(2)\nend", "def updatePrice()\n\t\t# ビットコインヒストリカルデータの取得\n\t\tget_btc_api()\n\n\t\t# 日経平均を中心にkabutanで取得できる国内銘柄\n\t\tarrCode = getKabutanTicker()\n # 一気に250銘柄進めようとすると負荷をかけてしまうためまずい→updated_atを見ながら当日取得していない銘柄を5銘柄ずつくらい取得する\n\t\tif !arrCode.nil?\n\t arrCode.each do |code|\n\t\t\t\tticker_without_t = code.gsub(/-T/, '').to_s\n\t getPriceKabutan(ticker_without_t)\n\t end\n\t\tend\n\n\t\t#株価指数(YahooFinanceで取得可能なもの)\n\t\tarrCode = getYahooTicker()\n\t\tif !arrCode.nil?\n\t\t\tarrCode.each_with_index do |code, i|\n\t\t\t\tp \"#{i}番目の株価取得中\"\n\t\t\t\tgetPriceYahoo(code)\n\t\t\tend\n\t\tend\n\tend", "def price_movement_chart\n [\n ['Dividend', 'Share Price Change'],\n ['0', '1 ←'],\n ['> 0', 'none'],\n ['≥ stock value', '1 →'],\n ['≥ 2× stock value', '2 →'],\n ['≥ 3× stock value', '3 →'],\n ]\n end", "def price\n \t\t@required = [:zip, :country, :sender_zip, :weight]\n \t\t\n @insured_value ||= 0\n @country ||= 'US'\n @sender_country ||= 'US'\n @transaction_type ||= 'GND' # default to UPS ground\n \n \t\t@data = \"AppVersion=1.2&AcceptUPSLicenseAgreement=yes&ResponseType=application/x-ups-rss&ActionCode=3&RateChart=Customer+Counter&DCISInd=0&SNDestinationInd1=0&SNDestinationInd2=0&ResidentialInd=$r&PackagingType=00&ServiceLevelCode=#{@transaction_type}&ShipperPostalCode=#{@sender_zip}&ShipperCountry=#{@sender_country}&ConsigneePostalCode=#{@zip}&ConsigneeCountry=#{@country}&PackageActualWeight=#{@weight}&DeclaredValueInsurance=#{@insured_value}\"\n\n \t\tget_response \"http://www.ups.com/using/services/rave/qcost_dss.cgi\"\n \t\t\n \t\tprice = @response.split(\"%\")\n \t\tprice = price[price.size-2]\n \t\t\n \t\treturn price.to_f\n \tend", "def price_for(artno, at = Date.today)\n discounts_for(artno, at).min_by(&:price).price\n rescue NoMethodError\n nil\n end", "def starting_price\r\n Money.new(starting_price_cents, starting_price_currency).format(with_currency: true)\r\n end", "def import_calc\n import = @quantity * @price * @duty\n end", "def price\n active_variants.present? ? price_range.first : raise( VariantRequiredError )\n end", "def get_ptc_value_date(date, value)\n date_arr = date.split(\"-\")\n year = date_arr[0]\n month = date_arr[1]\n \n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-#{month}-01 00:00:00\", \"#{year}-#{month}-31 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def get_ptc_value_date(date, value)\n date_arr = date.split(\"-\")\n year = date_arr[0]\n month = date_arr[1]\n \n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-#{month}-01 00:00:00\", \"#{year}-#{month}-31 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def get_ptc_value_date(date, value)\n date_arr = date.split(\"-\")\n year = date_arr[0]\n month = date_arr[1]\n \n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-#{month}-01 00:00:00\", \"#{year}-#{month}-31 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def savings\n read_attribute(:price) - read_attribute(:sale_price)\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def historic_trading(region, year, month)\n region = AEMO::Region.new(region) if region.is_a?(String)\n\n month = Kernel.format('%02d', month)\n url = 'https://aemo.com.au/aemo/data/nem/priceanddemand/' \\\n \"PRICE_AND_DEMAND_#{year}#{month}_#{region}1.csv\"\n\n response = HTTParty.get(url)\n parse_response(response)\n end", "def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (Closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable' #retrun unavailable to neither closing price or opending price is available\n end", "def full_price\n price + tax_evaluation\n end", "def price\n total_price = price_method(\"Principal\")\n individual_price = (total_price / quantity).to_f\n end", "def price()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Price::PriceRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def price_adjustment \n price_adjustment_fixed / 100.0 \n end", "def get_oil_price_obj(date)\n oil_price_obj = OilPrice.where('date <= ?', date).order(date: :desc).limit(1)[0]\n if oil_price_obj == nil\n oil_price_obj = OilPrice.order(date: :asc).limit(1)[0]\n end\n return oil_price_obj\n end", "def index_data(symbol, start_date, end_date)\n @all_dates = dates(start_date, end_date)\n json = quan(symbol,start_date,end_date)\n @dates = date_array(json)\n value = value_array(json)\n @missing_dates = compare_json_dates_range_dates(@dates, @all_dates)\n create_value(@missing_dates, value)\n @final = @all_dates.zip(value)\n return @final\n end", "def book_royalty(period='enddate', basis=\"Net receipts\")\n royarray = []\n sales = self.book_sales(period, basis, false) # this calls the royalty calculation for net receipts\n sales.each do |sale|\n royarray << sale.royalty_by_band.inject(0) { |sum, i| sum + i.to_f unless i.nan? || i.nil? }\n end\n book_royalty = royarray.inject(0) { |sum, i| sum +i.to_f }\n end", "def total\n number_of_days_rental = end_date - start_date\n daily_rate = car_category.daily_price\n\n number_of_days_rental * daily_rate\n end", "def graph_data\n\n\t\t# stock data\n\t\t@stock_data = HistoricalStockPrice.where(:stock_id => @stock_object.id).pluck(:last_traded_at, :price)\n\t\t\n\t\t@stock_data.map! { |time, price| [time.to_time.to_i * 1000, price.to_f] }\n\t\t@stock_data.sort_by! { |time, price| time }\n\t\t\n\t\t# puts \"stock data is:\"\n\t\t# @stock_data.each do |time, price|\n\t\t# \tputs \"Time: #{time}, Price: #{price}\"\n\t\t# end\n\n \treturn @stock_data\n \tend", "def dailies_avg_prices\n @item = EveItem.friendly.find( params[ :item_id ] )\n\n\t\traise \"Should be called only for base item : #{@item.inspect}\" unless @item.base_item\n\n\t\t@title = DAILIES_AVG_PRICES_TITLE + view_context.link_to( @item.name, item_path( @item ) ) + ' ' + view_context.print_total_cost_for_items( @item )\n\t\t@meta_title = DAILIES_AVG_PRICES_TITLE + @item.name\n\n\t\t@meta_content = 'The price of a basic item is computed over a weekly average of the price each day.'\n\n @dailies_details = @item.weekly_price_details.where(trade_hub_id: params[:trade_hub_id]).order( 'day DESC' ).paginate( :page => params[:page] )\n end", "def historic_stock(year)\n\n data = query_strategy.historic_stock(year)\n\n end", "def price(raw_coin, raw_date=nil)\r\n \r\n coin = raw_coin.downcase.split.map(&:capitalize).join(' ')\r\n \r\n return self.coin(coin).quote['USD']['price'].to_f if raw_date.nil?\r\n puts 'raw_date: ' + raw_date.inspect if @debug\r\n \r\n date = if raw_date.is_a? Date then\r\n raw_date.strftime(\"%Y%m%d\")\r\n else\r\n Chronic.parse(raw_date.gsub('-',' ')).strftime(\"%d%m%Y\")\r\n end\r\n puts 'date: ' + date.inspect if @debug\r\n \r\n # if date is today then return today's price\r\n \r\n if date == Date.today.strftime(\"%d%m%Y\")\r\n puts 'same day' if @debug\r\n return self.coin(coin).quote['USD']['price'].to_f \r\n end\r\n \r\n \r\n if @history_prices[coin] and @history_prices[coin][date] then\r\n @history_prices[coin][date]\r\n else\r\n begin\r\n \r\n if @debug then\r\n puts 'coin: ' + coin.inspect \r\n puts 'date: ' + date.inspect\r\n end\r\n \r\n #a = Coinmarketcap.get_historical_price(coin.gsub(/ /,'-'), date, date)\r\n #puts 'a: ' + a.inspect if @debug \r\n \r\n #r = a.any? ? a.first[:close] : self.coin(coin).quote['USD']['price'].to_f \r\n price = @cq.historical_price coin, date\r\n r = price ? price.to_f : self.coin(coin).quote['USD']['price'].to_f \r\n @history_prices[coin] ||= {}\r\n @history_prices[coin][date] = r\r\n File.write @historic_prices_file, @history_prices.to_yaml\r\n \r\n return r\r\n \r\n rescue\r\n puts ($!).inspect if @debug\r\n end\r\n end\r\n \r\n end", "def savings\n if raw_data[:PackagePrice] && raw_data[:PackagePrice][:TotalSavings]\n Money.new(raw_data[:PackagePrice][:TotalSavings][:Value].to_f * 100, raw_data[:PackagePrice][:TotalSavings][:Currency])\n else\n nil\n end\n end", "def price_fluc\n # return nil when current price is unavailable\n return nil if kindle_price == -1\n\n price_changes = prices(:order => [:retrieved_at.desc])\n\n # defensive code, this case is incorrect\n return nil if price_changes.empty?\n\n if price_changes.length == 1 # only 1 price, no fluc\n []\n else\n [price_changes[1], price_changes[0]]\n end\n end", "def average_price toy\n\t$average_price = $total_amount / toy[\"purchases\"].length\nend", "def total_cost\n return (date_range.end_date - date_range.start_date) * (200 * (1 - discount))\n end", "def event_tickets_sold_data(period_data = 'this_month')\n res = event_payments\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title, I18n.t('number.currency.format.unit')]]\n range.each{|d| data << [d.strftime(daily_report ? '%d' : '%Y-%m'), res.where(payment_at: d.beginning_of_day..(daily_report ? d.end_of_day : d.end_of_month.end_of_day)).sum(:amount).to_f] }\n data\n end", "def get_price\n item_prc_1\n end", "def price\n if raw_data[:PackagePrice] && raw_data[:PackagePrice][:TotalPrice]\n Money.new(raw_data[:PackagePrice][:TotalPrice][:Value].to_f * 100, raw_data[:PackagePrice][:TotalPrice][:Currency])\n else\n nil\n end\n end", "def price\n user_birth_year = user.birth_date.year rescue nil\n case year\n when 2010; user_birth_year >= 1996 ? 120 : 160 rescue nil\n when 2011; user_birth_year >= 1997 ? 120 : 160 rescue nil\n when 2012; 160\n when 2013; 170\n when 2014; 170\n when 2015; 175\n when 2016; user.postal_code == \"94340\" ? 160 : 180 rescue nil\n else nil\n end\n end", "def initialize(end_date, data_amount)\n @end_date = end_date\n @data_amount = data_amount\n calculate_start_date\n end", "def my_price\n envisage_to_my_price\n end", "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "def stock_historical_data(ticker)\n ############################################################################\n # Yahoo Finance historical quotes has been deprecated\n # YahooFinance::Client.new.historical_quotes(ticker, { start_date: Date.today - days, end_date: Date.today })\n ############################################################################\n i = 0\n history = { date: [], price: [] }\n\n url = \"https://finance.yahoo.com/quote/\" + ticker + \"/history?\"\n doc = Nokogiri::HTML(open(url))\n data = doc.at('table[data-test=\"historical-prices\"]')\n\n while i < data.children[1].children.length do\n check = data.children[1].children[i].text\n\n if (!check.include?('Dividend') && !check.include?('Split'))\n \thistory[:date] << data.children[1].children[i].children[0].text\n \thistory[:price] << data.children[1].children[i].children[5].text.to_f\n end\n\n i+=1\n end\n history\n end", "def net_sales_as_decimal\n net_sales[1..-1].to_d\n end", "def price\n BigDecimal('5.0')\n end", "def stock_picker(prices)\n acc_profit = 0\n acc_buy_date = 0\n acc_sell_date = 0\n \n profits = prices.map.with_index do |price, index|\n remaining_days = prices[index..-1] # to create an array that becomes smaller each iteration from index 0\n maximum = remaining_days.max # to identify the maximum number in that iteration's array\n highest_value = maximum - price # price is at index 0, so maximum minus minimum for each one will help identify the best buy/sell dates\n \n # create accumilator for index and value of highest profit\n if highest_value > acc_profit\n acc_profit = highest_value\n acc_buy_date = prices.index(price)\n acc_sell_date = prices.index(maximum)\n end\n\n end\n \n p \"Buy on day #{acc_buy_date} and sell on day #{acc_sell_date} for a profit of $#{acc_profit}.\"\n end", "def for_order(product)\n regular_price(product)\n end", "def price\n return self[:price] if market_open?\n previous_close\n end", "def parse_chart_data(dates, prices)\n dates.zip(prices).to_h\n end", "def price\n hash[\"Price\"]\n end", "def build_stock_return_data\n open_values = []\n close_values = []\n\n @values.dig(:values).map do |_codes, _date, open, _high, _low, close|\n open_values.push [open]\n close_values.push [close]\n end\n\n @open = calculate_average(open_values)\n @close = calculate_average(close_values)\n @stock_return = stock_return_formula\n end" ]
[ "0.60944486", "0.5973674", "0.59684974", "0.59417224", "0.59039927", "0.5892129", "0.58712965", "0.58702964", "0.5860345", "0.585219", "0.5847461", "0.5839834", "0.5825041", "0.58137023", "0.5777448", "0.5762498", "0.57554483", "0.57260656", "0.57260656", "0.57260656", "0.5705839", "0.5694028", "0.56939906", "0.5677182", "0.5673939", "0.5670624", "0.5642282", "0.5637846", "0.56183046", "0.5567594", "0.55629414", "0.5554291", "0.55494106", "0.55198616", "0.5511716", "0.5510912", "0.55070204", "0.5500832", "0.5488184", "0.54817605", "0.54795694", "0.54631877", "0.5462898", "0.5427733", "0.5425573", "0.542527", "0.5417884", "0.5417271", "0.54156744", "0.54156744", "0.5413559", "0.5412271", "0.54096353", "0.54059017", "0.5405832", "0.5401682", "0.540116", "0.53988916", "0.5393297", "0.53916985", "0.5388898", "0.5388784", "0.5388784", "0.5388784", "0.5383781", "0.538217", "0.538217", "0.53810847", "0.53807944", "0.5373397", "0.5365813", "0.5365177", "0.5364366", "0.53633165", "0.5356776", "0.5355853", "0.5354136", "0.5353975", "0.53531635", "0.5347837", "0.53456384", "0.53417", "0.5339354", "0.53174776", "0.5316857", "0.5314504", "0.5314243", "0.5313322", "0.5307984", "0.5298696", "0.5298394", "0.52944577", "0.5289354", "0.5284359", "0.5275088", "0.52728724", "0.5265097", "0.5264957", "0.5261419", "0.5260405", "0.52585465" ]
0.0
-1
Note can be updated w.r.t. scoped attributes combination
def validate_unique_nested_attributes(parent, collection, attribute, options = {}) return true if collection.empty? build_default_options(options) validate_unique_attribute_in_collection(parent, attribute, collection, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attributes(attrs)\n nattrs = attrs.reduce({}) do |acc, a|\n ak, av = a\n case ak\n when :list, :listed_object, :owner\n else\n acc[ak] = av\n end\n\n acc\n end\n\n super(nattrs)\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def attr(name); end", "def update_attributes(attrs)\n super({})\n end", "def attr; end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def lively_attributes(*args)\n self._active_attributes += args.collect(&:to_s)\n end", "def essential_attributes\n [\"is_transient\",\"id\"]\n end", "def attrs_authoritative\n @authority = :attributes\n self\n end", "def update_attr_with_ial(attr, ial); end", "def attribute(name); end", "def updatable_attributes\n [:name]\n end", "def attributes=(_arg0); end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def modified_external_data\n @modified_external_data ||= External.scope.map(&:attr)\nend", "def attr_info; end", "def update_attribute\n end", "def update!(**args)\n @attr_value = args[:attr_value] if args.key?(:attr_value)\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def override\n attributes.override\n end", "def nested_attributes_update_attributes(meta, obj, attributes)\n nested_attributes_check_key_modifications(meta, obj) do\n nested_attributes_set_attributes(meta, obj, attributes)\n end\n end", "def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end", "def changed_attributes\r\n attributes = HashWithIndifferentAccess.new\r\n \r\n if self.edited\r\n %w{rate name}.each do |attr|\r\n if self.different?(attr)\r\n attributes[attr] = self.send(attr)\r\n end\r\n end\r\n end\r\n attributes\r\n end", "def attributes(new_attrs)\n @new_attrs = new_attrs.symbolize_keys\n attrs = original_attributes.merge(@new_attrs.merge({\n is_current_version: true,\n id: @record.id,\n version: @record.version + 1\n }))\n end", "def decorated_attributes(attrs = {})\n attrs.dup\n end", "def update_attributes(attrs)\n difference = attrs.keys - ASSIGNABLE\n if difference.empty?\n attributes.merge!(attrs)\n else\n raise \"unexpected attributes #{difference} for #{@node.path}\"\n end\n end", "def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end", "def new_entry_attrs\n test_entry_attrs\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n end", "def mutable_attributes\n spec[\"mutable_attributes\"]\n end", "def edit_entry_attrs\n test_entry_attrs\n end", "def safe_attributes=(attrs, user=User.current)\n return unless attrs.is_a?(Hash)\n\n attrs = attrs.deep_dup\n\n # Project and Tracker must be set before since new_statuses_allowed_to depends on it.\n if (p = attrs.delete('project_id')) && safe_attribute?('project_id')\n if allowed_target_projects(user).where(:id => p.to_i).exists?\n self.project_id = p\n end\n end\n\n if (t = attrs.delete('tracker_id')) && safe_attribute?('tracker_id')\n self.tracker_id = t\n end\n if project\n # Set the default tracker to accept custom field values\n # even if tracker is not specified\n self.tracker ||= project.trackers.first\n end\n\n if (s = attrs.delete('status_id')) && safe_attribute?('status_id')\n if new_statuses_allowed_to(user).collect(&:id).include?(s.to_i)\n self.status_id = s\n end\n end\n\n attrs = delete_unsafe_attributes(attrs, user)\n return if attrs.empty?\n\n if attrs['parent_issue_id'].present?\n s = attrs['parent_issue_id'].to_s\n unless (m = s.match(%r{\\A#?(\\d+)\\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1]))\n @invalid_parent_issue_id = attrs.delete('parent_issue_id')\n end\n end\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n\n ###############\n ## Custom START\n editable_custom_field_ids |= editable_custom_field_values(user).map {|v| v.custom_field_id.to_s + '-comment'}\n ## Custom END\n ###############\n\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n # mass-assignment security bypass\n assign_attributes attrs, :without_protection => true\n end", "def bt_scope_attributes\n attributes.slice(*self.class.bt_scope_columns)\n end", "def new_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @usage_info = args[:usage_info] if args.key?(:usage_info)\n end", "def reload_attributes(atts = {})\n @attributes = {}\n @_memo = {}\n update_attributes(atts)\n end", "def attr_dirty!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys << key.to_sym\n @dirty_attribute_keys.uniq!\n end", "def safe_attributes=(attrs, user = User.current)\n if attrs.is_a?(Hash)\n if attrs['watcher_user_ids'].present?\n groups = Group.active.visible.where(id: attrs['watcher_user_ids'].compact.uniq)\n\n attrs['group_ids'] = groups.map(&:id).map(&:to_s)\n attrs['watcher_user_ids'] -= groups.map(&:id).map(&:to_s)\n\n groups.each do |group|\n group.users.each do |groups_user|\n attrs['watcher_user_ids'] << groups_user.id\n end\n end\n end\n end\n\n super\n end", "def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end", "def update!(**args)\n @attribute = args[:attribute] if args.key?(:attribute)\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def other_attrs\n @other_attrs ||= {}\n end", "def current_attributes\n attributes.each_key.each_with_object({}) do |key, h|\n h[key] = public_send(key)\n end\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def dirty_attributes\n embedded_attributes = {}\n\n each_embedment do |name, target|\n case (embedment = embedments[name])\n when Embedments::OneToMany::Relationship\n target.each do |resource|\n if resource.dirty?\n embedded_attributes[embedment] ||= []\n embedded_attributes[embedment] << resource.dirty_attributes\n end\n end\n when Embedments::OneToOne::Relationship\n # Relationship target is a single resource.\n if target.dirty?\n embedded_attributes[embedment] = target.dirty_attributes\n end\n end\n end\n\n super.merge(embedded_attributes)\n end", "def settled_attributes\n instance_vars = self.instance_variables.map do |attr|\n attr.to_s[1..-1].to_sym\n end\n\n instance_vars & attributes\n end", "def data_attributes\n end", "def writable_attributes resource = nil\n attrs = accessible_attributes(resource).delete_if { |attribute| attribute =~ /(_attributes)$/ }\n attrs -= get_associations(resource)\n end", "def attributes= new_attributes\n ingest_attributes(new_attributes)\n end", "def new_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "def attr(symbol, writable=false) end", "def new_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "def __attrs(attrs_hash={})\n @_undies_io.current.attrs(attrs_hash)\n end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def exposed_attributes\n [ :id, :curriculum_core_id, :subject_id, :curriculum_grade_id, :curriculum_area_id,\n :standard, :description1, :description2]\n end", "def attribute(*args)\n @attributes = attributes\n @attributes += args\n @attributes.uniq!\n end", "def update_attributes(attrs)\n result = nil\n obj = self.strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n val = self.send method.to_sym\n # Don't save objects with braces to database\n new_val = attrs[method]\n # if the object's value doesn't match the database record\n # then we procede with update\n if new_val and val != new_val\n unless self.method_name_reserved?(method) or new_val.length == 0\n # update viewable list\n result = Rhom::RhomDbAdapter::update_into_table(Rhom::TABLE_NAME,\n {\"value\"=>new_val},\n {\"object\"=>obj, \"attrib\"=>method})\n # update sync list\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>new_val,\n \"update_type\"=>'update'})\n end\n end\n end\n result\n end", "def update_attributes(atts)\n atts.delete('_type')\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end", "def safe_attributes=(attrs, user=User.current)\n if attrs.respond_to?(:to_unsafe_hash)\n attrs = attrs.to_unsafe_hash\n end\n\n return unless attrs.is_a?(Hash)\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n super(attrs, user)\n end", "def updated() read_attribute_w_fallbacks( :updated, :published ); end", "def attributes\n @attributes ||= {}\n @attributes\n end", "def attributes\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_to_set; end", "def lock_attribute_inheritance\n _attributes.tap do |attrs|\n define_singleton_method(:_attributes) { attrs }\n attrs.freeze\n end\n end", "def attributes_for_update(attribute_names)\n tag_lists = tag_types.map { |tags_type| \"#{tags_type.to_s.singularize}_list\" }\n super.delete_if { |attr| tag_lists.include? attr }\n end", "def attribute_values\n super.merge('product_id' => @source.concept_product.product.product_id)\n end", "def attributes\n super.merge({ 'visibility' => @visibility })\n end", "def setup_object_attributes; end", "def attributes\n [@attribute,@value].inject(Hash.new([])) do |memo,c|\n case c \n when Sower::Relation::Statement, Sower::Relation::Attribute, Sower::Relation::Value::Base\n memo.merge!(c.attributes){|k,v,n| v | n}\n end\n memo\n end\n end", "def readonly_attributes(*attrs)\n @readonly_attributes ||= [:created_at, :updated_at, :completed_at]\n if attrs.any?\n @readonly_attributes.map!(&:to_sym).concat(attrs).uniq!\n setup_attributes(@readonly_attributes, true)\n end\n @readonly_attributes\n end", "def visible_attr \n _storable_attributes\n end", "def old_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end" ]
[ "0.64899004", "0.641244", "0.641244", "0.6333127", "0.6332756", "0.63292086", "0.63237935", "0.63237935", "0.63237935", "0.63237935", "0.63027376", "0.6299845", "0.62622494", "0.624722", "0.62281346", "0.62134427", "0.6192202", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6126544", "0.60849667", "0.6053088", "0.60525167", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.60171705", "0.5992018", "0.5981122", "0.5973212", "0.5958625", "0.59516716", "0.59497744", "0.59348434", "0.5926014", "0.5918574", "0.5908635", "0.59058416", "0.59050995", "0.5896964", "0.5886895", "0.587882", "0.58767146", "0.5862707", "0.58509254", "0.5846315", "0.5841841", "0.58399606", "0.58378834", "0.5835137", "0.5835137", "0.58308494", "0.582712", "0.58201414", "0.5818458", "0.5812992", "0.58121246", "0.58078474", "0.5804964", "0.5801854", "0.579593", "0.57902867", "0.57884336", "0.5777248", "0.5776195", "0.5775986", "0.57733864", "0.57701474", "0.57679677", "0.57640505", "0.5762834", "0.5754908", "0.575065", "0.575065", "0.575065", "0.57505834", "0.5746887", "0.57434154", "0.5728724", "0.5724053", "0.57184076", "0.5714129", "0.57094675", "0.5708409", "0.570119", "0.56974405", "0.56974405", "0.56974405" ]
0.0
-1
Note can be updated w.r.t. scoped attributes combination
def validate_unique_nested_attributes_for_tree_polymorphism(parent, polymorphic_association_name, type, collection_name, attribute, options = {}) types_with_collection = find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name) return true if types_with_collection.blank? build_default_options(options) # Maintains unique values for complete collection hash = {} types_with_collection.each do |component, collection| validate_unique_attribute_in_collection(parent, attribute, collection, options, hash) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_attributes(attrs)\n nattrs = attrs.reduce({}) do |acc, a|\n ak, av = a\n case ak\n when :list, :listed_object, :owner\n else\n acc[ak] = av\n end\n\n acc\n end\n\n super(nattrs)\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def attr(name); end", "def update_attributes(attrs)\n super({})\n end", "def attr; end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def lively_attributes(*args)\n self._active_attributes += args.collect(&:to_s)\n end", "def essential_attributes\n [\"is_transient\",\"id\"]\n end", "def attrs_authoritative\n @authority = :attributes\n self\n end", "def update_attr_with_ial(attr, ial); end", "def attribute(name); end", "def updatable_attributes\n [:name]\n end", "def attributes=(_arg0); end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def modified_external_data\n @modified_external_data ||= External.scope.map(&:attr)\nend", "def attr_info; end", "def update_attribute\n end", "def update!(**args)\n @attr_value = args[:attr_value] if args.key?(:attr_value)\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def override\n attributes.override\n end", "def nested_attributes_update_attributes(meta, obj, attributes)\n nested_attributes_check_key_modifications(meta, obj) do\n nested_attributes_set_attributes(meta, obj, attributes)\n end\n end", "def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end", "def changed_attributes\r\n attributes = HashWithIndifferentAccess.new\r\n \r\n if self.edited\r\n %w{rate name}.each do |attr|\r\n if self.different?(attr)\r\n attributes[attr] = self.send(attr)\r\n end\r\n end\r\n end\r\n attributes\r\n end", "def attributes(new_attrs)\n @new_attrs = new_attrs.symbolize_keys\n attrs = original_attributes.merge(@new_attrs.merge({\n is_current_version: true,\n id: @record.id,\n version: @record.version + 1\n }))\n end", "def decorated_attributes(attrs = {})\n attrs.dup\n end", "def update_attributes(attrs)\n difference = attrs.keys - ASSIGNABLE\n if difference.empty?\n attributes.merge!(attrs)\n else\n raise \"unexpected attributes #{difference} for #{@node.path}\"\n end\n end", "def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end", "def new_entry_attrs\n test_entry_attrs\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n end", "def mutable_attributes\n spec[\"mutable_attributes\"]\n end", "def edit_entry_attrs\n test_entry_attrs\n end", "def safe_attributes=(attrs, user=User.current)\n return unless attrs.is_a?(Hash)\n\n attrs = attrs.deep_dup\n\n # Project and Tracker must be set before since new_statuses_allowed_to depends on it.\n if (p = attrs.delete('project_id')) && safe_attribute?('project_id')\n if allowed_target_projects(user).where(:id => p.to_i).exists?\n self.project_id = p\n end\n end\n\n if (t = attrs.delete('tracker_id')) && safe_attribute?('tracker_id')\n self.tracker_id = t\n end\n if project\n # Set the default tracker to accept custom field values\n # even if tracker is not specified\n self.tracker ||= project.trackers.first\n end\n\n if (s = attrs.delete('status_id')) && safe_attribute?('status_id')\n if new_statuses_allowed_to(user).collect(&:id).include?(s.to_i)\n self.status_id = s\n end\n end\n\n attrs = delete_unsafe_attributes(attrs, user)\n return if attrs.empty?\n\n if attrs['parent_issue_id'].present?\n s = attrs['parent_issue_id'].to_s\n unless (m = s.match(%r{\\A#?(\\d+)\\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1]))\n @invalid_parent_issue_id = attrs.delete('parent_issue_id')\n end\n end\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n\n ###############\n ## Custom START\n editable_custom_field_ids |= editable_custom_field_values(user).map {|v| v.custom_field_id.to_s + '-comment'}\n ## Custom END\n ###############\n\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n # mass-assignment security bypass\n assign_attributes attrs, :without_protection => true\n end", "def bt_scope_attributes\n attributes.slice(*self.class.bt_scope_columns)\n end", "def new_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @usage_info = args[:usage_info] if args.key?(:usage_info)\n end", "def reload_attributes(atts = {})\n @attributes = {}\n @_memo = {}\n update_attributes(atts)\n end", "def attr_dirty!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys << key.to_sym\n @dirty_attribute_keys.uniq!\n end", "def safe_attributes=(attrs, user = User.current)\n if attrs.is_a?(Hash)\n if attrs['watcher_user_ids'].present?\n groups = Group.active.visible.where(id: attrs['watcher_user_ids'].compact.uniq)\n\n attrs['group_ids'] = groups.map(&:id).map(&:to_s)\n attrs['watcher_user_ids'] -= groups.map(&:id).map(&:to_s)\n\n groups.each do |group|\n group.users.each do |groups_user|\n attrs['watcher_user_ids'] << groups_user.id\n end\n end\n end\n end\n\n super\n end", "def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end", "def update!(**args)\n @attribute = args[:attribute] if args.key?(:attribute)\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def other_attrs\n @other_attrs ||= {}\n end", "def current_attributes\n attributes.each_key.each_with_object({}) do |key, h|\n h[key] = public_send(key)\n end\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def dirty_attributes\n embedded_attributes = {}\n\n each_embedment do |name, target|\n case (embedment = embedments[name])\n when Embedments::OneToMany::Relationship\n target.each do |resource|\n if resource.dirty?\n embedded_attributes[embedment] ||= []\n embedded_attributes[embedment] << resource.dirty_attributes\n end\n end\n when Embedments::OneToOne::Relationship\n # Relationship target is a single resource.\n if target.dirty?\n embedded_attributes[embedment] = target.dirty_attributes\n end\n end\n end\n\n super.merge(embedded_attributes)\n end", "def settled_attributes\n instance_vars = self.instance_variables.map do |attr|\n attr.to_s[1..-1].to_sym\n end\n\n instance_vars & attributes\n end", "def data_attributes\n end", "def writable_attributes resource = nil\n attrs = accessible_attributes(resource).delete_if { |attribute| attribute =~ /(_attributes)$/ }\n attrs -= get_associations(resource)\n end", "def attributes= new_attributes\n ingest_attributes(new_attributes)\n end", "def new_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "def attr(symbol, writable=false) end", "def new_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "def __attrs(attrs_hash={})\n @_undies_io.current.attrs(attrs_hash)\n end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def exposed_attributes\n [ :id, :curriculum_core_id, :subject_id, :curriculum_grade_id, :curriculum_area_id,\n :standard, :description1, :description2]\n end", "def attribute(*args)\n @attributes = attributes\n @attributes += args\n @attributes.uniq!\n end", "def update_attributes(attrs)\n result = nil\n obj = self.strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n val = self.send method.to_sym\n # Don't save objects with braces to database\n new_val = attrs[method]\n # if the object's value doesn't match the database record\n # then we procede with update\n if new_val and val != new_val\n unless self.method_name_reserved?(method) or new_val.length == 0\n # update viewable list\n result = Rhom::RhomDbAdapter::update_into_table(Rhom::TABLE_NAME,\n {\"value\"=>new_val},\n {\"object\"=>obj, \"attrib\"=>method})\n # update sync list\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>new_val,\n \"update_type\"=>'update'})\n end\n end\n end\n result\n end", "def update_attributes(atts)\n atts.delete('_type')\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end", "def safe_attributes=(attrs, user=User.current)\n if attrs.respond_to?(:to_unsafe_hash)\n attrs = attrs.to_unsafe_hash\n end\n\n return unless attrs.is_a?(Hash)\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n super(attrs, user)\n end", "def updated() read_attribute_w_fallbacks( :updated, :published ); end", "def attributes\n @attributes ||= {}\n @attributes\n end", "def attributes\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_to_set; end", "def lock_attribute_inheritance\n _attributes.tap do |attrs|\n define_singleton_method(:_attributes) { attrs }\n attrs.freeze\n end\n end", "def attributes_for_update(attribute_names)\n tag_lists = tag_types.map { |tags_type| \"#{tags_type.to_s.singularize}_list\" }\n super.delete_if { |attr| tag_lists.include? attr }\n end", "def attribute_values\n super.merge('product_id' => @source.concept_product.product.product_id)\n end", "def attributes\n super.merge({ 'visibility' => @visibility })\n end", "def setup_object_attributes; end", "def attributes\n [@attribute,@value].inject(Hash.new([])) do |memo,c|\n case c \n when Sower::Relation::Statement, Sower::Relation::Attribute, Sower::Relation::Value::Base\n memo.merge!(c.attributes){|k,v,n| v | n}\n end\n memo\n end\n end", "def readonly_attributes(*attrs)\n @readonly_attributes ||= [:created_at, :updated_at, :completed_at]\n if attrs.any?\n @readonly_attributes.map!(&:to_sym).concat(attrs).uniq!\n setup_attributes(@readonly_attributes, true)\n end\n @readonly_attributes\n end", "def visible_attr \n _storable_attributes\n end", "def old_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end" ]
[ "0.64899004", "0.641244", "0.641244", "0.6333127", "0.6332756", "0.63292086", "0.63237935", "0.63237935", "0.63237935", "0.63237935", "0.63027376", "0.6299845", "0.62622494", "0.624722", "0.62281346", "0.62134427", "0.6192202", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6165199", "0.6126544", "0.60849667", "0.6053088", "0.60525167", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.6035744", "0.60171705", "0.5992018", "0.5981122", "0.5973212", "0.5958625", "0.59516716", "0.59497744", "0.59348434", "0.5926014", "0.5918574", "0.5908635", "0.59058416", "0.59050995", "0.5896964", "0.5886895", "0.587882", "0.58767146", "0.5862707", "0.58509254", "0.5846315", "0.5841841", "0.58399606", "0.58378834", "0.5835137", "0.5835137", "0.58308494", "0.582712", "0.58201414", "0.5818458", "0.5812992", "0.58121246", "0.58078474", "0.5804964", "0.5801854", "0.579593", "0.57902867", "0.57884336", "0.5777248", "0.5776195", "0.5775986", "0.57733864", "0.57701474", "0.57679677", "0.57640505", "0.5762834", "0.5754908", "0.575065", "0.575065", "0.575065", "0.57505834", "0.5746887", "0.57434154", "0.5728724", "0.5724053", "0.57184076", "0.5714129", "0.57094675", "0.5708409", "0.570119", "0.56974405", "0.56974405", "0.56974405" ]
0.0
-1
Returns a hash with component as key and its collection as value. component can be at any level but in hash, it is at root level
def find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name) components = find_desired_components(parent, polymorphic_association_name, type.to_s.camelize.constantize) components_with_collection = {} components.each do |component| components_with_collection[component] = component.send(collection_name) components_with_collection[component].each do |collection_element| components_with_collection.merge!(find_types_and_all_collections(collection_element, polymorphic_association_name, type, collection_name)) end end components_with_collection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_component_hash(item=nil)\n hash = {}\n items = []\n if(!item.nil?)\n items = item.components\n else\n for comp in @all_components\n if(comp.component_parents.empty?)\n items.push(comp)\n end\n end\n end\n for comp in items\n hash[comp] = all_component_hash(comp)\n end\n return hash\n end", "def all_prod_comp_hash(item=nil)\n\n hash = {}\n\n if(!item.nil?)\n items = item.components\n else\n items = @all_products\n end\n\n for comp in items\n\n hash[comp] = all_prod_comp_hash(comp)\n\n end\n\n return hash\n\n end", "def data\n hash = default_data\n components.each do |component|\n hash[component.property] = component.data\n end\n if has_element_class?\n hash['elements'] = []\n elements.each do |element|\n hash['elements'] << element.data\n end\n end\n hash\n end", "def components\n if @components.nil?\n @components = self.class.components(self.key)\n end\n @components\n end", "def hash_by_uri\n @hash_by_uri ||= begin\n result = {}\n flatten_hierarchy.each do |c|\n result[c.uri.to_s]=c\n end\n result\n end\n end", "def hash\n [@collection.full_namespace, @opts.hash, @selector.hash].hash\n end", "def hash(collection = nil, opts = {}, &block)\n self.collection(collection) if collection\n @top_level_object = ActiveSupport::HashWithIndifferentAccess.new\n proceed(block, opts)\n end", "def collection\n components.values.last[:collection]\n end", "def collection_hash\n collection_field_pairs = collection_fields.map do |field|\n [ normalize_header(field.header), field.value ]\n end\n Hash[ collection_field_pairs ]\n end", "def list\n @_componentable_container.keys\n end", "def hash\n [self.class.name, children.map { |el| el.hash }].hash\n end", "def to_h\n @collection.to_hash\n end", "def hash\n @elements.hash\n end", "def hash\n @elements.hash\n end", "def hash\n @children.hash\n end", "def component_groups\n @component_groups ||=\n begin\n h = {}\n barcodes.each do |barcode|\n cid = component_dict.component_id(barcode: barcode)\n h[cid] = h.fetch(cid, []).append(barcode).uniq\n end\n h.each do |component_id, barcodes|\n h[component_id] = barcodes.sort_by do |barcode|\n component_dict.barcodes(cid: component_id)&.index(barcode)\n end\n end\n h\n end\n end", "def hash_by_label\n @hash_by_label ||= begin\n result = {}\n flatten_hierarchy.each do |c|\n result[c.label.downcase]=c\n end\n result\n end\n end", "def initial_components\n {}\n end", "def to_flat_h\n os = ObjectStack.new(@container, self)\n result = {}\n start = @container.name.size + 1\n os.traverse_deep_first do |oss|\n unless oss.element.is_a?(Container)\n result[oss.dom_id[start..-1]] = oss.object\n end\n end\n result\n end", "def to_hash\n root.to_hash\n end", "def deep_hash\n UniMap.deep_hash( self )\n end", "def collection_hierarchy\n @collection_hierarchy ||= \n TraverseAncestors[@collection.first][0..-2].tap do |fields|\n fields << @name\n end\n end", "def course_map\n @course_map ||= all_courses.each_with_object({}) do |course, map|\n if map[course.comp_key]\n map[course.comp_key] << course\n else\n map[course.comp_key] = [course]\n end\n end\n end", "def all_category_hash(item=nil)\n hash = {}\n items = []\n if(!item.nil?)\n for cat in @all_categories\n if(cat.parent_id.eql?(item.id))\n items.push(cat)\n end\n end\n else\n for cat in @all_categories\n if(cat.parent_id.nil?)\n items.push(cat)\n end\n end\n end\n for cat in items\n hash[cat] = all_category_hash(cat)\n end\n return hash\n end", "def root_hash\n self[1]\n end", "def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end", "def to_h\n @root.to_h\n end", "def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end", "def to_hash\n {name: @name, children: @children.map(&:to_hash)}\n end", "def component_dict(name, type: ConfigStruct, key_type: nil, description: nil, &block)\n type = Class.new(type, &block) if block\n component(name, :type => ConfigDict::Factory.new(type, key_type), :description => description)\n end", "def hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\n end", "def to_h\n @hash ||= {name:name, depth:depth}\n end", "def hash\n element.hash\n end", "def get_named_components()\n r = Hash.new\n names = get_component_names\n names.each { |n|\n begin\n r[n] = get_component_any(n)\n rescue\n end\n }\n return r\nend", "def get_named_components()\n r = Hash.new\n names = get_component_names\n names.each { |n|\n begin\n r[n] = get_component_any(n)\n rescue\n end\n }\n return r\nend", "def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end", "def client_state\n {\n \"Collections\" => collections.map do |c|\n {\n \"guid\" => c.guid,\n \"ctag\" => c.ctag,\n }\n end\n }\n end", "def structural_hash\n @structural_hash ||= pure_ruby_hash\n end", "def new_collection\n h = SimpleMapper::Collection::Hash.new\n h.attribute = self\n h\n end", "def serializable_hash\n collection? ? serializable_hash_for_collection : converter.call(@object)\n end", "def hash\n [].hash\n end", "def components\n arr = Arrays.new(@nb) { [] }\n (0...@component.size).each { |v| arr[@component[v]] << v }\n end", "def components\n arr = Arrays.new(@nb) { [] }\n (0...@component.size).each { |v| arr[@component[v]] << v }\n end", "def all_structural_subhashes\n hashes = []\n self.deep_each do |node|\n hashes << node.structural_hash\n end\n hashes\n end", "def to_hash\n log_blocked_facts\n logger.debug(\"Facter version: #{Facter::VERSION}\")\n\n resolved_facts = Facter::FactManager.instance.resolve_facts\n resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? }\n collection = Facter::FactCollection.new.build_fact_collection!(resolved_facts)\n\n # Ensures order of keys in hash returned from Facter.to_hash() and\n # Facter.resolve() is always stable\n if collection.empty?\n Hash[collection]\n else\n Hash[Facter::Utils.sort_hash_by_key(collection)]\n end\n end", "def get_associated_assembly_cmp_refs\n ndx_ret = {}\n get_objs(cols: [:assembly_templates]).each do |r|\n component_template = r[:component_template]\n pntr = ndx_ret[component_template[:id]] ||= component_template.merge(component_refs: [])\n pntr[:component_refs] << r[:component_ref].merge(r.hash_subset(:id, :display_name, :node, :assembly_template))\n end\n ndx_ret.values\n end", "def to_hash\n stack.inject { |h, layer| Util.deep_merge h, layer }\n end", "def to_hash\n @parent_hash.to_hash.merge(self)\n end", "def component_dict(name, options = {}, &block)\n name = name.to_sym\n declared_component_dicts << name\n type = options.fetch(:type, ConfigStruct)\n type = Class.new(type, &block) if block\n type = type.method(:new) if type.respond_to?(:new)\n key_type = options[:key_type]\n key_type = key_type.method(:new) if key_type.respond_to?(:new)\n attribute_initializers[name] = lambda do\n ConfigDict.new(type, key_type)\n end\n attr_reader name\n end", "def hash\n [self.class, dimension, system, name].hash\n end", "def hashify(value)\n case value\n when Hash, OpenStruct\n value.to_h.map { |k, v| [hashify(k), hashify(v)] }.to_h\n when Array\n value.map { |v| hashify(v) }\n else\n value\n end\n end", "def index\n @slug = params[:slug]\n @page = Page.where(:slug => @slug).includes(:page_component).first\n\n @components = Hash.new\n\n @page.page_component.each_with_index do |component, index|\n props_hash = Hash.new\n component.component_content.each_with_index do |prop, prop_index|\n props_hash.merge!({prop.name => prop.value})\n # component_props.push(props_hash)\n end\n @components[@page.page_component[index].react_component.component_name] = props_hash\n end\n\n\n render \"renders/index\"\n end", "def child_hash\n if !@child_hash\n @child_hash = {}\n self.children.each do |i|\n @child_hash[i.name] = i\n end\n end\n\n @child_hash\n end", "def generate_structure hash, parent\n\n if hash.is_a? Hash\n hash.each do |key, value|\n if key == :element\n if parent.class == @window.class\n parent.add(value)\n else\n parent.pack_start(value, true, true)\n end\n elsif key == :buttons\n @buttons.merge! create_buttons value, hash[:element]\n elsif value.is_a? Array\n value.each do |single_value|\n generate_structure single_value, hash[:element]\n end\n elsif value.is_a? Hash\n generate_structure value, hash[:element]\n end\n end\n end\n\n end", "def convertCollectionToHash(collection)\n hash = {}\n collection.each do |model|\n hash[model.id] = model\n end\n return hash\n end", "def convertCollectionToHash(collection)\n hash = {}\n collection.each do |model|\n hash[model.id] = model\n end\n return hash\n end", "def components\n\t\t\t@components ||= []\n\t\tend", "def serializable_hash\n collection? ? @object.map(&converter) : converter.call(@object)\n end", "def hash\n [_hash, name, owner].hash\n end", "def to_hash\n Hash[sort_tuples(section_tuples)]\n end", "def json_serialize\n components = []\n properties = []\n\n @children.each do |_, child_group|\n child_group.each do |child|\n if child.is_a?(Component)\n components << child.json_serialize\n else\n properties << child.json_serialize\n end\n end\n end\n\n [\n @name.downcase,\n properties,\n components\n ]\n end", "def hash\n\t\tvalue.hash\n\tend", "def categories(arg_)\n @config.lock\n\n objdata_ = _get_objdata(arg_)\n return nil unless objdata_\n hash_ = {}\n objdata_[2].each do |tup_, tupcats_|\n tupcats_.each do |cat_|\n hash_[cat_] = @categories[cat_][1].map{ |elem_| tup_[elem_] }\n end\n end\n hash_\n end", "def all_hiera_data\n {}\n end", "def to_hash\n { name => items.collect(&:to_hash) }\n end", "def recursive_to_h(struct)\n if struct.is_a?(Array)\n return struct.map { |v| v.is_a?(OpenStruct) || v.is_a?(Array) || v.is_a?(Hash) ? recursive_to_h(v) : v }\n end\n\n hash = {}\n\n struct.each_pair do |k, v|\n recursive_val = v.is_a?(OpenStruct) || v.is_a?(Array) || v.is_a?(Hash)\n hash[k] = recursive_val ? recursive_to_h(v) : v\n end\n hash\n end", "def hash\n @hash.hash\n end", "def helper(array)\n nest_it = {}\n\n array.each do |k_v_p|\n hashy = {}\n keys_array = parse_key(k_v_p.first)\n value = k_v_p.last\n\n hashy = hashify(keys_array, value) || {}\n nest_it = nest_it.deep_merge(hashy)\n\n end\n\n nest_it\n end", "def hash\n self.class.name.hash\n end", "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "def key_map\r\n hash = {}\r\n hash['id'] = id\r\n hash['name'] = name\r\n hash['description'] = description\r\n hash['contacts'] = contacts.map(&:key_map)\r\n hash['status'] = status\r\n hash['building'] = building.key_map\r\n hash['unit'] = unit.key_map\r\n hash['access'] = access\r\n hash['agency'] = agency\r\n hash['manager'] = manager\r\n hash\r\n end", "def collection_hsh\n collections_hasherizer(source_collections)\n end", "def build_struct_tree data\n data.to_hashugar\n end", "def collection\n Rails.logger.info \"XXXXX COLLECTION NAME #{collection_hash['collection name']}\"\n\n @collection ||= CollectionCreator.find_or_create_collection(\n collection_hash['collection name'],\n collection_hash['unit name'],\n collection_hash['collection description'],\n submitter_user_key\n )\n end", "def to_hash\n co_hash = {\"url_ver\" => openurl_ver, \"url_ctx_fmt\" => \"info:ofi/fmt:kev:mtx:ctx\"}\n\n @admin.each_key do |k|\n co_hash[k] = @admin[k][\"value\"] if @admin[k][\"value\"]\n end\n\n {@referent => \"rft\", @referringEntity => \"rfe\", @requestor => \"req\", @referrer => \"rfr\"}.each do |ent, abbr|\n co_hash.merge!(ent.to_hash(abbr)) unless ent.empty?\n end\n\n # svc and res are arrays of ContextObjectEntity\n {@serviceType => \"svc\", @resolver => \"res\"}.each do |ent_list, abbr|\n ent_list.each do |ent|\n co_hash.merge!(ent.to_hash(abbr)) unless ent.empty?\n end\n end\n co_hash\n end", "def tree_hash\n serializable_hash.merge(children: children.map(&:serializable_hash))\n end", "def tree_hash\n serializable_hash.merge(children: children.map(&:serializable_hash))\n end", "def initial_late_components\n {}\n end", "def hash\n [id, parent_id, sku, upc, ean, mpn, gtin, sort_order, created_time, modified_time, name, short_description, full_description, images, combination, default_price, list_price, wholesale_price, advanced_price, tax_class_id, avail_for_sale, allow_backorders, in_stock, manage_stock, inventory_level, inventory, min_quantity, default_qty_in_pack, is_qty_in_pack_fixed, weight_unit, weight, dimensions_unit, width, height, length, additional_fields, custom_fields].hash\n end", "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def collections\n return self.root_collection.subcollections\n end", "def to_hash\n h = hash.dup\n @hash.each do |name, node|\n h[name] = node.to_hash if node.respond_to? :to_hash\n end\n h\n end", "def hash\n [name, url].hash\n end", "def [](component_key)\n validate_component_key!(component_key)\n components.find { |component| component.key == component_key.to_sym }\n end", "def component_instance(name, strong_config = {})\n @cached_component_instances ||= {}\n @cached_component_instances[name] ||= begin\n composite = self\n name.to_s.split('__').each do |aggr|\n aggr = aggr.to_sym\n component_config = composite.components[aggr]\n raise ArgumentError, \"No component '#{aggr}' defined for component '#{composite.global_id}'\" if component_config.nil?\n short_component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{aggr} of #{composite.global_id}\" if short_component_class_name.nil?\n component_class = constantize_class_name(short_component_class_name)\n\n conf = weak_children_config.\n deep_merge(component_config).\n deep_merge(strong_config). # we may want to reconfigure the component at the moment of instantiation\n merge(:name => aggr)\n\n composite = component_class.new(conf, composite) # params: config, parent\n # composite.weak_children_config = weak_children_config\n # composite.strong_children_config = strong_children_config\n end\n composite\n end\n end", "def get_ordered_template_section_hash(phase_template)\r\n do_last = [] # hard coded list of known components to build last\r\n component_hash = ActiveSupport::OrderedHash.new\r\n last_array = Array.new\r\n template_hash = parse_phase_template(phase_template)\r\n template_hash.each do |section, attrs|\r\n title = attrs['title']\r\n config_error \"Phase template name #{phase_template.name.inspect} does not have a title.\", config if title.blank?\r\n do_last.select {|t| title.start_with?(t)}.blank? ? component_hash[section] = attrs : last_array.push([section, attrs])\r\n end\r\n last_array.each {|section, attrs| component_hash[section] = attrs}\r\n component_hash\r\n end", "def collect\n c = {\n @name => {\n \"color\"=> @color,\n \"hover\"=> @hover,\n \"entries\"=> []\n }\n }\n entries.each{ |e| c[@name]['entries'] << e.collect }\n c\n end", "def to_hash\n case node\n in SyntaxTree::HashLiteral[assocs:]\n in SyntaxTree::BareAssocHash[assocs:]\n else\n raise CompilationError, \"Unexpected node type: #{node.class.name}\"\n end\n\n assocs.to_h do |assoc|\n case assoc\n in SyntaxTree::Assoc[key:, value:]\n [RenderNode.new(key), RenderNode.new(value)]\n else\n raise CompilationError, \"Unexpected node type: #{node.class.name}\"\n end\n end\n end", "def hash\n\t\t\t@path.hash\n\t\tend", "def collect_as_hash\n Hash[collect]\n end", "def member_of_collections_attributes\n # A ChildWork will never be a direct member of a Collection\n return if ['ChildWork', 'Page'].include?(metadata[\"Object Type\"]) || !metadata['Parent ARK']\n arks_array = metadata['Parent ARK'].split('|~|')\n collection = []\n\n arks_array.each_with_index do |current_ark, index|\n ark_string = Ark.ensure_prefix(current_ark.strip)\n collection[index] = Collection.find_or_create_by_ark(ark_string)\n\n unless collection[index].recalculate_size == false\n collection[index].recalculate_size = false\n collection[index].save\n end\n end\n\n collection_return = {}\n collection.each_with_index do |current_collection, index|\n collection_return[index] = { id: current_collection.id }\n end\n\n collection_return\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def nestings\n @nestings ||= {}\n end", "def to_hash\n #Prevent inplace object chane to keep its state\n tohash = @metadata.clone\n #Call appropriate to_hash method for all available controls\n tohash['controls'].map!(&:to_hash)\n #Call appropriate to_hash method for all available connections\n tohash['connections'].map!(&:to_hash) unless tohash['connections'].nil?\n tohash\n end", "def components\n return @components\n end", "def hash\n [compute, group_by, index, multi_compute, search].hash\n end", "def hashify(element)\n if element.is_a? Hash\n element = element.to_hash if element.is_a?(HashWithIndifferentAccess)\n element.each_pair do |key, value|\n element[key] = hashify(value)\n end\n else\n # Must hashify enumerables encase their sub items are hashes\n # Can't enumerate through string as it returns strings, which are also enumerable (stack level too deep)\n if element.respond_to?(:each) && !element.is_a?(String)\n element.map{ |sub| hashify(sub) }\n else\n element\n end\n end\n end", "def generate_structure( value )\n part = {}\n unless value.has_key?( \"children\" )\n return [] if value[\"unbounded\"]\n return \"\"\n else\n value[\"children\"].each do | key, value |\n part[key] = generate_structure(value)\n end \n end\n \n return [part] if value[\"unbounded\"]\n part \n end", "def to_hash\n @items.group_by(&:context).inject({}) do |h,(k,v)|\n h[k.to_sym] = v.map(&:text); h\n end\n end", "def components\n\t\t\t\treturn @components.values unless (@components.nil?)\n\t\t\t\treturn nil\n\t\t\tend" ]
[ "0.7067134", "0.6437694", "0.6353984", "0.62929446", "0.6229039", "0.61670494", "0.60478646", "0.6025765", "0.5885588", "0.5747066", "0.57324773", "0.5726092", "0.5709676", "0.5709676", "0.56744725", "0.5565158", "0.55234265", "0.5518212", "0.55058384", "0.5493041", "0.54594284", "0.54551584", "0.5400405", "0.5378457", "0.53476065", "0.5340878", "0.5333087", "0.5309298", "0.5304521", "0.5301198", "0.53004605", "0.5289032", "0.5285841", "0.52771336", "0.52771336", "0.52762955", "0.5271212", "0.52660877", "0.52500844", "0.5249706", "0.52495927", "0.5244063", "0.5244063", "0.52402717", "0.52391213", "0.5229849", "0.521716", "0.519886", "0.5186643", "0.51817125", "0.5181284", "0.5178245", "0.51687354", "0.51641667", "0.516197", "0.516197", "0.5161343", "0.51598406", "0.51483244", "0.51479113", "0.5147756", "0.5142903", "0.5138937", "0.5137656", "0.5131894", "0.5120303", "0.5117702", "0.5117273", "0.5113672", "0.51094383", "0.51037514", "0.5102822", "0.5101096", "0.5099307", "0.50793153", "0.5077332", "0.5077332", "0.50723773", "0.50634706", "0.50596225", "0.50596225", "0.50494057", "0.50428224", "0.50312626", "0.50233686", "0.5023079", "0.50200135", "0.50187546", "0.5015499", "0.50150704", "0.5011499", "0.501118", "0.5007223", "0.50049245", "0.500343", "0.49969813", "0.49930438", "0.49919432", "0.4990305", "0.49828997", "0.49771377" ]
0.0
-1
This method adds an +after_validation+ callback. ==== Parameters +polymorphic_association_name+ Name of the tree polumorphic association with container and component as the name of polymorphic attributes +type+ The component type in which to look for collection +collection_name+ The association name that should be used for fetching collection. +attribute+ The attribute name on the association that should be validated. +options+ It accepts all options that `UniqunessValidator` accepts. Defaults to no options. Supports scope and case_sensitive options
def validates_uniqueness_in_memory_for_tree_polymorphism(polymorphic_association_name, type, collection_name, attribute, options = {}) after_validation do validate_unique_nested_attributes_for_tree_polymorphism self, polymorphic_association_name, type, collection_name, attribute, options end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_unique_nested_attributes_for_tree_polymorphism(parent, polymorphic_association_name, type, collection_name, attribute, options = {})\n types_with_collection = find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name)\n return true if types_with_collection.blank?\n\n build_default_options(options)\n\n # Maintains unique values for complete collection\n hash = {}\n\n types_with_collection.each do |component, collection|\n validate_unique_attribute_in_collection(parent, attribute, collection, options, hash)\n end\n end", "def add_association_callback association, hook, callback\n\n if association.options[hook]\n old_callbacks = Array(association.options[hook])\n association.options[hook] = [callback] + old_callbacks\n else\n association.options[hook] = [callback]\n end\n\n association.active_record.send(\n :add_association_callbacks,\n association.name,\n association.options\n )\n\n end", "def validate_collection_association(reflection)\n if association = association_instance_get(reflection.name)\n if records = associated_records_to_validate_or_save(association, new_record?, reflection.options[:autosave])\n records.each_with_index { |record, index| association_valid?(reflection, record, index) }\n end\n end\n end", "def run_association_callbacks(reflection, callback_type, object)\n # The reason we automatically set raise_error for singular associations is that\n # assignment in ruby always returns the argument instead of the result of the\n # method, so we can't return nil to signal that the association callback prevented\n # the modification\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove, :before_set].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n\n if res == false and stop_on_false\n Sequel::Deprecation.deprecate(\"Having #{callback_type} association callback return false to cancel modification\", \"Instead, call Model#cancel_action inside the association callback\")\n raise(HookFailed, \"Unable to modify association for #{inspect}: one of the #{callback_type} hooks returned false\")\n end\n end\n rescue HookFailed\n return false unless raise_error\n raise\n end", "def validate_unique_nested_attributes(parent, collection, attribute, options = {})\n return true if collection.empty?\n\n build_default_options(options)\n validate_unique_attribute_in_collection(parent, attribute, collection, options)\n end", "def run_association_callbacks(reflection, callback_type, object)\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n if res == false and stop_on_false\n save_failure(\"modify association for\", raise_error)\n return false\n end\n end\n end", "def save_collection_association(reflection)\n if association = association_instance_get(reflection.name)\n autosave = reflection.options[:autosave]\n\n # By saving the instance variable in a local variable,\n # we make the whole callback re-entrant.\n new_record_before_save = @new_record_before_save\n\n # reconstruct the scope now that we know the owner's id\n association.reset_scope\n\n if records = associated_records_to_validate_or_save(association, new_record_before_save, autosave)\n if autosave\n records_to_destroy = records.select(&:marked_for_destruction?)\n records_to_destroy.each { |record| association.destroy(record) }\n records -= records_to_destroy\n end\n\n records.each do |record|\n next if record.destroyed?\n\n saved = true\n\n if autosave != false && (new_record_before_save || record.new_record?)\n association.set_inverse_instance(record)\n\n if autosave\n saved = association.insert_record(record, false)\n elsif !reflection.nested?\n association_saved = association.insert_record(record)\n\n if reflection.validate?\n errors.add(reflection.name) unless association_saved\n saved = association_saved\n end\n end\n elsif autosave\n saved = record.save(validate: false)\n end\n\n raise(RecordInvalid.new(association.owner)) unless saved\n end\n end\n end\n end", "def auto_remove_callback\n @auto_remove_callback ||=\n (user_configuration_from_key('auto_remove_callback') || 'after_destroy')\n end", "def add_autosave_association_callbacks(reflection)\n save_method = \"autosave_associated_records_for_#{reflection.name}\"\n validation_method = \"validate_associated_records_for_#{reflection.name}\"\n force_validation = (reflection.options[:validate] == true || reflection.options[:autosave] == true)\n\n case reflection.macro\n when :has_many, :has_and_belongs_to_many, :has_many_polymorphs # hmp-added\n before_save :before_save_collection_association\n\n define_method(save_method) { save_collection_association(reflection) }\n # Doesn't use after_save as that would save associations added in after_create/after_update twice\n after_create save_method\n after_update save_method\n\n if force_validation || (reflection.macro == :has_many && reflection.options[:validate] != false)\n define_method(validation_method) { validate_collection_association(reflection) }\n validate validation_method\n end\n else\n case reflection.macro\n when :has_one\n define_method(save_method) { save_has_one_association(reflection) }\n after_save save_method\n when :belongs_to\n define_method(save_method) { save_belongs_to_association(reflection) }\n before_save save_method\n end\n\n if force_validation\n define_method(validation_method) { validate_single_association(reflection) }\n validate validation_method\n end\n end\n end", "def add_autosave_association_callbacks(reflection)\n save_method = :\"autosave_associated_records_for_#{reflection.name}\"\n\n if reflection.collection?\n around_save :around_save_collection_association\n\n define_non_cyclic_method(save_method) { save_collection_association(reflection) }\n # Doesn't use after_save as that would save associations added in after_create/after_update twice\n after_create save_method\n after_update save_method\n elsif reflection.has_one?\n define_non_cyclic_method(save_method) { save_has_one_association(reflection) }\n # Configures two callbacks instead of a single after_save so that\n # the model may rely on their execution order relative to its\n # own callbacks.\n #\n # For example, given that after_creates run before after_saves, if\n # we configured instead an after_save there would be no way to fire\n # a custom after_create callback after the child association gets\n # created.\n after_create save_method\n after_update save_method\n else\n define_non_cyclic_method(save_method) { throw(:abort) if save_belongs_to_association(reflection) == false }\n before_save save_method\n end\n\n define_autosave_validation_callbacks(reflection)\n end", "def add_association(type, class_name, name)\n define_method(name) do\n Associations::Factory.create(type, name, self)\n end\n define_method(\"#{name}=\") do |object|\n object.parentize(self, name)\n @attributes[name] = object.mongoidize\n end\n end", "def has_custom_object association_name, options = {}, &block \n if block_given?\n class_name = \"#{self.name}#{association_name.to_s.singularize.camelcase}\"\n create_class(class_name, CustomObject, &block) #unless defined?(class_name.classify.constantize)\n \n has_many association_name, :class_name=>class_name, :as => :customizable, :dependent => :destroy\n else\n raise \"no block given, which defines a CustomObject subclass\"\n end\n end", "def associations_before_validation_and_save\n collapse_associations # make obsolete ones = nil\n #\n # TODO: conflicting with 1.6.0 pre-quality. removed to check compatiblity or related errors\n # for remaining, fill login, password details only when login is empty\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each {|user| autofill_user_login( user) }\n #\n # Fri Nov 12 18:12:01 IST 2010, ramonrails\n # * these are mandatory to dispatch emails in user model\n # * a user must know the role while saving itself\n # assign roles to user objects. it will auto save the roles with user record\n # TODO: use this instead of association_after_save that is assigning roles\n self.senior.lazy_roles[:halouser] = group unless senior.blank? # senior.is_halouser_of group\n self.subscriber.lazy_roles[:subscriber] = senior unless subscriber.blank?\n self.caregiver1.lazy_roles[:caregiver] = senior unless caregiver1.blank?\n self.caregiver2.lazy_roles[:caregiver] = senior unless caregiver2.blank?\n self.caregiver3.lazy_roles[:caregiver] = senior unless caregiver3.blank?\n self.caregiver1.lazy_options[ senior ] = mem_caregiver1_options\n self.caregiver2.lazy_options[ senior ] = mem_caregiver2_options\n self.caregiver3.lazy_options[ senior ] = mem_caregiver3_options\n #\n # # now collect the users for save as associations\n # self.users = [senior, subscriber, caregiver1, caregiver2, caregiver3].uniq.compact # omit nil, duplicates\n end", "def after_validate\n end", "def after_save\n validate_uniqueness_as_run(:name)\n end", "def synced_destroy(association)\n set_callback(\n :destroy,\n :after\n ) do |doc|\n doc.remove_inverse_keys(association)\n end\n self\n end", "def before_after_callbacks_rule\n @before_after_callbacks_rule ||= CallbacksRule.new(self)\n end", "def define_touchable!(association)\n name = association.name\n method_name = define_relation_touch_method(name, association)\n association.inverse_class.tap do |klass|\n klass.after_save method_name\n klass.after_destroy method_name\n\n # Embedded docs handle touch updates recursively within\n # the #touch method itself\n klass.after_touch method_name unless association.embedded?\n end\n end", "def after(*hooks)\n self.class.new(relation, **options, after: after_hooks + hooks)\n end", "def around_save_collection_association\n previously_new_record_before_save = (@new_record_before_save ||= false)\n @new_record_before_save = !previously_new_record_before_save && new_record?\n\n yield\n ensure\n @new_record_before_save = previously_new_record_before_save\n end", "def define_after_destroy_callback(klass)\n # Clean up *all* leftover translations of this model, only once.\n b = self\n translation_classes = [class_name, *Mobility::Backends::Sequel::KeyValue::Translation.descendants].uniq\n klass.define_method :after_destroy do\n super()\n\n @mobility_after_destroy_translation_classes = [] unless defined?(@mobility_after_destroy_translation_classes)\n (translation_classes - @mobility_after_destroy_translation_classes).each do |translation_class|\n translation_class.where(:\"#{b.belongs_to}_id\" => id, :\"#{b.belongs_to}_type\" => self.class.name).destroy\n end\n @mobility_after_destroy_translation_classes += translation_classes\n end\n end", "def collection_of(attrib, *options)\n opts = merge_belongs_to_association_options(attrib, options.first)\n opts[:foreign_key] = opts[:foreign_key].pluralize\n opts[:readonly] = true\n\n property(opts[:foreign_key], [String], opts)\n\n create_association_property_setter(attrib, opts)\n create_collection_of_getter(attrib, opts)\n create_collection_of_setter(attrib, opts)\n end", "def synced_save(association)\n set_callback(\n :save,\n :after,\n if: ->(doc) { doc._syncable?(association) }\n ) do |doc|\n doc.update_inverse_keys(association)\n end\n self\n end", "def validate_creation_complete(association_class)\n association = association_class.validate_creation_complete(self)\n propagate_errors_up(association, true)\n end", "def before_validation_callback\n end", "def validates_duplicity_of(attr_name, scope: nil)\n set_callback :save, :before, Callback.new(attr_name, scope)\n end", "def uhook_categorized_with field, options\n association_name = field.to_s.pluralize.to_sym\n if self.is_translatable?\n share_translations_for association_name\n # overwrite the aliased methods since now should use the i18n methods\n if field.to_s != association_name\n alias_method field, association_name\n alias_method \"#{field}=\", \"#{association_name}=\"\n end\n end\n end", "def after_validation_on_create #:nodoc:\n soa = SOA.new( :domain => self )\n SOA_FIELDS.each do |f|\n soa.send( \"#{f}=\", send( f ) )\n end\n soa.serial = serial unless serial.nil? # Optional\n \n unless soa.valid?\n soa.errors.each_full do |e|\n errors.add_to_base e\n end\n end\n end", "def validate( options={} )\n\t\toptions = DEFAULT_VALIDATION_OPTIONS.merge( options )\n\n\t\tself.before_validation or\n\t\t\traise Treequel::BeforeHookFailed, :validation\n\t\tself.errors.add( :objectClass, 'must have at least one' ) if self.object_classes.empty?\n\n\t\tsuper( options )\n\t\tself.log.debug \"Validations failed:\\s %s\" % [ self.errors.full_messages.join(\"\\n \") ] if\n\t\t\tself.errors.count.nonzero?\n\n\t\tself.after_validation\n\tend", "def destroyed_by_association=(reflection)\n @destroyed_by_association = reflection\n end", "def build_callback_to_dependee_model\n last_association_chain = @quickery_builder.association_chains.last\n last_association_chain.model.quickery_association_chain_dependees ||= []\n last_association_chain.model.quickery_association_chain_dependees << last_association_chain\n end", "def child_association(method)\n if @resource_config[:child_assoc]\n raise DefinitionError, \"child_association already declared in #{self}\"\n end\n @resource_config[:child_assoc] = method\n end", "def define_association(assoc, options = {:view => {}, :summary => {}})\n return {:summary => :none} if options[:summary] == :none\n case assoc.macro\n when :has_one, :belongs_to\n if assoc.options[:polymorphic]\n [:polymorphic_select, :name]\n else\n [:select, :name]\n end\n when :has_many, :has_and_belongs_to_many\n if assoc.options[:polymorphic]\n [:polymorphic_membership, :count]\n else\n [:membership, :count]\n end \n end\n end", "def association\n @association ||= options[:association]\n end", "def validate_single_association(reflection)\n association = association_instance_get(reflection.name)\n record = association && association.reader\n association_valid?(reflection, record) if record && (record.changed_for_autosave? || custom_validation_context?)\n end", "def after_build\n end", "def run_callbacks(name, *args, &block)\n # validation is already propagated to embedded documents via the\n # AssociatedValidator. We don't need to duplicate the propagation here.\n return super if name == :validation\n\n propagate_callbacks_to_embedded_associations(name, :before)\n return_value = super\n propagate_callbacks_to_embedded_associations(name, :after)\n return_value\n end", "def after_save \n return unless @owner\n\n unless owner_role.nil?\n owner_role.users.each do |user|\n accepts_no_role!( :owner, user ) # unassign previous owners\n end\n end\n \n accepts_role!( :owner, @owner ) # assign new owner\n\n # clean up\n self.reload\n @owner = nil\n end", "def autosets_owner_on_create\n has_owner # this will do nothing if the user has already set up has_owner :something\n # the hook runs before validation so we can validate_associated\n before_validation_on_create :autoset_owner\n end", "def bay_area_callbacks\n [{\n conditions: [{key: 'partial', match: 'title'}, {key: 'name', match: 'gradeLevels'}],\n callback_type: 'append_to_children',\n options: {\n s: {label: 'Super Senior', partial: :basic_checkbox, name: :gradeLevels, value: :s},\n }\n }]\n end", "def validate_event_complete(association_class)\n association = association_class.validate_event_complete(self)\n propagate_errors_up(association, true)\n end", "def define_save_callbacks(klass, attributes)\n b = self\n callback_methods = Module.new do\n define_method :before_save do\n super()\n send(b.association_name).select { |t| attributes.include?(t.__send__(b.key_column)) && Util.blank?(t.__send__(b.value_column)) }.each(&:destroy)\n end\n define_method :after_save do\n super()\n attributes.each { |attribute| mobility_backends[attribute].save_translations }\n end\n end\n klass.include callback_methods\n end", "def call_reject_if(association_name, attributes)\n return false if will_be_destroyed?(association_name, attributes)\n\n opts = nested_attributes_options[association_name]\n case callback = opts[:reject_if]\n when Symbol\n method(callback).arity.zero? ? send(callback) : send(callback, attributes)\n when Proc\n callback.call(attributes)\n end\n end", "def enforce_type(type)\n\n dynamic_methods = proc do |dyn_type|\n\n define_method :get_type do\n dyn_type\n end\n\n def push(obj)\n if obj.instance_of? get_type\n super\n else\n raise WrongElementType,\n wrong_element_error_message(obj, get_type)\n end\n end\n\n def wrong_element_error_message(obj, type)\n \"The #{obj.class}, '#{obj}' is not a valid\" \\\n \" element for the #{self.class} collection.\" \\\n \" The element must be a #{type}.\"\n end\n\n def initialize(obj=nil)\n if obj.nil?\n super()\n else\n seq = super\n unless self.all_correct_types?(seq)\n raise WrongInitializationType,\n wrong_initialization_error_message(seq, get_type)\n end\n seq\n end\n end\n\n def all_correct_types?(seq)\n seq.all? {|i| i.instance_of? get_type}\n end\n\n def wrong_initialization_error_message(seq, type)\n contains_one = \" It contains a #{seq.first.class}\" \\\n \" but only elements of the #{type}\" \\\n \" type are allowed.\"\n contains_many = \" It contains elements which are\" \\\n \" not of the allowed type #{type}.\"\n \"The Array, #{seq} cannot be used to initialize\" \\\n \" an instance of #{self.class}.\".concat(\n seq.length.eql?(1) ? contains_one : contains_many)\n end\n end\n\n prepend_module = Module.new\n prepend_module.module_exec(type, &dynamic_methods)\n prepend_module\n end", "def attribute_type #nodoc\n case @options[:association]\n when :has_many then Associations::HasMany\n when :belongs_to then Associations::BelongsTo\n when :has_one then Association::HasOne\n when :has_and_belongs then Association::HasAndBelongs\n else Property\n end\n end", "def define_relation_touch_method(name, association)\n relation_classes = if association.polymorphic?\n association.send(:inverse_association_classes)\n else\n [ association.relation_class ]\n end\n\n method_name = \"touch_#{name}_after_create_or_destroy\"\n association.inverse_class.class_eval do\n define_method(method_name) do\n without_autobuild do\n if !touch_callbacks_suppressed? && relation = __send__(name)\n # This looks up touch_field at runtime, rather than at method definition time.\n # If touch_field is nil, it will only touch the default field (updated_at).\n relation.touch(association.touch_field)\n end\n end\n end\n end\n method_name.to_sym\n end", "def sanitize_has_many(association_name)\n association_name = association_name.to_s\n singular_name = association_name.singularize\n nested_name = \"#{association_name}_attributes\"\n klass = association_name.singularize.camelize.constantize\n remap singular_name => nested_name\n remap association_name => nested_name\n ensure_array nested_name\n sanitize_nested_attributes nested_name => klass\n end", "def after(event, callback)\n install_hook(:after, event, callback)\n end", "def handle_association_links\n @type = @normalized_type = @subtype\n obj = model.with_pk(@type, request, request.id)\n association_links(obj)\n end", "def after(which=:each, *tags, &procedure)\n @_hooks.add(:after, which, *tags, &procedure)\n end", "def after(method_to_hook, method_to_call = nil, options = {}, &block)\n add(:after, method_to_hook, method_to_call, options, &block)\n end", "def generate_association_writer(association_name, type)\n generated_association_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1\n if method_defined?(:#{association_name}_attributes=)\n remove_method(:#{association_name}_attributes=)\n end\n def #{association_name}_attributes=(attributes)\n assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes)\n end\n eoruby\n end", "def after_destroy\n super\n touch_associations\n end", "def add_callback(rule, blk)\n return unless include?(rule)\n @rules[rule].callbacks << blk\n end", "def has_many(association, **options, &block)\n create_association(:has_many, association, options, &block)\n end", "def sortable_belongs_to(container, scope_or_options = nil,\n options_with_scope = {}, &extension)\n scope, options = extract_association_params(scope_or_options, options_with_scope)\n on = options[:on] || :sort_position\n\n class_exec do\n belongs_to container, scope, options.except(:on, :scope), &extension\n\n reflection = reflect_on_association(container)\n options[:scope] ||= reflection.polymorphic? ? \\\n [reflection.foreign_type,\n reflection.foreign_key] : \\\n reflection.foreign_key\n options[:inverse_of] ||= reflection.inverse_of.try(:name)\n\n validates on, presence: true,\n numericality: { only_integer: true,\n greater_than: 0 },\n uniqueness: { scope: options[:scope] }\n end\n\n options[:container] = container\n sortable_methods(options)\n end", "def init_validation\n @tag = Valid.get_association self, :id\n end", "def after_column(options={},&block)\n new_dynamic_callback(:after_column,options,&block)\n end", "def parentize(object, association_name)\n self.parent = object\n self.association_name = association_name\n add_observer(object)\n end", "def observe_dynamically_loaded_field(field_id, options={}) # :nodoc\n f = options.delete(:function)\n unless(f)\n f = \"function(event){ new Ajax.Request('#{escape_javascript(@context.url_for(options[:url]).to_s)}', {asynchronous:true, evalScripts:true,parameters:'#{escape_javascript(options[:with].to_s)}='+$('#{escape_javascript(options[:with].to_s)}').getValue()})}\"\n else\n f = \"function(event){ #{f}; }\"\n end\n self << \"if($('#{escape_javascript(field_id.to_s)}').length){ $('#{escape_javascript(field_id.to_s)}').observe('change', #{f}); }\"\n end", "def a_une( klass, arg = nil )\n DBC.require( klass.class == Class,\n \"*** L'argument a a_une doit etre une classe:\n klass = #{klass} (.class = #{klass.class}) \" )\n\n association = klass.to_s.downcase.to_sym\n\n definir_reader_et_writer( association )\n set_attribut association, arg\n\n # Validation: ne doit pas etre nil et doit etre de la bonne classe.\n @validations[association] = lambda do\n (a = get_attribut association) &&\n a.kind_of?( klass )\n end\n\n self\n end", "def eager_graph_check_association(model, association)\n if association.is_a?(SQL::AliasedExpression)\n SQL::AliasedExpression.new(check_association(model, association.expression), association.alias)\n else\n check_association(model, association)\n end\n end", "def add relation, &block\n b = relation.factorization.to_bin\n @mutex.synchronize do\n if @uniqe[b]\n @relations << relation\n @uniqe[b] = false\n end\n yield if block_given? # executes the given code block\n end\n end", "def add_solr_eager_loaded_association association_name\n name = association_name.to_s\n unless self.solr_eager_loaded_associations.include?(name)\n self.solr_eager_loaded_associations << name\n end\n end", "def add_callback(type, options, &block); end", "def _before_validation\n end", "def build_callback_to_depender_model\n first_association_chain = @quickery_builder.association_chains.first\n first_association_chain.model.quickery_association_chain_dependers ||= []\n first_association_chain.model.quickery_association_chain_dependers << first_association_chain\n end", "def append_after(*args, &proc)\n add_callback(:append_after, *args, &proc)\n end", "def associations_after_save\n # # WARNING: the associations here are not using active_record, so they are not auto saved with user intake\n # # we are saving the associations manually here\n # collapse_associations # make obsolete ones = nil\n #\n # TODO: conflicting with 1.6.0 pre-quality. removed to check compatiblity or related errors\n # for remaining, fill login, password details only when login is empty\n # This is a 3 step process\n # \n # Thu Nov 11 00:14:24 IST 2010, ramonrails\n # Link per user, once only. compact.uniq ensures that\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # Sat Nov 20 02:03:52 IST 2010, ramonrails\n # * this logic is required when uset simply toggles the flag and saves\n _user = self.send( _what) # fetch the associated user\n unless _user.blank? || _user.nothing_assigned?\n # * default properties\n _user.autofill_login # create login and password if not already\n _user.lazy_associations[:user_intake] = self\n _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n\n case _what\n when 'senior'\n # _user.save\n # _user.is_halouser_of( group) unless _user.blank? || group.blank? # role\n _user.lazy_roles[:halouser] = group unless _user.blank? || group.blank? # role\n _user.save\n \n when 'subscriber'\n if subscribed_for_self? # senior is same as subscriber\n if was_subscribed_for_self?\n # * user and subscriber are same. not changed\n else\n # * subscriber was different. now same as senior\n self.subscriber_is_user = false # create old condition\n subscriber.is_not_subscriber_of( senior) unless subscriber.blank? || senior.blank? # remove old role first\n # subscriber.delete # remove this extra user\n self.subscriber_is_user = true # back to current situation\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n\n else # senior different from subscriber\n if was_subscribed_for_self?\n _user = senior.clone_with_profile if senior.equal?( subscriber) # same IDs, clone first\n senior.is_not_subscriber_of( senior) unless senior.blank? # senior was subscriber, not now\n else\n # all good. nothing changed\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n end\n \n when 'caregiver1'\n if caregiving_subscriber? # subscriber is caregiver\n if was_caregiving_subscriber?\n # all good. nothing changed\n else\n # was separate\n self.subscriber_is_caregiver = false # make old condition\n caregiver1.is_not_caregiver_of( senior) unless caregiver1.blank? || senior.blank?\n # caregiver1.delete # remove extra\n self.subscriber_is_caregiver = true # current condition again\n end\n \n else # subscriber different from caregiver1\n if was_caregiving_subscriber?\n _user = subscriber.clone_with_profile if subscriber.equal?( caregiver1) # same ID? clone first\n subscriber.is_not_caregiver_of( senior) unless subscriber.blank? || senior.blank? # remove caregiving role for subscriber\n else\n # all good. nothing changed\n end\n end\n if caregiving_subscriber? || (caregiver1_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior))\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver1_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver1_options\n _user.save\n # else\n # self.no_caregiver_1 = true\n # self.send(:update_without_callbacks)\n end\n \n when 'caregiver2'\n if caregiver2_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver2_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver2_options\n _user.save\n else\n self.no_caregiver_2 = true\n self.send(:update_without_callbacks)\n end\n\n when 'caregiver3'\n if caregiver3_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver3_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver3_options\n _user.save\n else\n self.no_caregiver_3 = true\n self.send(:update_without_callbacks)\n end\n end # case\n end # blank?\n end # _what\n \n # \n # Thu Jan 13 02:38:38 IST 2011, ramonrails\n # * Not required anymore\n # * lazy_associations attaches each user to this user intake\n # #\n # # * replace earlier associations. keep fresh ones\n # # * do not create duplicate associations\n # # QUESTION: what happens to orphaned users here?\n # # * reject new_record? anything not saved does not get assigned\n # # * only associate one copy of each\n # self.users = [senior, subscriber, caregiver1, caregiver2, caregiver3].reject(&:new_record?).compact.uniq\n # # # \n # # # Thu Jan 13 02:34:27 IST 2011, ramonrails\n # # # * pre_quality.feature had error dispatching emails\n # # # * This might dispatch the email more than once\n # # self.users.each(&:dispatch_emails)\n\n\n # [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # # \n # # Fri Nov 19 03:17:32 IST 2010, ramonrails\n # # * skip saving the object if already saved\n # # * happens when object is shared. subscriber == user, or, subscriber == caregiver\n # # * saving also dispatches emails. A few more triggers/callbacks. Please check model code\n # _skip = ((_what == 'subscriber') && subscribed_for_self?)\n # _skip = (_skip || (_what == 'caregiver1' && caregiving_subscriber?))\n # # \n # # Thu Nov 11 00:32:18 IST 2010, ramonrails\n # # Do not save any non-assigned data, or blank ones\n # unless _user.blank? || _user.nothing_assigned? || _skip\n # _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n # \n # # _user.autofill_login # Step 1: make them valid\n # if _user.save # Step 2: save them to database\n # # \n # # Thu Nov 11 00:13:31 IST 2010, ramonrails\n # # https://redmine.corp.halomonitor.com/issues/3696\n # # caused a bug that created multiple links to the same user\n # self.users << _user unless users.include?( _user) # Step 3: link them to user intake\n # end\n # end\n # end\n # #\n # # * add roles and options\n # # * roles are already handled by user model\n # # * this will not double write the roles\n # # senior\n # senior.is_halouser_of( group) unless senior.blank?\n # # subscriber\n # unless senior.blank? || subscriber.blank?\n # subscriber.is_subscriber_of( senior)\n # subscriber.is_caregiver_of( senior) if caregiving_subscriber?\n # end\n # # Wed Oct 27 23:55:22 IST 2010\n # # * no need to check subscriber_is_caregiver here. that is done in caregiver1 method\n # # * just call for each caregiver and assign position and other options\n # (1..3).each do |index|\n # _caregiver = self.send(\"caregiver#{index}\".to_sym)\n # _required = self.send(\"caregiver#{index}_required?\")\n # unless (_caregiver.blank? || !_required || _caregiver.nothing_assigned?)\n # _caregiver.is_caregiver_of( senior) unless _caregiver.is_caregiver_of?( senior)\n # # \n # # Thu Nov 4 05:57:16 IST 2010, ramonrails\n # # user values were stored with apply_attributes_from_hash\n # # now we persist them into database\n # _options = self.send(\"mem_caregiver#{index}_options\")\n # # \n # # Thu Nov 18 20:58:29 IST 2010, ramonrails\n # # * Do not use any other method here, cyclic dependency can occur\n # _caregiver.options_for_senior( senior, _options)\n # end\n # end\n\n end", "def after_set_callback; end", "def preconditions\n validator.kind == :uniqueness\n end", "def lowercase_inclusion_validator(attribute, collection, blank_ok = true)\n return if (var = eval(attribute.to_s)).blank? && blank_ok\n\n if !collection.include?(var.try(:downcase))\n errors.add(attribute, \"#{var} not in [#{collection.join(', ')}]\")\n end\n end", "def validation_hook_during_update_tree(kd_el)\n # override this method in validating subclass of self\n end", "def after_create_hook\n execute_hooks_for(:after, :create)\n end", "def after_hooks\n options[:after]\n end", "def validate_entity_association\n ids = [self.unit_id, self.collection_id, self.item_id].reject(&:nil?).length\n if ids > 1\n errors.add(:base, \"Instance can be associated with only one entity\")\n elsif ids == 0\n errors.add(:base, \"Instance must be associated with an entity\")\n end\n end", "def has_slug(attribute, options = {})\n options.assert_valid_keys(VALID_HAS_SLUG_OPTIONS)\n \n options = DEFAULT_HAS_SLUG_OPTIONS.merge(options).merge(:attribute => attribute)\n \n if defined?(has_slug_options)\n Rails.logger.error \"has_slug_options is already defined, you can only call has_slug once. This call has been ignored.\"\n else\n write_inheritable_attribute(:has_slug_options, options)\n class_inheritable_reader(:has_slug_options)\n\n if columns.any? { |column| column.name.to_s == options[:slug_column].to_s }\n require 'has_slug/sluggable_class_methods'\n require 'has_slug/sluggable_instance_methods'\n\n extend SluggableClassMethods\n include SluggableInstanceMethods\n\n before_save :set_slug,\n :if => :new_slug_needed?\n else\n require 'has_slug/not_sluggable_class_methods'\n require 'has_slug/not_sluggable_instance_methods'\n\n extend NotSluggableClassMethods\n include NotSluggableInstanceMethods\n end \n end\n end", "def before_validation\n\t\tunique_species = self.potential_species.uniq\n\t\tself.potential_species.clear\n\t\tself.potential_species = unique_species\n\tend", "def end_of_association_chain\n parent? ? parent_association : model\n end", "def sub_validate(sub_association, attributes)\n return unless @validate_others\n\n sub_association.validates_presence_of attributes\n propagate_errors_up(sub_association, true)\n end", "def after_create(obj); end", "def has_many_update data, relation\n data = { model.compare => ''}.merge data\n\n if relation.blank?\n warn \"[ARRGUMENT MISSING]: 'has_many_update' don't know about current relation, and check all relations\"\n end\n\n has_many_cleaner data.symbolize_keys, relation\n end", "def has_one(association_name, options = {})\n database.schema[self].associations << HasManyAssociation.new(self, association_name, options)\n end", "def check_association(model, association)\n raise(Sequel::UndefinedAssociation, \"Invalid association #{association} for #{model.name}\") unless reflection = model.association_reflection(association)\n raise(Sequel::Error, \"Eager loading is not allowed for #{model.name} association #{association}\") if reflection[:allow_eager] == false\n reflection\n end", "def validate(field, list_attribute)\n generate_validation_scripts unless @scripts_added\n @id_generator.generate_id(field)\n @script_list_fields_with_validation.append_text(\n \"hatemileValidationList.#{list_attribute}.push(\" \\\n \"'#{field.get_attribute('id')}');\"\n )\n end", "def detect_association(c)\n assoc, assoc_method = assoc_and_assoc_method_for_column(c)\n if assoc\n assoc_column = assoc.klass.columns_hash[assoc_method]\n assoc_method_type = assoc_column.try(:type)\n\n # if association column is boolean, display a checkbox (or alike), otherwise - a combobox (or alike)\n if c[:nested_attribute]\n c[:editor] ||= editor_for_attr_type(assoc_method_type)\n else\n c[:editor] ||= assoc_method_type == :boolean ? editor_for_attr_type(:boolean) : editor_for_association\n c[:assoc] = true\n end\n end\n end", "def has_many_with_protect(association_id, options = {}, &extension) #:nodoc:\n reflection = create_reflection(:has_many, association_id, options, self)\n \n # This would break if has_many :dependent behaviour changes. One\n # solution is removing both the second when and the else branches but\n # the exception message wouldn't be exact.\n case reflection.options[:dependent]\n when :protect\n module_eval \"before_destroy 'raise ReferentialIntegrityProtectionError, \\\"Can\\\\'t destroy because there\\\\'s at least one #{reflection.class_name} in this #{self.class_name}\\\" if self.#{reflection.name}.find(:first)'\"\n options.delete(:dependent)\n when true, :destroy, :delete_all, :nullify, nil, false\n #pass\n else\n raise ArgumentError, 'The :dependent option expects either true, :destroy, :delete_all, :nullify or :protect'\n end\n\n has_many_without_protect(association_id, options, &extension)\n end", "def destroy_slugs_after(options = {})\n\n\t\t\t\t\t# Propagate to other models\n\t\t\t\t\tif options[:disable_propagation] != true\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Propagate to parent\n\t\t\t\t\t\tself.parent.generate_slugs(disable_propagation: true) if self.parent\n\n\t\t\t\t\tend\n\n\t\t\t\tend", "def scrooge_seen_association!( association )\n if @owner.scrooged? && !@loaded\n @owner.class.scrooge_callsite(callsite_signature).association!(association, @owner.id)\n end\n end", "def owner_association\n owner_ref(self).send(owner_association_name.to_sym)\n end", "def scaffold_association_use_auto_complete(association)\n scaffold_associated_class(association).scaffold_use_auto_complete\n end", "def collection(name, option={})\n option = {\n :each => :hash\n }.update(option)\n option[:is_a] = :collection\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n define_validations(name, option)\n end", "def after(type=:each, &block)\n raise ArgumentError, \"invalid after-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"after_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(:teardown)\n define_method(type_method, &block)\n end", "def after_remove_asset_callback(asset)\n # Check to see if this is rehab or replacement ALI\n if rehabilitation_ali?\n self.estimated_cost -= asset.policy_analyzer.get_total_rehabilitation_cost\n else\n self.estimated_cost -= replacement_cost(asset) unless asset.scheduled_replacement_cost.nil?\n end\n self.estimated_cost = 0 if self.estimated_cost < 0\n\n save\n end", "def validate_with_callbacks\n run_callbacks(:before_validation)\n validate_without_callbacks\n run_callbacks(:after_validation) if errors.empty?\n end", "def add_rid_related_validations(options)\n validates(options[:field], presence: true)\n validates(options[:field], uniqueness: true) if options[:random_generation_method] != :uuid # If we're generating UUIDs, don't check for uniqueness\n end", "def add_polymorph_dispatch(type, method_name, param_names, injections, weaving)\n # Type is a CollectionType, its size-type indicates min/max args\n # This includes the polymorph object which needs to be deducted from the\n # number of additional args\n # NOTE: the type is valuable if there are type constraints also on the first arg\n # (better error message)\n range = type.size_range # get .from, .to, unbound if nil (from must be bound, to can be nil)\n raise ArgumentError, \"polymorph dispath on collection type without range\" unless range\n raise ArgumentError, \"polymorph dispatch on signature without object\" if range[0] < 1\n from = range[0] - 1 # The object itself is not included\n to = range[1] -1 # object not included here either (it may be infinity, but does not matter)\n if !injections.empty?\n from += injections.size\n to += injections.size\n end\n to = (to == Puppet::Pops::Types::INFINITY) ? -1 : to\n @dispatchers << Dispatch.new(type, Puppet::Pops::Visitor.new(self, method_name, from, to), param_names, injections, weaving)\n # @dispatchers << [ type, Puppet::Pops::Visitor.new(self, method_name, from, to), param_names, injections, weaving ]\n end", "def after_save; model.reset_dropdown_cache; super; end", "def coolio_after(scope = :each, &block)\n raise ArgumentError, \"coolio_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:coolio_after).unshift block\n end", "def assign_nested_attributes_for_collection_association association_name, attributes_collection\n return if attributes_collection.nil?\n\n associate_existing_records(association_name, attributes_collection)\n\n super\n end" ]
[ "0.58034647", "0.54024005", "0.5094982", "0.4961085", "0.48483062", "0.480316", "0.4736302", "0.46594498", "0.4463328", "0.4432931", "0.4426734", "0.4411381", "0.43567568", "0.43483585", "0.43428823", "0.43267116", "0.43225652", "0.42918825", "0.42668375", "0.426508", "0.42464325", "0.4218899", "0.4212305", "0.42072004", "0.4182901", "0.4170702", "0.4163952", "0.41514486", "0.41248426", "0.4124031", "0.41213745", "0.4105621", "0.40762085", "0.40697542", "0.4045694", "0.40421492", "0.40262312", "0.4024365", "0.40238547", "0.4022495", "0.40089622", "0.40029594", "0.39953065", "0.3973176", "0.39634803", "0.39573947", "0.3939628", "0.39289147", "0.39271498", "0.39252993", "0.39209065", "0.39001063", "0.38820833", "0.3878312", "0.38457188", "0.38396764", "0.3838326", "0.38382763", "0.38296482", "0.38140887", "0.38079724", "0.37957826", "0.3793855", "0.37882924", "0.3773932", "0.37604156", "0.37527385", "0.37454823", "0.37290633", "0.3729055", "0.37171835", "0.37165508", "0.3710311", "0.3706375", "0.37008256", "0.36965352", "0.3681269", "0.3681176", "0.36808312", "0.36805835", "0.36644724", "0.3658379", "0.3653694", "0.3651246", "0.3650738", "0.36504355", "0.36503458", "0.36464244", "0.3643515", "0.36369613", "0.3632182", "0.36298245", "0.3619174", "0.36158943", "0.3611791", "0.36091053", "0.36045516", "0.36000362", "0.35991234", "0.35987994" ]
0.70403355
0
GET /managers GET /managers.json
def index query = [] unless params[:key].blank? query << { name: /.*#{params[:key]}.*/ } end query << {} if query.blank? @managers = paginate(Manager.app.and('$or' => query)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end", "def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend", "def show\n\n @marina = Marina.find(params[:id])\n @marina.active_managers.each do |manager|\n if manager == current_user\n @manager = current_user\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marina }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end", "def _manager_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tprojects = Project.manager_search_with_params params\r\n\r\n\t\t\tcount = projects.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count == 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/manager_list', locals: { projects: projects.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend", "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\n @manager = Manager.find(params[:id])\n end", "def manager\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t@system_managers = User.search_by_type '', 'system_manager', true\n\t\t\t@user_managers = User.search_by_type '', 'user_manager', true\n\t\t\t@real_estate_managers = User.search_by_type '', 'real_estate_manager', true\n\t\t\t@project_managers = User.search_by_type '', 'project_manager', true\n\t\t\t@appraisers = User.search_by_type '', 'appraiser', true\n\t\t\t@statisticians = User.search_by_type '', 'statistician', true\n\t\tend", "def managers\n if @data_object.team_id\n Role.team_managers(@data_object.team_id)\n else\n []\n end\n end", "def manager\n users(:jolly)\n end", "def index\n @admin_managers = Admin::Manager.all\n end", "def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager }\n end\n end", "def managers\n [] << [user_id, contact_person_name]\n end", "def show\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager_account }\n end\n end", "def managers\n @members = self.user_workspace_memberships.where({:manager => 1})\n @users = []\n @members.each do |member|\n @users.push member.user if member.user\n end\n return @users\n end", "def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @manager }\n end\n end", "def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end", "def managers\n find_related_frbr_objects( :is_managed_by, :which_roles?) \n end", "def manager\n @technician = Team.find(params[:id]).technicians.where(\"manager is true\").first\n respond_to do |format|\n format.html { render html: \"/technicians/#{@technician.id}\" }\n format.json { render json: @technician }\n end\n end", "def index\n @managers_projects = ManagersProject.all\n end", "def index\n @service_managers = ServiceManager.paginate(page: params[:page])\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def retrive_employees_by_manager\n @employees = \n if params[:manager_id].present? \n Employee.includes(:department)\n .where(manager_id: params[:manager_id])\n else\n Employee.includes(:department).all\n end\n\n render :partial => \"employees\", :object => @employees\n end", "def show\n @manager_user = ManagerUser.find(params[:id])\n\n respond_to do |format| \n format.js\n format.json { render json: @manager_user }\n format.html\n end\n end", "def show\n @manager = Manager.find(params[:id])\n add_breadcrumb @manager.person.try(:first_last_name), manager_path(@manager)\n\n respond_to do |format|\n format.html {\n render :html => @manager\n } # show.html.erb\n format.json { render json: @manager, :callback => params[:callback] }\n format.js { render json: @manager, :callback => params[:callback] }\n end\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def result_type\n :client_managers\n end", "def index\n @payment_managers = PaymentManager.all\n end", "def fetch_logged_in_manager\n\n return success unless is_logged_in_manager?\n\n @manager_obj = Manager.where(id: @manager_id).first\n\n return validation_error(\n 'dm_sdav_4',\n 'invalid_api_params',\n ['invalid_manager_id'],\n GlobalConstant::ErrorAction.default\n ) if @manager_obj.blank? || @manager_obj[:status] != GlobalConstant::Manager.active_status\n\n success\n\n end", "def new\n @manager_account = ManagerAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager_account }\n end\n end", "def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end", "def index\n @projects_managers = ProjectsManager.all\n end", "def index\n @store_managers = StoreManager.all\n end", "def index\n @manager_associations = ManagerAssociation.all\n end", "def managers\n self.parent.managers\n end", "def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end", "def create\n @manager = Manager.new(manager_params)\n\n if @manager.save\n render :show, status: :created, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end", "def index\n @estate_managers = EstateManager.all\n end", "def set_managers_project\n @managers_project = ManagersProject.find(params[:id])\n end", "def users\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def manager_name\n manager.name\n end", "def _managers_specials\n @_managers_specials ||= Hash.new\n end", "def get_available_mentors\n url = \"#{@api_base_path}/users/available_mentors\"\n handle_timeouts do\n response = self.class.get(url, headers: auth_header)\n convert_response(response, \"user\")\n end\n end", "def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end", "def index\n @api_v1_campaigns_managers = Api::V1::CampaignsManager.all\n end", "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account_manager }\n end\n end", "def manager_name\n self.manager.name\n end", "def list\n @list ||= manager_list\n end", "def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end", "def project_managers\n people_with_the_role(\"project_manager\")\n end", "def managers\n course_enrollments.where(course_roles: { can_manage_course: true }).\n map(&:user)\n end", "def index\n @job_managers = JobManager.where(job_id: @job.id)\n end", "def manager\n Manager\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def manager\n if self.manager_id > 0\n User.find(self.manager_id)\n else\n User.new( :first_name => 'Not', :last_name => 'Assigned')\n end\n end", "def index\n\t\t#@data = {name: '角色', path: '/managers/roles'}\n\t\t@roles = Role.page(params[:page]).per(params[:rows])\n\t\trespond_with({rows: @roles, total: @roles.total_count}) \n\tend", "def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end", "def index\n @task_managers = TaskManager.all\n end", "def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @owners }\n end\n end", "def index\n render json: current_org.users\n end", "def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end", "def index\n @managers_positions = Managers::Position.all\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def manager\n\t\t\treturn nil if @entry.manager.nil?\n\t\t\tUser.find_by_distinguishedName(@entry.manager.to_s)\n\t\tend", "def update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def index\n @lcb_manager_users = LcbManagerUser.all\n end", "def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end", "def edit\n @manager = Manager.find(params[:id])\n end", "def show\n creator = Creator.find(params[:id])\n if !creator.nil?\n render json: creator, status: :ok\n else\n render json: creator.errors, status: :not_found\n end\n end", "def index\n\t\tmembers = Member.where(team_id: params[:team_id]).all\n\t\trespond_with members\n\tend", "def teams\n render json: @team_query\n end", "def show\n @team_mate = TeamMate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_mate }\n end\n end", "def members\n if @memorial\n @pagination = {\n q: params[:q].nil? ? \"\" : params[:q],\n p: params[:p].nil? ? \"1\" : params[:p],\n per_p: params[:per_p].nil? ? \"10\" : params[:per_p],\n total: 0,\n order: {\n column: @order.column,\n dir: @order.direction\n }\n }\n @users = @memorial.users\n .reorder(@order.column => @order.direction)\n .ransack(first_name_or_last_name_or_email_cont_any: @pagination[:q].split(\" \")).result\n @pagination[:total] = @users.length\n @users = @users\n .paginate(page: @pagination[:p], per_page: @pagination[:per_p])\n user_memorials = []\n @users.each do |u|\n user_memorials << u.user_memorials.find_by(memorial_id: @memorial[:uuid])\n end\n user = user_memorials.as_json({\n include: [{user: {only: [:uuid, :first_name, :last_name, :email]}}, {role: {only: [:uuid, :name]}}]\n })\n users = []\n user.each do |u|\n entity = {\n uuid: u['user']['uuid'],\n first_name: u['user']['first_name'],\n last_name: u['user']['last_name'],\n email: u['user']['email'],\n roles: [u['role']]\n }\n users << entity\n end\n response = {\n organization: @memorial[:organization_id].present? ? Organization.where(uuid: @memorial[:organization_id]).select(\"uuid, name, address, image, posY, posX, scale, rot\") : nil,\n results: users,\n pagination: @pagination\n }\n render json: response\n else\n render json: {error: 'You do not have access to this memorial'}, status: 422\n end\n end", "def create\n @admin_manager = Admin::Manager.new(admin_manager_params)\n\n respond_to do |format|\n if @admin_manager.save\n format.html { redirect_to @admin_manager, notice: 'Manager was successfully created.' }\n format.json { render :show, status: :created, location: @admin_manager }\n else\n format.html { render :new }\n format.json { render json: @admin_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_to :html, :json\n @organismes = Organisme.all\n end", "def get_component_managers\n debug 'GET Component Managers.'\n path = COMP_MNGS_PATH\n resp = get_object_to_sysmgr(path)\n unless resp.status_code == Response::OK\n return nil\n end\n begin\n comp_mgrs = {}\n resp.body.each do |prop|\n objp = ObjectProperty.new(prop)\n comp_mgrs[objp.remote_object_id] = objp\n end\n return comp_mgrs\n rescue => ex\n return dump_error(ex)\n end\n end", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def _manage_list\n\t\t# Author\n\t\tauthorize! :manage, Project\n\n\t\tper = Rails.application.config.item_per_page\n\n\t\tif params[:keyword].blank?\n\t\t\tinvestors = Investor.order(updated_at: 'asc')\n\t\telse\n\t\t\tinvestors = Investor.search(params[:keyword])\n\t\tend\n\n\t\tcount = investors.count\n\n\t\treturn render json: { status: 1 } if count === 0\n\n\t\trender json: {\n\t\t\tstatus: 0,\n\t\t\tresult: {\n\t\t\t\tlist: render_to_string(partial: 'investors/manage_list', locals: { investors: investors.page(params[:page].to_i, per) }),\n\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t}\n\t\t}\n\tend", "def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end", "def show\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end", "def index\n @menus = @user.menus.all\n render json: @menus\n end", "def index\n @admins = Admin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admins }\n end\n end", "def index\n @teams = Team.all\n render json: @teams\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n format.json { head :no_content }\n end\n end", "def list_employees_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 format.xls\n end\n end", "def show\n @team_admin = TeamAdmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_admin }\n end\n end", "def show\n @organismo = Organismo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organismo }\n end\n end", "def index\n @repositories = current_user.repositories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repositories }\n end\n end", "def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end", "def new\n @store_owner = StoreOwner.new(store_id: @store.id)\n @users = @group.users\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_owner }\n end\n end", "def index\n @facility_managers = FacilityManager.paginate(page: params[:page])\n end", "def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end" ]
[ "0.7909397", "0.7275918", "0.72303885", "0.7041812", "0.70305485", "0.701412", "0.6797675", "0.6748071", "0.6738564", "0.6678143", "0.6617074", "0.6565927", "0.6426277", "0.64221853", "0.6407861", "0.63928187", "0.63652194", "0.62316644", "0.6187057", "0.616267", "0.61027235", "0.60910165", "0.60480005", "0.6044295", "0.6023834", "0.59694445", "0.5965595", "0.5957048", "0.5921989", "0.5914157", "0.5912276", "0.5905899", "0.58943224", "0.58931947", "0.5888234", "0.58873117", "0.58831954", "0.5876009", "0.5869024", "0.584884", "0.58468336", "0.58352154", "0.58178335", "0.581069", "0.58005553", "0.57844853", "0.5779069", "0.57772887", "0.57366514", "0.57331765", "0.57318413", "0.5728754", "0.57281965", "0.57273674", "0.5721186", "0.57064885", "0.56889874", "0.56885284", "0.5687305", "0.568571", "0.5679261", "0.5667064", "0.5649011", "0.56454587", "0.56440693", "0.56438565", "0.5642239", "0.56413794", "0.56387836", "0.5636636", "0.56231487", "0.5614927", "0.5614092", "0.5613039", "0.5597563", "0.5584924", "0.55832", "0.5583169", "0.5580331", "0.5572339", "0.55669683", "0.55635047", "0.55623126", "0.556179", "0.5559256", "0.5558582", "0.55498457", "0.55330694", "0.55265033", "0.55172265", "0.55145484", "0.55101377", "0.5508303", "0.5505455", "0.5503109", "0.5499754", "0.54936355", "0.54815555", "0.5477113", "0.5475269" ]
0.6048514
22
GET /managers/1 GET /managers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @manager = Manager.find(params[:id])\n end", "def show\n\n @marina = Marina.find(params[:id])\n @marina.active_managers.each do |manager|\n if manager == current_user\n @manager = current_user\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marina }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end", "def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end", "def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager }\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 _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend", "def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @manager }\n end\n end", "def show\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager_account }\n end\n end", "def _manager_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tprojects = Project.manager_search_with_params params\r\n\r\n\t\t\tcount = projects.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count == 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/manager_list', locals: { projects: projects.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend", "def manager\n @technician = Team.find(params[:id]).technicians.where(\"manager is true\").first\n respond_to do |format|\n format.html { render html: \"/technicians/#{@technician.id}\" }\n format.json { render json: @technician }\n end\n end", "def manager\n users(:jolly)\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def show\n @manager = Manager.find(params[:id])\n add_breadcrumb @manager.person.try(:first_last_name), manager_path(@manager)\n\n respond_to do |format|\n format.html {\n render :html => @manager\n } # show.html.erb\n format.json { render json: @manager, :callback => params[:callback] }\n format.js { render json: @manager, :callback => params[:callback] }\n end\n end", "def manager\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t@system_managers = User.search_by_type '', 'system_manager', true\n\t\t\t@user_managers = User.search_by_type '', 'user_manager', true\n\t\t\t@real_estate_managers = User.search_by_type '', 'real_estate_manager', true\n\t\t\t@project_managers = User.search_by_type '', 'project_manager', true\n\t\t\t@appraisers = User.search_by_type '', 'appraiser', true\n\t\t\t@statisticians = User.search_by_type '', 'statistician', true\n\t\tend", "def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end", "def index\n @admin_managers = Admin::Manager.all\n end", "def new\n @manager_account = ManagerAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager_account }\n end\n end", "def show\n @manager_user = ManagerUser.find(params[:id])\n\n respond_to do |format| \n format.js\n format.json { render json: @manager_user }\n format.html\n end\n end", "def create\n @manager = Manager.new(manager_params)\n\n if @manager.save\n render :show, status: :created, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end", "def edit\n @manager = Manager.find(params[:id])\n end", "def set_managers_project\n @managers_project = ManagersProject.find(params[:id])\n end", "def manager_name\n self.manager.name\n end", "def managers\n [] << [user_id, contact_person_name]\n end", "def manager_name\n manager.name\n end", "def index\n @managers_projects = ManagersProject.all\n end", "def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def managers\n if @data_object.team_id\n Role.team_managers(@data_object.team_id)\n else\n []\n end\n end", "def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end", "def fetch_logged_in_manager\n\n return success unless is_logged_in_manager?\n\n @manager_obj = Manager.where(id: @manager_id).first\n\n return validation_error(\n 'dm_sdav_4',\n 'invalid_api_params',\n ['invalid_manager_id'],\n GlobalConstant::ErrorAction.default\n ) if @manager_obj.blank? || @manager_obj[:status] != GlobalConstant::Manager.active_status\n\n success\n\n end", "def update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end", "def manager\n if self.manager_id > 0\n User.find(self.manager_id)\n else\n User.new( :first_name => 'Not', :last_name => 'Assigned')\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account_manager }\n end\n end", "def show\n creator = Creator.find(params[:id])\n if !creator.nil?\n render json: creator, status: :ok\n else\n render json: creator.errors, status: :not_found\n end\n end", "def retrive_employees_by_manager\n @employees = \n if params[:manager_id].present? \n Employee.includes(:department)\n .where(manager_id: params[:manager_id])\n else\n Employee.includes(:department).all\n end\n\n render :partial => \"employees\", :object => @employees\n end", "def index\n query = []\n unless params[:key].blank?\n query << { name: /.*#{params[:key]}.*/ }\n end\n query << {} if query.blank?\n @managers = paginate(Manager.app.and('$or' => query))\n end", "def show\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end", "def manager\n Manager\n end", "def index\n @service_managers = ServiceManager.paginate(page: params[:page])\n end", "def managed(manager_id)\n return Manage.where(\"manager_id = ?\", manager_id)\n end", "def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n format.json { head :no_content }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def result_type\n :client_managers\n end", "def show\n @team_mate = TeamMate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_mate }\n end\n end", "def show\n @creator = Creator.find_by_id(params[:id])\n if @creator.present?\n respond_with @creator, status: :ok, location: creators_path(@creator)\n else\n render json: {error: 'Could not find the resource. Check if you are using the right creator_id.'}, status: :not_found\n end\n end", "def show\n @general_manager = GeneralManager.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @general_manager }\n end\n end", "def managers\n @members = self.user_workspace_memberships.where({:manager => 1})\n @users = []\n @members.each do |member|\n @users.push member.user if member.user\n end\n return @users\n end", "def create\n @admin_manager = Admin::Manager.new(admin_manager_params)\n\n respond_to do |format|\n if @admin_manager.save\n format.html { redirect_to @admin_manager, notice: 'Manager was successfully created.' }\n format.json { render :show, status: :created, location: @admin_manager }\n else\n format.html { render :new }\n format.json { render json: @admin_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @organismo = Organismo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organismo }\n end\n end", "def show\n team = Team.find_by(:id => params[:id])\n render :json => team\n end", "def show\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner }\n end\n end", "def fetch_and_validate_manager(manager_id, err_prefix = 'u_eh_m')\n return manager_not_found_response(\"#{err_prefix}:l_u_eh_fvm_1\") if manager_id.blank?\n manager = CacheManagement::Manager.new([manager_id]).fetch[manager_id]\n return manager_not_found_response(\"#{err_prefix}:l_u_eh_fvm_2\") if manager[:status] != GlobalConstant::Manager.active_status\n success_with_data(manager)\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n #format.json { head :ok }\n end\n end", "def show\n @director = Director.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @director }\n end\n end", "def show\n @store_manager_order = Store::Manager::Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_order }\n end\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def index\n @payment_managers = PaymentManager.all\n end", "def index\n @projects_managers = ProjectsManager.all\n end", "def update\n @manager = Manager.find(params[:id])\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n #format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @moresmallarmorinfo = Moresmallarmorinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallarmorinfo }\n end\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def show\n render status: 200, json: Team.find(params[:id])\n end", "def manager\n\t\t\treturn nil if @entry.manager.nil?\n\t\t\tUser.find_by_distinguishedName(@entry.manager.to_s)\n\t\tend", "def show\n # @passenger = Passenger.find(:name => params[:id])\n # render :json => @passenger\n end", "def index\n @manager_associations = ManagerAssociation.all\n end", "def show\n @mate = Mate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {mate: @mate} }\n end\n end", "def show\n @team_admin = TeamAdmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_admin }\n end\n end", "def show\n @name_server = NameServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @name_server }\n end\n end", "def show\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leader }\n end\n end", "def show\n @organ = Organ.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organ }\n end\n end", "def managers\n find_related_frbr_objects( :is_managed_by, :which_roles?) \n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end", "def show\n @team = Team.find(params[:id])\n\n render json: @team\n end", "def manager\n end", "def manager\n end", "def index\n @store_managers = StoreManager.all\n end", "def show\n @teammate = Teammate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teammate }\n end\n end", "def show\n render json: Server.where(name: params[:name]).first\n end", "def new\n\t\t@manager=Manager.new\n\tend", "def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end", "def show\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin }\n end\n end", "def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end", "def set_user\n @manager = User.find(params[:id])\n end", "def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end", "def index\n @api_v1_campaigns_managers = Api::V1::CampaignsManager.all\n end", "def new\n @manager_user = ManagerUser.new\n\n respond_to do |format| \n format.js\n format.html # new.html.erb\n format.json { render json: @manager_user }\n end\n end", "def new\n @store_manager_statistic = Store::Manager::Statistic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_statistic }\n end\n end", "def project_managers\n people_with_the_role(\"project_manager\")\n end", "def show\n @githuber = Githuber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @githuber }\n end\n end", "def new\n @store_owner = StoreOwner.new(store_id: @store.id)\n @users = @group.users\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_owner }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n @memos = Memo.find_all_by_article_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def showName\n render json: User.findByName(params[\"name\"])\n end", "def create\n login_id = params[:manager].delete(:login_id)\n gender_id = params[:manager].delete(:gender_id)\n clinic_id = params[:manager].delete(:clinic_id)\n @manager = Manager.new(params[:manager])\n \n @manager.login_id = login_id\n @manager.gender_id = gender_id\n @manager.clinic_id = clinic_id\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @job_managers = JobManager.where(job_id: @job.id)\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def index\n @task_managers = TaskManager.all\n end", "def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.json.jbuilder'\n\tend" ]
[ "0.73483473", "0.73277146", "0.7317662", "0.7131971", "0.7016169", "0.69423395", "0.691309", "0.68484384", "0.6818025", "0.67499816", "0.6664031", "0.66622746", "0.6649192", "0.65549284", "0.6439817", "0.63730985", "0.6346791", "0.6341102", "0.6292437", "0.6277915", "0.6252807", "0.62321174", "0.6212767", "0.61239797", "0.61185825", "0.6114332", "0.6110637", "0.6104268", "0.6103384", "0.6100924", "0.6098305", "0.6067472", "0.6056452", "0.6052965", "0.6039684", "0.60035414", "0.5984985", "0.59838694", "0.5971899", "0.59711134", "0.596279", "0.59185946", "0.591491", "0.5897442", "0.58931434", "0.5888203", "0.58624095", "0.58473974", "0.5846896", "0.58250684", "0.5821358", "0.579626", "0.5793991", "0.57898474", "0.5789375", "0.57843757", "0.5775585", "0.5768359", "0.5765419", "0.57646185", "0.5763668", "0.57407695", "0.5739996", "0.57315546", "0.57161623", "0.5706414", "0.56995976", "0.5699182", "0.5695952", "0.5688122", "0.5686618", "0.5684288", "0.5681986", "0.567679", "0.5675876", "0.5669229", "0.56642133", "0.56642133", "0.56620365", "0.5661475", "0.5660852", "0.56580114", "0.5657465", "0.56557286", "0.56394476", "0.5638267", "0.5633224", "0.56324774", "0.5629235", "0.5620477", "0.5609683", "0.5608213", "0.5606733", "0.5603229", "0.5601952", "0.55983114", "0.55982137", "0.5597428", "0.559461", "0.55919635", "0.559002" ]
0.0
-1
POST /managers POST /managers.json
def create @manager = Manager.new(manager_params) if @manager.save render :show, status: :created, location: @manager else render json: @manager.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_manager = Admin::Manager.new(admin_manager_params)\n\n respond_to do |format|\n if @admin_manager.save\n format.html { redirect_to @admin_manager, notice: 'Manager was successfully created.' }\n format.json { render :show, status: :created, location: @admin_manager }\n else\n format.html { render :new }\n format.json { render json: @admin_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n login_id = params[:manager].delete(:login_id)\n gender_id = params[:manager].delete(:gender_id)\n clinic_id = params[:manager].delete(:clinic_id)\n @manager = Manager.new(params[:manager])\n \n @manager.login_id = login_id\n @manager.gender_id = gender_id\n @manager.clinic_id = clinic_id\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n format.json { render json: @manager, status: :created, location: @manager }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager }\n end\n end", "def new\n @manager = Manager.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @manager }\n end\n end", "def manager_params\n params.require(:manager).permit(:name, :surname, :phone)\n end", "def create #创建\n @manager = Manager.new(manager_params)\n\n @manager.save!\n redirect_to managers_path, notice: '操作成功'\n end", "def manager_params\n params.require(:manager).permit(:name, :address)\n end", "def createManager\n if params[:op] == 'local'\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:manager])\n user = Manager.new(params_map)\n if !user.save\n render 'create'\n return\n end\n session[:user_id] = user.id \n redirect_to '/managers/show' \n else\n auth = session[:auth]\n if Manager.find_by(:email => auth[\"info\"][\"email\"])\n flash[:notice] = 'Email already used.'\n redirect_to '/create'\n else\n user=Manager.create_with_omniauth(session[:auth])\n session[:user_id] = user.id\n redirect_to '/managers/show'\n end\n end\n end", "def create\n @todo_manager = TodoManager.new(todo_manager_params)\n\n respond_to do |format|\n if @todo_manager.save\n format.html { redirect_to @todo_manager, notice: 'Todo manager was successfully created.' }\n format.json { render :show, status: :created, location: @todo_manager }\n else\n format.html { render :new }\n format.json { render json: @todo_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@manager=Manager.new(model_params)\n\t\tif @manager.save\n\t\t\tredirect_to managers_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend", "def create\n @league = League.find(params[:league_id])\n @team = Team.new(params[:team])\n @team.league = @league\n\n # Manager needs to be sent the email to come manage his team.\n # If he needs to sign-up, then he will be directed at the signup_before_action pat\n email = @team.manager_email_address\n\n @team.managers.push(manager_account = Account.create_pending_or_find_existing(email))\n\n respond_to do |format|\n if @team.save\n url_for_manager = team_path(@team)\n\n # The manager is a pending manager so we need to send the link through the onboard url\n if (manager_account.pending?)\n description = \"league_teams/new_manager_description\"\n url_for_manager = onboard_new_account_path_generator(manager_account, url_for_manager, description)\n end\n\n manager_account.send_invite!(:team_created, :team_id => @team.id, :url => url_for_manager)\n\n format.html { redirect_to @team, notice: 'Team was successfully created. Manager was emailed a link to the team.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @store_manager = StoreManager.new(store_manager_params)\n\n respond_to do |format|\n if @store_manager.save\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully created.' }\n format.json { render :show, status: :created, location: @store_manager }\n else\n format.html { render :new }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee =\n Employee.new(employee_params.merge({ manager_id: params[:manager_id] }))\n\n if @employee.save\n @employee.active!\n render json: @employee, status: :created\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end", "def managers\n response = request(:get, \"/manager\")\n response_to_array(response, \"managers\", KontaktIo::Resource::Manager)\n end", "def create_manager\n user = User.new(first_name: \"Ralph\", last_name: \"Wiggum\", username: \"rwiggum\", email: \"chris+rwiggum@cryptographi.com\", password: 'muffins1', password_confirmation: 'muffins1', job_title: 'Manager')\n company_domain = \"cryptographi.com\"\n team = Team.find_by(domain_name: company_domain)\n if !team\n create_admin\n end\n user.team = team\n manager = User.find_by(email: 'chris+jsmith@cryptographi.com')\n user.manager_id = manager.id\n if user.save\n user.add_role :manager\n end\n end", "def create_manager\n #@event_user = EventUser.new(event_user_params)\n @event_user = EventUser.new(event: @event)\n authorize @event_user\n\n @event_user.user = User.find(permitted_attributes(@event_user)[:user])\n @event_user.role = EventUser.roles[:organizador]\n\n respond_to do |format|\n if @event_user.save\n format.html { redirect_to admin_event_users_path(:code => @event.code),\n notice: 'Paticipante foi CRIADO com sucesso.' }\n format.json { render :show, status: :created, location:[:admin, @event_user] }\n else\n format.html {\n flash[:Error] = \"O Organizador já está inscrito no evento.\"\n redirect_to new_manager_admin_event_users_path(:code => @event.code)}\n format.json { render json: [:admin, @event_user].errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manager_account = ManagerAccount.new(params[:manager_account])\n\n respond_to do |format|\n if @manager_account.save\n format.html { redirect_to @manager_account, notice: 'Manager account was successfully created.' }\n format.json { render json: @manager_account, status: :created, location: @manager_account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manager_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manager_association = ManagerAssociation.new(manager_association_params)\n\n respond_to do |format|\n if @manager_association.save\n format.html { redirect_to @manager_association, notice: 'Manager association was successfully created.' }\n format.json { render :show, status: :created, location: @manager_association }\n else\n format.html { render :new }\n format.json { render json: @manager_association.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_manager = TaskManager.new(task_manager_params)\n\n respond_to do |format|\n if @task_manager.save\n format.html { redirect_to @task_manager, notice: 'Task manager was successfully created.' }\n format.json { render :show, status: :created, location: @task_manager }\n else\n format.html { render :new }\n format.json { render json: @task_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @account_manager = AccountManager.new(params[:account_manager])\n\n # respond_to do |format|\n # if @account_manager.save\n # format.html { redirect_to @account_manager, notice: 'Account manager was successfully created.' }\n # format.json { render json: @account_manager, status: :created, location: @account_manager }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @account_manager.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @payment_manager = PaymentManager.new(payment_manager_params)\n\n respond_to do |format|\n if @payment_manager.save\n format.html { redirect_to @payment_manager, notice: 'Payment manager was successfully created.' }\n format.json { render :show, status: :created, location: @payment_manager }\n else\n format.html { render :new }\n format.json { render json: @payment_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def manager_params\n params[:manager][:name] ||= \"user#{Manager.auto_increment_value}\"\n\n unless params[:manager][:password]\n token = Devise.friendly_token\n params[:manager][:password] ||= token\n params[:manager][:password_confirmation] ||= token\n params[:manager][:invite_confirmation_token] ||= token\n end\n\n params.require(:manager).permit(:name, :email, :password, :password_confirmation, :invite_confirmation_token)\n end", "def assign_manager\n \tuser = User.find(params[:user_id].to_i)\n manager = user.my_manager\n \tif manager.blank?\n\t UserLeadGenerator.create(user_id: params[:manager_id], lead_generator_id: user.id)\t\t\n else\n manager.update_attributes(user_id: params[:manager_id])\n end\t\t\n \tredirect_to admin_list_users_path\n end", "def managers\n [] << [user_id, contact_person_name]\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def manager_params\n params.fetch(:manager, {}).permit!\n end", "def new\n @manager_account = ManagerAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manager_account }\n end\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def create_manager\n self.manager = Manager.where(email: regestrar_details[\"email\"]).first\n\n unless manager\n self.manager = Manager.create(email: regestrar_details[\"email\"], password: DEFAULT_PASSWORD, password_confirmation: DEFAULT_PASSWORD)\n end\n end", "def manager=(user)\n self.manager_id = user.id\n end", "def create\n @projects_manager = ProjectsManager.new(projects_manager_params)\n\n respond_to do |format|\n if @projects_manager.save\n format.html { redirect_to @projects_manager, notice: 'Projects manager was successfully created.' }\n format.json { render :show, status: :created, location: @projects_manager }\n else\n format.html { render :new }\n format.json { render json: @projects_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manager = Manager.create(manager_params)\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to '/administrator/managers', notice: 'Product category was successfully created.' }\n format.json { render :show, status: :created, location: @manager }\n else\n format.html { render :new }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @text_manager = TextManager.new(text_manager_params)\n\n respond_to do |format|\n if @text_manager.save\n format.html { redirect_to text_managers_path, notice: 'Text manager was successfully created.' }\n format.json { render action: 'index', status: :created, location: @text_manager }\n else\n format.html { render action: 'new' }\n format.json { render json: @text_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend", "def create\n @job_manager = JobManager.new(job_manager_params)\n @job_manager.job_id = @job.id\n\n respond_to do |format|\n if @job_manager.job_manager_id && @job_manager.save\n @job.pipeline_status_id = 2\n @job.save\n @user = @job_manager.job_manager\n @job.track 'Manager Assigned', current_user, @job_manager\n if @user.email\n UserMailer.manager_assignment(@user, @job_manager).deliver_later\n end\n format.html { redirect_to job_job_managers_path(@job), notice: 'Job manager was successfully created.' }\n format.json { render :show, status: :created, location: @job_manager }\n else\n format.html { render :new }\n format.json { render json: @job_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account_manager }\n end\n end", "def create\n @estate_manager = EstateManager.new(estate_manager_params)\n\n respond_to do |format|\n if @estate_manager.save\n format.html { redirect_to @estate_manager, notice: 'Estate manager was successfully created.' }\n format.json { render :show, status: :created, location: @estate_manager }\n else\n format.html { render :new }\n format.json { render json: @estate_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts management_params\n @management = Management.new(management_params)\n if @management.save\n render json: @management, status: :created\n else \n render json: @management.errors, status: :unprocessable_entity\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end", "def create\n @general_manager = GeneralManager.new(params[:general_manager])\n\n respond_to do |format|\n if @general_manager.save\n format.html { redirect_to(@general_manager, :notice => 'General manager was successfully created.') }\n format.xml { render :xml => @general_manager, :status => :created, :location => @general_manager }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @general_manager.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @organization = Organization.new(name: params[:name], owner: params[:username]) #owner: params[:username]\n if @organization.save\n #binding.pry\n @owner = @organization.employees.new(username: params[:username], \n password: params[:password], \n organization_id: @organization.id,\n email: params[:email],\n admin: true)\n if @owner.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @owner.errors.full_messages }, status: :unprocessable_entity\n end\n\n else\n render json: { errors: @organization.errors.full_messages }, status: :unprocessable_entity\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 update\n if @manager.update(manager_params)\n render :show, status: :ok, location: @manager\n else\n render json: @manager.errors, status: :unprocessable_entity\n end\n end", "def set_managers_project\n @managers_project = ManagersProject.find(params[:id])\n end", "def manager\n users(:jolly)\n end", "def new\n\t\t@manager=Manager.new\n\tend", "def new\n @manager_user = ManagerUser.new\n\n respond_to do |format| \n format.js\n format.html # new.html.erb\n format.json { render json: @manager_user }\n end\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n format.json { head :no_content }\n end\n end", "def create\n @api_v1_campaigns_manager = Api::V1::CampaignsManager.new(api_v1_campaigns_manager_params)\n\n respond_to do |format|\n if @api_v1_campaigns_manager.save\n format.html { redirect_to @api_v1_campaigns_manager, notice: 'Campaigns manager was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_campaigns_manager }\n else\n format.html { render :new }\n format.json { render json: @api_v1_campaigns_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @water_manager = WaterManager.new(water_manager_params)\n\n respond_to do |format|\n if @water_manager.save\n format.html { redirect_to @water_manager, notice: 'Water manager was successfully created.' }\n format.json { render :show, status: :created, location: @water_manager }\n else\n format.html { render :new }\n format.json { render json: @water_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n #format.json { head :ok }\n end\n end", "def create\n @memo = Memo.new(memo_params)\n @memo.save\n @memos = Memo.all.order(id: \"DESC\")\n memo_list = []\n for memo in @memos\n user = memo.user.name\n memo_list << {\n memo: memo,\n user: user\n }\n end\n render json: memo_list\n # render json: @memos\n end", "def set_manager(manager_data)\n @manager = CompanyApi::Response::Entity::Manager.new(manager_data)\n end", "def create\n @managers_project = ManagersProject.new(managers_project_params)\n\n respond_to do |format|\n if @managers_project.save\n format.html { redirect_to @managers_project, notice: 'Project attacment was successfully created.' }\n format.json { render :show, status: :created, location: @managers_project }\n else\n format.html { render :new }\n format.json { render json: @managers_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_manager_params\n params.require(:admin_manager).permit(:username, :password, :password_confirmation, :authority)\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 _manager_list\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tprojects = Project.manager_search_with_params params\r\n\r\n\t\t\tcount = projects.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count == 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/manager_list', locals: { projects: projects.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend", "def store_manager_params\n params.require(:store_manager).permit(:email, :phone, :name, :location_id)\n end", "def manager\n end", "def manager\n end", "def create\n admin = Admin.create(admin_params(:first_name, :last_name, :email, :password))\n if admin.valid?\n token = encode_token({admin_id: admin.id})\n render json: {admin: admin, token: token}\n else\n render json: {errors: admin.errors.full_messages}\n end\n end", "def create\n @employee = current_owner.employees.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\n @marina = Marina.find(params[:id])\n @marina.active_managers.each do |manager|\n if manager == current_user\n @manager = current_user\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marina }\n end\n end", "def create\n @admins = Admin.new(admin_params)\n respond_to do |format|\n if @admins.save\n format.html { redirect_to admins_path, notice: 'Admin was successfully created.' }\n format.json { render :show, status: :created, location: @admins }\n else\n format.html { render :new }\n format.json { render json: @admins.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @delivery_man = DeliveryMan.new(delivery_man_params)\n\n if @delivery_man.save\n render json: @delivery_man, status: :created, location: @delivery_man\n else\n render json: @delivery_man.errors, status: :unprocessable_entity\n end\n end", "def create\n owner = User.find_or_create params[:owner_id]\n name = params[:name]\n\n lobby = Lobby.create! owner: owner, name: name\n render json: lobby.as_json( only: [:id, :name] )\n end", "def manager\n @technician = Team.find(params[:id]).technicians.where(\"manager is true\").first\n respond_to do |format|\n format.html { render html: \"/technicians/#{@technician.id}\" }\n format.json { render json: @technician }\n end\n end", "def update\n @manager = Manager.find(params[:id])\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n #format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin = Admin.new(admin_params)\n\n if @admin.save\n render json: @admin, status: :created, location: @admin\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def index\n @admin_managers = Admin::Manager.all\n end", "def create_full_group(creator_id, groupname, title = nil, description = nil)\n creator = User.new(creator_id, \"testuser\")\n @sling.switch_user(creator)\n #POST 1 - creating the manager sub-group\n create_pseudo_group(groupname + \"-manager\", groupname + \" Manager\", description)\n\n #POST 2 - creating the member sub-group\n create_pseudo_group(groupname + \"-member\", groupname + \" Member\", description)\n\n #POST 3 creating the main group\n group = create_target_group(groupname, title, description) #POST 3\n\n update_uri = \"/#{$USERMANAGER_URI}group/\"\n\n #POST 4 - updating the group managers\n batch_post = []\n batch_post[0] = {\"url\" => \"#{update_uri}#{groupname}-member.update.json\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"#{update_uri}#{groupname}-manager.update.json\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"#{update_uri}#{groupname}.update.json\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 4 - updating the group managersbatch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 4 - updating the group managersbatch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 4 - updating the group managers response code is: #{response.code}\")\n @file_log.info(\"POST 4 - updating the group managers response code is: #{response.code}\") if (@file_log)\n\n #POST 5 - updating the group members\n batch_post = []\n batch_post[0] = {\"url\" => \"#{update_uri}#{groupname}-manager.update.json\", \"method\" => \"POST\", \"parameters\" => {\":member\" => \"#{creator_id}\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"#{update_uri}#{groupname}.update.json\", \"method\" => \"POST\", \"parameters\" => {\":member\" => \"#{groupname}-member\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"#{update_uri}#{groupname}.update.json\", \"method\" => \"POST\", \"parameters\" => {\":member\" => \"#{groupname}-manager\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 5 - updating the group members batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 5 - updating the group members batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 5 - updating the group members response code is: #{response.code}\")\n @file_log.info(\"POST 5 - updating the group members response code is: #{response.code}\") if (@file_log)\n\n #POST 6 - creating test tags\n batch_post = []\n batch_post[0] = {\"url\" => \"/tags/test-tag1\", \"method\" => \"POST\", \"parameters\" => {\"sakai:tag-name\" => \"test-tag1\", \"sling:resourceType\" => \"sakai/tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/tags/test-tag2\", \"method\" => \"POST\", \"parameters\" => {\"sakai:tag-name\" => \"test-tag2\", \"sling:resourceType\" => \"sakai/tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 6 - creating test tags batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 6 - creating test tags batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 6 - creating test tags response code is: #{response.code}\")\n @file_log.info(\"POST 6 - creating test tags response code is: #{response.code}\") if (@file_log)\n\n #POST 7 - updating group visibility, joinability and permissions\n batch_post = []\n batch_post[0] = {\"url\" => \"#{update_uri}#{groupname}.update.html\", \"method\" => \"POST\", \"parameters\" => {\"rep:group-viewers@Delete\" => \"\", \"sakai:group-visible\" => \"public\", \"sakai:group-joinable\" => \"yes\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/~#{groupname}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => \"everyone\", \"privilege@jcr:read\" => \"granted\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"/~#{groupname}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => \"anonymous\", \"privilege@jcr:read\" => \"granted\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 7 - updating group visibility, joinability and permissions batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 7 - updating group visibility, joinability and permissions batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 7 - updating group visibility, joinability and permissions response code is: #{response.code}\")\n @file_log.info(\"POST 7 - updating group visibility, joinability and permissions response code is: #{response.code}\") if (@file_log)\n\n #POST 8 - creating initial sakai docs\n batch_post = []\n batch_post[0] = {\"url\" => \"/system/pool/createfile\", \"method\" => \"POST\", \"parameters\" => {\"sakai:pooled-content-file-name\" => \"Library\", \"sakai:description\" => \"\", \"sakai:permissions\" => \"public\", \"sakai:copyright\" => \"creativecommons\", \\\n \"structure0\" => \"{\\\"library\\\":{\\\"_ref\\\":\\\"id9867543247\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Library\\\",\\\"main\\\":{\\\"_ref\\\":\\\"id9867543247\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Library\\\"}}}\", \\\n \"mimeType\" => \"x-sakai/document\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n\n batch_post[1] = {\"url\" => \"/system/pool/createfile\", \"method\" => \"POST\", \"parameters\" => {\"sakai:pooled-content-file-name\" => \"Participants\", \"sakai:description\" => \"\", \"sakai:permissions\" => \"public\", \"sakai:copyright\" => \"creativecommons\", \\\n \"structure0\" => \"{\\\"participants\\\":{\\\"_ref\\\":\\\"id6573920372\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Participants\\\",\\\"main\\\":{\\\"_ref\\\":\\\"id6573920372\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_title\\\":\\\"Participants\\\"}}}\", \\\n \"mimeType\" => \"x-sakai/document\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"#POST 8 - creating initial sakai docs batch post is: #{batch_post_json}\")\n @file_log.debug(\"#POST 8 - creating initial sakai docs batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 8 - creating initial sakai docs response code is: #{response.code}\")\n @file_log.info(\"POST 8 - creating initial sakai docs response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 8 - creating initial sakai docs results: #{results}\")\n @file_log.debug(\"POST 8 - creating initial sakai docs results: #{results}\") if (@file_log)\n library_doc_hash, participants_doc_hash = nil, nil\n i = 0\n results.each do |result|\n result_body_json = JSON result[\"body\"]\n content_item = result_body_json[\"_contentItem\"]\n doc_hash = content_item[\"poolId\"]\n content_item_name = content_item[\"item\"][\"sakai:pooled-content-file-name\"]\n if (\"Library\".eql? content_item_name)\n library_doc_hash = doc_hash\n elsif (\"Participants\".eql? content_item_name)\n participants_doc_hash = doc_hash\n else\n @log.warn(\"could not find sakai doc name to confirm doc_hash\")\n end\n end\n @log.info(\"POST 8 - creating initial sakai docs Library sakai doc hash: #{library_doc_hash}, Participants sakai doc hash #{participants_doc_hash}\")\n @file_log.info(\"POST 8 - creating initial sakai docs Library sakai doc hash: #{library_doc_hash}, Participants sakai doc hash #{participants_doc_hash}\") if (@file_log)\n\n #POST 9 - importing sakai docs content \n batch_post = []\n batch_post[0] = {\"url\" => \"/p/#{library_doc_hash}.resource\", \"method\" => \"POST\", \"parameters\" => {\":operation\" => \"import\", \":contentType\" => \"json\", \":replace\" => \"true\", \":replaceProperties\" => \"true\", \\\n \":content\" => \"{\\\"id9867543247\\\":{\\\"page\\\":\\\"<img id='widget_mylibrary_id1367865652332' class='widget_inline' style='display: block; padding: 10px; margin: 4px;' \\\n src='/devwidgets/mylibrary/images/mylibrary.png' data-mce-src='/devwidgets/mylibrary/images/mylibrary.png' data-mce-style='display: block; padding: 10px; margin: 4px;' border='1'><br></p>\\\"},\\\n \\\"id1367865652332\\\":{\\\"mylibrary\\\":{\\\"groupid\\\":\\\"#{groupname}\\\"}}}\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n\n batch_post[1] = {\"url\" => \"/p/#{participants_doc_hash}.resource\", \"method\" => \"POST\", \"parameters\" => {\":operation\" => \"import\", \":contentType\" => \"json\", \":replace\" => \"true\", \":replaceProperties\" => \"true\", \\\n \":content\" => \"{\\\"id6573920372\\\":{\\\"page\\\":\\\"<img id='widget_participants_id439704665' class='widget_inline' style='display: block; padding: 10px; margin: 4px;' src='/devwidgets/participants/images/participants.png' \\\n data-mce-src='/devwidgets/participants/images/participants.png' data-mce-style='display: block; padding: 10px; margin: 4px;' border='1'><br></p>\\\"}, \\\n \\\"id439704665\\\":{\\\"participants\\\":{\\\"groupid\\\":\\\"#{groupname}\\\"}}}\",\"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 9 - importing sakai docs content batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 9 - importing sakai docs content batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 9 - importing sakai docs content response code is: #{response.code}\")\n @file_log.info(\"POST 9 - importing sakai docs content response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 9 - importing sakai docs content results from importing sakai docs post: #{results}\")\n @file_log.debug(\"POST 9 - importing sakai docs content results from importing sakai docs post: #{results}\") if (@file_log)\n\n #POST 10 - applying the test tags\n batch_post = []\n batch_post[0] = {\"url\" => \"/~#{groupname}/public/authprofile\", \"method\" => \"POST\", \"parameters\" => {\"key\" => \"/tags/test-tag1\", \":operation\" => \"tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/~#{groupname}/public/authprofile\", \"method\" => \"POST\", \"parameters\" => {\"key\" => \"/tags/test-tag2\", \":operation\" => \"tag\", \"_charset_\" => \"utf-8\"}, \"_charset_\" => \"utf-8\"}\n @log.debug(\"resource batch post is: #{batch_post}\")\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 10 - applying the test tags batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 10 - applying the test tags batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 10 - applying the test tags response code is: #{response.code}\")\n @file_log.info(\"POST 10 - applying the test tags response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 10 - applying the test tags results from :operation => tag post: #{results}\")\n @file_log.debug(\"POST 10 - applying the test tags results from :operation => tag post: #{results}\") if (@file_log)\n\n\n #POST 11 - setting the global viewers and permissions on the sakai docs\n batch_post = []\n batch_post[0] = {\"url\" => \"/p/#{library_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => [\"everyone\", \"anonymous\"]}}\n batch_post[1] = {\"url\" => \"/p/#{library_doc_hash}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => [\"everyone\", \"anonymous\"], \"privilege@jcr:read\" => \"granted\"}}\n batch_post[2] = {\"url\" => \"/p/#{participants_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => [\"everyone\", \"anonymous\"]}}\n batch_post[3] = {\"url\" => \"/p/#{participants_doc_hash}.modifyAce.html\", \"method\" => \"POST\", \"parameters\" => {\"principalId\" => [\"everyone\", \"anonymous\"], \"privilege@jcr:read\" => \"granted\"}}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 11 - setting the global viewers and permissions on the sakai docs response code is: #{response.code}\")\n @file_log.info(\"POST 11 - setting the global viewers and permissions on the sakai docs response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = ruby_body[\"results\"]\n @log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs results from setting permissions on sakai docs #{results}\")\n @file_log.debug(\"POST 11 - setting the global viewers and permissions on the sakai docs results from setting permissions on sakai docs #{results}\") if (@file_log)\n\n #POST 12 - setting the member viewer and manager viewer for the sakai docs\n batch_post = []\n batch_post[0] = {\"url\" => \"/p/#{library_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => \"#{groupname}-member\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post[1] = {\"url\" => \"/p/#{library_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post[2] = {\"url\" => \"/p/#{participants_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":viewer\" => \"#{groupname}-member\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post[3] = {\"url\" => \"/p/#{participants_doc_hash}.members.html\", \"method\" => \"POST\", \"parameters\" => {\":manager\" => \"#{groupname}-manager\", \"_charset_\" =>\"utf-8\"},\"_charset_\" => \"utf-8\"}\n batch_post_json = JSON.generate batch_post\n @log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs batch post is: #{batch_post_json}\")\n @file_log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs batch post is: #{batch_post_json}\") if (@file_log)\n parameters = {\"requests\" => batch_post_json}\n response = @sling.execute_post(@sling.url_for(\"#{$BATCH_URI}\"), parameters)\n @log.info(\"POST 12 - setting the member viewer and manager viewer for the sakai docs response code is: #{response.code}\")\n @file_log.info(\"POST 12 - setting the member viewer and manager viewer for the sakai docs response code is: #{response.code}\") if (@file_log)\n ruby_body = JSON response.body\n results = response.body[\"results\"]\n @log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs results from setting viewer and manager on sakai docs #{results}\")\n @file_log.debug(\"POST 12 - setting the member viewer and manager viewer for the sakai docs results from setting viewer and manager on sakai docs #{results}\") if (@file_log)\n\n #POST 13 - setting the doc structure on the sakai docs\n struct0 = {}\n str = \"{\\\"library\\\":{\\\"_title\\\":\\\"Library\\\",\\\"_order\\\":0,\\\"_nonEditable\\\":true,\\\"_view\\\":\\\"[\\\\\\\"everyone\\\\\\\",\\\\\\\"anonymous\\\\\\\",\\\\\\\"-member\\\\\\\"]\\\",\\\"_edit\\\":\\\"[\\\\\\\"-manager\\\\\\\"]\\\",\\\"_pid\\\":\\\"#{library_doc_hash}\\\"},\\\"participants\\\":{\\\"_title\\\":\\\"Participants\\\",\\\"_order\\\":1,\\\"_nonEditable\\\":true,\\\"_view\\\":\\\"[\\\\\\\"everyone\\\\\\\",\\\\\\\"anonymous\\\\\\\",\\\\\\\"-member\\\\\\\"]\\\",\\\"_edit\\\":\\\"[\\\\\\\"-manager\\\\\\\"]\\\",\\\"_pid\\\":\\\"#{participants_doc_hash}\\\"}}\"\n struct0[\"structure0\"] = str\n params = {}\n params[\":content\"] = JSON.generate struct0\n params[\":contentType\"] = \"json\"\n params[\":operation\"] = \"import\"\n params[\":replace\"] = true\n params[\":replaceProperties\"] = true\n params[\"_charset_\"] = \"utf-8\"\n @log.debug(\"POST 13 - setting the doc structure on the sakai docs post params are: \" + params.inspect)\n @file_log.debug(\"POST 13 - setting the doc structure on the sakai docs post params are: \" + params.inspect) if (@file_log)\n uri = \"/~#{groupname}/docstructure\"\n response = @sling.execute_post(@sling.url_for(uri), params)\n #this is an html response\n @log.info(\"POST 13 - setting the doc structure on the sakai docs response code: #{response.code}\")\n @file_log.info(\"POST 13 - setting the doc structure on the sakai docs response code: #{response.code}\") if (@file_log)\n\n # return the group that was created in create_target_group\n return group\n end", "def create\n @team_mate = TeamMate.new(params[:team_mate])\n\n respond_to do |format|\n if @team_mate.save\n format.html { redirect_to @team_mate, notice: 'Team mate was successfully created.' }\n format.json { render json: @team_mate, status: :created, location: @team_mate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_mate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @owner = Owner.new(owner_params)\n @owner.id = Owner.all.last.id + 1 #manually set id\n respond_to do |format|\n if @owner.save\n format.html { redirect_to @owner, notice: 'Owner was successfully created.' }\n format.json { render :show, status: :created, location: @owner }\n else\n format.html { render :new }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin = Admin.new(admin_params)\n\n respond_to do |format|\n if @admin.save\n format.html { redirect_to managements_path, notice: 'Management was successfully created.' }\n format.json { render :show, status: :created, location: @admin }\n else\n format.html { render :new}\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.new(params[:team])\n\n if @team.save\n render json: @team, status: :created, location: @team\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def create\n @admin = Admin.new(admin_params)\n\n respond_to do |format|\n if @admin.save\n format.html { redirect_to admin_admins_path, notice: \"Administrador (#{@admin.name}), foi cadastrado com sucesso!\" }\n format.json { render :show, status: :created, location: [:admin, @admin] }\n else\n format.html { render :new }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @director = Director.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @director }\n end\n end", "def create_managers\n @managers = configuration.managers.each_with_object({}) do |(name, configurator), hash|\n hash[name] = ObjectManager.new(name, self, &configurator)\n end\n end", "def create\n @team = Team.create({:name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end", "def create\n @adminstrator = Administrator.new(adminstrator_params)\n\n respond_to do |format|\n if @adminstrator.save\n format.html { redirect_to adminstrators_url, notice: 'Administrator #{adminstrator.name} successfully created.' }\n format.json { render :show, status: :created, location: @adminstrator }\n else\n format.html { render :new }\n format.json { render json: @adminstrator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n creator = Creator.new(creator_params)\n\n if creator.save\n render json: creator, status: :created\n else\n render json: creator.errors, status: :unprocessable_entry\n end\n\n end", "def create\n @team_admin = TeamAdmin.new(params[:team_admin])\n\n respond_to do |format|\n if @team_admin.save\n format.html { redirect_to @team_admin, notice: 'Team admin was successfully created.' }\n format.json { render json: @team_admin, status: :created, location: @team_admin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @store_owner = StoreOwner.new(store_id: @store.id)\n @users = @group.users\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_owner }\n end\n end", "def create\n megam_rest.post_accounts(to_hash)\n end", "def create\n @loner = Loner.new(loner_params)\n puts \"loner params: #{loner_params}\"\n\n respond_to do |format|\n if @loner.save\n format.html { redirect_to admin_loner_path(@loner), notice: 'Loner was successfully created.' }\n puts \"loner successfully saved\"\n format.json { render :show, status: :created, location: @loner }\n else\n format.html { render :new }\n format.json { render json: @loner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end", "def create\n @master_memorial = Master::Memorial.new(master_memorial_params)\n\n respond_to do |format|\n if @master_memorial.save\n format.html { redirect_to master_memorials_path, notice: 'Memorial was successfully created.' }\n format.json { render :show, status: :created, location: @master_memorial }\n else\n format.html { render :new }\n format.json { render json: @master_memorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @admin_manager.destroy\n respond_to do |format|\n format.html { redirect_to admin_managers_url, notice: 'Manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def managers\n if @data_object.team_id\n Role.team_managers(@data_object.team_id)\n else\n []\n end\n end", "def create\n\n params[:team_admin][:user_id] = @current_user.id\n @team_admin = TeamAdmin.new(params[:team_admin])\n\n respond_to do |format|\n if @team_admin.save\n format.html { redirect_to root_url }\n format.json { render json: @team_admin, status: :created, location: @team_admin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @manager = Manager.find(params[:id])\n end", "def new\n @admin = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: { rows: (@admin.nil? ? [] : [@admin.marshall]), status: (@admin.nil? ? 404 : 200), total: (@admin.nil? ? 0 : 1) } }\n end\n end", "def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end", "def create\n @employee_master = EmployeeMaster.new(employee_master_params)\n\n respond_to do |format|\n if @employee_master.save\n format.html { redirect_to @employee_master, notice: '社員情報が作成されました' }\n format.json { render action: 'show', status: :created, location: @employee_master }\n else\n set_masters;\n format.html { render 'new' }\n format.json { render json: @employee_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def validator_params\n params.require(:managers_validator).permit(:first_name, :last_name, :mobile, :email, :password, :password_confirmation)\n end", "def create\n @managers_position = Managers::Position.new(managers_position_params)\n\n respond_to do |format|\n if @managers_position.save\n format.html { redirect_to @managers_position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @managers_position }\n else\n format.html { render :new }\n format.json { render json: @managers_position.errors, status: :unprocessable_entity }\n end\n end\n end", "def manager\n Manager\n end", "def set_user\n @manager = User.find(params[:id])\n end" ]
[ "0.721417", "0.67620224", "0.66251385", "0.655345", "0.6453598", "0.63925993", "0.6375221", "0.63662505", "0.6348309", "0.63447255", "0.6299406", "0.629245", "0.6257339", "0.6234327", "0.62203383", "0.61756915", "0.6146879", "0.6106687", "0.6087594", "0.60547906", "0.6016857", "0.6010626", "0.5997212", "0.59895194", "0.5977737", "0.5968303", "0.5958972", "0.5931117", "0.5875271", "0.5817985", "0.5803866", "0.5782129", "0.5729218", "0.5727353", "0.5726454", "0.5723243", "0.5719249", "0.5717664", "0.5706105", "0.56620944", "0.5659696", "0.56563675", "0.5652922", "0.5608183", "0.56017524", "0.55833876", "0.55653256", "0.5553711", "0.55357397", "0.5531988", "0.55195504", "0.5519171", "0.5491502", "0.546952", "0.5466139", "0.5434636", "0.5425156", "0.54241174", "0.54030687", "0.5398281", "0.53955877", "0.53955877", "0.53784865", "0.5377868", "0.53516346", "0.5350874", "0.5349221", "0.53478134", "0.533864", "0.5337919", "0.53278047", "0.53086525", "0.5307146", "0.5305061", "0.5303452", "0.530329", "0.52980435", "0.52952075", "0.5295135", "0.52944165", "0.52938235", "0.52896667", "0.5282178", "0.5281941", "0.5279448", "0.52738875", "0.52690303", "0.52687544", "0.5265921", "0.5258164", "0.5256013", "0.5243813", "0.5243218", "0.5243022", "0.52390057", "0.52361125", "0.5227675", "0.5222379", "0.5216689", "0.5212672" ]
0.71298426
1
PATCH/PUT /managers/1 PATCH/PUT /managers/1.json
def update if @manager.update(manager_params) render :show, status: :ok, location: @manager else render json: @manager.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @manager = Manager.find(params[:id])\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n #format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manager = current_manager.rolable\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to manager_root_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n login_id = params[:manager].delete(:login_id)\n gender_id = params[:manager].delete(:gender_id)\n clinic_id = params[:manager].delete(:clinic_id)\n @manager = Manager.find(params[:id])\n\n @manager.login_id = login_id\n @manager.gender_id = gender_id\n @manager.clinic_id = clinic_id\n\n respond_to do |format|\n if @manager.update_attributes(params[:manager])\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todo_manager.update(todo_manager_params)\n format.html { redirect_to @todo_manager, notice: 'Todo manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_manager }\n else\n format.html { render :edit }\n format.json { render json: @todo_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manager.update(manager_params)\n format.html { redirect_to home_index_url, notice: \"The profile of the manager #{@manager.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manager = Manager.find(params[:id])\n if @manager.update(model_params)\n redirect_to manager_path(@manager)\n else\n render :edit\n end\n end", "def edit\n @manager = Manager.find(params[:id])\n end", "def update\n respond_to do |format|\n if @admin_manager.update(admin_manager_params)\n format.html { redirect_to @admin_manager, notice: 'Manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_manager }\n else\n format.html { render :edit }\n format.json { render json: @admin_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @manager_customer = args[:manager_customer] if args.key?(:manager_customer)\n @manager_link_id = args[:manager_link_id] if args.key?(:manager_link_id)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @task_manager.update(task_manager_params)\n format.html { redirect_to @task_manager, notice: 'Task manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_manager }\n else\n format.html { render :edit }\n format.json { render json: @task_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @user, :message => t('errors.messages.not_authorized_as_manager')\n @marina = Marina.find(params[:id])\n\n respond_to do |format|\n if @marina.update_attributes(params[:marina])\n format.html { redirect_to @marina, notice: 'Marina was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @marina.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store_manager.update(store_manager_params)\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_manager }\n else\n format.html { render :edit }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_campaigns_manager.update(api_v1_campaigns_manager_params)\n format.html { redirect_to @api_v1_campaigns_manager, notice: 'Campaigns manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_campaigns_manager }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_campaigns_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_manager.update(job_manager_params)\n @user = @job_manager.job_manager\n if @user.email\n UserMailer.manager_assignment(@user, @job_manager).deliver_later\n end\n format.html { redirect_to job_job_managers_path(@job), notice: 'Job manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_manager }\n else\n format.html { render :edit }\n format.json { render json: @job_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manager_account = ManagerAccount.find(params[:id])\n\n respond_to do |format|\n if @manager_account.update_attributes(params[:manager_account])\n format.html { redirect_to @manager_account, notice: 'Manager account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager_account.errors, status: :unprocessable_entity }\n end\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 @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def update\n respond_to do |format|\n if @manager_association.update(manager_association_params)\n format.html { redirect_to @manager_association, notice: 'Manager association was successfully updated.' }\n format.json { render :show, status: :ok, location: @manager_association }\n else\n format.html { render :edit }\n format.json { render json: @manager_association.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manager.update(manager_params)\n format.html { redirect_to '/administrator/managers', notice: 'Product category was successfully updated.' }\n format.json { render :show, status: :ok, location: @manager }\n else\n format.html { render :edit }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @general_manager = GeneralManager.find(params[:id])\n\n respond_to do |format|\n if @general_manager.update_attributes(params[:general_manager])\n format.html { redirect_to(@general_manager, :notice => 'General manager was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @general_manager.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end\n end", "def update\n respond_to do |format|\n if @todo.update(todo_params)\n to = current_user.is_manager? ? @todo : root_url\n format.html { redirect_to to, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_manager\n @manager = Manager.find(params[:id])\n end", "def update\n authorize @payment_manager\n respond_to do |format|\n if @payment_manager.update(payment_manager_params)\n format.html { redirect_to @payment_manager, notice: 'Payment manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_manager }\n else\n format.html { render :edit }\n format.json { render json: @payment_manager.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 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 team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @indirect_manager = args[:indirect_manager] if args.key?(:indirect_manager)\n @metadata = args[:metadata] if args.key?(:metadata)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @requester.update(requester_params)\n format.html { redirect_to @requester, notice: 'Requester was successfully updated.' }\n format.json { render :show, status: :ok, location: @requester }\n else\n format.html { render :edit }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.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\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, flash: { success: \"Owner was successfully updated.\" } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @projects_manager.update(projects_manager_params)\n format.html { redirect_to @projects_manager, notice: 'Projects manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @projects_manager }\n else\n format.html { render :edit }\n format.json { render json: @projects_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def 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 @text_manager.update(text_manager_params)\n format.html { redirect_to text_managers_path, notice: 'Text manager was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @text_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(admin_person_params)\n format.html { redirect_to [:admin, @person], notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to owners_path, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: owners_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n filtered_params = person_params\n filtered_params[:roles] ||= []\n filtered_params[:status] ||= []\n\n respond_to do |format|\n if @person.update(filtered_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n format.xml { render :show, status: :created, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.xml { render xml: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @estate_manager.update(estate_manager_params)\n format.html { redirect_to @estate_manager, notice: 'Estate manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @estate_manager }\n else\n format.html { render :edit }\n format.json { render json: @estate_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @m1.update(m1_params)\n format.html { redirect_to @m1, notice: 'M1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @m1 }\n else\n format.html { render :edit }\n format.json { render json: @m1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n format.html { redirect_to owners_path, notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to_update({thing: @author})\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 set_manager\n @manager = Manager.find(params[:id])\n end", "def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end", "def update\n @team = Team.find(params[:id])\n @player = Player.find(params[:player_id])\n if @player.access_key == params[:access_key] && (@team.leader_id == @player.id || @team.game.owner_id == @player.id) then\n @team.name = params[:name]\n @team.leader_id = params[:leader_id]\n\n respond_to do |format|\n if @team.save\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end", "def fetch_manager_to_be_updated\n\n @manager_to_be_updated_obj = Manager.where(id: @to_update_client_manager.manager_id).first\n\n return validation_error(\n 's_mm_sa_usar_3',\n 'resource_not_found',\n [],\n GlobalConstant::ErrorAction.default\n ) if @manager_to_be_updated_obj.blank?\n\n return validation_error(\n 's_mm_sa_usar_4',\n 'invalid_api_params',\n ['to_update_client_manager_id_inactive'],\n GlobalConstant::ErrorAction.default\n ) if @manager_to_be_updated_obj.status != GlobalConstant::Manager.active_status\n\n success\n\n end", "def update\n respond_to do |format|\n if @minister.update(minister_params)\n format.html { redirect_to @minister, notice: 'Minister was successfully updated.' }\n format.json { render :show, status: :ok, location: @minister }\n else\n format.html { render :edit }\n format.json { render json: @minister.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update \n staff = Staff.find(params[:id])\n #assign new attributes\n staff.assign_attributes(staff_params)\n ## check for any validations \n if staff.valid?\n staff.save \n render json: staff\n else \n reder json: staff.errors.full_messages\n end \n\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 rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n respond_to do |format|\n if @maker_master.update(maker_master_params)\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker_master }\n else\n format.html { render :edit }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n if @todo.update(todo_params.merge!(updated_by_id: current_user.id))\n render json: @todo\n else\n render json: {errors: @todo.errors.full_messages}, status: 422\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to edit_owner_path(@owner), notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store_manager_order = Store::Manager::Order.find(params[:id])\n\n respond_to do |format|\n if @store_manager_order.update_attributes(params[:store_manager_order])\n format.html { redirect_to @store_manager_order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_manager_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee_master.update(employee_master_params)\n format.html { redirect_to @employee_master, notice: '社員情報が更新されました' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @employee_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\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 render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Данные клиента обновлены.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @managers_project.update(managers_project_params)\n format.html { redirect_to @managers_project, notice: 'Project attacment was successfully updated.' }\n format.json { render :show, status: :ok, location: @managers_project }\n else\n format.html { render :edit }\n format.json { render json: @managers_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @yarn.update_attributes(params[:yarn])\n format.html { redirect_to @yarn, notice: 'Yarn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yarn.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 @person_type_masters = PersonTypeMaster.all\n @user = User.find_by_person_id(params[:id])\n logger.info \"The selected user -s #{@user.inspect}\"\n respond_to do |format|\n if @person_info.update(person_info_params)\n format.js { flash.now[:notice] = \"Personnel was successfully updated.\" }\n format.html { redirect_to current_user, notice: 'Person info was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_info }\n else\n @person_type_masters = PersonTypeMaster.all\n format.js {render :edit}\n format.html { render :edit }\n format.json { render json: @person_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to @mall, notice: 'Mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.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 manager_params\n params.require(:manager).permit(:name, :surname, :phone)\n end", "def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\n @team_mate = TeamMate.find(params[:id])\n\n respond_to do |format|\n if @team_mate.update_attributes(params[:team_mate])\n format.html { redirect_to @team_mate, notice: 'Team mate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_mate.errors, status: :unprocessable_entity }\n end\n end\n end", "def manager=(user)\n self.manager_id = user.id\n end", "def update\n respond_to do |format|\n if @orphan.update(orphan_params)\n format.html { redirect_to @orphan, notice: 'Orphan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @orphan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @finder = Finder.find(params[:id])\n\n respond_to do |format|\n if @finder.update_attributes(params[:finder])\n format.html { redirect_to @finder, notice: 'Finder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to edit_owner_path, notice: 'Owner was successfully updated.' }\n # format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n # format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n # format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n @guest_name = params[:meal][:guest_name]\n params[:meal].delete :guest_name\n @guest = Guest.where(:name => @guest_name).first\n if (@guest.nil?)\n @guest = Guest.new\n @guest.name = @guest_name\n end\n @meal.guest = @guest \n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, :notice => 'Le repas a été mis à jour avec succès.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mate = Mate.find(params[:id])\n\n respond_to do |format|\n if @mate.update_attributes(params[:mate])\n format.html { redirect_to @mate, notice: 'Mate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: {errors: @mate.errors}, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n respond_to do |format|\n if @mamal.update(mamal_params)\n format.html { redirect_to @mamal, notice: 'Mamal was successfully updated.' }\n format.json { render :show, status: :ok, location: @mamal }\n else\n format.html { render :edit }\n format.json { render json: @mamal.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manager }\n end\n end", "def update\n\n if params[:managers_validator][:password].blank?\n params[:managers_validator].delete(:password)\n params[:managers_validator].delete(:password_confirmation)\n end\n\n respond_to do |format|\n if @validator.update(validator_params)\n format.html { redirect_to @validator, notice: 'Validator was successfully updated.' }\n format.json { render :show, status: :ok, location: @validator }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @validator.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end" ]
[ "0.7064366", "0.6836373", "0.6717311", "0.6465882", "0.6377686", "0.61917645", "0.6190939", "0.6180217", "0.6164062", "0.60747576", "0.6058564", "0.6055788", "0.60408944", "0.5949687", "0.5901606", "0.5883272", "0.5869366", "0.583059", "0.58106047", "0.5810209", "0.5802248", "0.57996136", "0.57852787", "0.57759905", "0.571929", "0.57061976", "0.5695374", "0.56647307", "0.56545556", "0.5654187", "0.5651533", "0.5636579", "0.5635962", "0.56301206", "0.5612437", "0.55924606", "0.5591237", "0.5583472", "0.55656964", "0.5564598", "0.55606824", "0.5553025", "0.5542469", "0.55305433", "0.5526655", "0.5519824", "0.5518829", "0.55033404", "0.55033404", "0.5500884", "0.55005825", "0.54991853", "0.54927725", "0.5492178", "0.5490943", "0.5483944", "0.54827917", "0.54825294", "0.5476284", "0.5473474", "0.5471341", "0.5471341", "0.5466548", "0.5459411", "0.54582083", "0.5452145", "0.54521406", "0.5447244", "0.5442717", "0.5442717", "0.54406047", "0.54378384", "0.5433217", "0.5430975", "0.5429751", "0.5429359", "0.54239094", "0.5415301", "0.5409238", "0.54083073", "0.5403471", "0.54006094", "0.5398894", "0.53956753", "0.5386668", "0.5381978", "0.5377625", "0.5369463", "0.53680134", "0.5366926", "0.53648967", "0.53634053", "0.5358018", "0.5357989", "0.5355204", "0.53521484", "0.5351511", "0.5349619", "0.5347715", "0.5342805" ]
0.67525965
2
DELETE /managers/1 DELETE /managers/1.json
def destroy @manager.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manager = Manager.find(params[:id])\n @manager.destroy\n\n respond_to do |format|\n format.html { redirect_to managers_url }\n #format.json { head :ok }\n end\n end", "def destroy\n \t@manager = Manager.find(params[:id])\n \t@manager.destroy\n \tredirect_to managers_path\n end", "def destroy\n @manager_user = ManagerUser.find(params[:id])\n @manager_user.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo_manager.destroy\n respond_to do |format|\n format.html { redirect_to todo_managers_url, notice: 'Todo manager was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_campaigns_manager.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_campaigns_managers_url, notice: 'Campaigns manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @general_manager = GeneralManager.find(params[:id])\n @general_manager.destroy\n\n respond_to do |format|\n format.html { redirect_to(general_managers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @store_manager.destroy\n respond_to do |format|\n format.html { redirect_to store_managers_url, notice: 'Store manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_manager.destroy\n respond_to do |format|\n format.html { redirect_to admin_managers_url, notice: 'Manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manager_account = ManagerAccount.find(params[:id])\n @manager_account.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_manager.destroy\n respond_to do |format|\n format.html { redirect_to task_managers_url, notice: 'Task manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @managers_project.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Информация обновлена' }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_manager.destroy\n respond_to do |format|\n format.html { redirect_to payment_managers_url, notice: 'Payment manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end", "def destroy\n @mall = Mall.find(params[:id])\n @mall.destroy\n\n respond_to do |format|\n format.html { redirect_to malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n @estate_manager.destroy\n respond_to do |format|\n format.html { redirect_to estate_managers_url, notice: 'Estate manager was successfully destroyed.' }\n format.json { head :no_content }\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 destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mamal.destroy\n respond_to do |format|\n format.html { redirect_to mamals_url, notice: 'Mamal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_manager.destroy\n respond_to do |format|\n format.html { redirect_to job_managers_url, notice: 'Job manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall.put_to_trash\n respond_to do |format|\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @text_manager.destroy\n respond_to do |format|\n format.html { redirect_to text_managers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @water_manager.destroy\n respond_to do |format|\n format.html { redirect_to water_managers_url, notice: 'Water manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mill = Mill.find(params[:id])\n @mill.destroy\n\n respond_to do |format|\n format.html { redirect_to mills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manager_session.destroy\n respond_to do |format|\n format.html { redirect_to manager_sessions_url, notice: 'Manager session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @moresmallarmorinfo = Moresmallarmorinfo.find(params[:id])\n @moresmallarmorinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmallarmorinfos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import_manager.destroy\n respond_to do |format|\n format.html { redirect_to import_managers_url, notice: 'Import manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mate = Mate.find(params[:id])\n @mate.destroy\n\n respond_to do |format|\n format.html { redirect_to mates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_mate = TeamMate.find(params[:id])\n @team_mate.destroy\n\n respond_to do |format|\n format.html { redirect_to team_mates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manager_association.destroy\n respond_to do |format|\n format.html { redirect_to manager_associations_url, notice: 'Manager association was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n @store_manager_statistic.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_statistics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @projects_manager.destroy\n respond_to do |format|\n format.html { redirect_to projects_managers_url, notice: 'Projects manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mld_mate.destroy\n respond_to do |format|\n format.html { redirect_to mld_mates_url, notice: \"Mld mate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @gameroom = Gameroom.find(params[:id])\n if @gameroom.destroy\n render json: @gameroom, status: :accepted\n else\n render json: {errors: @gameroom.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def destroy\n @coordinator = Coordinator.find(params[:id])\n @coordinator.destroy\n\n respond_to do |format|\n format.html { redirect_to(coordinator_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @owner = Owner.find(params[:id])\n @owner.destroy\n\n respond_to do |format|\n format.html { redirect_to owners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @administrator.destroy\n respond_to do |format|\n format.html { redirect_to administrators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hal = Hal.find(params[:id])\n @hal.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/hals/view_mine\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @master_memorial.destroy\n respond_to do |format|\n format.html { redirect_to master_memorials_url, notice: 'Memorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n @spawner = Spawner.find(params[:id])\n @spawner.destroy\n\n respond_to do |format|\n format.html { redirect_to spawners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @commander = Commander.find(params[:id])\n @commander.destroy\n\n respond_to do |format|\n format.html { redirect_to commanders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @teammate = Teammate.find(params[:id])\n @teammate.destroy\n\n respond_to do |format|\n format.html { redirect_to teammates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minister.destroy\n respond_to do |format|\n format.html { redirect_to ministers_url, notice: 'Minister was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @owner = Owner.find(params[:id])\n @owner.destroy\n\n respond_to do |format|\n format.html { redirect_to owners_path, notice: 'Oferta a fost stearsa cu success.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\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 @marina = Marina.find(params[:id])\n @marina.destroy\n\n respond_to do |format|\n format.html { redirect_to marinas_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 @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall_type = MallType.find(params[:id])\n @mall_type.destroy\n\n respond_to do |format|\n format.html { redirect_to mall_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @total_owner = TotalOwner.find(params[:id])\n @total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(total_owners_url) }\n format.xml { head :ok }\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 @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url, notice: 'Owner was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @store_manager_order = Store::Manager::Order.find(params[:id])\n @store_manager_order.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @director = Director.find(params[:id])\n @director.destroy\n\n respond_to do |format|\n format.html { redirect_to directors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ministries = Ministries.find(params[:id])\n @ministries.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministries_url) }\n format.xml { head :ok }\n end\n end", "def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n @management.destroy\n respond_to do |format|\n format.html { redirect_to managements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mstore.destroy\n respond_to do |format|\n format.html { redirect_to mstores_url, notice: 'Mstore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url, notice: 'Owner was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @managers_position.destroy\n respond_to do |format|\n format.html { redirect_to managers_positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_admin.destroy\n respond_to do |format|\n\n format.html { redirect_to manage_admins_url, notice: '此管理员账户已被删除.' }\n\n format.json { head :no_content }\n end\n end", "def destroy\n @m2.destroy\n respond_to do |format|\n format.html { redirect_to m2s_url, notice: 'M2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage.destroy\n respond_to do |format|\n format.html { redirect_to manages_url, notice: 'user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_info = ServerInfo.find(params[:id])\n @server_info.destroy\n\n respond_to do |format|\n format.html { redirect_to server_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metodo = Metodo.find(params[:id])\n @metodo.destroy\n\n respond_to do |format|\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_movie_maker = MovieMaker.find(params[:id])\n @admin_movie_maker.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_movie_makers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t @monument.destroy\n\t respond_to do |format|\n\t format.html { redirect_to users_url }\n\t format.json { head :no_content }\n\t end\n\tend", "def destroy\n `echo \"Nome:#{@gym.name}\\n Gerente: #{@gym.manager.name}\\n Address:#{@gym.location.address}\" | mutt -s \"Gym was successfully destroyed.\" #{@gym.manager.email}`\n @gym.destroy\n respond_to do |format|\n format.html { redirect_to gyms_url, notice: 'Gym was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mentorship = Mentorship.find(params[:id])\n @mentorship.destroy\n\n respond_to do |format|\n format.html { redirect_to mentorships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_mural.destroy\n respond_to do |format|\n format.html { redirect_to admin_murals_url, notice: 'Mural was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @minuman.destroy\n respond_to do |format|\n format.html { redirect_to minumen_url, notice: 'Minuman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lcb_manager_user.destroy\n respond_to do |format|\n format.html { redirect_to lcb_manager_users_url, notice: 'Lcb manager user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga.destroy\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Manga was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga.destroy\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Manga was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mort.destroy\n respond_to do |format|\n format.html { redirect_to morts_url, notice: 'Mort was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url, notice: 'Admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7904788", "0.78689444", "0.74837434", "0.7243191", "0.72422427", "0.7089869", "0.70372486", "0.701016", "0.70077926", "0.6970911", "0.6880537", "0.6847453", "0.68360025", "0.6789581", "0.67398727", "0.6734186", "0.6712372", "0.66943264", "0.66681415", "0.66623986", "0.6647601", "0.66013104", "0.65977985", "0.6587391", "0.6566731", "0.65666527", "0.6550789", "0.6546708", "0.65381944", "0.65378356", "0.65335715", "0.6525984", "0.6524483", "0.6522608", "0.65225375", "0.651615", "0.6509194", "0.6505256", "0.6502503", "0.64959383", "0.6492594", "0.6492591", "0.6492574", "0.6489211", "0.6489124", "0.64832234", "0.6465108", "0.6463306", "0.6456271", "0.64547104", "0.64542234", "0.6452795", "0.64486676", "0.6444834", "0.64427334", "0.6439891", "0.6436908", "0.6435177", "0.643134", "0.6429593", "0.64290154", "0.64275205", "0.6426", "0.6421392", "0.64210266", "0.6418942", "0.641766", "0.64170074", "0.6414985", "0.64146084", "0.64062786", "0.64009744", "0.6400659", "0.6399275", "0.63990116", "0.63902944", "0.63896394", "0.6386675", "0.63838243", "0.63822746", "0.638094", "0.63743675", "0.6371682", "0.6371611", "0.6371371", "0.63711023", "0.63710237", "0.63694143", "0.63673824", "0.6366043", "0.6365899", "0.63605905", "0.6359129", "0.6357056", "0.6356622", "0.6355299", "0.63552445", "0.63552445", "0.63542813", "0.6353291" ]
0.6961436
10
Use callbacks to share common setup or constraints between actions.
def set_manager @manager = Manager.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 manager_params params.fetch(:manager, {}).permit! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n 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 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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
GET /brothers GET /brothers.xml
def index @brothers = Brother.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @brothers } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end", "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def index\n @borrows = Borrow.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @borrows }\n end\n end", "def show\n @bouncer = Bouncer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bouncer }\n end\n end", "def index\n @bowls = Bowl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bowls }\n end\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end", "def show\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brochure_interest }\n end\n end", "def show\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brochure_interest }\n end\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def index\n @myers_briggs_types = MyersBriggsType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @myers_briggs_types }\n end\n end", "def show\n @brochure_travel = BrochureTravel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brochure_travel }\n end\n end", "def show\n @been2other = Been2other.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @been2other }\n end\n end", "def show\n @myers_briggs_type = MyersBriggsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @myers_briggs_type }\n end\n end", "def index\n @borrower_residences = BorrowerResidence.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @borrower_residences.to_xml }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bet }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def show\n @booker = Booker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booker }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @chronopay_links }\n end\n end", "def show\n @bogey = Bogey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bogey }\n end\n end", "def show\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bingo }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def show\n @team_roaster = TeamRoaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team_roaster }\n end\n end", "def index\n @bosses = Boss.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bosses }\n end\n end", "def index\n @betpayees = Betpayee.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @betpayees }\n end\n end", "def show\n @wrestler = Wrestler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wrestler }\n end\n end", "def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend", "def show\n @burger = Burger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @burger }\n end\n end", "def show\n @roaster = Roaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @roaster }\n end\n end", "def index\n @loans = Loan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @loans }\n end\n end", "def index\n @partyrelationships = Partyrelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyrelationships }\n end\n end", "def index\n @brochure_interests = BrochureInterest.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brochure_interests }\n end\n end", "def show\n @betpayee = Betpayee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @betpayee }\n end\n end", "def show\n @bairro = Bairro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bairro }\n end\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def index\n @bets = Bet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bets }\n end\n end", "def show\n @business_partner = BusinessPartner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @business_partner }\n end\n end", "def show\n @crawler_receive = CrawlerReceive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawler_receive }\n end\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end", "def show\n @congressman = Congressman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @congressman }\n end\n end", "def show\n @other = Other.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @other }\n end\n end", "def show\n @prov_composer_bios = ProvComposerBios.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @prov_composer_bios.to_xml }\n end\n end", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def show\n @business = Business.find_by_permalink(params[:id])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @business.to_xml }\n end\n end", "def tournaments\n get('sports/en/tournaments.xml')\n end", "def index\n @balances = Balance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @balances }\n end\n end", "def index\n @bouncers = Bouncer.find_top_urls\n @title = \"Top 10 URLs\"\n @show_edit_controls = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bouncers }\n end\n end", "def show\n @borrow = Borrow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @borrow }\n end\n end", "def show\n @network = Network.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network } \n end\n end", "def show #DESC: Ver detalles de un hobbie\n @hobbie = Hobbie.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hobbie }\n end\n end", "def show\n @title = \"Show Networks\"\n @network = Network.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network }\n end\n end", "def show\n @network_detail = Subnet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network_detail }\n end\n end", "def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end", "def index\n @boredoms = Boredom.all\n end", "def index\n @bonuses = Bonus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bonuses }\n end\n end", "def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end", "def show\n @borrower_residence = BorrowerResidence.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @borrower_residence.to_xml }\n end\n end", "def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergy }\n end\n end", "def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end", "def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { \n @brands = Brand.all\n render xml: @brands \n }\n end\n end", "def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relationship }\n end\n end", "def show\n @balance = Balance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def show\n @loanbook = Loanbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loanbook }\n end\n end", "def index\n @blacklists = Blacklist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blacklists }\n end\n end", "def index\n @guest_books = GuestBook.find(:all, :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @guest_books }\n end\n end", "def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end", "def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @barrio }\n end\n end", "def show\n @boss = Boss.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boss }\n end\n end", "def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end", "def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end", "def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end", "def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end", "def index\n @marketplaces = Marketplace.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @marketplaces }\n end\n end", "def show\n @bookfair = Bookfair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bookfair }\n end\n end", "def show\n @revendedor = Revendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @revendedor }\n end\n end", "def show\n @house_book = HouseBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @house_book }\n end\n end", "def index\n @authorships = Authorship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @authorships }\n end\n end", "def show\n @business = Business.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @business }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scholarship }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def show\n @gear = Gear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gear }\n end\n end", "def show\n @carrier = Carrier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carrier }\n end\n end", "def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end", "def show\n @news_blast = NewsBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_blast }\n end\n end", "def show\n @bairro_micro = BairroMicro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bairro_micro }\n end\n end", "def index\n @brouchers = Broucher.all\n end", "def show\n @bowl = Bowl.find(params[:id])\n @visits = Visit.find_all_by_user_id(@bowl.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bowl }\n end\n end", "def show\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def code_rels\n @arc = Arc.find_by_code(params[:code])\n @arc_rels = @arc.relationships\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc_rels.to_xml(:root => 'relationships', :except => [ :created_at, :updated_at ]) }\n end\n end", "def index\n @crawler_receives = CrawlerReceive.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @crawler_receives }\n end\n end" ]
[ "0.73023427", "0.64718395", "0.619665", "0.6172347", "0.61217886", "0.6118232", "0.6065591", "0.6045527", "0.6019558", "0.59852296", "0.59852296", "0.59692013", "0.5957953", "0.59242517", "0.59165835", "0.58907324", "0.58901817", "0.58817494", "0.58806276", "0.5870787", "0.5836806", "0.5831401", "0.5824537", "0.58158034", "0.58115464", "0.5807045", "0.5799219", "0.5791731", "0.5789499", "0.5778609", "0.57549584", "0.5753158", "0.57444024", "0.5734573", "0.57329667", "0.573146", "0.5700769", "0.5698203", "0.568941", "0.56858623", "0.5684765", "0.5681468", "0.5681355", "0.56713706", "0.5666686", "0.5663455", "0.56570345", "0.565132", "0.56507415", "0.5649447", "0.5645528", "0.56419814", "0.56364864", "0.563398", "0.56305397", "0.5624792", "0.5623106", "0.5617556", "0.5616589", "0.56138337", "0.5613679", "0.56122094", "0.5608341", "0.56066436", "0.55984265", "0.5598067", "0.55976945", "0.55929875", "0.5590622", "0.5585763", "0.55809987", "0.5579318", "0.5576412", "0.5574219", "0.55665994", "0.55663866", "0.55648255", "0.55648255", "0.55648255", "0.55648255", "0.55647355", "0.55620223", "0.55608624", "0.55594444", "0.5556041", "0.5552989", "0.55527675", "0.55443305", "0.55443305", "0.55443305", "0.5542451", "0.55319554", "0.5531778", "0.55277133", "0.5524585", "0.5523375", "0.5521817", "0.552114", "0.5520621", "0.551893" ]
0.7340559
0
GET /brothers/1 GET /brothers/1.xml
def show @brothers = Brother.all @brother = Brother.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @brother } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @brothers = Brother.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brothers }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end", "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def show\n @bouncer = Bouncer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bouncer }\n end\n end", "def index\n @bowls = Bowl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bowls }\n end\n end", "def show\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "def index\n @borrows = Borrow.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @borrows }\n end\n end", "def show\n @brochure_travel = BrochureTravel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brochure_travel }\n end\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def show\n @been2other = Been2other.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @been2other }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @chronopay_links }\n end\n end", "def show\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brochure_interest }\n end\n end", "def show\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brochure_interest }\n end\n end", "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bet }\n end\n end", "def show\n @bogey = Bogey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bogey }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat }\n end\n end", "def show\n @crawler_receive = CrawlerReceive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawler_receive }\n end\n end", "def show\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bingo }\n end\n end", "def show\n @network = Network.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network } \n end\n end", "def show\n @bairro = Bairro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bairro }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @roaster = Roaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @roaster }\n end\n end", "def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end", "def show\n @network_detail = Subnet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network_detail }\n end\n end", "def show\n @wrestler = Wrestler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wrestler }\n end\n end", "def show\n @title = \"Show Networks\"\n @network = Network.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @network }\n end\n end", "def show\n @bairro_micro = BairroMicro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bairro_micro }\n end\n end", "def show\n @booker = Booker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booker }\n end\n end", "def show\n @burger = Burger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @burger }\n end\n end", "def index\n @borrower_residences = BorrowerResidence.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @borrower_residences.to_xml }\n end\n end", "def show\n @myers_briggs_type = MyersBriggsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @myers_briggs_type }\n end\n end", "def index\n @bosses = Boss.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bosses }\n end\n end", "def show\n @news_blast = NewsBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_blast }\n end\n end", "def index\n @bets = Bet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bets }\n end\n end", "def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergy }\n end\n end", "def index\n @myers_briggs_types = MyersBriggsType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @myers_briggs_types }\n end\n end", "def show\n @other = Other.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @other }\n end\n end", "def show\n @borrow = Borrow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @borrow }\n end\n end", "def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @barrio }\n end\n end", "def show\n @business = Business.find_by_permalink(params[:id])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @business.to_xml }\n end\n end", "def show\n @prov_composer_bios = ProvComposerBios.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @prov_composer_bios.to_xml }\n end\n end", "def show\n @betpayee = Betpayee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @betpayee }\n end\n end", "def show\n @bom = Bom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bom }\n end\n end", "def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end", "def show\n @bixo = Bixo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bixo }\n end\n end", "def show\n @building = Building.find(params[:id])\n \n render :xml => @building\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @building }\n # end\n end", "def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end", "def show\n @bout = Bout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bout }\n end\n end", "def show\n @browsenodeid = Browsenodeid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @browsenodeid }\n end\n end", "def show\n @congressman = Congressman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @congressman }\n end\n end", "def index\n @brochure_interests = BrochureInterest.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brochure_interests }\n end\n end", "def index\n @crawler_receives = CrawlerReceive.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @crawler_receives }\n end\n end", "def index\n @betpayees = Betpayee.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @betpayees }\n end\n end", "def show\n @team_roaster = TeamRoaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team_roaster }\n end\n end", "def show\n @boss = Boss.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boss }\n end\n end", "def show\n @bonificacion = Bonificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bonificacion }\n end\n end", "def show\n @balance = Balance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def show\n @gear = Gear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gear }\n end\n end", "def show\n @carrier = Carrier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carrier }\n end\n end", "def show\n @services_charger = ServicesCharger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @services_charger }\n end\n end", "def show\n @house_book = HouseBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @house_book }\n end\n end", "def show\n @business_partner = BusinessPartner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @business_partner }\n end\n end", "def show\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def show\n @bp_request = BpRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bp_request }\n end\n end", "def index\n @loans = Loan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @loans }\n end\n end", "def index\n @bouncers = Bouncer.find_top_urls\n @title = \"Top 10 URLs\"\n @show_edit_controls = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bouncers }\n end\n end", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { \n @brands = Brand.all\n render xml: @brands \n }\n end\n end", "def show\n @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def index\n @bonuses = Bonus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bonuses }\n end\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @bid.to_xml }\n end\n end", "def show\n @loanbook = Loanbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loanbook }\n end\n end", "def index\n @balances = Balance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @balances }\n end\n end", "def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lore }\n end\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def show\n @bowl = Bowl.find(params[:id])\n @visits = Visit.find_all_by_user_id(@bowl.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bowl }\n end\n end", "def show\n @carro = Carro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carro }\n end\n end", "def show\n @business = Business.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @business }\n end\n end", "def show\n @borrower_residence = BorrowerResidence.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @borrower_residence.to_xml }\n end\n end", "def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relationship }\n end\n end", "def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bio }\n end\n end", "def show\n @nostro = Nostro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def show\n @clicker = Clicker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clicker }\n end\n end", "def show\n @bap = Bap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bap }\n end\n end", "def show\n @bdig = Bdig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bdig }\n end\n end", "def show\n @bp_transport_to_converter_data = BpTransportToConverterData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bp_transport_to_converter_data }\n end\n end", "def show\n @liga_blaz_blue = LigaBlazBlue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @liga_blaz_blue }\n end\n end", "def show\n @chirp = Chirp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chirp }\n end\n end", "def show\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bottle }\n \tformat.json { render :json => @bottle }\n\t\tend\n end", "def show\n @booking = Booking.find(params[:id])\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @booking }\n end\n end", "def show\n @buddy = Buddy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @buddy }\n end\n end", "def show\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subway }\n end\n end", "def index\n @partyrelationships = Partyrelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyrelationships }\n end\n end", "def show #DESC: Ver detalles de un hobbie\n @hobbie = Hobbie.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hobbie }\n end\n end", "def show\n @v_netweight = VNetweight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @v_netweight }\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 show\n @revendedor = Revendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @revendedor }\n end\n end", "def show\n @colo = Colo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colo }\n end\n end" ]
[ "0.7219056", "0.63309246", "0.6278176", "0.6262042", "0.6239098", "0.611427", "0.6110006", "0.6108222", "0.6091106", "0.609063", "0.60477924", "0.60189563", "0.6010542", "0.6006859", "0.6006859", "0.5982755", "0.5959786", "0.5951936", "0.59075636", "0.59024906", "0.5885215", "0.58771706", "0.5876792", "0.5866414", "0.58530515", "0.585086", "0.58369297", "0.58320725", "0.5828604", "0.5825588", "0.58232635", "0.58223385", "0.58187103", "0.5802228", "0.5782858", "0.5776037", "0.5764575", "0.5760211", "0.57588136", "0.57510084", "0.5744377", "0.5742557", "0.5741298", "0.5727978", "0.57191426", "0.5713176", "0.57130593", "0.5708764", "0.5701396", "0.56921566", "0.5690018", "0.56882006", "0.567909", "0.56786317", "0.56771696", "0.5674837", "0.5671827", "0.56716377", "0.5664227", "0.56610835", "0.5660235", "0.56591326", "0.5658473", "0.5657044", "0.56557685", "0.5653839", "0.5653227", "0.5651623", "0.5646836", "0.5644603", "0.5641247", "0.5638201", "0.5636721", "0.56331563", "0.5627815", "0.56247896", "0.5621614", "0.5617249", "0.5616904", "0.56157374", "0.5613824", "0.56082696", "0.56039494", "0.56029415", "0.55970705", "0.5593633", "0.5592413", "0.5591866", "0.55900055", "0.55869335", "0.5584349", "0.5583161", "0.55822194", "0.5581159", "0.5577865", "0.5574155", "0.55727667", "0.5571907", "0.5571302", "0.55704814" ]
0.7269294
0
GET /brothers/new GET /brothers/new.xml
def new @brother = Brother.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @brother } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brother }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n flash[:notice] = 'Brother was successfully created.'\n format.html { render :back }\n format.xml { render :xml => @brother, :status => :created, :location => @brother }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brother.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @bowl = Bowl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bowl }\n end\n end", "def new\n @been2other = Been2other.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @been2other }\n end\n end", "def new\n @other = Other.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @other }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @relationship = Relationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\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 @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\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 @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def new\n @bouncer = Bouncer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bouncer }\n end\n end", "def new\n @title = \"New Networks\"\n @network = Network.new\n @computers = Computer.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network }\n end\n end", "def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end", "def new\n @boss = Boss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boss }\n end\n end", "def new\n @roaster = Roaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @roaster }\n end\n end", "def new\n @bingo = Bingo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bingo }\n end\n end", "def new\n @balance = Balance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "def new\n @rink = Rink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rink }\n end\n end", "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end", "def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @browsenodeid = Browsenodeid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @browsenodeid }\n end\n end", "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def new\n @brochure_travel = BrochureTravel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brochure_travel }\n end\n end", "def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end", "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @burger = Burger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @burger }\n end\n end", "def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @brochure_interest = BrochureInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brochure_interest }\n end\n end", "def new\n @brochure_interest = BrochureInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brochure_interest }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def new\n @bp_request = BpRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bp_request }\n end\n end", "def new\n @buddy = Buddy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @buddy }\n end\n end", "def new\n @abonne = Abonne.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end", "def new\n @house = House.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house }\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 @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end", "def new\n @promos = Promos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promos }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\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 @bairro = Bairro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bairro }\n end\n end", "def new\n @revendedor = Revendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revendedor }\n end\n end", "def new\n @gear = Gear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gear }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @brand = Brand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brand }\n end\n end", "def new\n @bogey = Bogey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bogey }\n end\n end", "def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end", "def new\n @carro = Carro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @carro }\n end\n end", "def new\n @booker = Booker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booker }\n end\n end", "def new\n @bookfair = Bookfair.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookfair }\n end\n end", "def new\n @house_book = HouseBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house_book }\n end\n end", "def new\n @address = Address.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address }\n end\n end", "def new\n @crew = Crew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crew }\n end\n end", "def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contrato }\n end\n end", "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "def new\n @team_roaster = TeamRoaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team_roaster }\n end\n end", "def new\n @book = Book.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "def new\n @town_type = TownType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town_type }\n end\n end", "def new\n @shelf = Shelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelf }\n end\n end", "def new\n @allergen = Allergen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @allergen }\n end\n end", "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @crawler_receive = CrawlerReceive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawler_receive }\n end\n end", "def new\n @pastor = Pastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pastor }\n end\n end", "def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end", "def new\n @barrio = Barrio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @barrio }\n end\n end", "def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end" ]
[ "0.71615607", "0.71490526", "0.71388006", "0.7043233", "0.7028396", "0.70106125", "0.70029837", "0.69805753", "0.6937177", "0.691787", "0.69136286", "0.68756163", "0.6863917", "0.68307054", "0.68270946", "0.6811362", "0.6790906", "0.6787047", "0.67855257", "0.6775386", "0.6773864", "0.67676806", "0.67623544", "0.6757776", "0.6753572", "0.6740813", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6737146", "0.6722234", "0.6718374", "0.6717743", "0.671545", "0.67139095", "0.67087185", "0.6706017", "0.6706017", "0.6697516", "0.66925573", "0.6690193", "0.6690193", "0.6690037", "0.667947", "0.6670351", "0.6670018", "0.66623604", "0.6650901", "0.6649318", "0.6646502", "0.664648", "0.66395324", "0.66259176", "0.6620456", "0.6620456", "0.66162455", "0.6613041", "0.6611908", "0.6611908", "0.6611908", "0.6611908", "0.6611908", "0.6611908", "0.6611908", "0.66033787", "0.66025037", "0.6597398", "0.6596785", "0.6596183", "0.6593367", "0.65924066", "0.65880066", "0.65878654", "0.6582721", "0.65820885", "0.6581227", "0.65806186", "0.65792155", "0.6576209", "0.6571315", "0.65620327", "0.6561481", "0.6559878", "0.65585977", "0.6558154", "0.6556675", "0.655665", "0.65563816", "0.6556138", "0.6555542", "0.6554492", "0.65525824", "0.65503365", "0.6549852" ]
0.78451896
0
POST /brothers POST /brothers.xml
def create @brother = Brother.new(params[:brother]) respond_to do |format| if @brother.save flash[:notice] = 'Brother was successfully created.' format.html { render :back } format.xml { render :xml => @brother, :status => :created, :location => @brother } else format.html { render :action => "new" } format.xml { render :xml => @brother.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { render json: @brother, status: :created, location: @brother }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\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 response.body\n end", "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def index\n @brothers = Brother.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brothers }\n end\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n flash[:notice] = 'Neighborhood was successfully created.'\n format.html { redirect_to(@neighborhood) }\n format.xml { render :xml => @neighborhood, :status => :created, :location => @neighborhood }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @neighborhood.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @been2other = Been2other.new(params[:been2other])\n\n respond_to do |format|\n if @been2other.save\n format.html { redirect_to(@been2other, :notice => 'Been2other was successfully created.') }\n format.xml { render :xml => @been2other, :status => :created, :location => @been2other }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @been2other.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pneighbour = Pneighbour.new(params[:pneighbour])\n\n respond_to do |format|\n if @pneighbour.save\n format.html { redirect_to(@pneighbour, :notice => 'Pneighbour was successfully created.') }\n format.xml { render :xml => @pneighbour, :status => :created, :location => @pneighbour }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pneighbour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend", "def create\n @boredom = Boredom.new(boredom_params)\n\n respond_to do |format|\n if @boredom.save\n format.html { redirect_to @boredom, notice: 'Boredom was successfully created.' }\n format.json { render :show, status: :created, location: @boredom }\n else\n format.html { render :new }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brochure_interest = BrochureInterest.new(params[:brochure_interest])\n\n respond_to do |format|\n if @brochure_interest.save\n format.html { redirect_to(@brochure_interest, :notice => 'Brochure interest was successfully created.') }\n format.xml { render :xml => @brochure_interest, :status => :created, :location => @brochure_interest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def create\n @draft_partnership = DraftPartnership.new(params[:partnership])\n\n respond_to do |format|\n if @draft_partnership.save\n\n format.xml { render :xml => @draft_partnership, :status => :created, :location => @draft_partnership }\n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brother }\n end\n end", "def create\n @brodo = Brodo.new(brodo_params)\n\n respond_to do |format|\n if @brodo.save\n format.html { redirect_to @brodo, notice: 'Brodo was successfully created.' }\n format.json { render :show, status: :created, location: @brodo }\n else\n format.html { render :new }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to(brothers_url) }\n format.xml { head :ok }\n end\n end", "def set_brother\n @brother = Brother.find(params[:id])\n end", "def create\n @brochure_interest = BrochureInterest.new(params[:brochure_interest])\n\n respond_to do |format|\n if @brochure_interest.save\n format.html { redirect_to(admin_brochure_interests_url, :notice => 'Brochure interest was successfully created.') }\n format.xml { render :xml => @brochure_interest, :status => :created, :location => @brochure_interest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @business_partner = BusinessPartner.new(params[:business_partner])\n\n respond_to do |format|\n if @business_partner.save\n format.html { redirect_to(@business_partner, :notice => 'Business partner was successfully created.') }\n format.xml { render :xml => @business_partner, :status => :created, :location => @business_partner }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @business_partner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @broucher = current_user.company.stall.brouchers.build(broucher_params)\n\n respond_to do |format|\n if @broucher.save\n format.html { redirect_to @broucher.stall, notice: 'Broucher was successfully created.' }\n format.json { render :show, status: :created, location: @broucher }\n else\n format.html { render :new }\n format.json { render json: @broucher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @betpayee = Betpayee.new(params[:betpayee])\n respond_to do |format|\n if @betpayee.save\n flash[:notice] = 'Betpayee was successfully created.'\n format.html { redirect_to(@betpayee) }\n format.xml { render :xml => @betpayee, :status => :created, :location => @betpayee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @betpayee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bowl = Bowl.new(params[:bowl])\n\n respond_to do |format|\n if @bowl.save\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully created.') }\n format.xml { render :xml => @bowl, :status => :created, :location => @bowl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end", "def post\n Rentlinx.client.post(self)\n end", "def create\n @neighbourhood = Neighbourhood.new(neighbourhood_params)\n\n respond_to do |format|\n if @neighbourhood.save\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @kebab = Kebab.new\n @kebab.build_promoter\n @kebab.transportations << Transportation.new\n @kebab.participations << Participation.new\n @kebab.comments << Comment.new\n @people = Person.all(:order => 'name asc')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kebab }\n end\n end", "def post_business(business, location)\n xml = Builder::XmlMarkup.new\n query = xml.tag!(\"BPMSPost\", 'Edition' => \"1.1\") {\n xml.tag!(\"Record\") {\n xml.tag!(\"Phone\", location.phone)\n xml.tag!(\"BusinessName\", location.location_name)\n xml.tag!(\"Address\", location.address)\n xml.tag!(\"City\", location.city)\n xml.tag!(\"State\", location.state)\n xml.tag!(\"Zip\", location.zip)\n xml.tag!(\"URL\", location.website_url)\n xml.tag!(\"TagLine\", location.special_offer)\n #xml.tag!(\"LogoImage\", location.logo)\n xml.tag!(\"Categories\") {\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Primary\")\n xml.tag!(\"Name\", business.industry_primary)\n }\n if business.industry_alt_1.present?\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Alt1\")\n xml.tag!(\"Name\", business.industry_alt_1)\n }\n end\n if business.industry_alt_2.present?\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Alt2\")\n xml.tag!(\"Name\", business.industry_alt_2)\n }\n end\n }\n }\n }\n body = build_request(3700, 1510, query)\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n xml_doc['Error'] == '0' # success (returns true/false)\n end", "def create\n @bingo = Bingo.new(params[:bingo])\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully created.') }\n format.xml { render :xml => @bingo, :status => :created, :location => @bingo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def create(bin_params)\n @rest.post('save', bin_params)\n end", "def create\n @abonne = Abonne.new(params[:abonne])\n\n respond_to do |format|\n if @abonne.save\n flash[:notice] = 'Abonne was successfully created.'\n format.html { redirect_to(@abonne) }\n format.xml { render :xml => @abonne, :status => :created, :location => @abonne }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @abonne.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "def create\n @brochure_travel = BrochureTravel.new(params[:brochure_travel])\n\n respond_to do |format|\n if @brochure_travel.save\n format.html { redirect_to(@brochure_travel, :notice => 'Brochure travel was successfully created.') }\n format.xml { render :xml => @brochure_travel, :status => :created, :location => @brochure_travel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brochure_travel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bogey = Bogey.new(params[:bogey])\n\n respond_to do |format|\n if @bogey.save\n flash[:notice] = 'Bogey was successfully created.'\n format.html { redirect_to(@bogey) }\n format.xml { render :xml => @bogey, :status => :created, :location => @bogey }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bogey.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @family_bond = FamilyBond.new(family_bond_params)\n\n respond_to do |format|\n if @family_bond.save\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully created.' }\n format.json { render :show, status: :created, location: @family_bond }\n else\n format.html { render :new }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @other = Other.new(params[:other])\n\n respond_to do |format|\n if @other.save\n flash[:notice] = 'Other was successfully created.'\n format.html { redirect_to(@other) }\n format.xml { render :xml => @other, :status => :created, :location => @other }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @other.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @neighbour = Neighbour.new(neighbour_params)\n\n respond_to do |format|\n if @neighbour.save\n format.html { redirect_to @neighbour, notice: 'Neighbour was successfully created.' }\n format.json { render :show, status: :created, location: @neighbour }\n else\n format.html { render :new }\n format.json { render json: @neighbour.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def create\r\n @receivable = Receivable.new(params[:receivable])\r\n\r\n respond_to do |format|\r\n if @receivable.save\r\n flash[:notice] = 'Título a receber criado.'\r\n format.html { redirect_to(@receivable) }\r\n format.xml { render :xml => @receivable, :status => :created, :location => @receivable }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @receivable.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @intranet_boleto = Intranet::Boleto.new(intranet_boleto_params)\n\n respond_to do |format|\n if @intranet_boleto.save\n format.html { redirect_to @intranet_boleto, notice: \"Boleto was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_boleto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n @node.broadcast_add_me\n Cue.send_all_pending\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end", "def create\n @nostro = Nostro.new(params[:nostro])\n\n respond_to do |format|\n if @nostro.save\n flash[:notice] = 'Nostro was successfully created.'\n format.html { redirect_to(@nostro) }\n format.xml { render :xml => @nostro, :status => :created, :location => @nostro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nostro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end", "def create\n @browsenodeid = Browsenodeid.new(browsenodeid_params)\n\n respond_to do |format|\n if @browsenodeid.save\n format.html { redirect_to(@browsenodeid, :notice => 'Browsenodeid was successfully created.') }\n format.xml { render :xml => @browsenodeid, :status => :created, :location => @browsenodeid }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @browsenodeid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(body)\n request = Net::HTTP::Post.new(bind_uri)\n request.body = body\n request.content_length = request.body.size\n request[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\n Jabber.debug(\"Sending POST request - #{body.strip}\")\n\n response = Net::HTTP.new(domain, port).start { |http| http.request(request) }\n\n Jabber.debug(\"Receiving POST response - #{response.code}: #{response.body.inspect}\")\n\n unless response.is_a?(Net::HTTPSuccess)\n raise Net::HTTPBadResponse, \"Net::HTTPSuccess expected, but #{response.class} was received\"\n end\n\n response\n end", "def send_request( xml )\n write( xml )\n read\n end", "def submit\n obj = ActiveSupport::Inflector.constantize(self.class.to_s.gsub(/Builder/, ''))\n obj.new(Client.post_xml_request(to_s))\n end", "def create\n @revendedor = Revendedor.new(params[:revendedor])\n\n respond_to do |format|\n if @revendedor.save\n flash[:notice] = 'Revendedor was successfully created.'\n format.html { redirect_to(@revendedor) }\n format.xml { render :xml => @revendedor, :status => :created, :location => @revendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @revendedor.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 @friendship = current_person.friendships.build(:granter_id => params[:granter_id], :accepted => params[:accepted])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to people_url, notice: 'A friend request has been sent to ' + Person.find(params[:granter_id]).name }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def create\n @brite_rt_waxman = BriteRtWaxman.new(brite_rt_waxman_params)\n\n respond_to do |format|\n if @brite_rt_waxman.save\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def postRelationship(oapID, userPropID)\n toPost = Nokogiri::XML::Builder.new { |xml|\n xml.send('import-relationship', 'xmlns' => \"http://www.symplectic.co.uk/publications/api\") {\n xml.send('from-object', \"publication(source-c-inst-1,pid-#{oapID})\")\n xml.send('to-object', \"user(pid-#{userPropID})\")\n xml.send('type-name', \"publication-user-authorship\")\n }\n }.to_xml\n uri = URI(\"#{$elementsAPI}/relationships\")\n\n # Log what we're about to POST.\n $transLog.write(\"\\n---------------------------------------------------------------\\n\")\n $transLog.write(\"\\nPOST #{uri}\\n\\n\")\n $transLog.write(toPost)\n\n if $testMode\n puts \"(test mode: skipping real put)\"\n return\n end\n\n # And put it\n (1..10).each { |tryNumber|\n\n puts \" Posting relationship for user ID #{userPropID}.\"\n req = Net::HTTP::Post.new(uri)\n req['Content-Type'] = 'text/xml'\n req.basic_auth $apiCred[0], $apiCred[1]\n req.body = toPost\n res = $elementsAPIConn.request(req)\n\n # Log the response\n $transLog.write(\"\\nResponse:\\n\")\n $transLog.write(\"#{res} code=#{res.code} message=#{res.message.inspect}\\n\")\n $transLog.write(\"#{res.body.start_with?('<?xml') ? Nokogiri::XML(res.body, &:noblanks).to_xml : res.body}\\n\")\n\n # HTTPConflict and HTTPGatewayTimeOut happen occasionally, and are likely transitory\n if res.is_a?(Net::HTTPConflict) || res.is_a?(Net::HTTPGatewayTimeOut)\n puts \" Note: failed due to #{res} (likely a transitory concurrency issue).\"\n if tryNumber < 20\n puts \" Will retry after a 30-second pause.\"\n sleep 30\n next\n else\n puts \" Out of retries. Aborting.\"\n end \n end\n\n # Fail if the POST failed.\n res.is_a?(Net::HTTPSuccess) or raise(\"Error: post failed: #{res}\")\n\n # Otherwise, we're done.\n return\n }\nend", "def create\n @bizcard = Bizcard.new(params[:bizcard])\n @bizcard.relationships.build(:user_id => current_user.id)\n\n respond_to do |format|\n if @bizcard.save\n format.html { redirect_to root_path, notice: 'Bizcard was successfully created.' }\n format.json { render json: @bizcard, status: :created, location: @bizcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bizcard.errors, status: :unprocessable_entity }\n end\n end\n end", "def bridges_create(params = {})\n post \"bridges\", params\n end", "def create\n @myers_briggs_type = MyersBriggsType.new(params[:myers_briggs_type])\n\n respond_to do |format|\n if @myers_briggs_type.save\n flash[:notice] = 'Myers Briggs Type was successfully created.'\n format.html { redirect_to(@myers_briggs_type) }\n format.xml { render :xml => @myers_briggs_type, :status => :created, :location => @myers_briggs_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @myers_briggs_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end", "def create\n @test_booking_child = TestBookingChild.new(params[:test_booking_child])\n\n respond_to do |format|\n if @test_booking_child.save\n format.html { redirect_to(@test_booking_child, :notice => 'TestBookingChild was successfully created.') }\n format.xml { render :xml => @test_booking_child, :status => :created, :location => @test_booking_child }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_booking_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @team_roaster = TeamRoaster.new(params[:team_roaster])\n\n respond_to do |format|\n if @team_roaster.save\n format.html { redirect_to(@team_roaster, :notice => 'Team roaster was successfully created.') }\n format.xml { render :xml => @team_roaster, :status => :created, :location => @team_roaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team_roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @balance = Balance.new(params[:balance])\n\n respond_to do |format|\n if @balance.save\n format.html { redirect_to(@balance, :notice => 'Balance was successfully created.') }\n format.xml { render :xml => @balance, :status => :created, :location => @balance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @balance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new_customer \n ForestOperations.link_parent_child_nodes_return_parent(\n ForestOperations.create_node(\n line_content[:sent_or_accepted_by],\n :accepted),\n ForestOperations.create_node(\n line_content[:recived_by]\n ) \n )\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bunker = Bunker.new(params[:bunker])\n\n respond_to do |format|\n if @bunker.save\n flash[:notice] = 'Bunker was successfully created.'\n format.html { redirect_to(@bunker) }\n format.xml { render :xml => @bunker, :status => :created, :location => @bunker }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bunker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bp_request = BpRequest.new(params[:bp_request])\n\n respond_to do |format|\n if @bp_request.save\n flash[:notice] = 'BpRequest was successfully created.'\n format.html { redirect_to(@bp_request) }\n format.xml { render :xml => @bp_request, :status => :created, :location => @bp_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bp_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @partner_person = PartnerPerson.new(params[:partner_person])\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n if @partner_person.save\n format.html { redirect_to(@partner_person, :notice => 'PartnerPerson was successfully created.') }\n format.xml { render :xml => @partner_person, :status => :created, :location => @partner_person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partner_person.errors, :status => :unprocessable_entity }\n end\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 create\n @bairro = Bairro.new(params[:bairro])\n\n respond_to do |format|\n if @bairro.save\n flash[:notice] = \"Bairro criado com sucesso.\"\n format.html { redirect_to(admin_bairros_path) }\n format.xml { render :xml => @bairro, :status => :created, :location => @bairro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bairro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_recibo = TipoRecibo.new(params[:tipo_recibo])\n\n respond_to do |format|\n if @tipo_recibo.save\n format.html { redirect_to(@tipo_recibo, :notice => 'Tipo recibo was successfully created.') }\n format.xml { render :xml => @tipo_recibo, :status => :created, :location => @tipo_recibo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_recibo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @robin = Robin.new(robin_params)\n\n respond_to do |format|\n if @robin.save\n format.html { redirect_to @robin, notice: 'Robin was successfully created.' }\n format.json { render :show, status: :created, location: @robin }\n else\n format.html { render :new }\n format.json { render json: @robin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @partyrelationship = Partyrelationship.new(params[:partyrelationship])\n\n respond_to do |format|\n if @partyrelationship.save\n format.html { redirect_to(@partyrelationship, :notice => 'Partyrelationship was successfully created.') }\n format.xml { render :xml => @partyrelationship, :status => :created, :location => @partyrelationship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @partyrelationship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end", "def create\n @bonificacion = Bonificacion.new(params[:bonificacion])\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to(@bonificacion, :notice => 'Bonificacion was successfully created.') }\n format.xml { render :xml => @bonificacion, :status => :created, :location => @bonificacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bonificacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @relationshipneighbor = Relationshipneighbor.new(relationshipneighbor_params)\n\n respond_to do |format|\n if @relationshipneighbor.save\n format.html { redirect_to @relationshipneighbor, notice: 'Relationshipneighbor was successfully created.' }\n format.json { render :show, status: :created, location: @relationshipneighbor }\n else\n format.html { render :new }\n format.json { render json: @relationshipneighbor.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @fan = Fan.new(params[:fan])\n\n respond_to do |format|\n if @fan.save\n format.html { render :action => 'thanks' }\n format.xml { render :xml => @fan, :status => :created, :location => @fan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bond = Bond.new(bond_params)\n\n respond_to do |format|\n if @bond.save\n format.html { redirect_to bonds_path, notice: I18n.t('messages.created_with', item: @bond.company) }\n format.json { render :show, status: :created, location: @bond }\n else\n format.html { render :new }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @outgoing_type = OutgoingType.new(params[:outgoing_type])\n\n respond_to do |format|\n if @outgoing_type.save\n format.html { redirect_to(outgoing_types_path, :notice => 'Outgoing type was successfully created.') }\n format.xml { render :xml => @outgoing_type, :status => :created, :location => @outgoing_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outgoing_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @brochure_travel = BrochureTravel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brochure_travel }\n end\n end", "def new\n @myers_briggs_type = MyersBriggsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @myers_briggs_type }\n end\n end", "def create\n @boook = Boook.new(boook_params)\n\n respond_to do |format|\n if @boook.save\n format.html { redirect_to @boook, notice: 'Boook was successfully created.' }\n format.json { render :show, status: :created, location: @boook }\n else\n format.html { render :new }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address_book = AddressBook.new(params[:address_book])\n\n respond_to do |format|\n if @address_book.save\n flash[:notice] = :address_book_created.l\n format.html { redirect_to(address_books_url) }\n format.xml { render :xml => @address_book, :status => :created, :location => @address_book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bond = Bond.new(bond_params)\n @bond.citizen = current_citizen\n\n respond_to do |format|\n if @bond.save\n format.html { redirect_to \"/citizens/#{@bond.citizen.id}?tab=finances\", notice: 'Bond bought.' }\n format.json { render :show, status: :created, location: @bond }\n else\n format.html { render :new }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @been2other = Been2other.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @been2other }\n end\n end", "def create\n @partner = Partner.new(params[:partner])\n @company = Company.find(params[:company_id])\n @partner.company = @company\n @partner.save\n\n respond_to do |format|\n if @partner.save\n format.html { redirect_to @partner}\n format.json { render json: @partner, 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 @cancellation = Cancellation.new_from_xml(request.body.read)\n respond_to do |format|\n if @cancellation.save! \n format.xml { render :action => 'show', :status => :created, :location => @cancellation }\n else\n format.xml { render :xml => @cancellation.errors, :status => :unprocessable_entity }\n end\n end \n \n #@orders.each do |order|\n end", "def to_xml\n http.body\n end", "def create\n @type_bond = TypeBond.new(type_bond_params)\n\n respond_to do |format|\n if @type_bond.save\n format.html { redirect_to @type_bond, notice: 'Type bond was successfully created.' }\n format.json { render :show, status: :created, location: @type_bond }\n else\n format.html { render :new }\n format.json { render json: @type_bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def postContractCreate( entity_id, user_id, payment_provider, basket, billing_period, source, channel, campaign, referrer_domain, referrer_name, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['payment_provider'] = payment_provider\n params['basket'] = basket\n params['billing_period'] = billing_period\n params['source'] = source\n params['channel'] = channel\n params['campaign'] = campaign\n params['referrer_domain'] = referrer_domain\n params['referrer_name'] = referrer_name\n params['flatpack_id'] = flatpack_id\n return doCurl(\"post\",\"/contract/create\",params)\n end", "def new\n @bouncer = Bouncer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bouncer }\n end\n end", "def boredom_params\n params.require(:boredom).permit(:name, :activity)\n end", "def create\n @roaster = Roaster.new(params[:roaster])\n\n respond_to do |format|\n if @roaster.save\n flash[:notice] = 'Roaster was successfully created.'\n format.html { redirect_to(@roaster) }\n format.xml { render :xml => @roaster, :status => :created, :location => @roaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @roaster.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.61392224", "0.6081564", "0.58604574", "0.5848659", "0.55267984", "0.5439152", "0.54050064", "0.5393558", "0.53862566", "0.53813714", "0.5363521", "0.5346834", "0.5332638", "0.5318381", "0.5315566", "0.53073955", "0.5303928", "0.5262948", "0.5262113", "0.52343315", "0.5233101", "0.52325314", "0.52274597", "0.52064365", "0.52040046", "0.51966393", "0.51847684", "0.518083", "0.51779056", "0.51757413", "0.5169378", "0.5166234", "0.5148678", "0.51476806", "0.514201", "0.5141536", "0.51354074", "0.5132209", "0.51314545", "0.51142246", "0.5112876", "0.51102203", "0.5107089", "0.51052034", "0.510159", "0.50877464", "0.5084468", "0.50731933", "0.5072894", "0.5070862", "0.50613886", "0.5057129", "0.5054011", "0.50439185", "0.5039494", "0.5035287", "0.50332904", "0.50297415", "0.50296193", "0.50288814", "0.50242436", "0.5021056", "0.5010258", "0.5002594", "0.5000065", "0.4998945", "0.49903274", "0.49899012", "0.49847257", "0.49816734", "0.49816734", "0.49756813", "0.49721143", "0.49715897", "0.49714226", "0.49709785", "0.4964773", "0.49596536", "0.49595228", "0.49575707", "0.49385303", "0.49361795", "0.49289516", "0.49267375", "0.49255213", "0.49171764", "0.49159557", "0.4915673", "0.49135065", "0.49132165", "0.49108195", "0.49097228", "0.49044093", "0.4899686", "0.48906222", "0.48901993", "0.48896405", "0.48880738", "0.48798218", "0.48781592" ]
0.6692793
0
PUT /brothers/1 PUT /brothers/1.xml
def update @brother = Brother.find(params[:id]) respond_to do |format| if @brother.update_attributes(params[:brother]) flash[:notice] = 'Brother was successfully updated.' format.html { redirect_to roster_show_path(@brother) } format.xml { head :ok } else #debugger format.html { render :action => "edit" } format.xml { render :xml => @brother.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n if @brother.update_attributes(params[:brother])\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brother.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(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 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 @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n if @draft_partnership.update_attributes(params[:partnership])\n\n format.xml \n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n if @neighborhood.update_attributes(params[:neighborhood])\n flash[:notice] = 'Neighborhood was successfully updated.'\n format.html { redirect_to(@neighborhood) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @neighborhood.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_object_xml(object_type, id, xml)\n @client.update_business_object_by_public_id({\n :busObNameOrId => object_type,\n :busObPublicId => id,\n :updateXml => xml\n })\n return last_error\n end", "def set_brother\n @brother = Brother.find(params[:id])\n end", "def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.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 @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n if @brochure_interest.update_attributes(params[:brochure_interest])\n format.html { redirect_to(@brochure_interest, :notice => 'Brochure interest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to(brothers_url) }\n format.xml { head :ok }\n end\n end", "def update\n @bouncer = Bouncer.find(params[:id])\n\n respond_to do |format|\n if @bouncer.update_attributes(params[:bouncer])\n format.html { redirect_to(@bouncer, :notice => 'URL was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bouncer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @other = Other.find(params[:id])\n\n respond_to do |format|\n if @other.update_attributes(params[:other])\n flash[:notice] = 'Other was successfully updated.'\n format.html { redirect_to(@other) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @other.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @been2other = Been2other.find(params[:id])\n\n respond_to do |format|\n if @been2other.update_attributes(params[:been2other])\n format.html { redirect_to(@been2other, :notice => 'Been2other was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @been2other.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def update\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n if @brochure_interest.update_attributes(params[:brochure_interest])\n format.html { redirect_to([:admin, @brochure_interest], :notice => 'Brochure interest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n if @pneighbour.update_attributes(params[:pneighbour])\n format.html { redirect_to(@pneighbour, :notice => 'Pneighbour was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pneighbour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to(@bottle, :notice => 'Bottle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bairro_micro = BairroMicro.find(params[:id])\n\n respond_to do |format|\n if @bairro_micro.update_attributes(params[:bairro_micro])\n flash[:notice] = 'BairroMicro was successfully updated.'\n format.html { redirect_to(@bairro_micro) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bairro_micro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n flash[:notice] = 'Brother was successfully created.'\n format.html { render :back }\n format.xml { render :xml => @brother, :status => :created, :location => @brother }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brother.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @browsenodeid = Browsenodeid.find(params[:id])\n\n respond_to do |format|\n if @browsenodeid.update_attributes(browsenodeid_params)\n format.html { redirect_to(@browsenodeid, :notice => 'Browsenodeid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @browsenodeid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def update\n @roaster = Roaster.find(params[:id])\n\n respond_to do |format|\n if @roaster.update_attributes(params[:roaster])\n flash[:notice] = 'Roaster was successfully updated.'\n format.html { redirect_to(@roaster) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @robin.update(robin_params)\n format.html { redirect_to @robin, notice: 'Robin was successfully updated.' }\n format.json { render :show, status: :ok, location: @robin }\n else\n format.html { render :edit }\n format.json { render json: @robin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n #format.html { redirect_to(@box, :notice => 'Box was successfully updated.') }\n format.html {redirect_to my_boxes_path}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @box.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |format|\n if @boredom.update(boredom_params)\n format.html { redirect_to @boredom, notice: 'Boredom was successfully updated.' }\n format.json { render :show, status: :ok, location: @boredom }\n else\n format.html { render :edit }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def update\n @gearbox_type = GearboxType.find(params[:id])\n\n respond_to do |format|\n if @gearbox_type.update_attributes(params[:gearbox_type])\n format.html { redirect_to(@gearbox_type, :notice => 'Gearbox type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gearbox_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @carrier = Carrier.find(params[:id])\n\n respond_to do |format|\n if @carrier.update_attributes(params[:carrier])\n flash[:notice] = 'Carrier was successfully updated.'\n format.html { redirect_to(carriers_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @carrier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n format.html { redirect_to(@boat, :notice => 'Boat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end", "def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end", "def put!\n request! :put\n end", "def update\n @bogey = Bogey.find(params[:id])\n\n respond_to do |format|\n if @bogey.update_attributes(params[:bogey])\n flash[:notice] = 'Bogey was successfully updated.'\n format.html { redirect_to(@bogey) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bogey.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @family = Family.find(params[:id])\n\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = \"Family #{@family.business_name} was successfully updated.\"\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n connection.put(element_path, to_xml)\n end", "def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @robo.update(robo_params)\n format.html { redirect_to @robo, notice: 'Robo was successfully updated.' }\n format.json { render :show, status: :ok, location: @robo }\n else\n format.html { render :edit }\n format.json { render json: @robo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bom = Bom.find(params[:id])\n\n respond_to do |format|\n if @bom.update_attributes(params[:bom])\n format.html { redirect_to(@bom, :notice => 'Bom was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n respond_to do |format|\n if @boolio.update( boolio_params )\n format.html { redirect_to @boolio, notice: 'Boolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @boolio }\n else\n format.html { render :edit }\n format.json { render json: @boolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boss = Boss.find(params[:id])\n\n respond_to do |format|\n if @boss.update_attributes(params[:boss])\n flash[:notice] = 'Boss was successfully updated.'\n format.html { redirect_to(@boss) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boss.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n flash[:notice] = 'Contract was successfully updated.'\n format.html { redirect_to(@contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @brochure_travel = BrochureTravel.find(params[:id])\n\n respond_to do |format|\n if @brochure_travel.update_attributes(params[:brochure_travel])\n format.html { redirect_to(@brochure_travel, :notice => 'Brochure travel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @brochure_travel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @prov_composer_bios = ProvComposerBios.find(params[:id])\n\n respond_to do |format|\n if @prov_composer_bios.update_attributes(params[:prov_composer_bios])\n flash[:notice] = 'ProvComposerBios was successfully updated.'\n format.html { redirect_to prov_composer_bio_url(@prov_composer_bios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prov_composer_bios.errors.to_xml }\n end\n end\n end", "def update\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n if @barrio.update_attributes(params[:barrio])\n format.html { redirect_to(@barrio, :notice => 'Barrio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @barrio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n if @shelf.update_attributes(params[:shelf])\n flash[:notice] = 'Shelf was successfully updated.'\n format.html { redirect_to(@shelf) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shelf.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @nostro = Nostro.find(params[:id])\n\n respond_to do |format|\n if @nostro.update_attributes(params[:nostro])\n flash[:notice] = 'Nostro was successfully updated.'\n format.html { redirect_to(@nostro) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nostro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n if @brochure.update_attributes(params[:brochure])\n format.html { redirect_to @brochure, notice: 'Brochure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brochure.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 @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n flash[:notice] = 'Node was successfully updated.'\n format.html { redirect_to(@node) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @broucher.update(broucher_params)\n format.html { redirect_to @broucher, notice: 'Broucher was successfully updated.' }\n format.json { render :show, status: :ok, location: @broucher }\n else\n format.html { render :edit }\n format.json { render json: @broucher.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brodo.update(brodo_params)\n format.html { redirect_to @brodo, notice: 'Brodo was successfully updated.' }\n format.json { render :show, status: :ok, location: @brodo }\n else\n format.html { render :edit }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to(\"/contractview\", :notice => 'Contract was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bairro = Bairro.find(params[:id])\n\n respond_to do |format|\n if @bairro.update_attributes(params[:bairro])\n flash[:notice] = \"Bairro atualizado com sucesso.\"\n format.html { redirect_to(admin_bairros_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bairro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def index\n @brothers = Brother.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brothers }\n end\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 update\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n if @neighborhood.update_attributes(params[:neighborhood])\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n if @neighborhood.update_attributes(params[:neighborhood])\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team_roaster = TeamRoaster.find(params[:id])\n\n respond_to do |format|\n if @team_roaster.update_attributes(params[:team_roaster])\n format.html { redirect_to(@team_roaster, :notice => 'Team roaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n if @protocolo.update_attributes(params[:protocolo])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@protocolo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocolo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @business_partner = BusinessPartner.find(params[:id])\n\n respond_to do |format|\n if @business_partner.update_attributes(params[:business_partner])\n format.html { redirect_to(@business_partner, :notice => 'Business partner was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @business_partner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @house_book = HouseBook.find(params[:id])\n\n respond_to do |format|\n if @house_book.update_attributes(params[:house_book])\n format.html { redirect_to(@house_book, :notice => 'House book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @house_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node_config = NodeConfig.find(params[:id])\n\n respond_to do |format|\n if @node_config.update_attributes(params[:node_config])\n format.html { redirect_to(@node_config, :notice => 'NodeConfig was successfully updated.') }\n format.json { render :json => @node_config, :status => :ok }\n format.xml { render :xml => @node_config, :status => :ok }\n else\n format.xml { render :xml => @node_config.errors, :status => :unprocessable_entity }\n format.any { render :json => @node_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @call_box = CallBox.find(params[:id])\n\n respond_to do |format|\n if @call_box.update_attributes(params[:call_box])\n format.html { redirect_to([@layer, @call_box], :notice => 'Call Box was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @call_box.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @surname = Surname.find(params[:id])\n\n respond_to do |format|\n if @surname.update_attributes(params[:surname])\n format.html { redirect_to @surname, notice: 'Surname was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @surname.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update\n @carro = Carro.find(params[:id])\n\n respond_to do |format|\n if @carro.update_attributes(params[:carro])\n format.html { redirect_to(@carro, :notice => 'Carro atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @carro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @town = Town.find(params[:id])\n\n respond_to do |format|\n if @town.update_attributes(params[:town])\n flash[:notice] = 'Town was successfully updated.'\n format.html { redirect_to(@town) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @town.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n if @orden_cobro.update_attributes(params[:orden_cobro])\n format.html { redirect_to @orden_cobro, notice: 'Orden cobro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orden_cobro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n if @abonne.update_attributes(params[:abonne])\n flash[:notice] = 'Abonne was successfully updated.'\n format.html { redirect_to(@abonne) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @abonne.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n respond_to do |format|\n if @neighbourhood.update(neighbourhood_params)\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully updated.' }\n format.json { render :show, status: :ok, location: @neighbourhood }\n else\n format.html { render :edit }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def 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" ]
[ "0.61944085", "0.61622566", "0.6067706", "0.60124433", "0.587071", "0.5719319", "0.55922663", "0.55847657", "0.55485606", "0.54673594", "0.5457736", "0.5447154", "0.5438106", "0.54122555", "0.5402323", "0.53718936", "0.5357636", "0.5349355", "0.5331841", "0.53261787", "0.53195715", "0.5314854", "0.53132814", "0.5293965", "0.5293575", "0.5283739", "0.5283591", "0.5280264", "0.5270696", "0.5249926", "0.5236671", "0.5234366", "0.5233032", "0.52281696", "0.52240413", "0.52230024", "0.52151686", "0.5212306", "0.5201724", "0.5200327", "0.51924515", "0.5182995", "0.51719093", "0.5163388", "0.5163168", "0.5158149", "0.5156787", "0.5154139", "0.51537853", "0.5151774", "0.5151597", "0.5151581", "0.51479065", "0.5147409", "0.5142303", "0.51406395", "0.5138976", "0.5138269", "0.5137187", "0.5133632", "0.5128381", "0.5127802", "0.5107298", "0.5105164", "0.510368", "0.5101727", "0.51000804", "0.5099085", "0.50863826", "0.50845355", "0.508448", "0.5079452", "0.50786424", "0.50786424", "0.5074535", "0.5065201", "0.50640255", "0.50629413", "0.50560284", "0.5050339", "0.5045973", "0.5036916", "0.5036896", "0.50352156", "0.50327176", "0.50311214", "0.50305164", "0.50289637", "0.502797", "0.5027251", "0.5023934", "0.5023127", "0.5020655", "0.5019614", "0.50101036", "0.5001114", "0.5001114", "0.5001114", "0.5001114", "0.5001114" ]
0.6233822
0
DELETE /brothers/1 DELETE /brothers/1.xml
def destroy @brother = Brother.find(params[:id]) @brother.destroy respond_to do |format| format.html { redirect_to(brothers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\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 @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to brothers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @been2other = Been2other.find(params[:id])\n @been2other.destroy\n\n respond_to do |format|\n format.html { redirect_to(been2others_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @pneighbour = Pneighbour.find(params[:id])\n @pneighbour.destroy\n\n respond_to do |format|\n format.html { redirect_to(pneighbours_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to(bowls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bogey = Bogey.find(params[:id])\n @bogey.destroy\n\n respond_to do |format|\n format.html { redirect_to(bogeys_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bail = Bail.find(params[:id])\n# @bail.destroy\n\n respond_to do |format|\n format.html { redirect_to(bails_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @bairro = Bairro.find(params[:id])\n @bairro.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_bairros_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @abonne = Abonne.find(params[:id])\n @abonne.destroy\n\n respond_to do |format|\n format.html { redirect_to(abonnes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bouncer = Bouncer.find(params[:id])\n @bouncer.destroy\n\n respond_to do |format|\n format.html { redirect_to(bouncers_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @brochure_travel = BrochureTravel.find(params[:id])\n @brochure_travel.destroy\n\n respond_to do |format|\n format.html { redirect_to(brochure_travels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bingo = Bingo.find(params[:id])\n @bingo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bingos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bom = Bom.find(params[:id])\n @bom.destroy\n\n respond_to do |format|\n format.html { redirect_to(boms_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy #DESC: Eliminar hobbies\n @hobbie = Hobbie.find(params[:id])\n @hobbie.destroy\n\n respond_to do |format|\n format.html { redirect_to(hobbies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to(neighborhoods_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bottle = Bottle.find(params[:id])\n @bottle.destroy\n\n respond_to do |format|\n format.html { redirect_to(bottles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bairro_micro = BairroMicro.find(params[:id])\n @bairro_micro.destroy\n\n respond_to do |format|\n format.html { redirect_to(bairro_micros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @brochure_interest = BrochureInterest.find(params[:id])\n @brochure_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to(brochure_interests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @brochure_interest = BrochureInterest.find(params[:id])\n @brochure_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_brochure_interests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @borrow = Borrow.find(params[:id])\n @borrow.destroy\n\n respond_to do |format|\n format.html { redirect_to(borrows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rubro.destroy\n\n respond_to do |format|\n format.html { redirect_to(rubros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @bonificacion = Bonificacion.find(params[:id])\n @bonificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(bonificacions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @burger = Burger.find(params[:id])\n @burger.destroy\n\n respond_to do |format|\n format.html { redirect_to(burgers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to(boats_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @allergy = Allergy.find(params[:id])\n @allergy.destroy\n\n respond_to do |format|\n format.html { redirect_to(allergies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @child = Child.find(params[:id])\n @child.destroy\n\n respond_to do |format|\n format.html { redirect_to(children_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @roaster = Roaster.find(params[:id])\n @roaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(roasters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bap = Bap.find(params[:id])\n @bap.destroy\n\n respond_to do |format|\n format.html { redirect_to(baps_url) }\n format.xml { head :ok }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @relationship = Relationship.find(params[:id])\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(relationships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @other = Other.find(params[:id])\n @other.destroy\n\n respond_to do |format|\n format.html { redirect_to(others_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(childmasters_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 destroy\n @brodo.destroy\n respond_to do |format|\n format.html { redirect_to brodos_url, notice: 'Brodo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @balance = Balance.find(params[:id])\n @balance.destroy\n\n respond_to do |format|\n format.html { redirect_to(balances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @boredom.destroy\n respond_to do |format|\n format.html { redirect_to boredoms_url, notice: 'Boredom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @beer.destroy\n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "def destroy\n @crawler_receive = CrawlerReceive.find(params[:id])\n @crawler_receive.destroy\n\n respond_to do |format|\n format.html { redirect_to(crawler_receives_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @carro = Carro.find(params[:id])\n @carro.destroy\n\n respond_to do |format|\n format.html { redirect_to(carros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @allergen = Allergen.find(params[:id])\n @allergen.destroy\n\n respond_to do |format|\n format.html { redirect_to(allergens_url) }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def destroy\n @myers_briggs_type = MyersBriggsType.find(params[:id])\n @myers_briggs_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(myers_briggs_types_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end", "def destroy\n @revendedor = Revendedor.find(params[:id])\n @revendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(revendedors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @zebra = Zebra.find(params[:id])\n @zebra.destroy\n\n respond_to do |format|\n format.html { redirect_to(zebras_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @belonging = Belonging.find(params[:id])\n @belonging.destroy\n\n respond_to do |format|\n format.html { redirect_to(belongings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nostro = Nostro.find(params[:id])\n @nostro.destroy\n\n respond_to do |format|\n format.html { redirect_to(nostros_url) }\n format.xml { head :ok }\n end\n end", "def destroy1\n @compare = Compare.find(params[:id])\n @compare.destroy\n\n respond_to do |format|\n format.html { redirect_to(compares_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |format|\n format.html { redirect_to(bios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cabo_eleitoral = CaboEleitoral.find(params[:id])\n @cabo_eleitoral.destroy\n\n respond_to do |format|\n format.html { redirect_to(cabo_eleitorals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxband = Taxband.find(params[:id])\n @taxband.destroy\n\n respond_to do |format|\n format.html { redirect_to(taxbands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @business = Business.find_by_permalink(params[:id])\n @business.destroy\n\n respond_to do |format|\n format.html { redirect_to businesses_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @irb = Irb.find(params[:id])\n @irb.destroy\n\n respond_to do |format|\n format.html { redirect_to(irb_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relationship = @assembly.relationships.find(params[:id])\n child = @relationship.child\n child.used = false\n child.save\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to [@plan, @assembly], notice: 'Relationship was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @miscellaneous_child = MiscellaneousChild.find(params[:id])\n @miscellaneous_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_children_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lore = Lore.find(params[:id])\n @lore.destroy\n\n respond_to do |format|\n format.html { redirect_to(lores_url) }\n format.xml { head :ok }\n end\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @contrato = Contrato.find(params[:id])\n @contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bp_request = BpRequest.find(params[:id])\n @bp_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(bp_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bird.destroy\n head :no_content\n end", "def destroy\n @banana = Banana.find(params[:id])\n @banana.destroy\n\n respond_to do |format|\n format.html { redirect_to(bananas_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end" ]
[ "0.6724334", "0.6706081", "0.6682589", "0.6617006", "0.64082694", "0.6338538", "0.63118607", "0.6292326", "0.62902135", "0.6250445", "0.62392855", "0.62373847", "0.6232365", "0.6214394", "0.62100387", "0.62057966", "0.61704373", "0.61657697", "0.6152545", "0.61333907", "0.6125898", "0.6122695", "0.6117349", "0.6110467", "0.6109776", "0.6106456", "0.6090977", "0.6090871", "0.60882044", "0.6084867", "0.6084282", "0.6069723", "0.6064716", "0.60486615", "0.60456634", "0.6045545", "0.6044136", "0.6037134", "0.60370123", "0.6034127", "0.60319155", "0.60319155", "0.60319155", "0.60319155", "0.60319155", "0.60242736", "0.6022748", "0.6009742", "0.60050076", "0.600476", "0.600476", "0.6004351", "0.6004264", "0.5997294", "0.59957004", "0.598238", "0.5976001", "0.5968682", "0.59672326", "0.59579813", "0.59570575", "0.59538746", "0.5950639", "0.5944518", "0.5938982", "0.5937969", "0.59376603", "0.5933933", "0.59322214", "0.593105", "0.5929185", "0.59274215", "0.59267217", "0.5926659", "0.5924027", "0.59227955", "0.59227115", "0.5920721", "0.591696", "0.59150785", "0.5911751", "0.5910998", "0.59104204", "0.5909799", "0.59083086", "0.5904825", "0.59002006", "0.5897451", "0.5897029", "0.5897011", "0.5896679", "0.5894518", "0.5894032", "0.58932376", "0.58794826", "0.5879026", "0.5878675", "0.58766884", "0.58760464", "0.5875375" ]
0.7327873
0
GET /questionnaires/1 GET /questionnaires/1.json
def show @questionnaire = Questionnaire.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @questionnaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def show\n @data_collection = DataCollection.find(params[:id])\n @questionnaires = @data_collection.questionnaires\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_collection }\n end\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend", "def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end", "def index\n # @questionnaires = Questionnaire.all \n end", "def index\n @questionnaires = Questionnaire.all\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end", "def get_questionnaires\n @get_questionnaires ||= questionnaire_service.search('context-type-value': get_use_context)\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end", "def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end", "def show\n @question_datum = QuestionDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_datum }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end", "def show\n render_json @question\n end", "def show\n @questions = Question.find(params[:id])\n end", "def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end", "def index\n @questionaries = Questionary.all\n end", "def show\n @user_quest = UserQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_quest }\n end\n end", "def index\n @questid = params[:questionnaire_id]\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def show\n # id from url comes in as :id key of params hash\n @question = Question.find(params[:id])\n\n @answers = @question.answers.order(created_at: :desc)\n end", "def show\n @questionairre_item = QuestionairreItem.includes(:questionairre_answers).find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionairre_item }\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end", "def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end", "def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end", "def show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end", "def show\n question = QuestionOuverteService.instance.afficherQuestionParId(params[:id])\n (question != nil) ? (render json: question, status: :ok) : (render json: nil, status: :not_found)\n end", "def index\n @questions = @questionable.questions\n end", "def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end", "def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end", "def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end", "def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\n end\n end", "def index\n @api_v1_questions = Api::V1::Question.all\n end", "def show\n render json: @answer\n end", "def show\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire_group }\n end\n end", "def index\n @questionnaires = Questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end", "def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end", "def show\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_question }\n end\n end", "def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def show\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @survey_question }\n end\n end", "def show\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questions_option }\n end\n end", "def show\n render json: @quiz\n end", "def show\n @questions = Question.find(params[:id])\n @answers = @question.answers.all\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @answers = @question.answers\n respond_with( @answers )\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def show\n # @question_answer = Question::Answer.new\n @question = Question.find(params[:question_id])\n @answer = Answer.new(:question_id => @question.id, :quiz_id => @question.quiz.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_answer }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def index\n @questionnaires = Questionnaire.all\n# @questionnaires = User.questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def show\n @categorie_analytique = CategorieAnalytique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categorie_analytique }\n end\n end" ]
[ "0.742471", "0.7290521", "0.6979919", "0.68588394", "0.68273973", "0.670289", "0.667116", "0.6660555", "0.6644325", "0.662616", "0.6584409", "0.6584409", "0.6584409", "0.65730816", "0.65534264", "0.65438294", "0.6525332", "0.65009725", "0.6489891", "0.6481722", "0.646325", "0.6447228", "0.6445348", "0.6424588", "0.6411809", "0.6411809", "0.6411809", "0.641175", "0.6409554", "0.63993764", "0.6386517", "0.63826287", "0.63721293", "0.63721293", "0.6371591", "0.6360899", "0.6350421", "0.6323352", "0.63066196", "0.63058114", "0.6291927", "0.6288278", "0.62779474", "0.62734455", "0.6269916", "0.6264821", "0.6260723", "0.62525237", "0.625197", "0.6246207", "0.6240881", "0.62377363", "0.6235394", "0.6230318", "0.6228722", "0.62208986", "0.6207563", "0.62073374", "0.62057185", "0.61999387", "0.61951244", "0.6191724", "0.6191545", "0.61903006", "0.617292", "0.6168467", "0.61591285", "0.61499894", "0.6146501", "0.61401945", "0.6131884", "0.61279976", "0.6108536", "0.6104309", "0.6103776", "0.6087745", "0.6087745", "0.6087745", "0.60809976", "0.60806876", "0.606718", "0.6066146", "0.60629886", "0.6061787", "0.6052448", "0.6048226", "0.60456914", "0.6044893", "0.60420156", "0.60356003", "0.60356003", "0.60356003", "0.60356003", "0.60356003", "0.60336816", "0.6031033", "0.6026767", "0.601807", "0.6016725" ]
0.7089278
3
author ahmed jihad called to show answer view for questionnaires finds the selected questionnaire Args :
def answer_show @questionnaire = Questionnaire.find(params[:id]) answer = @questionnaire.answer_questionnaires.build render 'answer_show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n idx = params[:id]\n @question = Question.find(params[:id])\n @newAnswer = Answer.new(:question_id => params[:id])\n @Answers = Answer.where(question_id: idx)\n @answer = Answer.all\n end", "def show\n @question = Question.find(params[:id])\n @answerlist = Answer.where(\"question_id = ?\", @question.id )\n \n end", "def show\n @id=params[:qid]\n @question=Question.find(@id)\n session[:qid]=@id\n @answers=Answer.where(:question_id => @id)\n #added by lyz\n @article = Article.find(@question.article_id)\n end", "def view_quiz\n @questionnaire = Questionnaire.find(params[:id])\n @participant = Participant.find(params[:pid]) #creating an instance variable since it needs to be sent to submitted_content/edit\n render :view\n end", "def view_quiz\n @questionnaire = Questionnaire.find(params[:id])\n @participant = Participant.find_by_id(params[:pid]) #creating an instance variable since it needs to be sent to submitted_content/edit\n render :view\n end", "def show\n @answer = Answer.find(params[:id])\n @question = @answer.question\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def show\n # @answers = @response.answers\n # @questionnaire_name = @response.questionnaire.name\n # @user = @response.user\n end", "def index\n # @questionnaires = Questionnaire.all \n end", "def show\n @questions = Question.find(params[:id])\n @answers = @question.answers.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def show\n\t\t_get_current_question_and_choices(params[:id])\n\tend", "def list_answer_responses\n article = find_entity # questionnaire article\n receive_and_set_background_params\n @display_mode = params[:display_mode]\n @is_answer_response = true # choose only answer response article to questionnaire article\n @question_entities = article.questionnaires\n find_detail_of_thread(article.a_thread)\n render :partial => \"detail_with_answer_responses\", :layout => \"base_layout\"\n end", "def show\n @quiz = params[:quiz_id]\n @fake_answers = FakeAnswer.where(question_id: params[:id])\n end", "def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end", "def edit_quiz\n\n @questionnaire = Questionnaire.find(params[:id])\n render :edit\n end", "def show\n @answer = Answer.find(params[:id])\n end", "def show\n @answer = Answer.find_by_uuid(params[:id])\n @question = @answer.question\n end", "def show\n @question = Question.find(params[:id])\n #if !(@question.accessible(current_user.id, current_user.institution_id))\n # respond_to do |format|\n # format.html { redirect_to action: \"index\" }\n # #format.json { render json: @question }\n # end\n # return\n #end\n @listed_tags = [\"concept_names\", \"academic_class\", \"chapter\", \"blooms_taxonomy\", \"subject\", \"course\", \"qsubtype\", \"specialCategory\", \"difficulty_level\"]\n @edit_copy = 'copy'\n if (@question.edit_access(current_user.id))\n @edit_copy = 'edit'\n end\n #@can_delete = @question.join(:quiz_question_instances).join(:quiz_targeted_groups)\n values = {}\n where = \"quiz_question_instances.question_id = :question_id\"\n values[:question_id] = params[:id]\n @used = nil #Quiz.select(\"quizzes.id,quizzes.name\").joins(:quiz_question_instances).select(\"quiz_question_instances.grade\").joins(:quiz_targeted_groups).select(\"published_on,published_by\").where(where,values).order('quizzes.timecreated DESC')\n respond_to do |format|\n format.html { render \"show_\"+@question.qtype}\n format.json { render json: @question }\n end\n end", "def show\n @answers = @journal.journal_answers\n end", "def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def show\n @rec_not_saved = false\n @question = Question.find(params[:id])\n @answers = @question.answers.find(:all, :order => \"answers.created_at ASC\", :include => :user)\n @answer = @question.answers.new\n @answer.user_id = session[:user_id]\n end", "def show\n chapterno = params[:chapter]|| \"all\"\n chapterno = chapterno.to_i\n @chapter_questions = (chapterno == 0 ? @course.questions : @course.questions.where(\"chapter >= #{chapterno} and chapter < #{chapterno+1}\").order(index_number: :desc))\n @chapternumbers = @course.questions.collect(&:chapter).uniq\n answerd = params[:answerd]|| \"all\"\n if answerd == \"false\"\n @chapter_questions = @chapter_questions.where(\"answer is null or answer=''\")\n elsif answerd == \"true\"\n @chapter_questions = @chapter_questions.where(\"answer is not null or answer<>''\")\n end\n\n @chapter_questions.order(index_number: :desc)\n\n\n end", "def set_questionnairedetail\n @questionnairedetail = Questionnairedetail.find(params[:id])\n end", "def show\n @problem_set = ProblemSet.find(params[:problem_set_id])\n if session[:user_id].nil?\n session[:redirect_url] = \"/problem_sets/#{@problem_set.id}/questions/\"\n redirect_to(\"/login/\")\n else\n @question = Question.where(:problem_set_id => params[:problem_set_id], :count => params[:id]).first\n if @question.nil?\n flash[:notice] = \"NO SUCH QUESTION!\"\n redirect_to :action=>\"index\"\n else\n @answer = Answer.where(:question_id => @question.id).all\n @response = Response.where(:user_id => session[:user_id], :question_id => @question.id).first\n if @response.nil?\n @response = Response.new\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end\n end\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def index\n @questid = params[:questionnaire_id]\n end", "def show\n #TODO: Qiita 記事がない場合はrouteを変えて飛ばす\n if @question == nil\n render \"questions/delete_question\"\n return\n end\n # before_action :set_question\n if @question.best_answer_id\n @bestanswer = Answer.find(@question.best_answer_id)\n end\n\n if user_signed_in?\n @answer = @question.answers.build(user_id: current_user.id)\n end\n impressionist(@question, nil, unique: [:session_hash])\n\n end", "def answer\n @form_data = Form.get_published_form(params[:code])\n if @form_data.nil?\n redirect_to \"/dashboard\"\n else\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end\n end", "def answers_by_views(options={})\n parse_answers(request(singular(id) + \"answers/views\", options))\n end", "def show\n @question = Question.find(params[:id])\n @avatar = Avatar.find_by_user_id(@question.user_id)\n @user = User.find(@question.user_id)\n @answers = Question.findanswers(@question.id.to_s)\n @correctanswers = Question.findcorrectanswers(@question.id.to_s)\n @totalanswers = @answers.size + @correctanswers.size\n\t if current_user == @user\n @asker = true\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end", "def survey_answer_for attempt, question\n question.field(attempt: attempt, answer: attempt.answer_to(question))\n\n render partial: question.field.show_path, locals: { question: question }\n end", "def index\n @questionnairedetails = Questionnairedetail.all\n end", "def index\n @question_option_selections = @question_answer.question_option_selections\n end", "def get_answers_list\n @answers = Answer.find_all_by_questionare_id params[:q_id]\n unless @answers.blank?\n render :partial => \"answers_list\"\n else\n render :text => \"No Record Found\"\n end\n end", "def show\n @questions = @exam.questions\n @question = Question.new\n end", "def show\n @tabs = Tab.order(:position).all\n @answer = Answer.new\n @courses = Course.where(program_id: @program.id, year_id: @year.id)\n end", "def goto_questionnaires\n goto_controller('Questionnaires')\n end", "def show\n \n\n #find the option id\n a=params[:id]\n #find the option\n o=Option.find(a)\n #Find the question id\n z=o.Question.id\n #Find the Question\n question=Question.find(z)\n #Find the Quiz id of the Question\n x=question.Quiz.id\n #Find the actual quiz that the question belongs to\n quiz=Quiz.find(x)\n #This query can also be written in one line as\n #ans=Quiz.find(Question.find(Option.find(params[:id]).Question.id).Quiz.id) \n\n\n\n return redirect_to \"/quizzes/#{x}\"\n end", "def index\n @selected_answers = SelectedAnswer.all\n end", "def show\n @questions = get_questions\n @answers\n @count = -1\n @total_questions\n @new_quiz = Quiz.new\n end", "def show\n # raise \"#{params}\"\n @answers = @question.answers.offset(1) # exclude the first record\n # because it's attached to question\n @answer = @question.answers.first\n @answer_tags = @answer.answer_tags\n @tags = []\n @answer_tags.each do |answer_tag|\n tag = Tag.find(answer_tag[:tag_id])\n @tags.push(tag)\n end\n end", "def set_answer\n @answer = Answer.find(params[:id])\n @question = @answer.question\n end", "def show\n # id from url comes in as :id key of params hash\n @question = Question.find(params[:id])\n\n @answers = @question.answers.order(created_at: :desc)\n end", "def show\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @answer }\n end\n end", "def show_explanation\n @room = current_user.room\n @question = @room.question\n return if !@room.show_explanation?\n last_choice = current_user.histories.last.choice if !current_user.histories.empty?\n current_user_choice = (last_choice and last_choice.question_id==@question.id) ? last_choice : nil\n\n puts \"User #{current_user.id} chose #{current_user_choice.id if current_user_choice}\"\n @choices = @question.choices.collect do |choice| {\n data: choice,\n result: if choice.correct\n \"correct\"\n elsif current_user_choice and choice.id==current_user_choice.id\n \"selected\"\n end,\n selected: @room.active_users.all.select {|u| u.histories.last.choice_id == choice.id if !u.histories.empty?}\n }\n end\n messages = {\n correct: \"Congratulations! You got the right answer.\",\n incorrect: \"Sorry, you got the wrong answer. See explanation below.\",\n blank: \"You didn't select an answer. See explanation below.\"\n }\n styles = {\n correct: \"alert alert-success\",\n incorrect: \"alert alert-error\",\n blank: \"alert\"\n }\n # If there's a choice_id (user chose a choice) and that choice is correct\n if current_user.status != 0\n #If user didn't select answer\n if current_user_choice==nil\n @change= current_user.lose_to!(@question)\n @message = messages[:blank]\n @style = styles[:blank]\n #If user chose an incorrect answer\n elsif !current_user_choice.correct?\n @change = current_user.lose_to!(@question)\n @message = messages[:incorrect]\n @style = styles[:incorrect]\n else\n @change = current_user.win_to!(@question)\n @message = messages[:correct]\n @style = styles[:correct]\n end\n end\n render partial: \"show_explanation\"\n end", "def index\n #show answers for particular survey\n @survey = Survey.find(params[:survey_id])\n @answers = @survey.answers.order(\"question_id, created_at\")\n \n #show answers for specific question\n if (params[:question_id])\n @question = Question.find(params[:question_id])\n @answers = @question.answers.order(\"question_id, created_at\")\n end\n #show answers for specific response\n if (params[:response_id])\n @response = Response.find(params[:response_id])\n @answers = @response.answers.order(\"question_id\")\n end\n end", "def set_answer\n\t\t#@answer = Survey.find(params[:id])\n\tend", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def view\n @quiz = Quiz.find(params[:id])\n render 'show'\n end", "def show\n @questions = @line_case.questions\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @questionnaire }\n end\n end", "def index\n @given_answers = GivenAnswer.all\n end", "def show\n @answer = @discussion.answers.build\n @answers = @discussion.answers.where.not(id: nil)\n end", "def show\n\t@solution = @examquestion.question.solutions.build.tap { |sol| sol.user_id = current_user.id } if user_signed_in?\n end", "def show\n @questions = Question.find(params[:id])\n end", "def set_answer\n @answer = Form::Answer.find(params[:id])\n end", "def show\n @answer = Answer.new\n # render plain: \"In show action\"\n end", "def index\n @quiz_answers = QuizAnswer.all\n end", "def goto_questionnaires\n node_object = TreeFolder.find_by_name('Questionnaires')\n session[:root] = FolderNode.find_by_node_object_id(node_object.id).id\n redirect_to controller: 'tree_display', action: 'list'\n end", "def show\n \t@quiz = Quiz.find(params[:id])\n end", "def index\n @tipo_answers = TipoAnswer.all\n end", "def show\n @quiz = Quiz.find(params[:id])\n end", "def set_answer\n @answer = @question.answers.find(params[:id])\n end", "def index\n @dei_field_answers = DeiFieldAnswer.all\n end", "def show\n invalid_questionnaires if @questionnaire.user != @current_user_email\n end", "def show\n @question_sheet = @answer_sheet.question_sheet\n pf = Qe.table_name_prefix\n @elements = @question_sheet.pages.collect {|p| p.elements.includes(:pages).order(\"#{pf}pages.number,#{pf}page_elements.position\").all}.flatten\n @elements = QuestionSet.new(@elements, @answer_sheet).elements.group_by{ |e| e.pages.first }\n end", "def answer_form\n AnswerForm.new(view_context)\n end", "def show_questionaires\r\n @quests_pages, @quests = paginate(:questionaires,\r\n :order => 'created_at') \r\n end", "def quiz_answer(quiz)\n if quiz.answer_type == 'multi'\n show_multi_answer(quiz.answers.first.text, quiz.answer_input)\n elsif quiz.answer_type == 'check'\n show_check_answer(quiz.answers.first.text, quiz.answer_input)\n else\n quiz.answers.first.text\n end\n end", "def show\r\n @batch = Batch.find(params[:batch_id])\r\n @answer = Answer.new\r\n @comment = Comment.new\r\n @solution = Solution.new\r\n @solutions = Solution.all\r\n @batch_set_answers = Answer.where('batch_set_id = ?', @batch_set.id)\r\n end", "def index\n @questionnaires = Questionnaire.all\n# @questionnaires = User.questionnaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questionnaires }\n end\n end", "def quiz\n @questions = Question.all\n @idx = params[:idx] ? (params[:idx].to_i + 1) : 0\n if params[:answer]\n question = Question.find(params[:id])\n if check_answer(params[:answer], question.answer)\n @correct_answer_number = params[:correct_answer_number].to_i + 1\n if @idx < @questions.size\n flash[:notice] = \"Correct\"\n else\n flash[:notice] = \"Correct. Summary: You have answered #{@correct_answer_number} question(s) correctly out of #{@questions.size}\"\n end\n else\n @correct_answer_number = params[:correct_answer_number].to_i\n if @idx < @questions.size\n flash[:notice] = \"Incorrect\"\n else\n flash[:notice] = \"Incorrect. Summary: You have answered #{@correct_answer_number} question(s) correctly out of #{@questions.size}\"\n end\n end\n else\n @correct_answer_number = 0\n end\n if @idx >= @questions.size\n @idx = 0\n @correct_answer_number = 0\n end\n flash[:notice] = \"No questions have been added yet. Please ask the administrator to add some questions first.\" if @questions.size == 0\n end", "def view\n @assignment = Assignment.find(params[:id])\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @scores = @assignment.get_scores(@questions)\n end", "def index\n @question_answers = QuestionAnswer.all\n end", "def index\n if(params[:find]!=nil)\n session[:quizid]=params[:find]\n @questions = Question.find_by_sql(\"select * from questions\n where question= any\n (SELECT question from questions\n join publishquizzes\n on questions.id = question_id\n join quizzes\n on quizzes.id = quiz_id\n where quiz_id =\n \"+params[:find]+\")\")\n flash[:done]=\"yeah\" \n elsif (params[:quiz]==nil)\n @questions=Question.all \n else\n session[:quizid]=params[:quiz]\n @questions = Question.find_by_sql(\"select * from questions\n where question!= all\n (SELECT question from questions\n join publishquizzes\n on questions.id = question_id\n join quizzes\n on quizzes.id = quiz_id\n where quiz_id =\n \"+session[:quizid]+\")\")\n @quizzes = Quiz.find(:all, :conditions=>\"section_id = \"+session[:sectionid]+\" and status='Unpublished'\")\n #@sections = Section.find(:all,:conditions=>\"id = \"+@quizzes[0].section_id.to_s)\n @sections = Section.find(:all,:conditions=>\"id = \"+session[:sectionid])\n @subject = Subject.find(:all,:conditions=>\"id = \"+@sections[0].subject_id.to_s)\n flash[:subjectname]=@subject[0].name\n flash[:sectionname]=@sections[0].section + \" Quizzes\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end", "def show\n @exam = Exam.find(params[:id])\n @question = Question.new\n end", "def show\n @questions = Question.all\n end", "def show\n if logged_as_student?\n student = Student.find(session[:user_id])\n group = Group.find(student.group_id)\n if !Sqanswer.where(:teacher_id => group.teacher_id, :student_id => student.id, :sidequest_id => @sidequest.id, :reward => @sidequest.reward, :read => false).exists?\n @sqanswer = Sqanswer.new(:teacher_id => group.teacher_id, :student_id => student.id, :sidequest_id => @sidequest.id, :reward => @sidequest.reward, :read => false)\n @sqanswer.save\n else\n @sqanswer = Sqanswer.find_by(:student_id => student, :sidequest_id => @sidequest.id)\n end\n end\n \n if logged_as_teacher?\n @sidequest = Sidequest.find(params[:id])\n @sqanswers = Sqanswer.where(sidequest_id: @sidequest.id, read: false).sort_by{|e| e[:time]}.reverse \n end\n end", "def show\n @choices = Choice.where(employee_id: @employee.id)\n end", "def show\n @question = Question.find(params[:id])\n end", "def show\n @question = Question.find(params[:question_id])\n end", "def show\n @answer = Answer.new\n end", "def index\n @answers = Answer.all\n \n end", "def set_questionario\n @questionario = Questionario.find(params[:id])\n end" ]
[ "0.7262069", "0.72015166", "0.69205433", "0.68985146", "0.68927073", "0.6833385", "0.67852485", "0.67852485", "0.67852485", "0.6750978", "0.6734262", "0.6731386", "0.67247146", "0.6673209", "0.6656468", "0.6646929", "0.6636093", "0.6631575", "0.65606964", "0.6538327", "0.65376365", "0.6486339", "0.64663094", "0.645906", "0.6454651", "0.64528644", "0.6446594", "0.6444663", "0.6443558", "0.6433136", "0.6433136", "0.6433136", "0.6433136", "0.6433136", "0.6433136", "0.6433136", "0.6433136", "0.6433136", "0.643281", "0.63934714", "0.63436955", "0.6342331", "0.6330597", "0.6324977", "0.6301701", "0.6297924", "0.62973577", "0.628731", "0.6282539", "0.6276325", "0.6256334", "0.62516147", "0.6246217", "0.6235618", "0.62333786", "0.6227203", "0.6210792", "0.6209097", "0.62072897", "0.6198426", "0.6187001", "0.6172224", "0.61703223", "0.6166057", "0.6166057", "0.6162744", "0.6162744", "0.61480767", "0.61251044", "0.6120072", "0.6105844", "0.6103742", "0.61022717", "0.6095463", "0.6094758", "0.60896975", "0.60824674", "0.6077132", "0.60698", "0.60683906", "0.6066446", "0.6062697", "0.6061297", "0.6057863", "0.60478187", "0.60362667", "0.60119045", "0.6007255", "0.6006558", "0.6005761", "0.5999682", "0.5996804", "0.59939116", "0.59917015", "0.59902376", "0.5990104", "0.5988908", "0.5987382", "0.5980503", "0.59799886" ]
0.75555646
0
Send to reviewer Questionnaire Args :
def sendQuestionnaire email=params[:email] emails=email.split(",") description=params[:description] questionnaire_id = params[:questionnaire_id] emails.each do |one| ReviewerInviter.task_invitation(one, description, "http://localhost:3000/questionnaires/answer_show?id="+questionnaire_id).deliver() end respond_to do |format| format.html { redirect_to(:back) } #, flash[:success] = "holder updated") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rreply_params\n params.require(:rreply).permit(:text, :user_id, :relpy_id)\n end", "def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end", "def perform(user, questions)\n \n end", "def interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end", "def apply(interviewee,interviewer)\n @interviewee = interviewee\n @interviewer = interviewer\n mail(to: @interviewee.email + \",\" + @interviewer.email, subject: '面接日程承認のお知らせ')\n end", "def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end", "def chose_correct_answer\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/questions/#{@answer.question.id}\")\n subject = \"[bootcamp] #{@answer.receiver.login_name}さんの質問【 #{@answer.question.title} 】で#{@answer.sender.login_name}さんの回答がベストアンサーに選ばれました。\"\n mail to: @user.email, subject: subject\n end", "def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end", "def reply_params\n params.require(:reply).permit(:message, :realtor_id, :inquiry_id)\n end", "def send_enquiry_reply(enquirer)\n send_message(:election_enquiry_reply, nil, enquirer)\n end", "def reply_params\n params.require(:reply).permit(:replier, :topic, :reply_body)\n end", "def send_survey\n Message.send_survey_to(self)\n end", "def reply\n end", "def email_questions(email,corpo)\n\t\t@email = email\n\t\t@corpo = corpo\n\t\tmail(to: 'naltispace@gmail.com',from: email, subject: 'Mensagem do CurriculumXD')\n\t\t# mail = Mail.new do\n\t\t# from email\n\t\t# to 'naltispace@gmail.com'\n\t\t# subject 'Mensagem do CurriculumXD'\n\t\t# body corpo\n\t\t# end\n\t\t# mail.deliver!\n\tend", "def send_candidate_details(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n #changed title as per Task #41\n subject = \"Candidate has \" + @interview.candidate_status + \" your interview request\"\n #subject = \"Candidate Profile - \" + @candidate.name\n \n mail to: @employer.email, subject: subject\n end", "def reply(workitem)\n\n puts '-' * 80\n puts '*** WARNING : please use the Ruote::StorageParticipant#proceed(wi)'\n puts ' instead of #reply(wi) which is deprecated'\n #caller.each { |l| puts l }\n puts '-' * 80\n\n proceed(workitem)\n end", "def sendReview\r\n email=params[:email]\r\n emails=email.split(\",\")\r\n description=params[:description]\r\n page_id = params[:page_id]\r\n emails.each do |one|\r\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/pages/reviewer?id=\"+page_id).deliver()\r\n end\r\n respond_to do |format|\r\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \r\n end\r\n end", "def candidate_interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Congrats!! You have been selected for an Interview\"\n \n mail to: @candidate.email, subject: subject\n end", "def ask(question, context, to, jid_user)\n puts \"Bot: #{question}\"\n @questions[to]=context\n end", "def reply_params\n params.require(:reply).permit(:lesson_component_id, :user_id, :reply_id, :body)\n end", "def reply\n if logged_in?\n if params[:reply]\n @reply = Question.new(params[:reply])\n @reply.correct_flag=0\n @reply.user_id = current_user.id\n @reply.save\n @user = current_user\n @parent = Question.find(@reply.parentid)\n @parent_user = User.find(@parent.user_id)\n @answers = Question.findanswers(@parent.id.to_s)\n @answer = Question.find_all_by_id(@reply.id)\n \n UserMailer.deliver_new_answer(@parent_user, @reply)\n score(current_user,30)#When the user answers the question correctly\n respond_to do |format|\n flash[:notice] = 'Your answer was submitted successfully.'\n format.html { redirect_to(question_path(@parent))}\n format.xml { render :xml => @reply }\n end\n end\n else\n flash[:notice] = 'Your must login or create an account to reply to a question.'\n redirect_to :controller => 'account', :action => 'login'\n end\n end", "def notify_manager_for_panel(emp_from, req, resume, emp_to, emp_array)\n subject 'Interview added for your requirement'\n recipients [ emp_to.email ]\n from [ \"recruitment-no-reply@mirafra.com\" ]\n sent_on Time.now\n content_type 'text/html'\n body :emp_from => emp_from,\n :emp_to => emp_to,\n :emp_array => emp_array,\n :req => req,\n :resume => resume\n end", "def reply\n is_reputable_to do\n @post = Post.find(params[:id])\n @topic = @post.topic\n @topicable = @topic.topicable\n #\n render_reply_form\n end \n end", "def reply_request(request , assigned_room)\n request.room = assigned_room\n request.done = true\n request.save\n request.needers.each do |needer|\n Notification.send_notification(needer,\n 2,\n 2,\n (\"The Room ( \" << assigned_room << \" ) was Assigned for your Session/Meeting\"))\n end\n end", "def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end", "def reply_params\n params.require(:reply).permit(:body, :repliable_id)\n end", "def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end", "def notify_question_owner(answer)\n \t@answer = answer\n \t@question = answer.question\n \t@receiver = @question.user\n \tmail(to: @receiver.email,\n \t\t\t subject: \"You've got a new answer!\")\n end", "def show_humour_replies(sender_id, quick_replies)\n say(sender_id, IDIOMS[:greetings], quick_replies)\n humour_analysis(sender_id)\nend", "def answer_to_question(answer)\n @recipients = answer.question.profile.email\n @subject = \"Your question has been answered\"\n self.body = {:question => answer.question, :answer => answer,\n :profile_url => url_for(:controller => :profiles, :action => :show, :id => answer.profile_id),\n :question_url => url_for(:controller => :questions, :action => :show, :id => answer.question_id),\n }\n end", "def ask_user_question\n return unless (@target = find_or_goto_index(User, params[:id].to_s)) &&\n can_email_user_question?(@target) &&\n request.method == \"POST\"\n\n subject = params[:email][:subject]\n content = params[:email][:content]\n QueuedEmail::UserQuestion.create_email(@user, @target, subject, content)\n flash_notice(:runtime_ask_user_question_success.t)\n redirect_to(user_path(@target.id))\n end", "def prapor_quest; end", "def new_question(question, recepient)\n if recepient.privacy_setting.notify_on_new_question \n @question, @recepient = question, recepient\n mail(\n :subject => \"#{@question.user.name} just asked a new question.\",\n :from => \"noreply@studyhall.com\",\n :to => recepient.email,\n :date => Time.now\n )\n end\n end", "def question(course, user, question, qid)\n @course = course\n @user = user\n @question = question\n\n recipients = [course.owner.email, 'questions@idealme.com']\n mail to: recipients, from: \"#{course.slug}+#{qid}@questions.idealme.com\"\n end", "def view_quiz\n @questionnaire = Questionnaire.find(params[:id])\n @participant = Participant.find(params[:pid]) #creating an instance variable since it needs to be sent to submitted_content/edit\n render :view\n end", "def reply_params\n\t\tparams.require(:reply).permit(:commenter, :body, :user_id)\n\tend", "def answer\n question = Question.joins(:subscriptions, :answers).first\n raise \"No subsriptions, cannot create sample\" if question.nil?\n CustomMailer.answer(question.user, question.answers.first)\n end", "def survey_sent(participant)\n @participant = participant\n mail :to => participant.email, :subject => \"Conteste la encuesta\"\n end", "def questions\n \n end", "def ask_for_recipient\n\n end", "def ask\n @question = params[:question]\n end", "def review\n @user_quest = UsersQuest.find(params[:id])\n end", "def inquiry_reply_params\n params.require(:inquiry_reply).permit(:reply, :user_id, :inquiry_detail_id)\n end", "def view_quiz\n @questionnaire = Questionnaire.find(params[:id])\n @participant = Participant.find_by_id(params[:pid]) #creating an instance variable since it needs to be sent to submitted_content/edit\n render :view\n end", "def email(defn, participant, assignment)\n defn[:body][:type] = \"Teammate Review\"\n participant = AssignmentParticipant.find(reviewee_id)\n topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end", "def review(review)\n @review = review\n @abstract = review.abstract_doc\n User.with_role(:admin).each do |user|\n mail(to: user.email, subject: 'All reviews submitted for abstract titled '+@abstract.title)\n end\n end", "def reply_params\n params.require(:reply).permit(:question_id, :reply, :bool)\n end", "def new_completed(questions, user)\n @user = User.last\n @responses = @user.responses\n @questions = questions\n mail( :to => \"ijcurtiss99@gmail.com\",\n :cc => \"ijcurtiss7@gmailc.com\",\n :subject => \"Coding Challenge Submission\" )\n end", "def repondre_params\n params.require(:repondre).permit(:user_id, :question_id)\n end", "def question_answered(data, user, answer, _options_string)\n @user = user\n @username = @user.name\n @answer = answer\n @question_title = @answer.question.text.to_s\n @plan_title = @answer.plan.title.to_s\n @template_title = @answer.plan.template.title.to_s\n @data = data\n @recipient_name = @data['name'].to_s\n @message = @data['message'].to_s\n @answer_text = @options_string.to_s\n @helpdesk_email = helpdesk_email(org: @user.org)\n\n I18n.with_locale I18n.default_locale do\n mail(to: data['email'],\n subject: data['subject'])\n end\n end", "def raf_submitted(study_subject)\n#\t\t@greeting = \"Hi\"\n\t\t@study_subject = study_subject\n\n\t\tmail to: \"magee@berkeley.edu\"\n\t\tmail cc: [\"jakewendt@berkeley.edu\", \"notifyccls@berkeley.edu\"]\n\t\tmail subject: \"TEST [CCLS Patient Notification Received] Identifier: #{@study_subject.icf_master_id_to_s}\"\n\tend", "def reply_params\n params.require(:reply).permit(:nestreply_id, :answer, :emp_login_id, :forum_id) if params[:reply]\n end", "def questionnairedetail_params\n params.require(:questionnairedetail).permit(:answerUser, :eval, :idquestion, :questionnaire_id)\n end", "def recruiter_meeting_email\n @applicant = params[:applicant]\n @recruiter = params[:recruiter]\n @meeting_time = params[:meeting_time]\n \n mail(to: @recruiter.email, subject: \"Interview for #{@applicant.position.title} scheduled\")\n end", "def test_create_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:tim_reply_to__andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@matt, @tim, reply_to, about)\r\n end", "def reply_params\n params.require(:reply).permit(:content, :puntos, :user_id, :contribution_id, :comment_id)\n end", "def self_intro_enquiry(*args)\n self.update_attribute(:bot_response, \"I'm Brian.\")\n return false\n end", "def asked_to_answer_params\n params.require(:asked_to_answer).permit(:question_id, :user_id)\n end", "def conflict_notification\n if session[:user].role_id !=6\n @instructor = session[:user]\n else\n @instructor = Ta.get_my_instructor(session[:user].id)\n end\n @participant = AssignmentParticipant.find(params[:id])\n @assignment = Assignment.find(@participant.parent_id)\n\n\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @reviewers_email_hash = Hash.new\n\n @caction = \"view\"\n @submission = params[:submission]\n if @submission == \"review\"\n @caction = \"view_review\"\n @symbol = \"review\"\n process_response(\"Review\", \"Reviewer\", @participant.get_reviews, \"ReviewQuestionnaire\")\n elsif @submission == \"review_of_review\"\n @symbol = \"metareview\"\n process_response(\"Metareview\", \"Metareviewer\", @participant.get_metareviews, \"MetareviewQuestionnaire\")\n elsif @submission == \"review_feedback\"\n @symbol = \"feedback\"\n process_response(\"Feedback\", \"Author\", @participant.get_feedback, \"AuthorFeedbackQuestionnaire\")\n elsif @submission == \"teammate_review\"\n @symbol = \"teammate\"\n process_response(\"Teammate Review\", \"Reviewer\", @participant.get_teammate_reviews, \"TeammateReviewQuestionnaire\")\n end\n\n @subject = \" Your \"+@collabel.downcase+\" score for \" + @assignment.name + \" conflicts with another \"+@rowlabel.downcase+\"'s score.\"\n @body = get_body_text(params[:submission])\n\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:occupation, :why_participate, :carpentry, :plumbing, :electrical, :roofing, :song_leader, :bible, :recreation, :lifeguard, :accounting, :firstaid, :cpr_firstaid, :camp, :year, :site_leader, :involved_activities, :camp_director_approval, :camp_director_approval_date, :user_approval, :user_approval_date, :printed_date, :user_id)\n end", "def create\n\n @question = Question.new(question_params)\n @question.save\n if @question.valid?\n Reviewer.notify_reviewers('New Question', @question.title, @question.id)\n flash[:notice] = 'Reviewers have been notified. Your question is pending'\n else\n flash[:alert] = 'Please fill out all the fields and try again.'\n end\n redirect_to new_question_path\n end", "def set_reply\n @reply = Replie.find(params[:id])\n end", "def submit_enquiry(enquiry)\n @enquiry = enquiry\n mail(:subject => \"new enquiry from #{enquiry.name}\")\n end", "def mechanic_quest; end", "def create\n @question = Question.new(question_params)\n @question.save\n notify_reviewers\n redirect_to @question\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def _on_reply(wi)\n Ruote.participant_send(self, :on_reply, 'workitem' => wi)\n end", "def reply_params\n params.require(:reply).permit(:user_id, :parent_id, :post_id, :title, :text)\n end", "def set_rreply\n @rreply = Rreply.find(params[:id])\n end", "def quiz\n end", "def review\n @assignment = Assignment.find params[:assignment_id]\n redirect_to view_questionnaires_path id: @assignment.questionnaires.find_by(type: 'AuthorFeedbackQuestionnaire').id\n end", "def ask_params\n params.require(:ask).permit(:user_id, :left_ask_deal_id, :right_ask_deal_id, :category_id, :message, :be_completed, :admin_choice, :spec1, :spec2, :spec3)\n end", "def skier_quest; end", "def new_interview(user)\n @user = user\n mail to: user.email, subject: \"New Interview is added\"\n end", "def send_quick_answers(recipient:, message:, quick_answers:)\n\t\tquickreplies = []\n\t\tquick_answers.each{|msg| quickreplies << msg}\n\t\tchat_id = recipient['id']\n\n\t\tanswers = Telegram::Bot::Types::ReplyKeyboardMarkup.new(keyboard: quickreplies, one_time_keyboard: true)\n\t\t@bot.send_message(chat_id: chat_id, text: message, reply_markup: answers)\n\tend", "def ask_answer\n @sender_detail = SenderDetail.where(:unique_key => params[:link]).first\n if @sender_detail.nil?\n flash[:notice] = \"Invalid Token\"\n redirect_to sorry_path\n else\n @sender = EmailSender.find(@sender_detail.user_id).email\n \n @email = Email.find(@sender_detail.email_id)\n @listener = EmailSender.find(@email.listener_id)\n @question = @email.question\n end\n end", "def ask_questions\n super\n print \"What was your reason for joining? \"\n self.reason_for_joining = gets.strip.chomp\n end", "def inquiry(inquiry)\n @inquiry = inquiry\n @greeting = \"咨询\"\n\n mail to: \"cvsend@139.com\", subject:\"有人咨询\", temlate_path: 'refer_notifier',template_name: 'inquiry'\n end", "def resource_params\n params.require(:answerfrommoderator).permit(:user_id, :send_message, :name, :content)\n end", "def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend", "def reply\n body_arr = params[:Body].split(' ')\n method = body_arr[0]\n if method.upcase == 'REGISTER'\n p \"Registering User #{body_arr[1]} from #{params[:From]}\"\n User.register(params[:From], body_arr[1])\n send_sms(params[:From], \"User registered. Hello #{body_arr[1]}!\")\n Thread.new(params[:From], &method(:send_question))\n head 201 && return # Response is given to Twilio server for possible future use. \n elsif User.get(params[:From], 'name').nil?\n p 'User does not exist!'\n\n send_sms(params[:From], \"Please register with the form 'REGISTER <name>'.\")\n head 404 && return\n else \n # process answer\n answer = method\n p \"Processing answer #{answer}\"\n #TODO-v1: critical section to prevent user from keeping hitting the endpoint \n if answer == Question.get(User.get(params[:From], 'curr_ques_id'), 'answer')\n prev_count = User.get(params[:From], 'count')\n User.update(params[:From], 'count', prev_count.to_i + 1)\n if User.get(params[:From], 'count') == '5' #TODO: dynamic number\n send_sms(params[:From], 'Congratulations, you hit 5 question! Reward is sent. Answered question is cleared to 0')\n User.update(params[:From], 'count', 0) \n else\n send_sms(params[:From], \"Answer recorded.\\nYou have answered #{User.get(params[:From], 'count')} questions correctly.\")\n end\n else \n send_sms(params[:From], \"Wrong answer.\\nDon't be upset. You still have answered #{User.get(params[:From], 'count')} questions correctly.\")\n end\n User.update(params[:From], 'curr_ques_id', '-1') # So that user cannot answer the same question again and again! Fixed the repeat msg problem \n Thread.new(params[:From], &method(:send_question))\n head 204 && return\n end\n end", "def reply_params\n params.require(:reply).permit(:place_id, :user_id, :character_id, :body)\n end", "def refer(line_item)\n @line_item = line_item\n @greeting = \"Hi #{@line_item.name}\"\n @job = Job.find(@line_item.job_id)\n\n mail to: line_item.email, subject:\"Hi #{@line_item.name}, 猎友会给您推荐职位了\", temlate_path: 'refer_notifier',template_name: 'refer'\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def reply (workitem)\n\n reply_to_parent(workitem)\n end", "def test_create_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@tim, @andy, reply_to, about)\r\n end", "def view_replies(topic_title)\n self.h1(:class=>\"discussion_topic_subject\", :text=>topic_title).parent.button(:class=>\"discussion_show_topic_replies s3d-button s3d-link-button\").click\n \n end", "def rent(user, artwork)\n @user, @artwork = user, artwork\n subject = \"Huur van <name of work> via Xposers\".sub('<name of work>', artwork.title)\n\n @mail_content = Intmail.find_by_id(6)\n mail(to: user.email, bcc: 'info@xposers.nl', subject: subject)\n end", "def argumentative_question_params\n params.require(:argumentative_question).permit(:question,:answer1, :answer2, :answer3, :answer4, :argument1, :argument2, :argument3 , :argument4 , :correct_answer , :correct_argument , :feedback_wrong_argument, :feedback_wrong , critical_thinking_list: [], subject_list: [])\n end", "def reply_params\n params.require(:reply).permit(:post_id, :body, :repliable_id, :repliable_type, :parent_id)\n end", "def new_interview\n UserMailer.new_interview\n end", "def do_new_reply\n @feeditem_id = params['feeditem_id']\n @challenge_id = params['challenge_id']\n @reply_text = params['reply_text']\n ChallengeFeeds.post_comment(dbdc_client, @feeditem_id, @reply_text)\n redirect_to :id => @challenge_id, :action => 'show'\n end", "def interview_date_decision_notification(interviewee, interviewer, datetime)\n @interviewee = interviewee\n @interviewer = interviewer\n @datetime = datetime\n mail to: [interviewee.email, interviewer.email], subject: \"#{interviewee.name} さんの面接日時が確定しました\"\n end", "def interview_status_change(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request - \" + @interview.status\n \n mail to: @employer.email, subject: subject\n end", "def ask_question\n\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:q1answer, :q2answer, :q3answer, :q4answer, :q5answer, :q6answer, :q7answer, :q8answer)\n end", "def note_reply_params\n params.permit(:text, :note_id, :user_id)\n end", "def ask_post\n page(MorePage).select_more_actions(\"Ask HN\")\n page(MorePage).page_handler(\"Ask HN\")\n page(FeedDetailsPage).touch_row\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n page(SubmissionPage).await\n page(MorePage).backpage\n page(MorePage).page_handler(\"Ask HN\")\n page(MorePage).backpage\n end", "def ask\n \"@all Question '#{@question}'\"\n end", "def ask\n if @help_request.valid?\n MyousicaMailer.deliver_help_request(@help_request)\n flash[:notice] = \"Thanks for contacting us! Your question has been sent to our help desk, you'll receive a reply in few hours.\"\n else\n flash[:error] = \"Your help request could not be sent. Please correct the errors and try again!\"\n end \n\n params[:return_to] ? redirect_to(:action => 'show', :id => params[:return_to]) : redirect_to(:action => 'index')\n end" ]
[ "0.64253783", "0.64250964", "0.6405494", "0.6399295", "0.6331919", "0.629761", "0.62583584", "0.6222392", "0.61396784", "0.6128877", "0.6072317", "0.604679", "0.60286707", "0.6027854", "0.6021975", "0.5994871", "0.59911704", "0.5988208", "0.5962552", "0.59617734", "0.595377", "0.594181", "0.59202147", "0.5918477", "0.5913899", "0.5912906", "0.5890562", "0.58849543", "0.5883473", "0.58736026", "0.5850126", "0.58450645", "0.5844562", "0.5837098", "0.58353585", "0.58295137", "0.5825063", "0.5811185", "0.58099735", "0.58086115", "0.58061373", "0.57979894", "0.57951784", "0.5795154", "0.57930744", "0.57857096", "0.57692575", "0.57667136", "0.57642", "0.57462734", "0.5743524", "0.5729986", "0.5727902", "0.57157725", "0.57091147", "0.5703698", "0.569428", "0.5689913", "0.5681682", "0.5674463", "0.56687474", "0.56648177", "0.5664291", "0.5664041", "0.56618685", "0.56590873", "0.56551087", "0.5654345", "0.56542933", "0.5652542", "0.56454915", "0.56351304", "0.56349534", "0.56327844", "0.56241393", "0.5623466", "0.5619609", "0.56158257", "0.5612682", "0.5606583", "0.55987424", "0.55813795", "0.5577733", "0.5577731", "0.5577731", "0.55773735", "0.5570721", "0.55681574", "0.5567222", "0.5558625", "0.5557482", "0.55570966", "0.55567586", "0.55539495", "0.5550392", "0.55500114", "0.5544893", "0.55437964", "0.554168", "0.55315286" ]
0.65418077
0
GET /questionnaires/new GET /questionnaires/new.json
def new @project = Project.find(params[:project_id]) @questionnaire = Questionnaire.new question = @questionnaire.qquestions.build respond_to do |format| format.html # new.html.erb format.json { render json: @questionnaire } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def new\n @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\n end\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n\t\t@question = Question.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @question }\n\t\tend\n\tend", "def new\n @question = Question.find(params[:question_id])\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end", "def new\n @question_category = QuestionCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_category }\n end\n end", "def new\n @category_question = CategoryQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_question }\n end\n end", "def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end", "def new\r\n @intern_question = InternQuestion.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end", "def new\n @questions = Question.all\n @question = Question.new\n @answers = @question.answers.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n # @question.save\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end", "def new\n @multiple_choice_question = MultipleChoiceQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multiple_choice_question }\n end\n end", "def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end", "def new\n @question_datum = QuestionDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_datum }\n end\n end", "def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end", "def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def new\n @question_type = QuestionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_type }\n end\n end", "def new\n @critical_question = CriticalQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critical_question }\n end\n end", "def new\n @question_template = QuestionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_template }\n end\n end", "def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question_response = QuestionResponse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_response }\n end\n end", "def new\n \t@question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n format.json { render :json => @question}\n end\n end", "def new\n @question = @subsection.questions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @questionnaire_group = QuestionnaireGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire_group }\n end\n end", "def new\n @base_question = BaseQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @base_question }\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 @questionnaire = Questionnaire.new(:questionnaire_date => Date.today)\n @questionnaires_created = Questionnaire.last_created(10)\n @questionnaire.build_questionnaire_fields!\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\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 @qa = Qa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qa }\n end\n end", "def new\n @questionbank = Questionbank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionbank }\n end\n end", "def new\n @question_tag = QuestionTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_tag }\n end\n end", "def new\n @quick_answer = QuickAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_answer }\n end\n end", "def new\n @quest_tree = QuestTree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest_tree }\n end\n end", "def new\n @title = t('view.surveys.new_title')\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @problem = Problem.new\n @problem.answers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @intake_question = IntakeQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake_question }\n end\n end", "def new\n @q = Q.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @q }\n end\n end", "def new\n @question_field = QuestionField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_field }\n end\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\n end\n end", "def new_rest\n @question_localized = QuestionLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_localized }\n end\n end", "def new\n @other_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @other_study }\n end\n end", "def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end", "def new\n @answer_set = AnswerSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer_set }\n end\n end", "def new\n @quetion = Quetion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quetion }\n end\n end", "def new\n # Define a new question to properly generate a form\n @question = Question.new\n end", "def new\n @answer = @question.answers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @answer }\n end\n end", "def new\n @question = @page.questions.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end", "def new\n @question = Question.new\n @identities = Identity.all\n @timelines = Timeline.all\n @categories = Category.all\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_question_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.slim\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n @question = Question.new\n render :new\n end", "def new\n @liquidacion = Liquidacion.new\n\n #Levanto de conceptos, todos los conceptos que son requeridos para liquidacion de auxiliares \n @conceptos = Concepto.where(:anhomes => 201407).order(:codigo_concepto) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liquidacion }\n end\n end", "def new\n @questions_option = QuestionsOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questions_option }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @poll_question = PollQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_question }\n end\n end", "def new\n\t@questionnaire=Questionnaire.find(params[:questionnaire_id])\n\tif (params[:questionnaire_id].nil?)\n\t @questions = nil\n\telse\n\t @questions = Questionnaire.find(params[:questionnaire_id]).questions\n\tend\n\t@question = Question.new\n\n\n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.xml { render :xml => @question }\n\tend\n end", "def new\n @quiniela = Quiniela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quiniela }\n end\n end", "def new\n @answer = Answer.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def new\n @concept = Concept.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concept }\n end\n end", "def new\n @idiom = Idiom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idiom }\n end\n end", "def new # GET /answers/new\n @answer = Answer.new\n end", "def new\n @categorie_analytique = CategorieAnalytique.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorie_analytique }\n end\n end", "def new\n @questionnaire = Questionnaire.new\n @questionnaire.course_instance = @instance\n \n authorize! :create, @questionnaire\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def new\n @critic = Critic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critic }\n end\n end", "def new\n @cards_question = Cards::Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cards_question }\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest }\n end\n end", "def new\n @survey = Survey.new\n @title = \"Новый тест\"\n\n 3.times do\n question = @survey.questions.build\n 4.times { question.answers.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requisition }\n end\n end", "def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categoria }\n end\n end", "def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end", "def new\n @report_question = ReportQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_question }\n end\n end", "def new\n @dquestion = Dquestion.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @dquestion }\n #end\n end", "def new\n @interview = Interview.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interview }\n end\n end", "def new\n @practice = Practice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @practice }\n end\n end", "def new\n @text_story = TextStory.new\n @questions = Question.find_all_by_category_id(params[:category_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_story }\n end\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\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" ]
[ "0.7892105", "0.76516545", "0.76516545", "0.76516545", "0.76516545", "0.76516545", "0.76293546", "0.76174647", "0.7589048", "0.7588852", "0.7582643", "0.75260043", "0.7442386", "0.7421873", "0.74044603", "0.7374837", "0.73635507", "0.736207", "0.73514986", "0.73323613", "0.73294944", "0.732867", "0.7326048", "0.73250204", "0.73198426", "0.73161393", "0.73025626", "0.7301206", "0.7272611", "0.7262751", "0.7245563", "0.7241686", "0.7236024", "0.72217244", "0.72032917", "0.7201412", "0.7201412", "0.7176177", "0.7167946", "0.7165576", "0.7162969", "0.71483856", "0.7147485", "0.71470904", "0.71287304", "0.71106505", "0.7100855", "0.70943177", "0.7093876", "0.7071876", "0.7062511", "0.70595664", "0.70570016", "0.7046012", "0.7044487", "0.7034734", "0.7028705", "0.7013065", "0.7005504", "0.7001353", "0.6995471", "0.69933325", "0.6983799", "0.6977503", "0.69759506", "0.69759506", "0.69759506", "0.69759506", "0.69759506", "0.6965799", "0.69570976", "0.69567645", "0.69530386", "0.6952755", "0.69461465", "0.69402367", "0.6939021", "0.6938348", "0.6914436", "0.69042677", "0.69037414", "0.68978083", "0.6892731", "0.689125", "0.68908244", "0.6885029", "0.68841213", "0.6875698", "0.687328", "0.68714195", "0.68665224", "0.6864885", "0.6862478", "0.68510395", "0.6849924", "0.6843339", "0.68425566", "0.6838773", "0.6838773", "0.68358225" ]
0.7293158
28
POST /questionnaires POST /questionnaires.json
def create @project = Project.find(params[:questionnaire][:project_id]) @questionnaire = Questionnaire.new(params[:questionnaire]) respond_to do |format| if @questionnaire.save format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' } format.json { render json: @questionnaire, status: :created, location: @questionnaire } format.js { render "redirect" } else format.html { render action: "new" } format.json { render json: @questionnaire.errors, status: :unprocessable_entity } format.js {render "validation_error"} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @questionnaire.build_questionnaire_with_options(\n questionnaire_params[:options][:question_count],\n questionnaire_params[:options][:answer_count])\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire,\n notice:\n 'Тест успешно создан, для заполнения вопросов и ответов\n - пройдите в раздел \"Редактировать тест\".'}\n format.json { render :show, status: :created, location: @questionnaire }\n else\n format.html { render :new }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if !params[:_json].blank?\n params[:_json] = JSON.parse params[:_json] if params[:_json].is_a? String\n \n #Routine de transformation en CSV\n json = params[:_json][0]\n headers = []\n values = []\n csv_string = CSV.generate do |csv|\n json.each do |key, value|\n if (!key.blank? && !value.blank? && value!=\"Autre\")\n #Exclusion de certain champs Limesurvey\n if !['id','Complété','Dernière page vue','Langue de départ', 'FusionQuestion', 'Code'].include?(key)\n #Nettoyage des champs du type \"champs [other]\"\n if key.include?(\" [other]\")\n #puts \"test [other]\"\n key = key.split(\" [other]\")[0] \n end\n headers << key\n values << value \n end\n end\n end\n csv << headers\n csv << values\n end\n \n @questionnaire = Questionnaire.new(params[:questionnaire])\n @questionnaire.content = csv_string\n profil_id, category_id = json['FusionQuestion'].to_s.split(\"/\")\n @questionnaire.profil = Profil.find(id=profil_id)\n @questionnaire.category = Category.find(id=category_id)\n end\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title, { question_ids: [] })\n end", "def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end", "def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend", "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def new\n @survey = Survey.new\n @title = \"Новый тест\"\n\n 3.times do\n question = @survey.questions.build\n 4.times { question.answers.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to new_questionnaire_path }\n # format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render \"questionnaires/steps/step0\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end", "def create\n @question = Question.new(question_params)\n @question.answers.build(params[:question][:answer])\n\n # Creating associations for themes and levels\n asked_themes = params[:question][:theme_list].reject { |c| c.empty? }\n asked_levels = params[:question][:level_list].reject { |c| c.empty? }\n @question.theme_list.add(asked_themes)\n @question.level_list.add(asked_levels)\n\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render action: 'show', status: :created, location: questions_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(\n :title,\n :description,\n options: {},\n questions_attributes:\n [:id,\n :question_text,\n :correct_answer,\n :_destroy,\n question_answers_attributes:\n [:id,\n :is_correct_flag,\n :answer_text,\n :_destroy\n ]\n ])\n end", "def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end", "def questionario_resposta_params\n params.require(:questionario_resposta).permit(:questionario_id, :participante_id, :pergunta_id, :alternativa_id)\n end", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def create\n # @answer = Answer.new\n # @answer.user_id = current_user.もid\n # @answer.question_id = params[:question_id]\n # @answer.content = params[:content]\n # @answer.save\n # 一個保存できれば、何個でも保存できる\n if !params[:answer][:content]\n render json: {errors: \"未入力の項目があります。\"}, status: 422\n\n end\n @answer = current_user.answers.build(answer_params)\n @answer.save\n end", "def create\n @questionario_resposta = QuestionarioResposta.new(questionario_resposta_params)\n\n respond_to do |format|\n if @questionario_resposta.save\n format.html { redirect_to @questionario_resposta, notice: 'Questionario resposta was successfully created.' }\n format.json { render :show, status: :created, location: @questionario_resposta }\n else\n format.html { render :new }\n format.json { render json: @questionario_resposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\t\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n @question = Question.new(question_param)\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n\t#=end\n end", "def add_new_questions\n questionnaire_id = params[:id]\n # If the questionnaire is being used in the active period of an assignment, delete existing responses before adding new questions\n if AnswerHelper.check_and_delete_responses(questionnaire_id)\n flash[:success] = 'You have successfully added a new question. Any existing reviews for the questionnaire have been deleted!'\n else\n flash[:success] = 'You have successfully added a new question.'\n end\n\n questionnaire = Questionnaire.find(questionnaire_id)\n current_num_of_questions = questionnaire.questions.size\n max_seq = 0\n Questionnaire.find(questionnaire_id).questions.each do |question|\n if !question.seq.nil? && question.seq > max_seq\n max_seq = question.seq\n end\n end\n ((current_num_of_questions + 1)..(current_num_of_questions + params[:question][:total_num].to_i)).each do\n max_seq += 1\n # Create question object based on type using question_factory\n question = question_factory(params[:question][:type], questionnaire_id, max_seq)\n if question.is_a? ScoredQuestion\n question.weight = params[:question][:weight]\n question.max_label = Question::MAX_LABEL\n question.min_label = Question::MIN_LABEL\n end\n\n if Question::SIZES.key?(question.class.name)\n question.size = Question::SIZES[question.class.name]\n end\n if Question::ALTERNATIVES.key?(question.class.name)\n question.alternatives = Question::ALTERNATIVES[question.class.name]\n end\n\n begin\n question.save\n rescue StandardError => e\n flash[:error] = e.message\n end\n end\n redirect_to edit_questionnaire_path(questionnaire_id.to_sym)\n end", "def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:question]\n for question_key in params[:question].keys\n begin\n if params[:question][question_key][:txt].strip.empty?\n # question text is empty, delete the question\n Question.delete(question_key)\n else\n if (@questionnaire.type == \"QuizQuestionnaire\")\n Question.update(question_key,:weight => 1, :txt => params[:question][question_key][:txt] )\n else\n Question.update(question_key, params[:question][question_key])\n end\n Question.update(question_key, params[:question][question_key])\n end\n rescue ActiveRecord::RecordNotFound \n end\n end\n end\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:abstract)\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully created.\" }\n else\n # format.html { render :new, status: :unprocessable_entity }\n format.html { redirect_to new_questionnaire_url, alert: @questionnaire.errors.full_messages.first }\n end\n end\n end", "def create\n @questionnaire = current_user.questionnaires.new(questionnaire_params)\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to company_questionnaire_path(@questionnaire.company, @questionnaire), notice: 'Questionnaire was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire } \n else \n flash[:danger] = @questionnaire.errors.full_messages.join(', ')\n format.html { render :new }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend", "def create\n @quiz = Quiz.find(params[:quiz_id])\n @question = Question.new(question_params) \n #respond_to do |format|\n if @question.save\n link_quiz_question(@quiz, @question)\n #format.json { render :show, status: :created, location: @question }\n else\n redirect_to quizzes_path\n flash[:notice] = 'Falha em criar pergunta'\n #format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n #end\n end", "def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end", "def create_quiz_questionnaire\n create_questionnaire\n end", "def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:q1answer, :q2answer, :q3answer, :q4answer, :q5answer, :q6answer, :q7answer, :q8answer)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title)\n end", "def new\n @questions = Question.all\n @question = Question.new\n @answers = @question.answers.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end", "def create\n\t\t@questionary = Questionary.new(questionary_params)\n\n\t\trespond_to do |format|\n\t\t\tif @questionary.save\n\t\t\t\tformat.html { redirect_to '/questionary_items/new/' + @questionary.id.to_s }\n\t\t\t\tformat.json { render :show, status: :created, location: @questionary }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @questionary.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.build(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @questionnaires = Questionnaire.all\n end", "def index\n # @questionnaires = Questionnaire.all \n end", "def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to @quiz, notice: \"Quiz was successfully created.\" }\n format.json { render :show, status: :created, location: @quiz }\n\t\tmy_array = []\n\t\tmy_array << @quiz.option1\n\t\tmy_array << @quiz.option2\n\t\tmy_array << @quiz.option3\n\t\tmy_array << @quiz.option4\n\t\t\n\t\tcorrect_respo = my_array[@quiz.correct_response.to_i - 1]\n\t\t@quiz.correct_response_text = correct_respo\n\t\t@quiz.save\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end", "def create\n filtered_params = filter_params(question_params)\n @question = @form.questions.new(filtered_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно создан' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_new_questions(questionnaire_id)\n\n if params[:new_question]\n # The new_question array contains all the new questions\n # that should be saved to the database\n for question_key in params[:new_question].keys\n q = Question.new(params[:new_question][question_key])\n q.questionnaire_id = questionnaire_id\n if @questionnaire.type == \"QuizQuestionnaire\"\n q.weight = 1 #setting the weight to 1 for quiz questionnaire since the model validates this field\n q.true_false = false\n end\n q.save if !q.txt.strip.empty?\n end\n end\n end", "def question_params\n params.require(:question).permit(:titulo, :descripcion, :user_id, :university_id, :tag_ids => [])\n end", "def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @question = @quiz.questions.new\n\n 4.times { @question.answers.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def create\n \n @dquestion = @dtest.dquestions.new(params[:dquestion])\n\n respond_to do |format|\n if @dquestion.save\n # @dquestion.count_answer\n format.html { redirect_to dtest_dquestions_url(@dtest) }\n format.js\n else\n \n format.html { redirect_to dtests_url }\n end\n\n end\n #(@dquestion.count_answer).times { |i| Danswer.create!(answer_text: 'Answer ' + i.to_s, dquestion_id: @dquestion.id)}\n\n end", "def create\n @questionnaire = Questionnaire.new(params[:questionnaire])\n @quest = Quest.new(params[:quest])\n @choice = Choice.new(params[:choice])\n\n respond_to do |format|\n if @questionnaire.save\n flash[:notice]=\"Questionnaire Name #{@questionnaire.questionnaireName} Created\"\n format.html { redirect_to(:controller =>\"questionnaires\",:action =>\"new\") }\n #format.html { redirect_to(@questionnaire, :notice => 'Questionnaire was successfully created.') }\n format.xml { render :xml => @questionnaire, :status => :created, :location => @questionnaire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @questionnaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(params[:questionnaire])\n @questionnaire.course_instance = @instance\n \n authorize! :create, @questionnaire\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to [@instance, @questionnaire], notice: 'Kysymyslomakkeen luominen onnistui.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @completed_quest = CompletedQuest.new(params[:completed_quest])\n\n respond_to do |format|\n if @completed_quest.save\n format.html { redirect_to @completed_quest, notice: 'Completed quest was successfully created.' }\n format.json { render json: @completed_quest, status: :created, location: @completed_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @completed_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def questionnaire_params\n params.require(:questionnaire).permit!\n # params.require(:questionnaire).permit(:company_founder_1, :company_founder_2, :company_founder_3, :company_founder_4, :company_name, :company_website, :year_founded, :elevator_pitch, :interesting_why, :motivation, :product_stage, :financial_stage, :burn_rate, :revenue, :current_month_revenue, :ebitda_estimate, :risks_overview, :core_competency, :greatest_challenge, :opportunity, :critical_cost, :worst_case_scenario, :customers, :customers_overview, :customer_location, :customer_consumption, :customer_motivation, :customer_drivers, :distribution_power, :supply_power, :pricing_strategy, :company_evolution, :cofounder_story, :skills_mix_1, :skills_mix_2, :management_team_status, :management_team_filled_roles, :management_city_location, :past_experience_relevancy, :time_investment, :full_time_employees, :early_stage_experience, :location_relevancy, :contributed_capital, :management_earnings, :alternative_interest)\n end", "def create\n @room = Room.new(room_params)\n \n respond_to do |format|\n if @room.save\n trivia_category = (@room.category.eql? \"any\") ? '' : \"category=\" + @room.category\n \n questions_response = RestClient::Request.execute(\n method: :get,\n url: 'https://opentdb.com/api.php?amount=7&type=multiple&' + trivia_category\n )\n questions = JSON.parse(questions_response)['results']\n\n questions.each do |question|\n Question.create(\n :problem => question['question'],\n :category => question['category'],\n :correct_answer => question[\"correct_answer\"],\n :incorrect_answer_one => question[\"incorrect_answers\"][0],\n :incorrect_answer_two => question[\"incorrect_answers\"][1],\n :incorrect_answer_three => question[\"incorrect_answers\"][2],\n :room_id => @room.id\n )\n end\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n content = \"朝食は\" + params[:my_dairy][:question1] + \"\\n\" + \"昼食は\" + params[:my_dairy][:question2] + \"\\n\" + \"夕食は\" + params[:my_dairy][:question3]\n @my_dairy = MyDairy.new(content: content)\n\n respond_to do |format|\n if @my_dairy.save\n format.html { redirect_to @my_dairy, notice: 'My dairy was successfully created.' }\n format.json { render :show, status: :created, location: @my_dairy }\n else\n format.html { render :new }\n format.json { render json: @my_dairy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @survey = Survey.new\n 3.times do\n question = @survey.questions.build\n 4.times { question.choices.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def create\n @tipo_answer = TipoAnswer.new(tipo_answer_params)\n\n respond_to do |format|\n if @tipo_answer.save\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_answer }\n else\n format.html { render :new }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def question_params\n params.require(:question).permit(:content, :response_type_id, :parent_id, :category_id, :groups,\n :version_independent_id, :description, :other_allowed, :subcategory_id,\n concepts_attributes: [:id, :value, :display_name, :code_system],\n data_collection_methods: [])\n end", "def new\n @project = Project.find(params[:project_id])\n @questionnaire = Questionnaire.new\n question = @questionnaire.qquestions.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def question_params\n params.require(:question).permit(:title, :body)\n #require returns question array\n #of everything being posted, work with the questions part, and allow these two things to be submitted\n end", "def question_params\n params.require(:question).permit(:trivia_id, :quiz_id, :response, :is_correct)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:occupation, :why_participate, :carpentry, :plumbing, :electrical, :roofing, :song_leader, :bible, :recreation, :lifeguard, :accounting, :firstaid, :cpr_firstaid, :camp, :year, :site_leader, :involved_activities, :camp_director_approval, :camp_director_approval_date, :user_approval, :user_approval_date, :printed_date, :user_id)\n end", "def create\n purpose = params[:question].delete(:purpose)\n @question = Question.new(params[:question])\n @question.caption ||= \"\"\n @question.page = @page\n\n respond_to do |format|\n if @question.save and @question.update_attribute(:type, params[:question][:type])\n if purpose\n SpecialFieldAssociation.create :question => @question, :purpose => purpose, :questionnaire => @questionnaire\n end\n \n @question = Question.find(@question.id)\n if @question.kind_of? Questions::Field and @question.caption.blank?\n # get the default field caption in\n @question.caption = \"Pulse aqu’ para escribir una pregunta\"\n @question.save\n end\n \n format.html { redirect_to question_url(@question) }\n format.xml { head(:created, :location => question_url(@questionnaire, @page, @question, :format => 'xml')) }\n format.json { head(:created, :location => question_url(@questionnaire, @page, @question, :format => 'json')) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors.to_xml, :status => 500 }\n format.json { render :json => @question.errors.to_json, :status => 500 }\n end\n end\n end", "def create\n @multiple_choice_question = MultipleChoiceQuestion.new(params[:multiple_choice_question])\n\n respond_to do |format|\n if @multiple_choice_question.save\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully created.' }\n format.json { render json: @multiple_choice_question, status: :created, location: @multiple_choice_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end", "def create\n @test_question = TestQuestion.new(params[:test_question])\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' }\n format.json { render :json => @test_question, :status => :created, :location => @test_question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n quiz = Quiz.new(set_quiz_params)\n\n respond_to do |format|\n format.json do\n \n if quiz.valid?\n if quiz.save!\n render json: success_api({ question: quiz.question }, \"You fill correct answer!\")\n else\n render json: failed_api({ question: quiz.question }, \"You fill incorrect answer!\")\n end\n else\n render json: failed_api({}, quiz.errors.full_messages.first)\n end\n end\n end\n end", "def question_params\n params.require(:question).permit(:title, topic_ids: [], answers_attributes: [:id, :content, :is_correct])\n end", "def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end", "def create\n @questionnairedetail = Questionnairedetail.new(questionnairedetail_params)\n\n respond_to do |format|\n if @questionnairedetail.save\n format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully created.' }\n format.json { render :show, status: :created, location: @questionnairedetail }\n else\n format.html { render :new }\n format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quest = Quest.new(quest_params)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render :show, status: :created, location: @quest }\n else\n format.html { render :new }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @other_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @other_study }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def create\n @answer = current_user.answers.new(answer_params)\n @answer.question = @question\n @question.update(cant_answers: @question.cant_answers + 1)\n @answer.puntaje = 0\n @answer.best = false;\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer.question, notice: 'Respuesta creada satisfactoriamente' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n question = @current_user.question.create!(question_params)\n render json: { question: question }\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }\n format.json { head :no_content }\n end\n end", "def create\n @question = current_user.questions.new(question_params)\n if current_user.university != nil \n @question.university_id = current_user.university_id\n end\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'La pregunta fue creado correctamente.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(params, answer_sheet)\n questions_indexed = @questions.index_by(&:id)\n\n # loop over form values\n params ||= {}\n params.each do |question_id, response|\n next if questions_indexed[question_id.to_i].nil? # the rare case where a question was removed after the app was opened.\n # update each question with the posted response\n questions_indexed[question_id.to_i].set_response(posted_values(response), answer_sheet)\n end\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def question_params\n params.require(:question).permit(:title, :body, :answer, :tag_list, :slug)\n end", "def question_params\n params.require(:question).permit(\n :title,\n :question_type,\n :created_at,\n :updated_at,\n :muted_text,\n :placeholder,\n :step,\n :ordering,\n :form_id,\n :has_optional_answer,\n :is_group_view,\n answers_attributes: [:answer, :_destroy, :id]\n )\n end", "def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def question_params\n params.require(:question).permit(:title, :body, :answer)\n end", "def create\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n @answer = @question.answers.build(params[:answer])\n @answer.user_id = @current_user.id\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def answer_params\n params.require(:answer).permit(:body, :question_id, :status)\n end", "def question_params\n params.require(:question).permit(\n :title,\n :order,\n :answer_ids => [],\n )\n end", "def create\n @survey = Survey.new(params[:survey])\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Тест добавлен.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6628127", "0.6585721", "0.6516484", "0.6485117", "0.6454647", "0.6394063", "0.6381477", "0.63798666", "0.63659567", "0.63437366", "0.6333206", "0.63324606", "0.62913746", "0.6288558", "0.6235486", "0.6231012", "0.6214164", "0.6159615", "0.614689", "0.6143025", "0.61364704", "0.6117868", "0.6110644", "0.6106414", "0.6095363", "0.6092998", "0.6085435", "0.6077123", "0.6077123", "0.6077123", "0.6067746", "0.606558", "0.60582787", "0.60560787", "0.6051984", "0.60462916", "0.60384214", "0.6036347", "0.60152876", "0.6009347", "0.59973085", "0.5997101", "0.5987082", "0.598304", "0.59481144", "0.5944233", "0.59416026", "0.59285533", "0.5922053", "0.59180796", "0.59015775", "0.5900209", "0.5897306", "0.58949447", "0.58914924", "0.5888257", "0.5876245", "0.58753574", "0.58677536", "0.5866731", "0.58629", "0.5856625", "0.58553094", "0.5855236", "0.58532095", "0.58480036", "0.5846551", "0.58460194", "0.5844278", "0.5842111", "0.5837559", "0.583559", "0.58347464", "0.58286995", "0.5826003", "0.5824188", "0.58197457", "0.5817", "0.58140075", "0.5811226", "0.5804927", "0.58042437", "0.57998145", "0.5798417", "0.57838297", "0.5782844", "0.57778907", "0.5776805", "0.5756538", "0.5755035", "0.5754114", "0.5753937", "0.5753441", "0.5749935", "0.57491314", "0.57491213", "0.57487994", "0.574301", "0.57421726", "0.5739545" ]
0.59409505
47
author ahmed jihad called to update questionnaire questions or answers finds the selected questionnaire Args :
def update @questionnaire = Questionnaire.find(params[:id]) respond_to do |format| if @questionnaire.update_attributes(params[:questionnaire]) format.html { redirect_to "http://localhost:3000/questionnaires/finish"} format.json { head :no_content } format.js { render "redirect" } else format.html { render "http://localhost:3000/questionnaires/finish" } format.json { render json: @questionnaire.errors, status: :unprocessable_entity } format.js {render "validation_error"} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(questionnaire_params)\n for qid in params[:question].keys\n @question = Question.find(qid)\n @question.txt = params[:question][qid.to_sym][:txt]\n @question.save\n @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)\n i=1\n for quiz_question_choice in @quiz_question_choices\n choose_question_type(i, quiz_question_choice)\n i+=1\n end\n end\n end\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]\n end", "def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(params[:questionnaire])\n\n for qid in params[:question].keys\n question_advices = QuestionAdvice.find_all_by_question_id(qid)\n i=1\n for question_advice in question_advices\n if params[:question][qid][\"weight\"] == i.to_s\n score = 1\n else\n score = 0\n end\n i+=1\n question_advice.update_attributes(:score => score, :advice => params[:question_advice][question_advice.id.to_s][\"advice\"])\n end\n end\n save_questionnaire\n #save_choices @questionnaire.id\n end\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid]\n end", "def update\n @question.statement = params[:question][:statement]\n unless @question.online\n @question.level = (@chapter.section.fondation? ? 0 : params[:question][:level])\n if @question.is_qcm\n if params[:question][:many_answers] == '1'\n @question.many_answers = true\n else\n if @question.many_answers\n # Must check there is only one true\n i = 0\n @question.items.order(:id).each do |c|\n if c.ok\n if i > 0\n c.ok = false\n flash[:info] = \"Attention, il y avait plusieurs réponses correctes à cet exercice, seule la première a été gardée.\"\n c.save\n end\n i = i+1\n end\n end\n if @question.items.count > 0 && i == 0\n # There is no good answer\n flash[:info] = \"Attention, il n'y avait aucune réponse correcte à cet exercice, une réponse correcte a été rajoutée aléatoirement.\"\n @item = @question.items.order(:id).first\n @item.ok = true\n @item.save\n end\n end\n @question.many_answers = false\n end\n else\n if params[:question][:decimal] == '1'\n @question.decimal = true\n @question.answer = params[:question][:answer].gsub(\",\",\".\").to_f\n else\n @question.decimal = false\n @question.answer = params[:question][:answer].gsub(\",\",\".\").to_i\n end\n end\n end\n \n if @question.save\n redirect_to chapter_path(@chapter, :type => 5, :which => @question.id)\n else\n render 'edit'\n end\n end", "def update\n def answer_given(question_id)\n return (params[:answer] and params[:answer][question_id.to_s] and\n params[:answer][question_id.to_s].length > 0)\n end\n \n @resp = Response.find(params[:id])\n\n @questionnaire.questions.each do |question|\n if question.kind_of? Questions::Field\n ans = Answer.find_answer(@resp, question)\n if answer_given(question.id)\n if ans.nil?\n ans = Answer.new :question_id => question.id, :response_id => @resp.id\n end\n ans.value = params[:answer][question.id.to_s]\n ans.save\n else\n # No answer provided\n if not ans.nil?\n ans.destroy\n end\n end\n end\n end\n\n respond_to do |format|\n if @resp.update_attributes(params[:response])\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.js { redirect_to(response_url(@questionnaire, @resp, :format => \"js\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit(index, params)\n question.update(question: params[:questions][\"question_#{index + 1}\".to_sym])\n choice_num = 1\n @choices.select { |choice| choice.question_id == question.id}.each do |choice|\n choice.update(choice: params[\"choice_#{choice_num}\".to_sym])\n choice_num += 1\n end\n end", "def update \t\n\t \t# TODO: make sure that there are no duplicates for questions\n\t \t\n\t \t@param_list = params # for debugging in case of errors (see update.html.erb)\n\t \t\n\t \t#return\n\t \tif params[:id].nil?\n\t \t\t@error_message = 'ERROR: invalid question id'\n\t \telsif params[:question].nil?\n\t \t\t@error_message = 'ERROR: no question parameter provided'\n \t\telsif params[:question][:short_name].nil? or params[:question][:short_name].empty?\n \t\t\t@error_message = 'ERROR: no short name provided'\n \t\telsif params[:question][:text].nil? or params[:question][:text].empty?\n \t\t\t@error_message = 'ERROR: no question text provided'\n \t\telsif params[:question][:question_type].nil? or params[:question][:question_type].empty?\n \t\t\t@error_message = 'ERROR: no question type provided'\n\t\telsif params[:question][:domain].nil? or params[:question][:domain].empty?\n\t\t\t@error_message = 'ERROR: no question domain provided'\n\t\telsif not [Question::UNFILED_DOMAIN,Question::PROFILE_DOMAIN,Question::FEEDBACK_DOMAIN].include?(params[:question][:domain].downcase)\n\t\t\t@error_message = 'ERROR: invalid question domain provided'\n \t\telsif not ['Text','Multiple Choice','Multiple Selection'].include?(params[:question][:question_type])\n \t\t\t@error_message = 'ERROR: invalid question type'\n \t\telsif params[:question][:question_type] != 'Text' and (params[:choices].nil? or params[:choices].empty?)\n \t\t\t@error_message = 'ERROR: did not specify choices for a choice question' \t\t\t\n \t\telse\n\t\t \tquestion_type = _condense_question_type(params[:question][:question_type]) # represents the desired new question type\n \t\t\t# TODO: make sure that there are no duplicates\n\t\t \t\n\t\t \tif question_type.nil?\n \t\t\t\t@error_message = 'ERROR: could not condense question type properly!'\n \t\t\telse\n \t\t\t\t# now can save the question, but first must check if it already exists - won't the question always exist?\n \t\t\t\tcurrent_question = Question.where('id = ?',params[:id]).first \t\t\t\t\n\t\t\t \tif current_question.nil? # not found, so will make and store a new one - rare occasion, but enforces idempotency\t\t \t\t\n\t\t\t \t\t# this will create a new question, create any choices that don't already exist, and replace all Inclusions\n\t\t\t \t \t_create_new_question params[:question][:short_name], params[:question][:text], question_type, params[:question][:domain].downcase, current_user.id, params[:choices]\t\t \t\t\n\t\t \t\telse # this question already exists - just update its information and update the choices database with any new choices; also replace all Inclusion links\n\t\t\t \t\t@previous_question_type = current_question.question_type\n\t\t \t\t\t@question = Question.update(current_question.id.to_i, :short_name => params[:question][:short_name], :text => params[:question][:text], :question_type => question_type, :updated_by => current_user.id, :domain => params[:question][:domain].downcase) # updated_at will be done automatically by Rails\n\t\t\t \t\t@error_message = '[INFO] Question updated in database!'\n\t\t\t \t\t\n\t\t \t\t\t# update possbilities:\n\t\t \t\t\t# text -> text: do nothing (just modify the question above)\n\t\t \t\t\t# text -> mc/ms (non-text): add all non-existing choices from params, add Inclusion records between choices and all params (no need to replace here; can't be any choices for a former text question)\n\t\t\t\t\t# mc/ms (non-text) -> text: delete all existing Inclusion records between choices and question\n\t\t\t\t\t# mc/ms (non-text) -> mc/ms (non-text): \n\t\t \t\t\t\n\t\t\t \t\tif @previous_question_type == 'TEXT' and question_type != 'TEXT'\n\t\t\t \t\t\t_update_current_choices_and_inclusions(@question.id,params[:choices])\n\t\t \t\t\telsif @previous_question_type != 'TEXT' and question_type == 'TEXT'\n\t\t \t\t\t\t# only delete the old inclusion ties (questions are, after all, decoupled from choices)\n\t\t \t\t\t\t#old_ties = Inclusion.where('question_id = ?',).all.collect { |i| i.choice_id.to_i }\n\t\t \t\t\t\t#Inclusion.destroy_all(\"question_id = #{current_question.id.to_i}\")\n\t\t \t\t\t\tActiveRecord::Base.connection.execute(\"DELETE FROM inclusions WHERE question_id = #{current_question.id.to_i}\") # is there a better way?\t\n\t\t \t\t\t\t\n\t\t \t\t\telsif @previous_question_type != 'TEXT' and question_type != 'TEXT'\n\t\t \t\t\t\t# here, must delete old Inclusion ties before adding the new ones (which, in effect, replaces all ties)\n\t\t \t\t\t\t#Inclusion.destroy_all(\"question_id = #{current_question.id.to_i}\")\n\t\t \t\t\t\tActiveRecord::Base.connection.execute(\"DELETE FROM inclusions WHERE question_id = #{current_question.id.to_i}\")\n\t\t \t\t\t\t_update_current_choices_and_inclusions(@question.id,params[:choices])\n\t \t\t\t\tend\t\t \t\t\n\t\t \t\tend\n\t \t\tend\n \t\tend\n \t\t\n \t\tif @error_message.index('ERROR').nil? # if there is an error, stay on this page; else, allow user to continue\n \t\t\tredirect_to :action => :index\n \t\tend\n\tend", "def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_assignment_form(exist_assignment)\n questionnaire_array = assignment_form_params[:assignment_questionnaire]\n questionnaire_array.each { |cur_questionnaire| cur_questionnaire[:assignment_id] = exist_assignment.id.to_s }\n assignment_form_params[:assignment_questionnaire]\n due_array = assignment_form_params[:due_date]\n due_array.each { |cur_due| cur_due[:parent_id] = exist_assignment.id.to_s }\n assignment_form_params[:due_date]\n @assignment_form.update(assignment_form_params, current_user)\n end", "def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def update\n\t@question = Question.find(params[:id])\n\t@questionnaire_question=QuestionnaireQuestion.find_by_question_id(@question.id)\n\t@questionnaire=Questionnaire.find(@questionnaire_question.questionnaire_id)\n\n\trespond_to do |format|\n\t if @question.update_attributes(params[:question])\n\t#\tformat.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n\t\tformat.html { redirect_to new_question_path(:questionnaire_id=>@questionnaire.id), :notice => 'Answer was successfully Saved.' }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end", "def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_question\n @questions=Admin::Questionbank.find(:all,:select=>\"id,question_code,subject_name,question_number,internal_ref_number\",:order=>'created_at DESC',:limit=>3)\n @questionbank=Admin::Questionbank.find(params[:id])\n @examtypes=Admin::Examtype.find(:all,:select=>\"id,examtype\",:order=>'examtype')\n @sectiontopics=Admin::Sectiontopic.find(:all,:select => 'DISTINCT Topic,id')\n @sectiontags=Admin::Sectiontemplate.find(:all,:select=>'SectionTags')\n totalexamtypes = \"\"\n i=1\n @examtypes.size.times{\n examtypes = params['etype'+i.to_s]['checked']\n if totalexamtypes == ''\n totalexamtypes = examtypes\n else\n totalexamtypes = totalexamtypes+','+examtypes\n end\n i=i+1\n }\n @questionbank.examtype_tags=totalexamtypes\n if @questionbank.question_media_type==0 # if question type is textual\n @questionbank.update_attributes(params[:questionbank])\n redirect_to :action => 'edit_success', :id => @questionbank\n elsif @questionbank.question_media_type==1 #if question type is graphical \n @questionbank.topic=params[:questionbank][:topic]\n @questionbank.sub_topic=params[:questionbank][:sub_topic]\n @questionbank.sub_sub_topic=params[:questionbank][:sub_sub_topic]\n @questionbank.tags=params[:questionbank][:tags]\n @questionbank.correct_answer=params[:questionbank][:correct_answer]\n @questionbank.source=params[:questionbank][:source]\n @questionbank.author=params[:questionbank][:author]\n @questionbank.comments=params[:questionbank][:comments]\n @questionbank.internal_ref_number=params[:questionbank][:internal_ref_number]\n @questionbank.topic=params[:questionbank][:topic].strip\n @questionbank.tags=params[:questionbank][:tags].strip\n Admin::Questionbank.save_imagepaths_in_db(params[:questionbank],@questionbank,@questionbank.subject_code,@questionbank.question_code)## to save the image paths in db\n @questionbank.save\n Admin::Questionbank.delete_previous_files(params[:questionbank]) ## to delete the previous files in application if they exist \n Admin::Questionbank.save_images(params[:questionbank],@questionbank.subject_code,@questionbank.question_code)## and save the files(images) again\n redirect_to :action => 'edit_success', :id => @questionbank\n else\n render :action => 'edit_question'\n end\n end", "def update!(**args)\n @choice_question = args[:choice_question] if args.key?(:choice_question)\n @date_question = args[:date_question] if args.key?(:date_question)\n @file_upload_question = args[:file_upload_question] if args.key?(:file_upload_question)\n @grading = args[:grading] if args.key?(:grading)\n @question_id = args[:question_id] if args.key?(:question_id)\n @required = args[:required] if args.key?(:required)\n @row_question = args[:row_question] if args.key?(:row_question)\n @scale_question = args[:scale_question] if args.key?(:scale_question)\n @text_question = args[:text_question] if args.key?(:text_question)\n @time_question = args[:time_question] if args.key?(:time_question)\n end", "def update_multiple_answer_questions params\n #clear questions first\n self.pal_additional_areas.clear\n self.pal_participation_levels.clear\n self.help_additional_areas.clear\n self.professions.clear\n self.search_plan_types.clear\n self.npln_participation_levels.clear\n self.referral_fees.clear\n self.plan_types.clear\n self.claim_types.clear\n self.sponsor_types.clear\n self.npln_additional_areas.clear\n self.jurisdictions.clear\n self.geo_areas.clear\n\n self.pal_additional_areas << params[:pal_additional_areas].collect{|p| PalAdditionalArea[p]} if params[:pal_additional_areas]\n self.pal_participation_levels << params[:pal_participation_levels].collect{|p| PalParticipationLevel[p]} if params[:pal_participation_levels]\n self.help_additional_areas << params[:help_additional_areas].collect{|p| HelpAdditionalArea[p]} if params[:help_additional_areas]\n self.professions << Profession[params[:profession]] if (params[:profession] and !params[:profession].blank?)\n self.search_plan_types << params[:search_plan_types].collect{|p| SearchPlanType[p]} if params[:serach_plan_types]\n self.npln_participation_levels << params[:npln_participation_levels].collect{|p| NplnParticipationLevel[p]} if params[:npln_participation_levels]\n self.referral_fees << params[:referral_fees].collect{|p| ReferralFee[p]} if params[:referral_fees]\n self.plan_types << params[:plan_types].collect{|p| PlanType[p]} if params[:plan_types]\n self.claim_types << params[:claim_types].collect{|p| ClaimType[p]} if params[:claim_types]\n self.sponsor_types << params[:sponsor_types].collect{|p| SponsorType[p]} if params[:sponsor_types]\n self.npln_additional_areas << params[:npln_additional_areas].collect{|p| NplnAdditionalArea[p]} if params[:npln_additional_areas]\n self.jurisdictions << params[:jurisdictions].collect{|p| Jurisdiction[p]} if params[:jurisdictions]\n self.geo_areas << params[:geo_areas].collect{|p| GeoArea[p]} if params[:geo_areas]\n end", "def update\n @questionnaire.update_attributes(\n status: :completed,\n answer: questionnaire_params.to_xml\n )\n render_to_msg('Успешно пройден')\n rescue => e\n logger.info(\"ОШИБКА: #{e}\")\n @questionnaire.update_attributes(status: :error)\n render_to_msg('Возникла непредвиденная ошибка, попробуйте еще раз')\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend", "def update\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n @tags = @question.tags.order(:id)\n @tag = @question.tags.build\n @taggings = Tagging.where(:tag_id => @tags.collect{|x| x.id},:question_id => params[:id]).order(:tag_id)\n @answer = @question.answers.find(params[:id])\n @user = @answer.user\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n # make other answers wrong\n if params[:answer][:correct]\n @question.answers.each do |a|\n if a != @answer\n a.correct = false\n a.save\n end\n end\n end\n format.html { render :template => 'questions/show', :answer_id=>@answer.id, :user_id=>@user.id,:question_id => @question.id, notice: 'Answer was successfully updated.'}\n #format.json { head :no_content }\n #redirect_to question_url(@question_id)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_item = QuestionItem.find(params[:id])\n# render :text => params.inspect\n\n\t\t#the 'chosen' plugin does not seem to delete the last response_domain_alls, add missing explicit empty value\n\t\tif !params[:question_item].key?(\"response_domain_all_ids\")\n\t\t\tparams[:question_item][:response_domain_all_ids] = [\"\"]\n\t\tend\n\n respond_to do |format|\n if @question_item.update_attributes(params[:question_item])\n format.html { redirect_to(@question_item, :notice => 'Question item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ask = Ask.find(params[:id])\n # 补充问题的\n if params[:answers_content_renew]\n renew = \"<br/><hr/>问题补充:<br/>\" + params[:answers_content_renew]\n if not @ask.content\n new_content = renew\n else\n new_content = @ask.content + renew\n end\n @ask.update_attributes({ :content => new_content })\n flash[:message] = \"成功补充了您的问题\"\n end\n # 更新状态的\n if params[:status] == 2.to_s\n @ask.update_attributes({ :status => params[:status] })\n flash[:message] = \"您的问题已经正常关闭\"\n elsif params[:status] == 1.to_s\n bestanswer = AskAnswer.find_by_id params[:answer_id]\n @ask.update_attributes({\n :status => params[:status],\n :bestanswer => bestanswer.id,\n :bestanswer_uid => bestanswer.user_id,\n :bestanswer_username => bestanswer.user.username\n })\n flash[:message] = \"您的问题已经正常关闭,并且选择了正确答案\"\n # 给解决问题的人发通知\n your_ask_url = XMAPP_MAIN_DOMAIN_URL+\"/asks/#{@ask.id}\"\n message = \"您对问题<a href=\\\"#{your_ask_url}\\\" >#{@ask.title}<\\/a>的回答被选择为正确答案,系统将赏给你30个金币和20的积分\"\n send_dz_notify bestanswer.user.dz_common_id, @ask.user.dz_common_id, '', message, 'slove_ask'\n # 给解决问题的人加金币和积分\n add_discuz_extcredits bestanswer.user.dz_common_id, 30\n add_discuz_credits bestanswer.user.dz_common_id, 20\n # 更新这个答案的状态为 checked\n bestanswer.update_attributes({:ifcheck => 1})\n # 发全站动态\n dz_user = session[:login_user]\n ask_index_url = XMAPP_MAIN_DOMAIN_URL+\"/asks\"\n ask_thread_url = XMAPP_MAIN_DOMAIN_URL+\"/asks/#{@ask.id}\"\n #title_template = \"#{dz_user.username}在<a href=\\\"#{ask_index_url}\\\" >问答频道<\\/a>提了一个问题<a href=\\\"#{ask_thread_url}\\\" >#{@ask.title}<\\/a>\"\n\t answer_user_url = USER_SPACE_URL_BASE.gsub('{dz_uid}', bestanswer.user.dz_common_id.to_s)\n\t ask_user_url = USER_SPACE_URL_BASE.gsub('{dz_uid}', @ask.user.dz_common_id.to_s)\n\t title_template = \"<a href=\\\"#{answer_user_url}\\\" >#{@ask.bestanswer_username}<\\/a>解决了<a href=\\\"#{ask_user_url}\\\" >#{@ask.user.username}<\\/a>的问题<a href=\\\"#{ask_thread_url}\\\" >#{@ask.title}<\\/a>\"\n\t title_data = {}\n\t require 'php_serialization'\n\t title_data = PhpSerialization.dump(title_data)\n send_dz_feed 2003, bestanswer.user.dz_common_id, @ask.bestanswer_username, title_template, title_data, '', title_data\n end\n redirect_to ask_path @ask\n end", "def save_choices(questionnaire_id)\n\n if params[:new_question] and params[:new_choices]\n questions = Question.find_all_by_questionnaire_id(questionnaire_id)\n i = 1\n for question in questions\n for choice_key in params[:new_choices][i.to_s].keys\n\n if choice_key == params[:new_question][i.to_s][\"weight\"]\n score = 1\n else\n score = 0\n end\n q = QuestionAdvice.new(:score => score, :advice => params[:new_choices][i.to_s][choice_key], :question_id => question.id)\n q.save\n end\n i += 1\n question.weight = 1\n question.true_false = false\n end\n end\n end", "def updateAnswer(ls,time)\n # ls is a list of list of answerd_factor_id, statistic_id pairs\n # t contains date information\n puts ls.inspect\n ls.each do |e|\n sid = e[0][1].to_i\n stat = Statistic.where(id: sid)\n\n amount = stat[0].EvalEquation(current_user.id, e)\n #if exists\n if Answer.where(user_id: current_user.id,statistic_id: sid,month: time[:month], year: time[:year]).first.present?\n Answer.where(user_id: current_user.id,statistic_id: sid,month: time[:month], year: time[:year]).first.update(:amount =>amount) #update the amount only\n else\n ans = Answer.where(amount: amount,user_id: current_user.id,statistic_id: sid,month: time[:month], year: time[:year]).create #otherwise create the field.\n end\n end\n end", "def update\n @question_response = QuestionResponse.find(params[:id])\n\n\t\t\t@question = @question_response.question\n if @question_response.update(qr_params)\n flash[:notice] = t('questionresponse_updated_success')\n\t\t\t\trender :action => 'list' \n else\n render :action => \"edit\" \n end\n end", "def update\n # Do not support updating an answer for now\n # Once you have answered there is no return\n end", "def set_answer\n\t\t#@answer = Survey.find(params[:id])\n\tend", "def update\n @question = Question.find(params[:id])\n\n # @question.question_type_id = params[:question][:question_type_id]\n # @question.question_category_id = @question.question_type.question_category_id\n\n # authorize! :update, @question\n # @question.question_type_id = params[:question][:question_type_id]\n # @question.question_category_id = @question.question_type.question_category_id\n\n \n # # get fields from the form to update the question's section\n # @question.book = params[:question][:book]\n # @question.chapter = params[:question][:chapter]\n # @question.verse = params[:question][:verse]\n # @question.section_id = @question.set_section\n #---------------------------------------------------------\n \n # # if the the question has been approved, set the approver and the date approved\n # unless params[:question][:approval_level] == nil\n # @question.approved_by = current_user.id\n # @question.approved_on = DateTime.now\n # end\n\t\n @question.update_attributes(params[:question])\n unless @question.approval_level == -1\n respond_with @question\n\tend\n\t\n\t# set the section for this question\n\t#@question.section_id = @question.set_section\n \n # the quesiton is marked as refused, drop from database\n if @question.approval_level == -1\n \t@question.destroy\n destroyed = 1\n redirect_to approve_path, :notice => \"Successfully deleted question\"\n return\n end\n # if @question.update_attributes(params[:question])\n # # determine user and send them to appropriate page\n # if current_user.is_writer?\n # redirect_to write_path, :notice => \"Successfully updated question.\"\n # elsif current_user.is_approver?\n # redirect_to approve_path, :notice => \"Successfully updated question.\"\n # else\n # redirect_to @question, :notice => \"Successfully updated question.\"\n # end\n # else\n # render :action => 'edit'\n # end\n end", "def update_assignment_questionnaires(attributes)\n return if attributes.nil? || attributes.empty?\n\n if attributes[0].key?(:questionnaire_weight)\n validate_assignment_questionnaires_weights(attributes)\n @errors = @assignment.errors.to_s\n topic_id = nil\n end\n unless @has_errors\n # Update AQ if found, otherwise create new entry\n attributes.each do |attr|\n next if attr[:questionnaire_id].blank?\n\n questionnaire_type = Questionnaire.find(attr[:questionnaire_id]).type\n topic_id = attr[:topic_id] if attr.key?(:topic_id)\n duty_id = attr[:duty_id] if attr.key?(:duty_id) # if duty_id is present in the attributes, save it.\n aq = assignment_questionnaire(questionnaire_type, attr[:used_in_round], topic_id, duty_id)\n if aq.id.nil?\n unless aq.save\n @errors = @assignment.errors.to_s\n @has_errors = true\n next\n end\n end\n unless aq.update_attributes(attr)\n @errors = @assignment.errors.to_s\n @has_errors = true\n end\n end\n end\n end", "def admin_update\n @question = Question.find(params[:id])\n authorize @question\n\n guidance = @question.get_guidance_annotation(current_user.org_id)\n current_tab = params[:r] || 'all-templates'\n if params[\"question-guidance-#{params[:id]}\"].present?\n unless guidance.present?\n guidance = Annotation.new(type: :guidance, org_id: current_user.org_id, question_id: @question.id)\n end\n guidance.text = params[\"question-guidance-#{params[:id]}\"]\n guidance.save\n else\n # The user cleared out the guidance value so delete the record\n guidance.destroy! if guidance.present?\n end\n example_answer = @question.get_example_answer(current_user.org_id)\n if params[\"question\"][\"annotations_attributes\"].present? && params[\"question\"][\"annotations_attributes\"][\"0\"][\"id\"].present?\n unless example_answer.present?\n example_answer = Annotation.new(type: :example_answer, org_id: current_user.org_id, question_id: @question.id)\n end\n example_answer.text = params[\"question\"][\"annotations_attributes\"][\"0\"][\"text\"]\n example_answer.save\n else\n # The user cleared out the example answer value so delete the record\n example_answer.destroy if example_answer.present?\n end \n \n if @question.question_format.textfield?\n @question.default_value = params[\"question-default-value-textfield\"]\n elsif @question.question_format.textarea?\n @question.default_value = params[\"question-default-value-textarea\"]\n end\n @section = @question.section\n @phase = @section.phase\n template = @phase.template\n \n attrs = params[:question]\n attrs[:theme_ids] = [] unless attrs[:theme_ids]\n \n if @question.update_attributes(attrs)\n @phase.template.dirty = true\n @phase.template.save!\n\n redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, r: current_tab), notice: success_message(_('question'), _('saved'))\n else\n @edit = (@phase.template.org == current_user.org)\n @open = true\n @sections = @phase.sections\n @section_id = @section.id\n @question_id = @question.id\n\n flash[:alert] = failed_update_error(@question, _('question'))\n if @phase.template.customization_of.present?\n @original_org = Template.where(dmptemplate_id: @phase.template.customization_of).first.org\n else\n @original_org = @phase.template.org\n end\n redirect_to admin_show_phase_path(id: @phase.id, section_id: @section.id, question_id: @question.id, r: current_tab)\n end\n end", "def update\n @survey = Survey.find_by_id( params[:survey_id] )\n @question = Question.find_by_id( params[:id] )\n\n if @question.update( question_params )\n if params[:commit] == \"Continue to the Next Step\"\n params[:option_num].to_i.times do\n @question.options.create # TODO: cleanup, could create empty options in db\n end\n\n redirect_to edit_survey_question_path(@survey, @question)\n else\n flash.now[:success] = \"Question Added!\"\n\n # Create new empty question for render\n @question = @survey.questions.build\n\n render :new\n end\n else\n flash.now[:error] = \"Sorry, we couldn't add that question due to errors.\"\n render :new\n end\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_answers!(params)\n SurveyQuestion.with_question.find_all_by_survey_id(survey_id).each do |question| # iterate through all survey questions\n if params[question.id.to_s].blank? # if the question hasn't been answered\n remove_answer(question.id)\n else\n set_answer(question, params[question.id.to_s]) # save the answer\n end\n end\n save\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def update_existing_quiz_question(course_id,quiz_id,id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n QuizQuestion.new(response)\n end", "def update\n @question = Question.find(params[:id])\n @type = 'Post'\n @top = nil\n if(@question.parentid >0)\n \n @top = Question.find_by_id(@question.parentid)\n @question.headline = '1'\n end\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if(@question.parentid < 1) # if editing a question\n flash[:notice] = 'Question was successfully updated.'\n format.html { redirect_to(question_path(@question.id)) }\n else #If editing an answer\n flash[:notice] = 'Answer was successfully updated.'\n format.html { redirect_to(question_path(@question.parentid)) }\n end\n else\n if @question.headline == '1'\n format.html { render :action => \"editanswer\" }\n else\n format.html { render :action => \"edit\" }\n end\n \n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n knowledge = Knowledge.first(:idurl => (knowledge_idurl = params[:knowledge_idurl]))\n quizze = Quizze.first(:idurl => (quizze_idurl = params[:quizze_idurl]))\n quizze.question_idurls = params[:select_question_idurls]\n quizze.product_idurls = params[:select_product_idurls]\n quizze.save\n redirect_to(\"/quizzes/#{knowledge_idurl}/#{quizze_idurl}\")\n end", "def update\n @page = Page.find(params[:id])\n questions = @presenter.all_questions_for_page(params[:id])\n questions.post(params[:answers], @answer_sheet)\n \n questions.save\n \n @elements = questions.elements\n \n # Save references\n if params[:reference].present?\n params[:reference].each do |id, values|\n ref = @answer_sheet.reference_sheets.find(id)\n # if the email address has changed, we have to trash the old reference answers\n ref.attributes = values\n ref.save(:validate => false)\n end\n end\n @presenter.active_page = nil\n @answer_sheet.touch\n respond_to do |format|\n format.js\n #format.html\n end\n end", "def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_faq_params=faq_params\n new_faq_params[:question]=params[:question]\n new_faq_params[:answer]=params[:answer]\n\n faq_params=new_faq_params\n end\n\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { redirect_to @faq, notice: 'Faq was successfully updated.' }\n format.json { render :show, status: :ok, location: @faq }\n else\n format.html { render :edit }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @answer.update(answer_params)\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:edit, @answer)\n end\n end", "def update\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权修改别人编写的考试\"\n end\n parsed_param=exam_params\n @exam.questions.delete_all\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if @exam.update(parsed_param)\n format.html { redirect_to @exam, notice: \"已成功更新考试“#{@exam.name}.”\" }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_answer\n @quiz = Quiz.find(params[:quiz_id])\n @question = Question.find_by(quiz_id: @quiz.id, number: params[:question_id]) || Question.find_by(quiz_id: @quiz.id, id: params[:question_id])\n @answer = Answer.find_by(question_id: @question.id, id: params[:id]) if params.key?(:id)\n end", "def assignment_questionnaire(questionnaire_type, round_number, topic_id, duty_id = nil)\n round_number = nil if round_number.blank?\n topic_id = nil if topic_id.blank?\n\n # Default value of duty_id is nil, and when duty_id is not nil, then it means that the function call\n # is made to access assignment_questionnaire of that particular duty. If questionnaires varies by duty,\n # then find the relevant questionnaire and return.\n if duty_id && @assignment.questionnaire_varies_by_duty\n # Get all AQs for the assignment and specified duty_id\n assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, duty_id: duty_id)\n assignment_questionnaires.each do |aq|\n # If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it\n return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type\n end\n elsif @assignment.varying_rubrics_by_round? && @assignment.vary_by_topic?\n # Get all AQs for the assignment and specified round number and topic\n assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, used_in_round: round_number, topic_id: topic_id)\n assignment_questionnaires.each do |aq|\n # If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it\n return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type\n end\n elsif @assignment.varying_rubrics_by_round?\n # Get all AQs for the assignment and specified round number by round #\n assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, used_in_round: round_number)\n assignment_questionnaires.each do |aq|\n # If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it\n return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type\n end\n elsif @assignment.vary_by_topic?\n # Get all AQs for the assignment and specified round number by topic\n assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id)\n assignment_questionnaires.each do |aq|\n # If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it\n return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type\n end\n else\n # Get all AQs for the assignment\n assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id)\n assignment_questionnaires.each do |aq|\n # If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it\n return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type\n end\n end\n\n # Create a new AQ if it was not found based on the attributes\n default_weight = {}\n default_weight['ReviewQuestionnaire'] = 100\n default_weight['MetareviewQuestionnaire'] = 0\n default_weight['AuthorFeedbackQuestionnaire'] = 0\n default_weight['TeammateReviewQuestionnaire'] = 0\n default_weight['BookmarkRatingQuestionnaire'] = 0\n default_aq = AssignmentQuestionnaire.where(user_id: @assignment.instructor_id, assignment_id: nil, questionnaire_id: nil).first\n default_limit = if default_aq.blank?\n 15\n else\n default_aq.notification_limit\n end\n\n aq = AssignmentQuestionnaire.new\n aq.questionnaire_weight = default_weight[questionnaire_type]\n aq.notification_limit = default_limit\n aq.assignment = @assignment\n aq\n end", "def update\n puts params\n @question = Question.find(params[:id])\n if params[:commit] == 'Answer'\n @question.resolved = true\n @question.end_time = Time.now\n @question.username = current_user.email.split('@')[0]\n if @question.update(update_question_params)\n redirect_to solve_path\n end\n end\n\n if params[:commit] == 'Escalate'\n @question.escalated = true\n @escalate = @question.escalatings.create();\n @question.save\n @escalate.username = current_user.email.split('@')[0]\n @escalate.save\n redirect_to solve_path\n end \n \n end", "def update!(**args)\n @item_id = args[:item_id] if args.key?(:item_id)\n @question_id = args[:question_id] if args.key?(:question_id)\n end", "def edit_question\n @questions=Admin::Questionbank.find(:all,:select=>\"id,question_code,subject_name,question_number,internal_ref_number\",:order=>'created_at DESC',:limit=>3)\n @questionbank=Admin::Questionbank.find(params[:id])\n @examtypes=Admin::Examtype.find(:all,:select=>\"id,examtype\",:order=>'examtype')\n @sectiontopics=Admin::Sectiontopic.find(:all,:select => 'DISTINCT Topic,id')\n @sectiontags=Admin::Sectiontemplate.find(:all,:select=>'SectionTags')\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question.update\n @cancel.update\n end", "def update!(**args)\n @choices = args[:choices] if args.key?(:choices)\n end", "def update\n respond_to do |format|\n if @answer.editable? && @answer.update(answer_params)\n format.html { redirect_to [@project, @discussion], notice: 'Answer was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def edit_quiz\n\n @questionnaire = Questionnaire.find(params[:id])\n render :edit\n end", "def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:question]\n for question_key in params[:question].keys\n begin\n if params[:question][question_key][:txt].strip.empty?\n # question text is empty, delete the question\n Question.delete(question_key)\n else\n if (@questionnaire.type == \"QuizQuestionnaire\")\n Question.update(question_key,:weight => 1, :txt => params[:question][question_key][:txt] )\n else\n Question.update(question_key, params[:question][question_key])\n end\n Question.update(question_key, params[:question][question_key])\n end\n rescue ActiveRecord::RecordNotFound \n end\n end\n end\n end", "def update\n @s = Script.find(params[:script_id], :include => [:questions])\n @interview = Interview.find(params[:id])\n\n if @interview.update_attributes(interview_params)\n render :text => 'Interview Saved'\n else\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end", "def update\n @multiplechoice = Multiplechoice.find(params[:id])\n\n respond_to do |format|\n if @multiplechoice.update_attributes(params[:multiplechoice])\n format.html { redirect_to(@multiplechoice, :notice => 'Your question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @multiplechoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_answer\n require_admin\n if request.post?\n @answer = Answer.find(edit_answer_params[:id]) #inbound data object with 2 params(possibly 3 if we need to include question id)\n @answer.text = edit_answer_params[:text]\n @answer.save() #save to the db\n #@answer.questionId = edit_question_params.questionId\n redirect_to controller:\"qa\", action:\"view_question\", id:@answer.question_id\n \n else\n @answer = Answer.find(Integer(params[\"id\"]))\n end\n end", "def update\n raise \"need to provide the 'invitation_uuid' param\" unless params[:invitation_uuid]\n raise \"need to provide the 'answers' param\" unless params[:answers]\n raise \"need to provide the 'ways_to_communicate' param\" unless params[:ways_to_communicate]\n raise \"need to provide the 'good_times' param\" unless params[:good_times]\n\n # \"answers\"=>{\"2e6ef486-71da-4a55-a964-bc3d35b68905\"=>\"\", \"6998baeb-8137-46bf-a19c-203516e46f48\"=>\"\", \"bba75480-701b-4bca-bbd4-f9a26837897f\"=>\"\"}, \n # \"ways_to_communicate\"=>\"person phone text social email\", \n # \"invitation_uuid\"=>\"4fc4d329-be71-48bd-b318-d1dbfcff4533\", \n # \"good_times\"=>\"\", \n # \"id\"=>\"7228a166-b7fd-44d5-bef5-3473c9c44080\"}\n\n invitation = Invitation.find_by_uuid(params[:invitation_uuid])\n subject = invitation.sender\n raise \"Couldn't find the subject user\" unless subject\n subject_enrollment = subject.current_enrollment\n\n assessment = ThreeSixtyAssessment.find_unexpired_and_incomplete_assessment(subject_enrollment, invitation.recipient)\n raise \"Couldn't find the assessment for enrollment uuid #{@subject.enrollment_uuid} and recipient_identifier #{invitation.recipient_identifier}\" unless assessment\n\n # just stored as a list of the symbol values. See: ThreeSixtyAssessment.WAYS_TO_COMMUNICATE\n ways_to_communicate = params[:ways_to_communicate]\n good_times = params[:good_times]\n\n if sup = assessment.supplimental_answers.where(respondent_identifier:invitation.recipient).last\n sup.update_attributes!(ways_to_communicate:ways_to_communicate, good_times:good_times)\n else\n assessment.supplimental_answers.create!(respondent_identifier:invitation.recipient, ways_to_communicate:ways_to_communicate, good_times:good_times)\n end\n\n\n params[:answers].each do |question_uuid, answer|\n logger.info \" ANSWER: question_uuid:#{question_uuid} answer:#{answer}\"\n # next if answer == \"\" # bypass enpty answers\n\n check = Check.find_by_uuid(question_uuid)\n throw \"you must provide the uuid of the question (aka check)\" unless check\n\n assessment.responses.create!(check_uuid:check.uuid, value:answer, respondent_identifier:invitation.recipient)\n end\n\n # if we get here, then the assessment must be complete (right now, exceptions are thrown)\n track_event(current_enrollment, :completed_360_assessment, target:assessment)\n render text:\"ok\"\n rescue Exception => e\n logger.error(\"THREE SIXTY ERROR: #{e.message}\")\n raise e # TODO remove the raise when dev is stable\n #render text:\"Error: #{e.message}\"\n end", "def update\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n unless @edit_or_delete_right\n redirect_to questions_url,notice:\"您没有修改别人编写的题目的权限\"\n end\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to questions_url, notice: \"已经成功更新题目:#{@question.title}.\" }\n format.json { render :show, status: :ok, location: questions_url }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_answer\n @answer = Answer.find(params[:id])\n @question = @answer.question\n end", "def update\n # If 'Add' or 'Edit/View advice' is clicked, redirect appropriately\n if params[:add_new_questions]\n permitted_params = params.permit(:id, new_question: params[:new_question].keys)\n redirect_to action: 'add_new_questions', id: permitted_params[:id], question: permitted_params[:new_question]\n elsif params[:view_advice]\n redirect_to controller: 'advice', action: 'edit_advice', id: params[:id]\n else\n @questionnaire = Questionnaire.find(params[:id])\n if @questionnaire.update_attributes(questionnaire_params)\n update_questionnaire_questions\n flash[:success] = 'The questionnaire has been successfully updated!'\n else\n flash[:error] = @questionnaire.errors.full_messages.join(', ')\n end\n redirect_to action: 'edit', id: @questionnaire.id.to_s.to_sym\n end\n rescue StandardError => e\n flash[:error] = e.message\n redirect_to action: 'edit', id: @questionnaire.id.to_s.to_sym\n end", "def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} &lt;#{current_user.email}&gt;\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} &lt;#{current_user.email}&gt;\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end", "def edit_single_question(collection_id, question)\r\n clear\r\n begin\r\n puts \"#{question['Id']}. #{question['Question']}\\n\"\r\n puts \"A: #{question['A']}\\n\"\r\n puts \"B: #{question['B']}\\n\"\r\n puts \"C: #{question['C']}\\n\"\r\n puts \"D: #{question['D']}\\n\"\r\n puts \"Correct option: #{question['Right_answer']}\\n\"\r\n puts \"-------------------------\\n\".colorize(:light_cyan)\r\n rescue JSON::ParserError, NoMethodError, NoMemoryError, StandardError\r\n puts \"It seems the custom content is empty. Please move to custom menu to add a new custom collection.\\n\\n\\n\"\r\n end\r\n # Passing the inheritance arguments plus corresponding keys to edit the content\r\n options = [\r\n { name: 'Question Content', value: -> { edit_content(collection_id, question, 'Question') } },\r\n { name: 'Option A', value: -> { edit_content(collection_id, question, 'A') } },\r\n { name: 'Option B', value: -> { edit_content(collection_id, question, 'B') } },\r\n { name: 'Option C', value: -> { edit_content(collection_id, question, 'C') } },\r\n { name: 'Option D', value: -> { edit_content(collection_id, question, 'D') } },\r\n { name: 'Correct option', value: -> { edit_correct_option(collection_id, question, 'Right_answer') } },\r\n { name: 'Comfirm the change', value: lambda {\r\n @prompt.yes?(\"\\nDo you want to comfirm the change or continue editing?\") ? comfirm_edit(collection_id, question['Id'], question) : return\r\n } },\r\n { name: 'Ignore the changes and go back to upper menu', value: lambda {\r\n @prompt.yes?(\"\\nDo you really want to go back to upper menu without saving?\") ? edit_quiz(collection_id) : return\r\n } }\r\n ]\r\n option = @prompt.select('Please select from the following options.', options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\\n\", show_help: :always, per_page: 8)\r\n end", "def admin_update\n question = Question.includes(section: { phase: :template}).find(params[:question_id])\n authorize question\n\n# example_answer = Annotation.find_or_create_by(question: question, org: current_user.org, type: Annotation.types[:example_answer])\n# guidance = Annotation.find_or_create_by(question: question, org: current_user.org, type: Annotation.types[:guidance])\n \n hash = {question_id: question.id, org_id: current_user.org.id}\n process_changes(hash.merge({type: Annotation.types[:example_answer]}), params[:example_answer_text], _('example answer'))\n process_changes(hash.merge({type: Annotation.types[:guidance]}), params[:guidance_text], _('guidance'))\n\n if !flash[:notice].blank? || !flash[:alert].blank?\n template = question.section.phase.template\n template.dirty = true\n template.save!\n end\n tab = params[:r] || 'all-templates'\n redirect_to \"#{admin_show_phase_path(question.section.phase.id)}?section_id=#{question.section.id}&r=#{tab}\"\n end", "def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @simple_question_alternative.update(simple_question_alternative_params)\n render status: :ok, json: @simple_question_alternative\n else\n self.send(:edit)\n end\n end", "def set_questionnairedetail\n @questionnairedetail = Questionnairedetail.find(params[:id])\n end", "def update\n respond_to do |format|\n if @selected_answer.update(selected_answer_params)\n format.html { redirect_to @selected_answer, notice: 'Selected answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @selected_answer }\n else\n format.html { render :edit }\n format.json { render json: @selected_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n question = params.require(:question).permit(:title, :text, :tag1, :tag2, :tag3)\n Question.where('id = ?',@question.id).update(question)\n redirect_to questions_path, notice: '更新しました。'\n end", "def update\n if @question.update(question_params)\n redirect_to set_answer_question_path(@question)\n end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n route = edit_admin_learning_object_path(id: @learning_object.id, anchor: 'answer-settings')\n\n begin\n ActiveRecord::Base.transaction do\n @learning_object.answers.force_all.each do |a|\n a.update!(\n is_correct: params[\"correct_answer_#{a.id}\"] == \"1\",\n visible: params[\"visible_answer_#{a.id}\"] == \"1\",\n answer_text: params[\"edit_answer_text_#{a.id}\"]\n )\n end\n @learning_object.validate_answers!\n end\n rescue AnswersCorrectnessError\n return redirect_to(route, :alert => \"Otázka nesmie mať viac ako jednu správnu odpoveď.\")\n rescue AnswersVisibilityError\n return redirect_to(route, :alert => \"Otázka nesmie mať viac ako jednu viditeľnú odpoveď.\")\n end\n\n redirect_to route, :notice => \"Zmeny v odpovediach boli úspešne uložené.\"\n end", "def update\n \n load_quiz_section_and_question\n load_option\n \n respond_to do |format|\n if @option.update_attributes(params[:option])\n format.html { redirect_to admins_quiz_section_question_path(@quiz,@section,@question.sequence_no), notice: 'Option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_answer\n\t @doubt = Answer.find(params[:id])\n\t end", "def update\n @study = Study.find(params[:id])\n @project = Project.find(@study.project_id)\n #@project = Project.find(session[:project_id])\n #@study = Study.set_study_type(params, @study)\n if @saved = @study.update_attributes(params[:study])\n questions_flag = false\n questions = get_questions_params(params)\n # if we're updating from the key question form,\n # remove previously saved questions for this study\n kq_error = false\n unless params[:updating_kq].nil?\n # if there are question parameters, save the new entries\n unless questions.empty?\n @study.assign_questions(questions, params[:extraction_form_id])\n else\n flash[:error] = \"This operation is not allowed. Studies must be associated with at least one key question.\"\n kq_error = true\n end\n end\n end\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n @study_extforms.uniq!\n @extraction_forms = @study.get_extraction_forms\n @included_sections = Hash.new\n @borrowed_section_names, @section_donor_ids = [Hash.new,Hash.new]\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @kqs_per_section = Hash.new\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n tmpForm = ExtractionForm.find(ef.extraction_form_id)\n @extraction_forms << tmpForm\n included = ExtractionFormSection.get_included_sections(ef.extraction_form_id)\n borrowed = ExtractionFormSection.get_borrowed_sections(ef.extraction_form_id)\n @included_sections[ef.extraction_form_id] = included\n @borrowed_section_names[ef.extraction_form_id] = borrowed.collect{|x| x[0]}\n @section_donor_ids[ef.extraction_form_id] = borrowed.collect{|x| x[1]}\n @kqs_per_section[ef.extraction_form_id] = ExtractionFormSection.get_questions_per_section(ef.extraction_form_id,@study)\n end\n end\t\n redirect_to \"/projects/#{@project.id}/studies/#{@study.id}/edit\"\n end", "def update\n @drug_test = DrugTest.find(params[:id])\n @tests = params[:tests]\n \n @updates = Hash.new\n if not @tests.blank?\n @tests.each do |t|\n @selected_test = SelectedTest.find_by_id(t[:id])\n if @selected_test.completed_at.blank?\n if t[:result] != \"\"\n @updates[t[:id].to_i] = {:result => t[:result], :completed_at => Time.now}\n end\n end\n end\n end\n exame_responsible = params[:selection][:exame_responsible]\n \n respond_to do |format|\n if not exame_responsible.blank?\n @drug_test.selection.exame_responsible = exame_responsible\n @drug_test.selection.save\n end\n @drug_test.update_attributes(params[:drug_test])\n if SelectedTest.update(@updates.keys, @updates.values) \n\n format.html { redirect_to @drug_test, notice: 'Teste de droga foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\" }\n format.json { render json: @drug_test.errors, status: :unprocessable_entity }\n end\n end\n \n \n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to company_questionnaire_path(@questionnaire.company, @questionnaire), notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n flash[:danger] = @questionnaire.errors.full_messages.join(', ')\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test.created_at != @test.updated_at \n respond_to do |format|\n format.html { redirect_to @test, notice: \"Cheating activity is not allowed! You have done this test!\" } # Khong cho phep user lam lai bai test da nop\n end\n else\n begin\n answers = params[:test][:answer_ids]\n score = 0\n @test.questions.each do |question|\n ans = answers[\"question_#{question.id}\"]\n if !ans.nil?\n if question.answers.where(\"answers.id = #{ans.to_i}\").first.right_answer\n score = score + 1\n end\n ## Cap nhat Answer ID da chon ##\n QuestionsTest.where(:question_id => question.id, :test_id => @test.id)\n .update_all(:chosen_answer_id => ans.to_i)\n end\n end\n ## Luu diem ##\n @test.score = score\n @test.save\n\n respond_to do |format|\n format.html { redirect_to @test }\n format.json { render :show, status: :ok, location: @test }\n end\n rescue\n @test.score = 0\n @test.save\n respond_to do |format|\n format.html { redirect_to @test }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n @faq_question = args[:faq_question] if args.key?(:faq_question)\n @match_confidence = args[:match_confidence] if args.key?(:match_confidence)\n @match_confidence_level = args[:match_confidence_level] if args.key?(:match_confidence_level)\n @source = args[:source] if args.key?(:source)\n end", "def update\n respond_to do |format|\n if @question_option_selection.update(question_option_selection_params)\n format.html { redirect_to @question_answer_question_option_selection_path(@question_answer), notice: 'Question option selection was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_option_selection }\n else\n format.html { render :edit }\n format.json { render json: @question_option_selection.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_answer\n @answer = @question.answers.find(params[:id])\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n# oldfounders = @questionnaire.qfounders # dynamic memory, build adds to it\n oldfounders = []\n @questionnaire.qfounders.each { |f| oldfounders << f } # not dynamic memory\n\n# if !Qfounder.params_any?(params['qfounder'])\n if !params['qfounder'].nil? && params['qfounder'].any?\n params['qfounder'].each { |k, fdr|\n# if Qfounder.has_params?(fdr)\n qfdr = Qfounder.new(fdr)\n if qfdr.valid?\n ffdr = qfdr.member_of(oldfounders)\n if !ffdr.nil? # rm from oldfounders if already exists\n oldfounders.delete(ffdr)\n else # build only if fdr params changed\n @questionnaire.qfounders.build(fdr)\n end\n end # qfdr.valid?\n } # params['q'].each\n end # !params['q'].nil?\n\n# delete remaining oldfounders\n @questionnaire.qfounders.delete(oldfounders)\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n# flash[:notice] = 'Application was successfully updated.'\n# format.html { redirect_to(apply_questionnaire_path(@questionnaire)) }\n format.html { render :action => \"show\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @questionnaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_question(part_num, question_num)\n frm.link(:id=>\"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:modify\").click\n end", "def update\n if @group_question_alternative.update(group_question_alternative_params)\n render status: :ok, json: @group_question_alternative\n else\n self.send(:edit)\n end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @answer.update(answer_params)\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.74206066", "0.710176", "0.6869177", "0.67881596", "0.6744114", "0.6714786", "0.6694838", "0.6653741", "0.6587967", "0.65695393", "0.6559974", "0.65345615", "0.65164286", "0.64954233", "0.64361286", "0.6400128", "0.6400128", "0.6400128", "0.6399558", "0.6358398", "0.6351486", "0.63445085", "0.6331748", "0.6326621", "0.6316543", "0.63073784", "0.6293193", "0.62845325", "0.62821996", "0.62741625", "0.62705445", "0.6248859", "0.6240015", "0.6237649", "0.6235979", "0.6235979", "0.6235979", "0.6235979", "0.6235979", "0.6235979", "0.6235979", "0.6235979", "0.6235979", "0.62359154", "0.6226685", "0.6205996", "0.6203827", "0.61998814", "0.61993647", "0.6196988", "0.6192047", "0.6188781", "0.61755735", "0.6167719", "0.6165628", "0.6162733", "0.6160327", "0.61553967", "0.6148713", "0.61381197", "0.61312", "0.6114933", "0.61140937", "0.6112905", "0.6109988", "0.610682", "0.61050487", "0.6103094", "0.60987145", "0.60870457", "0.6084076", "0.6075327", "0.60745203", "0.6066608", "0.6062577", "0.6059745", "0.60534596", "0.6050122", "0.60489357", "0.6042985", "0.6041293", "0.60379696", "0.60379696", "0.60379696", "0.60379696", "0.60317004", "0.6031023", "0.6026519", "0.6024717", "0.6024362", "0.60240555", "0.602075", "0.60186017", "0.6018109", "0.6014708", "0.60124755", "0.60086846", "0.60056573", "0.6001814", "0.5984475", "0.59838015" ]
0.0
-1
DELETE /questionnaires/1 DELETE /questionnaires/1.json
def destroy @questionnaire = Questionnaire.find(params[:id]) @questionnaire.destroy respond_to do |format| format.html { redirect_to questionnaires_url(:project_id =>@questionnaire.project_id) } format.json { head :no_content } format.js {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n authorize! :destroy, @questionnaire\n\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end", "def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy \n respond_to do |format|\n format.html { redirect_to company_questionnaires_path(@company), notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end", "def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n\tend", "def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_path(@question.subsection_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to paper_questions_path, notice: '題目已被成功刪除' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @completed_quest = CompletedQuest.find(params[:id])\n @completed_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to completed_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey.destroy\n respond_to do |format|\n format.html { redirect_to surveys_url, notice: \"Le questionnaire vient d'être détruit.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @argumentative_question.destroy\n respond_to do |format|\n format.html { redirect_to argumentative_questions_url, notice: 'Pregunta eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n return\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно удалена' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionario_resposta.destroy\n respond_to do |format|\n format.html { redirect_to questionarios_respostas_url, notice: 'Questionario resposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnairedetail.destroy\n respond_to do |format|\n format.html { redirect_to questionnairedetails_url, notice: 'Questionnairedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_datum = QuestionDatum.find(params[:id])\n @question_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to question_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end", "def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end", "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @quest_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_quest_items_url, notice: 'Всё норм' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questao.destroy\n respond_to do |format|\n format.html { redirect_to questaos_url, notice: 'Questao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url, notice: 'Quest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # before_action :set_question\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"質問を削除しました\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n head :no_content\n end", "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_field = QuestionField.find(params[:id])\n @question_field.destroy\n\n respond_to do |format|\n format.html { redirect_to question_fields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_answer.destroy\n respond_to do |format|\n format.html { redirect_to tipo_answers_url, notice: 'Tipo answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionstatu.destroy\n respond_to do |format|\n format.html { redirect_to questionstatus_index_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to category_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_question = BaseQuestion.find(params[:id])\n @base_question.destroy\n\n respond_to do |format|\n format.html { redirect_to base_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionset.destroy\n respond_to do |format|\n format.html { redirect_to questionsets_url, notice: 'Questionset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@questionary.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to questionaries_url, notice: 'Questionary was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end", "def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to(quests_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @question_localized = QuestionLocalized.find(params[:id])\n @question_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n # format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7898324", "0.7862014", "0.7862014", "0.7656997", "0.75277", "0.7525976", "0.74903286", "0.74424833", "0.742435", "0.73963", "0.7379923", "0.7351437", "0.73412085", "0.73230916", "0.7314", "0.7314", "0.7314", "0.7314", "0.7314", "0.7314", "0.7312036", "0.72998637", "0.72879285", "0.7281148", "0.7278654", "0.72769743", "0.72762096", "0.727618", "0.727618", "0.727618", "0.727618", "0.727618", "0.727618", "0.7275455", "0.72673404", "0.72673404", "0.7257823", "0.725558", "0.725363", "0.725291", "0.7249691", "0.7218739", "0.72179186", "0.72084844", "0.71845007", "0.718412", "0.7182522", "0.7179786", "0.71796197", "0.7173848", "0.7173848", "0.7172857", "0.7171926", "0.7170832", "0.7151803", "0.71437943", "0.7139431", "0.7137816", "0.7137608", "0.71355456", "0.71324086", "0.7124831", "0.7124782", "0.7118682", "0.711514", "0.711367", "0.71095014", "0.71047974", "0.7100394", "0.708898", "0.7081387", "0.7078266", "0.70722705", "0.7068295", "0.70669514", "0.7066442", "0.70594984", "0.70594984", "0.705771", "0.70487404", "0.7044607", "0.70434976", "0.70431507", "0.70379686", "0.70311666", "0.70300454", "0.702407", "0.702407", "0.7018589", "0.7015383", "0.7013691", "0.70099646", "0.7007319", "0.70066", "0.7003945", "0.7003945", "0.7003945", "0.7003945", "0.7003945", "0.7003945" ]
0.72889656
22
Question 3: Refactor this code to make the code easier to predict and easier to maintain
def tricky_method(a_string_param, an_array_param) a_string_param += 'rutabaga' an_array_param << 'rutabaga' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def suivre; end", "def schubert; end", "def king_richard_iii; end", "def operations; end", "def operations; end", "def checks; end", "def intensifier; end", "def corrections; end", "def romeo_and_juliet; end", "def the_lineup #in short, this returns only phrases that have situations which are selected AND scores (familiarity levels) which have been selected\n the_situations = []\n the_scores = []\n the_phrases = []\n @situations.each do |s|\n if s.studying_now == true\n the_situations << s.id\n else\n next\n end\n end\n#the_situations = @situations.map do {|s| s.studying_now == true}\n# do this for scores (with map)\n# do this for phrases (with map)\n\n @scores.each do |s|\n if s.studying_now == true\n the_scores << s.id\n else\n next\n end\n end\n\n the_situations.each do |this_situation_id| #checking situations that are true\n a_situation = @situations.find(this_situation_id) #a single situation that is true\n\n the_scores.each do |this_score_id| #checking scores that are true\n a_score = @scores.find(this_score_id) #a single true score for this iteration\n\n all_phrases_in_a_situation = a_situation.phrases.all #all the phrases for the relevant situation\n all_phrases_in_a_situation.each do |this_phrase| #cycling over a given phrase in a true situation\n if (this_phrase.score_id == a_score.id) && (this_phrase.familiarity_score < 100.0)\n the_phrases << this_phrase\n else\n next\n end\n end\n\n end\n end\n\n the_phrases\n\n #a phrase should have the correct id from situations array\n #a phrase should have the correct id from scores array\n #a phrase should also have a score less than the trip wire\n\n #phrase.familiarity score should autoset at situations home (it does)\n end", "def solution4(input)\n end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def p15\n\t\nend", "def villian; end", "def formation; end", "def jack_handey; end", "def scientist; end", "def process_question\n #There are two types of Questions - One which starts with 'how many Credits is ' and the other is 'how much is' \n if @line.start_with? \"how many Credits is \"\n main_question_part = @line.split(\"how many Credits is \")[1] #e.g from how many Credits is glob prok Silver ? gets glob prok Silver ?\n galatic_literals = Translation.translate_question(main_question_part) #e.g from glob prok Silver gets glob prok\n trademetal = TradeMetal.get_trade_metal(main_question_part) #e.g from glob prok Silver gets Silver\n if trademetal && galatic_literals\n trademetal_price_credit = (galatic_literals.galactic_words_to_numeral * trademetal.unit_price).to_i\n puts \"#{galatic_literals} #{trademetal.coin_name} is #{trademetal_price_credit} Credits\"\n return\n end\n elsif @line.start_with? \"how much is \"\n main_question_part = @line.split(\"how much is \")[1] #e.g from how much is pish tegj glob glob ? gets pish tegj glob glob ?\n galatic_literals = Translation.translate_question(main_question_part) #e.g from pish tegj glob glob ? gets pish tegj glob glob\n if galatic_literals\n conversion_value = galatic_literals.galactic_words_to_numeral\n puts \"#{galatic_literals} is #{conversion_value}\"\n return\n end\n end\n throw_away_meaningless_line\n end", "def common\n \n end", "def stderrs; end", "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def organizeDecResults( decResults, studentHashNames, sheet ) \n # Find values for name and results\n decName = decResults.pop\n name = sheet.translateName( decName )\n strResults = formatAnswersToSimple( sheet.translateAllAnswers(decResults) )\n strAmbig = sheet.translateAllAmbig( decResults )\n sheet.ambiguous_answers = strAmbig\n unless strAmbig == \"\" then\n course = Course.find(self.course_id)\n teacher = Teacher.find(course.teacher_id)\n ambigIssue = Issue.new( :code => 1, :resolved => false,\n :scansheet_id => sheet.id, :teacher_id => teacher.id, \n :name => \"Ambiguous Answers\" )\n ambigIssue.save\n end\n\n # Enter and save data for the sheet\n sheet.name = decName\n sheet.answers_string = decResults\n\n sheet.save\n # Find the student from the given students for a match\n theStudent = findStudentFromName( name, studentHashNames )\n grade = gradeStudent( strResults, self.answer_key ) \n # If found, then handle data from here.\n unless theStudent == nil then\n @newAssignmentStudent = AssignmentsStudents.new({ :assignment_id => self.id,\n :student_id => theStudent.id, :scansheet_id => sheet.id,\n :grade => grade,:results => strResults, :answer_key => self.answer_key })\n theStudent.grade = theStudent.compileGrade\n theStudent.save\n else \n course = Course.find(self.course_id)\n teacher = Teacher.find(course.teacher_id)\n nameIssue = Issue.new( :code => 2, :resolved => false,\n :scansheet_id => sheet.id, :teacher_id => teacher.id,\n :name => \"Name Not Found\" )\n nameIssue.save \n nameArr = name.split(\",\")\n @newStudent = Student.new( :first_name => (\"~\" + nameArr[0]),\n :middle_name => (\"~\" + nameArr[1]), :last_name => (\"~\" + nameArr[2]), :grade => grade,\n :course_id => self.course_id )\n @newStudent.save\n @newAssignmentStudent = AssignmentsStudents.new({ :assignment_id => self.id,\n :student_id => @newStudent.id, :scansheet_id => sheet.id, :grade => grade,\n :results => strResults, :answer_key => self.answer_key} )\n end\n @newAssignmentStudent.save\n end", "def who_we_are\r\n end", "def alternatives; end", "def terpene; end", "def offences_by; end", "def offenses_to_check=(_arg0); end", "def transformations; end", "def prime_mutation_determination(roll)\n case roll\n when 1..9\n @@primary_mutations << \"Acid Blood\"\n @@attacks << {:attack_mode => \"Acid blood spray\", :SV => 20, :rate => 1, :range => 2, :damage => \"d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"60\", :notes => \"automatic on melee or point-blank puncturing attack\"}\n\n when 10..20\n @@primary_mutations << \"Acid Spit\"\n @@attacks << {:attack_mode => \"Acid Spit\", :SV => 6, :rate => 1, :range => 6, :damage => \"d6 + 2 per dround for d6 rounds\", :ammo => \"2/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"60\", :notes => \"does same damage to ropes, bars, locks, etc.\"}\n when 21..32\n @@primary_mutations << \"Advanced Mind\"\n @@intelligence += (d(10 + d(10) + d(10)))\n @@character_notes << \"character gains two hazard checks against insanity and mental attacks that require hazard checks\"\n\n when 33..36\n @@primary_mutations << \"Agony Sphere\"\n @@attacks << {:attack_mode => \"Agony Sphere\", :SV => \"auto\", :rate => 1, :range => (@@willpower/2), :damage => \"d6 + +10DV to targets\", :ammo => \"1/day per user rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"60\", :notes => \"requires 3 full rounds of concentration to unleash; can be sustained for 1 rd/willpower point\"}\n\n when 37..44\n @@primary_mutations << \"Amphibian\"\n @@character_notes << \"Can breathe as well in water as air\"\n @@character_notes << \"Suffers d3 dmg per day in arid environments\"\n\n when 45..52\n @@primary_mutations << \"Amplification\"\n @@character_notes << \"Doubles daily/rank-based rate of limited-use mutations\"\n\n when 53..59\n @@primary_mutations << \"Aquatic Adaptation\"\n @@character_notes << \"Webbed hands and feet\"\n @@character_notes << \"Withstands cold 2x vs. humans\"\n @@character_notes << \"Must be fully immersed in water 1hr per day or suffer d3 dmg; d6 in desert areas\"\n\n when 60..71\n @@primary_mutations << \"Arid Adaptation\"\n @@dv -= 3\n @@appearance = [@@appearance - d(8), 1].max\n @@character_notes << \"Needs 1/10th as much water as pure stock human\"\n @@character_notes << \"Specialized organ holds 2 liters drinking water (can yak up in 250 or 500ml portions)\"\n\n when 72..79\n @@primary_mutations << \"Asphyxiation Zone\"\n @@attacks << {:attack_mode => \"Asphyxiation Zone\", :SV => \"auto\", :rate => 1, :range => (@@willpower * 2), :damage => \"d10\", :ammo => \"2/day per user rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"61\", :notes => \"lasts 2 rounds per rank\"}\n\n when 80..89\n @@primary_mutations << \"Aura of Protection\"\n @@character_notes << \"2 uses / rank / day; DV -10 + 10 pt force field dmg soak per round; duration willpower rounds; 2 rounds to activate\"\n\n when 90..102\n @@primary_mutations << \"Ballistic Hide\"\n @@dv -= 4\n @@appearance = [@@appearance - d(4), 1].max\n @@character_notes << \"Additional -20DV vs. blunt/crushing attacks including non-AP bullets\"\n\n when 103..109\n @@primary_mutations << \"Beak\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@attacks << {:attack_mode => \"Beak\", :SV => 10, :rate => 1, :range => 1, :damage => \"d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"61\", :notes => \"\"}\n @@character_notes << \"Character cannot speak clearly\"\n\n when 110..127\n @@primary_mutations << \"Beam Eyes\"\n @@attacks << {:attack_mode => \"Beam Eyes\", :SV => 15, :rate => 1, :range => (@@willpower + @@perception), :damage => \"10 + d6/rank\", :ammo => \"2 / rank / day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"61\", :notes => \"\"}\n\n when 128..134\n @@primary_mutations << \"Berserker Rage\"\n @@character_notes << \"Berserker Rage: 2/day/rank usage; duration 1 battle; -5DV, +10SV, +10dmg (melee weapons only); +20 strength; can fight on for d6 rounds after suffering fatal damage\"\n when 135..144\n @@primary_mutations << \"Bladed Limbs\"\n def bladed_limbs_location(roll)\n case roll\n when 1 then result = \"Shoulder\"\n when 2 then result = \"Back\"\n when 3 then result = \"Chest\"\n when 4 then result = \"Side\"\n when 5 then result = \"Hip\"\n when 6 then result = \"Abdomen\"\n end\n end\n\n d(4).times do\n bladed_limbs_location(d(6))\n @@character_notes << \"Sword-like bone blade protruding from #{result}\"\n @@appearance = [@@appearance - 2, 1].max\n @@character_weight += 5\n end\n\n @@attacks << {:attack_mode => \"Bladed limb(s)\", :SV => 5, :rate => \"1 per bladed limb\", :range => 0, :damage => \"d12 + 2\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62\", :notes => \"\"}\n\n\n when 145..149\n @@primary_mutations << \"Blurred Movement\"\n @@character_notes << \"Blurred Movement: -20DV; willpower rounds/day; can be used to blur entire body or only parts\"\n\n when 150..179\n @@character_notes << \"Due to body disporportion, no relic shell armor can be worn, but other types can be modified to fit\"\n def body_disproportion_location(roll)\n case roll\n when 1\n @@primary_mutations << \"Body Disproportion: Dominant arm is massive!\"\n @@character_notes << \"Dominant arm has strength of #{(@@strength + @@strength + d(20) + d(20))} which applies to all 1- and 2-handed melee weapons character wields\"\n @@appearance = [@@appearance - d(4), 1].max\n @@move -= 0.5\n @@character_weight += (20 + d(20))\n when 2\n @@primary_mutations << \"Body Disproportion: Character's head is massive!\"\n @@intelligence += (d(20) + 20)\n @@move -= 1\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@character_notes << \"TWO intelligence-based hazard checks, when called for\"\n @@character_weight += (20 + d(10))\n when 3\n @@primary_mutations << \"Body Disproportion: Upper body incredibly over-muscled!\"\n @@strength += (20 + d(20))\n @@endurance += (20 + d(20))\n @@move -= 1\n @@agility = [@@agility - d(10), 1].max\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@character_weight += (20 + d(20) + d(20))\n when 4\n @@primary_mutations << \"Body Disproportion: hips and legs are twice normal length!\"\n @@move += @@move\n @@character_height += 100\n @@appearance = [@@appearance - d(4), 1].max\n @@attacks << {:attack_mode => \"Wicked kick\", :SV => 0, :rate => \"1\", :range => 0, :damage => \"2d10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62\", :notes => \"\"}\n @@character_weight += (30 + d(20) + d(20))\n when 5\n @@primary_mutations << \"Body Disproportion: comically giant hands and feet!\"\n @@attacks << {:attack_mode => \"Punch or kick\", :SV => 0, :rate => \"1\", :range => 0, :damage => \"2d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62\", :notes => \"\"}\n @@character_notes << \"Weapons with triggers, keyboards, or other items requiring normal human hands are unusable without modifying item.\"\n @@appearance = [@@appearance - (d(6) + 1), 1].max\n @@character_weight += (d(6) + d(6) + d(6) + d(6))\n when 6\n @@primary_mutations << \"Body Disproportion: extra long arms!\"\n @@character_notes << \"+5 SV in melee combat\"\n @@character_notes << \"+5 thrown weapon DMG\"\n @@appearance = [@@appearance - (d(4) + 1), 1].max\n when 7\n @@primary_mutations << \"Body Disproportion: greatly elongated torso!\"\n @@character_notes << \"If pregnant, gives birth to a litter of d4 + 1 offspring.\"\n @@endurance += (d(10) + d(10))\n @@appearance = [@@appearance - d(6), 1].max\n @@character_height += (20 + d(20))\n @@character_weight += (10 + d(20))\n def elongated_torso_bonus(roll1, roll2, roll3, roll4) # need to add actual mutation results via primary_mutations_roll(xx)\n case roll1\n when 1..50\n @@primary_mutations << \"Reserve heart\"\n end\n case roll2\n when 1..65\n @@primary_mutations << \"Radiation absorption\"\n end\n case roll3\n when 1..37\n @@primary_mutations << \"Breath holding\"\n end\n case roll4\n when 1..72\n @@primary_mutations << \"Nutriment cache\"\n end\n\n end\n elongated_torso_bonus(d(100),d(100),d(100),d(100))\n when 8\n 2.times do\n elongated_torso_bonus(d(7))\n end\n end\n\n end\n body_disproportion_location(d(8))\n\n when 180..195\n def body_regeneration_rate(roll)\n case roll\n when 1..12\n @@endurance_healing_rate += 4\n when 13..32\n @@endurance_healing_rate += 7\n when 33..40\n @@endurance_healing_rate += 10\n when 41..64\n @@endurance_healing_rate = 15\n when 65..87\n @@endurance_healing_rate = \"1 pt per hour\"\n when 88..93\n @@endurance_healing_rate = \"2 pts per hour\"\n when 94..96\n @@endurance_healing_rate = \"4 pts per hour\"\n when 97..98\n @@endurance_healing_rate = \"6 pts per hour\"\n when 99\n @@endurance_healing_rate = \"10 pts per hour\"\n when 100\n @@endurance_healing_rate = \"1 pt per round\"\n end\n end\n body_regeneration_rate(d(100))\n @@primary_mutations << \"Body Regeneration: #{@@endurance_healing_rate} healing rate bonus\"\n\n when 196..201\n @@primary_mutations << \"Breath Holding: triple base endurance rate + regular breath holding rate (Hub Rules p. 122)\"\n when 202..224\n @@primary_mutations << \"Claws: don’t hinder her from using bows, crossbows, or weapons that use a trigger, but disallow her from using keyboards or doing fne electronics work\"\n @@attacks << {:attack_mode => \"Claw\", :SV => 7, :rate => \"1 per hand\", :range => 0, :damage => \"d12 each\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62-63\", :notes => \"\"}\n @@character_notes << \"Thanks to claws, character climbs as though she has 2 points in Climbing skill\"\n when 225..230\n @@primary_mutations << \"Climbing Suckers: like a gecko, character can climb on anything at 1/2 move\"\n @@character_notes << \"When falling, type A agility based hazard check to catch side of building/pit and stop fall\"\n when 231..239\n @@primary_mutations << \"Coma Inducement\"\n @@attacks << {:attack_mode => \"Coma inducement\", :SV => 0, :rate => \"\", :range => @@willpower + @@willpower, :damage => \"coma\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"victim gets tybe B willpower based hazard check; see p. 63 for details\"}\n when 240..253\n number_of_pincers = 0\n arms_too = \"True\"\n pincer_size = \"Small\"\n def pincer_formation_on_mutant(roll)\n case roll\n when 1..2\n @@primary_mutations << \"Crab Pincers: 1 pincer replacing 1 arm\"\n number_of_pincers += 1\n @@character_weight -= 15\n when 3..6\n @@primary_mutations << \"Crab Pincers: 2 pincers replacing both human arms\"\n number_of_pincers += 2\n @@character_weight -= 30\n when 7\n @@primary_mutations << \"Crab Pincers: 1 pincer growing from shoulder, both human arms intact\"\n number_of_pincers += 1\n when 8..9\n @@primary_mutations << \"Crab Pincers: 2 pincers in addition to human arms\"\n number_of_pincers += 2\n when 10\n number_of_pincers = (2 + d(2))\n def arms_too(roll)\n case roll\n when 79..100\n arms_too = \"False\"\n @@character_weight -= 30\n end\n end\n @@primary_mutations << \"Crab Pincers: #{number_of_pincers} total\"\n arms_too(d(100))\n end\n end\n def pincer_size(roll)\n case roll\n when 1..3\n pincer_size = \"Small\"\n @@character_weight += (number_of_pincers * 15)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 2, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d10 + 1\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n when 4..6\n pincer_size = \"Medium\"\n @@movement_rate_base -= (0.25 * number_of_pincers)\n @@character_weight += (number_of_pincers * 20)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 4, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d12 + 3\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n when 7..9\n pincer_size = \"Large\"\n @@movement_rate_base -= (0.5 * number_of_pincers)\n @@character_weight += (number_of_pincers * 35)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 7, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d20 + 3\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n when 10\n pincer_size = \"Massive\"\n @@movement_rate_base -= (0.75 * number_of_pincers)\n @@character_weight += (number_of_pincers * 50)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 10, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d20 + 10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n end\n end\n\n pincer_formation_on_mutant(d(10))\n pincer_size(d(10))\n @@primary_mutations << \"Pincers: #{number_of_pincers} of #{pincer_size} size\"\n if arms_too == \"False\"\n @@appearance = [@@appearance - (number_of_pincers * d(4) + 2), 1].max\n @@character_notes << \"No human arms - character cannot use triggers, keyboards, or complex items\"\n elsif arms_too == \"True\"\n @@appearance = [@@appearance - (number_of_pincers * d(4)), 1].max\n end\n\n\n when 254..292\n def deviant_skin_structure(roll)\n case roll\n when 1..3\n @@primary_mutations << \"Fire-proof skin\"\n @@character_notes << \"No damage from fire for 10 rounds; 1/2 damage after\"\n @@character_notes << \"1/2 damage from explosions\"\n when 4..5\n @@primary_mutations << \"Reflective skin\"\n @@character_notes << \"1/2 damage from beam weapons when clothed; 70 percent resistance to beam weapons vs. bare skin\"\n @@appearance += d(6)\n when 6..7\n @@primary_mutations << \"Alkaline skin\"\n @@character_notes << \"Character totally immune to acid attacks (which still ruin character's gear)\"\n when 8..10\n @@primary_mutations << \"Weather sensitive skin\"\n @@character_notes << \"Sense weather changes in 20km radius; can sense open bodies of water within 2 km\"\n when 11\n @@primary_mutations << \"Glow in the dark skin\"\n @@character_notes << \"3m radius green glow; visible up to 12km away - character can't turn off glow\"\n when 12\n @@primary_mutations << \"Photosynthetic skin\"\n @@character_notes << \"4 hrs in sunlight = 1 meal; 1 hr in sunlight = 3 pts healing (in addition to normal resting healing)\"\n end\n end\n deviant_skin_structure(d(12))\n\n when 293..298\n @@primary_mutations << \"Devastator Pulse\"\n @@attacks << {:attack_mode => \"Devastator Pulse\", :SV => (@@accuracy + @@willpower), :rate => \"4 rounds to charge, release on 5th\", :range => @@willpower, :damage => \"3d20 / d100 + 40 vs. machines\", :ammo => \"1/rank/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"\"}\n\n when 299..300\n @@primary_mutations << \"Displacement\"\n @@character_notes << \"Displacement: #{@@willpower} rounds per day, DV -30\"\n when 301..305\n @@primary_mutations << \"Doom Sphere\"\n @@attacks << {:attack_mode => \"Doom Sphere\", :SV => \"01-95\", :rate => \"1/10 days\", :range => (@@willpower * 10), :damage => \"3d20 vs organics; 6d20 vs electronics\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"User must make intelligence type B hazard check or go insane for 1 hour (p. 126)\"}\n when 306..314\n @@primary_mutations << \"Dread Zone\"\n @@attacks << {:attack_mode => \"Dread Zone\", :SV => \"01-95\", :rate => 1, :range => @@intelligence, :damage => \"tybe B hazard check vs. intelligence or +10SV to attack\", :ammo => \"1/rank/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"Duration: rank in rounds; does not affect inorganic beings or creatures with morale = n/a\"}\n when 315..322\n @@primary_mutations << \"Earth Thump\"\n @@attacks << {:attack_mode => \"Earth Thump\", :SV => (@@willpower + 30), :rate => \"3 rounds to generate\", :range => @@willpower, :damage => \"d10/user rank\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"Targets 1 human-sized enemy per rank of user (assuming multiple targets close together)\"}\n when 323..341\n @@primary_mutations << \"Electrical Charge\"\n @@attacks << {:attack_mode => \"Electrical Charge\", :SV => 20, :rate => \"1\", :range => 0, :damage => \"d20 + HC\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"Victim makes END-based tybe B hazard check or stunned for d3 rounds\"}\n @@character_notes << \"Four Electrical Charge jolts are suffcient to fully re-charge a standard power cell.\"\n when 342..349\n @@primary_mutations << \"Electrical Pulse\"\n @@attacks << {:attack_mode => \"Electrical Pulse\", :SV => 20, :rate => 1, :range => (@@willpower), :damage => \"d20 / 3d20 vs machines\", :ammo => \"3/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"Can be used to start fires as well\"}\n when 350..355\n @@primary_mutations << \"Electro Magnetic Pulse\"\n @@attacks << {:attack_mode => \"Electro Magnetic Pulse\", :SV => 30, :rate => 1, :range => @@willpower, :damage => \"d10/d100 vs electronics\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"\"}\n when 356..376\n @@primary_mutations << \"Empathy\"\n @@character_notes << \"Empathy: #{@@willpower} range. Unlimited uses. The subject is allowed a type C, intelligence based hazard check. If failed, mutant knows victim's emotions. Alternately, emotions can be projected.\"\n when 377..388\n @@primary_mutations << \"Energy Blade\"\n def energy_blade_type(roll) # table Hub Rules p. 65\n case roll\n when 1..20\n @@attacks << {:attack_mode => \"Energy Blade: Blue\", :SV => 10, :rate => 1, :range => 1, :damage => \"d12\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 21..40\n @@attacks << {:attack_mode => \"Energy Blade: Green\", :SV => 10, :rate => 1, :range => 1, :damage => \"d20 stun\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 41..65\n @@attacks << {:attack_mode => \"Energy Blade: Red\", :SV => 10, :rate => 1, :range => 1, :damage => \"d20\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 66..85\n @@attacks << {:attack_mode => \"Energy Blade: Orange\", :SV => 10, :rate => 1, :range => 1, :damage => \"2d20 stun\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 86..97\n @@attacks << {:attack_mode => \"Energy Blade: Purple\", :SV => 10, :rate => 1, :range => 1, :damage => \"2d20\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 98..99\n @@attacks << {:attack_mode => \"Energy Blade: White\", :SV => 10, :rate => 1, :range => 1, :damage => \"d100 stun\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 100\n @@attacks << {:attack_mode => \"Energy Blade: Gold\", :SV => 10, :rate => 1, :range => 1, :damage => \"d100\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n end\n end\n if @@primary_mutations.include? \"Energy Blade\" # Note: NO duplication -- reroll if this result comes up twice.\n @@primary_mutations_rolls += 1\n else\n energy_blade_type(d(100))\n end\n\n when 389..401\n @@primary_mutations << \"Extreme Size Decrease\"\n @@character_height = (22 + d(20) + d(20)) # NOTE: should be dependent on GENDER, ignored that.\n 3.times @@skills << \"Stealth\"\n 2.times @@skills << \"Climbing\"\n @@character_notes << \"Cannot wield two-handed weapons. Normal one-handed weapons including pistols must be employed with both hands (except knifes and daggers, which are considered swords for this mutant)\"\n @@character_notes << \"Relic armor cannot be worn except scrap relic.\"\n def extreme_size_decrease(height) # Hub Rules p. 65\n case height\n when 22..27\n @@character_weight = (15 + d(10))\n @@agility += 20\n @@movement_rate_base == 4.5\n @@strength = [@@strength - 15, 1].max\n @@endurance = [@@endurance - 10, 1].max\n when 28..35\n @@character_weight = (20 + d(12))\n @@agility += 15\n @@movement_rate_base = 5\n @@strength = [@@strength - 10, 1].max\n @@endurance = [@@endurance - 7, 1].max\n when 36..45\n @@character_weight = (25 + d(20))\n @@agility += 10\n @@movement_rate_base = 5.5\n @@strength = [@@strength - 5, 1].max\n @@endurance = [@@endurance - 5, 1].max\n when 46..65\n @@character_weight = (30 + d(20) + d(20))\n @@agility += 7\n @@movement_rate_base = 6\n @@strength = [@@strength - 3, 1].max\n @@endurance = [@@endurance - 3, 1].max\n end\n end\n\n extreme_size_decrease(@@character_height)\n\n when 402..419\n def fang_size(roll) # Hub rules p. 65\n case roll\n when 1..3\n sizeoffangs = \"Small\"\n fangsv = 2\n fangdmg = \"d6\"\n @@appearance = [@@appearance - 1, 1].max\n when 4..8\n sizeoffangs = \"Medium\"\n fangsv = 4\n fangdmg = \"d10\"\n @@appearance = [@@appearance - (1 + d(2)), 1].max\n when 9..10\n sizeoffangs = \"Huge\"\n fangsv = 6\n fangdmg = \"d20\"\n @@appearance = [@@appearance - (d(3) + 2), 1].max\n @@character_notes << \"Ability to speak clearly greatly reduced\"\n end\n @@attacks << {:attack_mode => \"Fangs\", :SV => fangsv, :rate => 1, :range => 0, :damage => fangdmg, :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"This attack can only be employed as a supplemental melee attack if involved in close fighting\"}\n @@primary_mutations << \"Fanged: #{sizeoffangs} size\"\n end\n\n fang_size(d(10))\n\n when 420..427\n @@primary_mutations << \"Flame Breath\"\n @@attacks << {:attack_mode => \"Flame Breath\", :SV => 10, :rate => 1, :range => \"3/rank\", :damage => \"d6/rd for 2d6 rds\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"66\", :notes => \"Up to 3 man sized targets can be attacked at once if close together\"}\n when 428..438\n def force_field_strength(roll) # Hub rules p. 66\n case roll\n when 1..10\n force_field = d(10)\n when 11..24\n force_field = (d(10) + 3)\n when 25..53\n force_field = (d(10) + 5)\n when 54..78\n force_field = (d(10) + 10)\n when 79..94\n force_field = (d(10) + 12)\n when 95\n force_field = (d(10) + 15)\n when 96\n force_field = (d(10) + 17)\n when 97\n force_field = (d(10) + 20)\n when 98\n force_field = (d(10) + 23)\n when 99\n force_field = (d(10) + 26)\n when 100\n force_field = (d(10) + 30)\n end\n @@primary_mutations << \"Force Field: 2 uses/rank/day; #{willpower} rounds duration; absorbs #{force_field} dmg/round\"\n end\n force_field_strength(d(100))\n\n when 439..445\n @@primary_mutations << \"Foul Flesh\"\n @@character_notes << \"Will not eat mutant: all mammals, all humanoids except moaners, horrlify, all amphibians, fsh, birds except black vultures, reptilius, all reptiles, except alligators and crocodilians.\"\n when 446..453\n def furred_mutation(roll)\n case roll\n when 1..3\n fur_type = \"Fine, cat-like\"\n fur_dv = -3\n fur_cold = \"Double normal human cold resistance\"\n @@appearance = [@@appearance - d(3), 1].max\n when 4..5\n fur_type = \"Wool, sheep-like\"\n fur_dv = -6\n fur_cold = \"Triple normal human cold resistance\"\n @@appearance = [@@appearance - (1 + d(4)), 1].max\n when 6..7\n fur_type = \"Thick, sheep-like wool\"\n fur_dv = -9\n fur_cold = \"Quadruple normal human cold resistance\"\n @@appearance = [@@appearance - (d(6) + 2), 1].max\n when 8..9\n fur_type = \"Badger-like bristles\"\n fur_dv = -11\n fur_cold = \"Double normal human cold resistance\"\n @@appearance = [@@appearance - (d(6) + d(6) + 2), 1].max\n @@character_notes << \"+2 dmg to basic punch attack\" # +2 dmg to punch attack -- HOW to implement??\n when 10\n fur_type = \"Porcupine-like quills\"\n fur_dv = -13\n fur_cold = \"Double normal human cold resistance\"\n @@appearance = [@@appearance - (d(6) + d(6) + 3), 1].max\n @@character_notes << \"+2 dmg to basic punch attack\" # +2 dmg to punch attack -- HOW to implement??\n end\n @@primary_mutations << \"Furred: #{fur_type}, #{fur_cold} cold resistance. #{fur_dv} DV bonus\"\n @@dv += fur_dv\n end\n furred_mutation(d(10))\n when 454..459\n\n def gaseous_discharge(roll) # Hub Rules p. 67\n case roll\n when 1..2\n gas_type = \"Sleep\"\n gas_effect = \"All must make an Endurance-based type A hazard check or pass out for d100 rounds.\"\n when 3..4\n gas_type = \"Blindness\"\n gas_effect = \"All must make an Endurance-based type A hazard check or go blind for d6 days.\"\n when 5\n gas_type = \"Stink\"\n gas_effect = \"All must make an Endurance-based type C hazard check or spend 2 rounds vomiting, becoming +30 to strike, with their own SV being reduced to half, rounded down.\"\n when 6\n gas_type = \"Corrosive\"\n gas_effect = \"All must make an Endurance-based type B hazard check suffer d6 damage/rd from corrosive acids. Those who succeed vs. hazard check take 1 dmg/rd.\"\n when 7\n gas_type = \"Hallucinogenic\"\n gas_effect = \"All must make an Intelligence-based tybe B hazard check or hallucinate, +30SV to strike and -30SV to retaliate. Animals must make a morale check or flee immediately.\"\n when 8\n gas_type = \"Poison\"\n gas_effect = \"All must make an Endurance-based type A hazard check or drop unconscious for 10 rounds. Their breathing ceases on the 11th round and if not resuscitated by artifcial respiration, will die on the 14th round.\"\n end\n @@primary_mutations << \"Gaseous Discharge: #{gas_type}\"\n @@attacks << {:attack_mode => \"Gaseous Discharge: #{gas_type}\", :SV => \"Auto\", :rate => 1, :range => \"10 m radius\", :damage => \"Special\", :ammo => \"2/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"66-67\", :notes => \"#{gas_effect} Gas dissipates in 2 rounds outdoors or lingers 2d10 + 4 rounds in enclosed areas.\"}\n @@character_notes << \"Character immune to #{gas_type}\"\n end\n\n gaseous_discharge(d(8))\n\n when 460..472\n def gaping_maw(roll) #Hub Rules p. 67\n case roll\n when 1..5\n maw_size = \"Large\"\n maw_sv = 4\n maw_damage = \"d12\"\n maw_mv_mod = 0\n maw_added_weight = 15\n @@appearance = [@@appearance - (d(4) + d(4) + 2), 1].max\n when 6..7\n maw_size = \"Huge\"\n maw_sv = 7\n maw_damage = \"d20\"\n maw_mv_mod -= 0.25\n maw_added_weight = 30\n @@appearance = [@@appearance - (d(4) + d(4) + 4), 1].max\n when 8..9\n maw_size = \"Massive\"\n maw_sv = 12\n maw_damage = \"2d20\"\n maw_mv_mod -= 0.5\n maw_added_weight = 70\n @@appearance = [@@appearance - (d(6) + d(6) + 5), 1].max\n when 10\n maw_size = \"Colossal\"\n maw_sv = 20\n maw_damage = \"3d20\"\n maw_mv_mod -= 1\n maw_added_weight = 120\n @@appearance = [@@appearance - (d(6) + d(6) + 8), 1].max\n end\n @@primary_mutations << \"Gaping Maw: #{maw_size} in size\"\n @@attacks << {:attack_mode => \"Gaping Maw\", :SV => maw_sv, :rate => 1, :range => 0, :damage => maw_damage, :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"67\", :notes => \"Can be employed as a supplemental melee attack \"}\n @@character_notes << \"Almost totally carnivorous diet. Mutant drools and spits when speaking in a low, gruff voice difficult for strangers to understand.\"\n @@character_weight += maw_added_weight\n @@movement_rate_base -= maw_mv_mod\n end\n\n gaping_maw(d(10))\n\n\n when 473..497\n def heal_touch(willpower)\n case willpower\n when 1..6\n healrate = \"d8\"\n when 7..14\n healrate = \"d12\"\n when 15..34\n healrate = \"d20\"\n when 35..64\n healrate = \"d20 + 10\"\n when 65..84\n healrate = \"d20 + 20\"\n when 85..105\n healrate = \"d20 + 30\"\n when 106..200\n healrate = \"d20 + 40\"\n end\n @@primary_mutations << \"Heal Touch: 2/day/rank, #{healrate} trait points healed. Diseases healed if victim makes Type B willpower based hazard check.\"\n end\n\n heal_touch(@@willpower)\n\n @@primary_mutations << \"Heal Touch\"\n when 498..511\n def heat_pulse(willpower) # Hub Rules p. 67\n case willpower\n when 1..6\n heat_pulse_sv = -5\n heat_pulse_dmg = \"d6\"\n heat_pulse_range = 5\n when 7..14\n heat_pulse_sv = 0\n heat_pulse_dmg = \"d10\"\n heat_pulse_range = 10\n when 15..34\n heat_pulse_sv = 4\n heat_pulse_dmg = \"d20\"\n heat_pulse_range = @@willpower\n when 35..64\n heat_pulse_sv = 6\n heat_pulse_dmg = \"d20 + 10\"\n heat_pulse_range = (@@willpower * 2)\n when 65..84\n heat_pulse_sv = 9\n heat_pulse_dmg = \"d20 + 20\"\n heat_pulse_range = (@@willpower * 3)\n when 85..105\n heat_pulse_sv = 12\n heat_pulse_dmg = \"d20 + 30\"\n heat_pulse_range = (@@willpower * 4)\n when 106..200\n heat_pulse_sv = 15\n heat_pulse_dmg = \"d20 + 40\"\n heat_pulse_range = (@@willpower * 5)\n end\n @@primary_mutations << \"Heat Pulse\"\n @@attacks << {:attack_mode => \"Heat Pulse\", :SV => heat_pulse_sv, :rate => 1, :range => heat_pulse_range, :damage => heat_pulse_dmg, :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"67\", :notes => \"\"}\n end\n\n heat_pulse(@@willpower)\n\n\n when 512..556\n\n def heightened_attributes(roll) # Hub Rules p. 68\n case roll\n when 1\n heightened_attributes_type = \"Cat Balance\"\n @@agility += (d(20) + 20)\n @@accuracy += (d(10) + d(10))\n @@perception += (d(20) + d(20))\n @@appearance += d(10)\n 2.times @@skills << \"Stealth\"\n @@character_notes << \"Due to cat balance, character always gets two hazard checks when agility or accuracy are involved.\"\n when 2\n heightened_attributes_type = \"Eagle Eyes\"\n @@accuracy += (d(10) + d(10))\n @@perception += (d(10) + d(10) + d(10))\n @@character_notes << \"Due to eagle eyes, character sees 10x better than typical human, including at night.\"\n when 3..4\n heightened_attributes_type = \"Strength\"\n @@strength += (d(20) + 30)\n @@appearance += (d(10) + d(10))\n @@character_notes << \"Due to heightened strength, character always gets two hazard checks when strength involved.\"\n when 5..6\n heightened_attributes_type = \"Endurance\"\n @@endurance += (d(20) + 30)\n @@character_notes << \"Due to heightened endurance, character always gets two hazard checks when endurance involved (eg, poison).\"\n when 7\n heightened_attributes_type = \"Hand-Eye Coordination\"\n @@accuracy += (d(20) + 20)\n @@character_notes << \"Due to superior hand-eye coordination, character always gets two hazard checks when accuracy involved.\"\n when 8\n heightened_attributes_type = \"Beauty\"\n @@appearance += (d(20) + 30)\n @@agility += d(6)\n @@accuracy += d(6)\n @@strength += d(6)\n @@character_notes << \"Due to heightened beauty, character always gets two hazard checks when appearance involved.\"\n when 9\n heightened_attributes_type = \"Auditory\"\n @@dv -= 5\n @@character_notes << \"+2 initiative when operating alone or more than 10m from companions.\"\n @@character_notes << \"Sonic attacks do double damage, while crying babies, crowded pubs, and other intense noises are painful.\"\n @@character_notes << \"Due to heightened hearing, character receives 4 attempts on hazard checks related to listening/hearing.\"\n when 10\n heightened_attributes_type = \"Olfactory\"\n (d(2) + 1).times @@skills << \"Tracking\"\n @@character_notes << \"Due to heightened sense of smell, character gets no hazard checks vs. stink-based attacks.\"\n @@character_notes << \"Character cannot be fooled by illusions at less than 10m\"\n @@character_notes << \"Bloodhound-like tracking abilities; however, after 12 hours, or rain, sand storms, or crossing water, all result in lost trails.\"\n when 11\n heightened_attributes_type = \"Willpower\"\n @@willpower += (d(20) + 30)\n @@character_notes << \"Due to heightened willpower, character always gets two hazard checks when willpower involved.\"\n when 12\n heightened_attributes_type = \"Intelligence\"\n @@intelligence += (d(20) + 30)\n @@character_notes << \"Due to heightened intelligence, character always gets two hazard checks when intelligence involved.\"\n end\n @@primary_mutations << \"Heightened Attributes: #{heightened_attributes_type}\"\n end\n\n heightened_attributes(d(12))\n\n\n when 557..566\n number_of_horns = d(4)\n @@primary_mutations << \"Horns: #{number_of_horns} on head\"\n @@character_weight += (2 * number_of_horns)\n @@attacks << {:attack_mode => \"Horns\", :SV => (3 * number_of_horns), :rate => 1, :range => 0, :damage => \"#{number_of_horns}d10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"68\", :notes => \"This attack can be employed as a supplemental melee attack\"}\n @@character_notes << \"Due to horns, character can't wear relic helmets or shell-class armor unless horns permanently removed.\"\n when 567..571\n @@primary_mutations << \"Image Multiplication: #{@@willpower} duration, 2 uses/day/rank. Up to #{@@willpower/10.floor} images of mutant's self created. Hub Rules p. 68\"\n when 572..578\n def image_projection(intelligence)\n case intelligence\n when 1..9\n image_projection_range = \"1 km\"\n image_projection_duration = \"d4 rounds\"\n when 10..34\n image_projection_range = \"#{@@intelligence/2} km\"\n image_projection_duration = \"2d4 rounds\"\n when 35..54\n image_projection_range = \"#{@@intelligence} km\"\n image_projection_duration = \"10 + d10 rounds\"\n when 55..74\n image_projection_range = \"#{@@intelligence * 2} km\"\n image_projection_duration = \"20 + d20 rounds\"\n when 75..94\n image_projection_range = \"#{@@intelligence * 100} km\"\n image_projection_duration = \"100 + d100 rounds\"\n when 95..200\n image_projection_range = \"anywhere within solar system\"\n image_projection_duration = \"200 + 2d100 rounds\"\n end\n @@primary_mutations << \"Image Projection: #{image_projection_range} range, #{image_projection_duration} duration. 1/rank/day. Illusion can repeat 2 words/round. Creatures with 35+ intelligence can make a type B intelligence based hazard check to recognize projection as an illusion. Hub Rules p. 69\"\n end\n\n image_projection(@@intelligence)\n\n when 579..603\n def immunity_mutation(roll)\n case roll\n when 1..2\n @@primary_mutations << \"Poison immunity: totally immune to all forms of poison. Also, cannot get drunk.\"\n when 3..4\n @@primary_mutations << \"Disease immunity: All forms of infection, disease, sickness, parasites, etc. don't affect character. Immune to parasites as well.\"\n when 5..6\n @@primary_mutations << \"Radiation immunity: unaffected by all forms of radiation.\"\n end\n end\n\n immunity_mutation(d(6))\n\n when 605..613\n @@primary_mutations << \"Increased Cellular Activity\"\n @@endurance_healing_rate = (@@endurance_healing_rate * 3)\n @@character_notes << \"Character suffers no ill effects from aging (only benefits) and will live forever if not killed in combat, disease, poison, or accident.\"\n when 614..617\n @@primary_mutations << \"Light Burst: 10m radius, 2/day/rank\"\n @@attacks << {:attack_mode => \"Light Burst\", :SV => 0, :rate => 1, :range => 0, :damage => 0, :ammo => \"1/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"69\", :notes => \"Type C agility HC or blinded for 2d5 rounds. Blindness: -2 MV, -20 SV, +20 SV to be struck.\"}\n when 618..624\n @@primary_mutations << \"Limb Regeneration: see Hub Rules p. 69 for regeneration rates.\"\n when 625..630\n def mandibles_mutation(roll)\n case roll\n when 1..2\n mandibles_size = \"Small\"\n mandibles_sv = 3\n mandibles_dmg = \"d10\"\n mandibles_weight = 5\n mandibles_appearance = -(d(4) + 3)\n when 3..5\n mandibles_size = \"Medium\"\n mandibles_sv = 5\n mandibles_dmg = \"d12\"\n mandibles_weight = 15\n mandibles_appearance = -(d(6) + 4)\n when 6..7\n mandibles_size = \"Large\"\n mandibles_sv = 8\n mandibles_dmg = \"d20\"\n mandibles_weight = 20\n mandibles_appearance = -(d(8) + 6)\n @@movement_rate_base -= 0.25\n when 8..9\n mandibles_size = \"Huge\"\n mandibles_sv = 11\n mandibles_dmg = \"d20 + 5\"\n mandibles_weight = 30\n mandibles_appearance = -(d(6) + d(6) + 5)\n @@movement_rate_base -= 0.5\n when 10\n mandibles_size = \"Massive\"\n mandibles_sv = 15\n mandibles_dmg = \"d20 + 10\"\n mandibles_weight = 40\n mandibles_appearance = -(d(6) + d(6) + d(6) + 6)\n @@movement_rate_base -= 1\n\n end\n\n @@attacks << {:attack_mode => \"Mandibles\", :SV => mandibles_sv, :rate => 1, :range => 0, :damage => mandibles_dmg, :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"69\", :notes => \"Can be employed as a supplemental melee attack\"}\n @@character_weight += mandibles_weight\n @@appearance += mandibles_appearance #due to implementation method no protection here from =< 0...\n @@primary_mutations << \"Mandibles: #{mandibles_size} size\"\n end\n\n mandibles_mutation(d(10))\n\n when 631..641\n @@primary_mutations << \"Mental Mine\"\n when 642..655\n @@primary_mutations << \"Mental Screen\"\n when 656..687\n @@primary_mutations << \"Mind Crush\"\n when 688..693\n @@primary_mutations << \"Mind Waste\"\n when 694..699\n @@primary_mutations << \"Monstrous Morph\"\n when 700..718\n def multi_arm_mutation(roll) # Hub Rules p. 71\n case roll\n when 1..10\n additional_arms = 1\n when 11..85\n additional_arms = 2\n when 86..90\n additional_arms = 3\n when 91..97\n additional_arms = 4\n when 98\n additional_arms = 5\n when 99\n additional_arms = 6\n when 100\n additional_arms = (d(6) +6)\n end\n if additional_arms % 2 == 1\n def odd_arm_side(roll)\n case roll\n when 1\n odd_arm = \"right\"\n when 2\n odd_arm = \"left\"\n end\n end\n odd_arm_side(d(2))\n @@character_notes << \"Odd arm is on the #{odd_arm_side} side.\"\n end\n\n @@primary_mutations << \"Multi-Arm: #{additional_arms} additional arms\"\n end\n\n multi_arm_mutation(d(100))\n\n when 719..728\n def multi_head_mutation(roll)\n case roll\n when 1..70\n additional_heads = 1\n multi_head_appearance = -d(4)\n multi_head_mv = 0\n multi_head_initiative = 1\n when 71..88\n additional_heads = 2\n multi_head_appearance = -(d(4) + 1 )\n multi_head_mv = 0.25\n multi_head_initiative = 1\n when 89..95\n additional_heads = 3\n multi_head_appearance = -(d(6) + 2)\n multi_head_mv = 0.5\n multi_head_initiative = 2\n when 96..97\n additional_heads = 4\n multi_head_appearance = -(d(6) + 4)\n multi_head_mv = 0.75\n multi_head_initiative = 2\n when 98..99\n additional_heads = 5\n multi_head_appearance = -(d(6) + 6)\n multi_head_mv = 1\n multi_head_initiative = 3\n when 100\n additional_heads = 6\n multi_head_appearance = -(d(6) + 8)\n multi_head_mv = 1.25\n multi_head_initiative = 4\n end\n\n @@primary_mutations << \"Multi-Head: #{additional_heads} additional heads.\"\n @@appearance += multi_head_appearance\n @@movement_rate_base -= multi_head_mv\n @@initiative += multi_head_initiative\n @@character_notes << \"Heads tend to sleep at different times, with wakeful heads acting as lookout.\"\n\n while extra_heads > 0 do\n intelligence = attributes_roll(d100)\n wisdom = attributes_roll(d100)\n puts \"Extra head no. #{extra_heads} has INT of #{intelligence} and WIS of #{wisdom}\"\n def extra_head_mutations(roll2)\n case roll2\n when 1..62\n extra_head_mutation = ghost_mutations(d(100))\n @@primary_mutations << extra_head_mutation\n @@character_notes << \"Extra head no. #{extra_heads} has the mental mutation #{extra_head_mutation}\" # HOW to pick just the name of the mental mutation??\n end\n end\n end\n additional_heads -= 1\n end\n multi_head_mutation(d(100))\n\n when 729..738\n @@primary_mutations << \"Night Vision: can see as well at night as a typical human can in daylight (at least starlight must be present).\"\n when 739..745\n @@primary_mutations << \"Peeling Radius\"\n @@attacks << {:attack_mode => \"Peeling Radius\", :SV => 0, :rate => 1, :range => 10, :damage => \"d6/rd\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"71\", :notes => \"10m radius. Automatic hit. Duration: 3 rds/rank\"}\n when 746..754\n def poison_bite_mutation(roll1, roll2) # Hub Rules p. 71\n case roll1\n when 1..54\n poison_bite_strength = \"A\"\n when 55..84\n poison_bite_strength = \"B\"\n when 85..97\n poison_bite_strength = \"C\"\n when 98..99\n poison_bite_strength = \"D\"\n when 100\n poison_bite_strength = \"E\"\n end\n\n case roll2\n when 1..5\n poison_bite_type = \"Death\"\n when 6\n poison_bite_type = \"Paralysis\"\n when 7\n poison_bite_type = \"Insanity\"\n when 8..10\n poison_bite_type = \"Sleep\"\n end\n\n @@primary_mutations << \"Poison Bite: #{poison_bite_type} venom, strength #{poison_bite_strength}, 4/day. Sufficient to coat 4 arrows/darts or 1 blade per injection's worth of poison.\"\n @@attacks << {:attack_mode => \"Poison Bite\", :SV => 0, :rate => 1, :range => 0, :damage => \"d6 plus poison\", :ammo => \"4/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"71\", :notes => \"#{poison_bite_type} venom, #{poison_bite_strength} strength.\"}\n end\n\n poison_bite_mutation(d(100),d(10))\n\n\n when 755..760\n\n def poison_blood_mutation(roll1, roll2) # Hub Rules p. 71\n case roll1\n when 1..54\n poison_bite_strength = \"A\"\n when 55..84\n poison_bite_strength = \"B\"\n when 85..97\n poison_bite_strength = \"C\"\n when 98..99\n poison_bite_strength = \"D\"\n when 100\n poison_bite_strength = \"E\"\n end\n\n case roll2\n when 1..5\n poison_bite_type = \"Death\"\n when 6\n poison_bite_type = \"Paralysis\"\n when 7\n poison_bite_type = \"Insanity\"\n when 8..10\n poison_bite_type = \"Sleep\"\n end\n\n @@primary_mutations << \"Poison Blood: #{poison_bite_type} venom, #{poison_bite_strength} strength. Any creature biting mutant poisoned.\"\n\n end\n\n poison_blood_mutation(d(100),d(10))\n\n when 761..767\n paralysis_tendrils = d(6)\n @@primary_mutations << \"Paralysis Tendrils: #{paralysis_tendrils} 3m length grow from mutant's chest\"\n @@appearance = [@@appearance - (4 * paralysis_tendrils), 1].max\n @@attacks << {:attack_mode => \"Paralysis Tendrils\", :SV => 10, :rate => 1, :range => 3, :damage => \"d12 stun, 2d20 vs machines\", :ammo => \"3/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"72\", :notes => \"#{paralysis_tendrils} tendrils, each capable of attack 3/day/rank.\"}\n\n\n when 768..773\n @@primary_mutations << \"Radiation Absorption: mutant immune to radioactivity, except for radioactive weapons, which do half damage.\"\n when 774..780\n @@primary_mutations << \"Radiation Detection: automatically senses the presence of radiation within a twenty meter radius, including those rare sources found in special radiation using robots, relic weapons and life forms.\"\n when 781..786\n @@primary_mutations << \"Radioactive Pulse\"\n @@attacks << {:attack_mode => \"Radioactive Pulse\", :SV => 10, :rate => 1, :range => @@willpower, :damage => \"d20 plus radiation\", :ammo => \"1/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"72\", :notes => \"Victim makes type B endurance hazard check or suffer medium exposure; then type A hazard check or suffer strong exposure.\"}\n when 787..794\n @@primary_mutations << \"Reserve Heart: If character deemed to be killed by poison or electricity, or a critical hit which specifcally states a piercing of the heart, she will appear to be quite dead for 2d20+10 rounds. After this comatose period without a pulse or heartbeat, her back up heart will suddenly kick in and induce 2d10 endurance of healing, bringing the character slowly back to life.\"\n when 795..802\n @@primary_mutations << \"Reserve Mind: back-up brain takes over in case of brain damage, unconsciousness, insanity, or lethal damage. Hub Rules p. 72\"\n when 803..809\n @@primary_mutations << \"Scaled Skin\"\n @@dv -= 8\n @@appearance = [@@appearance - d(4), 1].max\n @@character_notes << \"Scaled skin: immune to damage from sunburn, sand storms, insect bites, and topical irritants.\"\n when 810..814\n @@primary_mutations << \"Serpentine Body: +4 mv on land or swimming\"\n @@dv -= 5\n serpent_body_length = d(3) + 1\n @@character_weight += (40 * serpent_body_length)\n @@appearance = [@@appearance - (d(6) + 1), 1].max\n @@movement_rate_base += 4\n @@movement_rate_swimming += 4\n @@character_notes << \"Unable to wear relic shell class armor\"\n @@attacks << {:attack_mode => \"Serpentine Body Strike\", :SV => 0, :rate => 1, :range => serpent_body_length, :damage => \"d20 stun\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"72\", :notes => \"Constrict for d10 lethal dmg/rd after successful strike.\"}\n\n when 815..839\n def shell_mutation(roll) # Hub Rules p. 73\n case roll\n when 1..4\n shell_rating = \"Light\"\n shell_defense_value = 10\n shell_movement_penalty = 0.5\n shell_appearance_penalty = (d(4) + 1)\n shell_weight = 20\n when 5..7\n shell_rating = \"Medium\"\n shell_defense_value = 20\n shell_movement_penalty = 1\n shell_appearance_penalty = (d(6) + 2)\n shell_weight = 30\n when 8..9\n shell_rating = \"Heavy\"\n shell_defense_value = 30\n shell_movement_penalty = 1.5\n shell_appearance_penalty = (d(6) + 4)\n shell_weight = 40\n when 10\n shell_rating = \"Extra Heavy\"\n shell_defense_value = 40\n shell_movement_penalty = 2\n shell_appearance_penalty = (d(6) + 6)\n shell_weight = 50\n end\n @@primary_mutations << \"#{shell_rating} Shell: #{shell_defense_value} DV, -#{shell_movement_penalty} MV\"\n @@appearance = [@@appearance - shell_appearance_penalty, 1].max\n @@dv -= shell_defense_value\n @@movement_rate_base -= shell_movement_penalty\n @@character_weight += shell_weight\n @@character_notes << \"Due to Shell mutation, punches, kicks, head-butts etc. deal 2d6 dmg instead of typical d6.\"\n @@character_notes << \"Shell mutation: no relic armor OTHER than ballistic, riot, and bomb squad armor can be worn. Combat armor can be modified, d6+1 days.\"\n end\n\n shell_mutation(d(10))\n\n when 840..849\n def size_decrease_mutation(height)\n case height\n when 61..95\n @@agility += (d(8) + d(8))\n @@strength = [@@strength - d(10), 1].max\n @@endurance = [@@endurance - (d(6) + d(6)), 1].max\n 4.times @@skills << \"Stealth\"\n when 66..90\n @@agility += (d(6) + d(6))\n @@strength = [@@strength - d(8), 1].max\n @@endurance = [@@endurance - (d(4) + d(4)), 1].max\n 3.times @@skills << \"Stealth\"\n when 91..110\n @@agility += (d(4) + d(4))\n @@strength = [@@strength - d(6), 1].max\n @@endurance = [@@endurance - d(6), 1].max\n 2.times @@skills << \"Stealth\"\n when 111..130\n @@agility += d(6)\n @@strength = [@@strength - d(4), 1].max\n @@endurance = [@@endurance - d(4), 1].max\n 2.times @@skills << \"Stealth\"\n when 131..140\n @@agility += d(6)\n @@strength = [@@strength - d(3), 1].max\n @@endurance = [@@endurance - 2, 1].max\n @@skills << \"Stealth\"\n when 141..159\n @@agility += d(4)\n @@skills << \"Stealth\"\n when 160..199\n @@agility += d(3)\n @@skills << \"Stealth\"\n end\n end\n\n @@character_height -= d(100)\n size_decrease_mutation(@@character_height)\n @@primary_mutations << \"Size Decrease\"\n when 850..860\n @@primary_mutations << \"Size Increase\"\n @@character_height += (d(100) + d(100) + d(100) + d(100))\n\n def size_increase_mutation(height) # Hub Rules p. 73\n case height\n when 164..184\n @@strength += d(10)\n @@endurance && @@character_weight += (d(10) + 5)\n when 185..199\n @@movement_rate_base += 0.25\n @@strength += (d(10) + 5)\n @@endurance && @@character_weight += (d(10) + 10)\n when 200..250\n @@movement_rate_base += 0.5\n @@strength += (d(10) + 10)\n @@endurance && @@character_weight += (d(20) + 15)\n when 251..299\n @@movement_rate_base += 0.75\n @@strength += (d(20) + 15)\n @@endurance && @@character_weight += (d(20) + 20)\n when 300..350\n @@movement_rate_base += 1\n @@strength += (d(20) + 20)\n @@endurance && @@character_weight += (d(20) + 30)\n when 351..399\n @@movement_rate_base += 1.25\n @@strength += (d(20) + 30)\n @@endurance && @@character_weight += (d(20) + 40)\n when 400..425\n @@movement_rate_base += 1.5\n @@strength += (d(20) + 40)\n @@endurance && @@character_weight += (d(20) + 50)\n when 426..450\n @@movement_rate_base += 1.75\n @@strength += (d(20) + 50)\n @@endurance && @@character_weight += (d(20) + 60)\n when 451..475\n @@movement_rate_base += 2\n @@strength += (d(20) + 60)\n @@endurance && @@character_weight += (d(20) + 75)\n when 476..499\n @@movement_rate_base += 3\n @@strength += (d(20) + 75)\n @@endurance && @@character_weight += (d(20) + 88)\n when 500..525\n @@movement_rate_base += 4\n @@strength += (d(20) + 88)\n @@endurance && @@character_weight += (d(20) + 100)\n when 526..560\n @@movement_rate_base += 5\n @@strength += (d(20) + 100)\n @@endurance && @@character_weight += (d(20) + 130)\n when 561..580\n @@movement_rate_base += 6\n @@strength += (d(20) + 130)\n @@endurance && @@character_weight += (d(20) + 160)\n end\n end\n\n size_increase_mutation(@@character_height)\n\n when 861..869\n def sonic_wave_radius_mutation(willpower) # Hub Rules p. 73\n case willpower\n when 1..9\n attack_radius = 1\n damage = \"d4\"\n deafness_duration = \"1 minute\"\n when 10..23\n attack_radius = 2\n damage = \"d6\"\n deafness_duration = \"5 minutes\"\n when 24..34\n attack_radius = 4\n damage = \"d8\"\n deafness_duration = \"10 minutes\"\n when 35..60\n attack_radius = 5\n damage = \"d10\"\n deafness_duration = \"30 minutes\"\n when 61..70\n attack_radius = 7\n damage = \"d12\"\n deafness_duration = \"1 hour\"\n when 71..80\n attack_radius = 9\n damage = \"d20\"\n deafness_duration = \"2d4 hours\"\n when 81..90\n attack_radius = 15\n damage = \"d20 + 5\"\n deafness_duration = \"3d6 hours\"\n when 91..100\n attack_radius = 20\n damage = \"d20 + 10\"\n deafness_duration = \"d6 days\"\n when 101..110\n attack_radius = 25\n damage = \"d20 + 15\"\n deafness_duration = \"2d4 days\"\n when 111..120\n attack_radius = 30\n damage = \"d20 + 20\"\n deafness_duration = \"3d6 days\"\n when 121..130\n attack_radius = 40\n damage = \"d20 + 30\"\n deafness_duration = \"3d6 + 10 days\"\n when 131..140\n attack_radius = 50\n damage = \"d20 + 40\"\n deafness_duration = \"3d6 + 20 days\"\n when 141..150\n attack_radius = 60\n damage = \"d20 + 50\"\n deafness_duration = \"3d6 + 30 days\"\n end\n\n @@primary_mutations << \"Sonic Wave Radius: 2/day/rank, #{attack_radius} radius, #{damage} damage, #{deafness_duration} deafness.\"\n @@attacks << {:attack_mode => \"Sonic Wave Radius\", :SV => 100, :rate => 1, :range => attack_radius, :damage => damage, :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"73\", :notes => \"#{deafness_duration} deafness\"}\n end\n\n sonic_wave_radius_mutation(@@willpower)\n\n\n when 870..876\n @@primary_mutations << \"Spines: #{d(10) + 10} cm length, + d6 dmg to punch/kick\"\n @@dv -= (d(20) + 10)\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@character_notes << \"Unable to wear relic armor unless spines are sawed off monthly.\"\n when 877..880\n @@primary_mutations << \"Sprint: 2/day/rank, duration 2d10 + rank rounds. -20DV (-20SV with misslie weapons) while sprinting OR double melee attack rate.\"\n when 881..886\n def stalked_eyes_mutation(roll)\n case roll\n when 1..67\n eye_stalks = (d(4) + 1)\n @@primary_mutations << \"Stalked eyes: mutant has #{eye_stalks} #{(d(20) + 10)} cm long instead of typical eyes.\"\n when 68..100\n eye_stalks = (d(3) + 1)\n @@primary_mutations << \"Stalked eyes: mutant has #{eye_stalks} #{(d(20) + 10)} cm long in addition to typical eyes.\"\n end\n\n @@dv -= (eye_stalks * 3)\n @@initiative += 2\n @@appearance = [@@appearance - (eye_stalks * d(6)), 1].max\n end\n\n stalked_eyes_mutation(d(100))\n\n when 887..892\n def stench_spray_location(roll) # Hub Rules p. 74\n case roll\n when 1..2\n location = \"Groin\"\n when 3..4\n location = \"Stomach\"\n when 5..6\n location = \"Chest\"\n when 7\n location = \"Left armpit\"\n when 8\n location = \"Right armpit\"\n when 9\n location = \"Back\"\n when 10\n location = \"Butt\"\n end\n\n stench_spray_app = (6 + d(6))\n @@primary_mutations << \"Stench Spray: #{20 + d(20) + d(20)} cm organ located on character's #{location}\"\n @@attacks << {:attack_mode => \"Stench Spray\", :SV => 10, :rate => 1, :range => (@@strength / 2), :damage => \"Special\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"74\", :notes => \"Endurance-based type B hazard check or d6 + 1 rds vomiting, +30SV to strike, -30SV to attack others.\"}\n @@character_notes << \"Character's appearance -#{stench_spray_app} penalty after stench organ seen.\"\n\n end\n\n stench_spray_location(d(10))\n\n when 893..901\n @@primary_mutations << \"Strength Burst: 2/rank/day, 4 rds/rank duration, character's strength 4x regular amount. Contributes to strength-based hazard checks, melee damage, etc.\"\n when 902..909\n def stun_ray_launcher(roll)\n case roll\n when 1..17\n stun_location = \"eyes\"\n when 18..59\n stun_location = \"left hand\"\n when 60..101\n stun_location = \"right hand\"\n end\n\n @@primary_mutations << \"Stun Ray fired from #{stun_location}.\"\n @@attacks << {:attack_mode => \"Stun Ray\", :SV => 10, :rate => 1, :range => (@@willpower * 2), :damage => \"2d20 stun, x2 vs machines\", :ammo => \"3/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"74\", :notes => \"Stun damage fades after 1 hour.\"}\n end\n\n stun_ray_launcher(d(101))\n\n when 910..924\n def tail_mutation(roll) # Hub Rules p. 74\n case roll\n when 1..2\n tail_type = \"Club\"\n tail_length = 1.5\n tail_agility_bonus = d(4)\n tail_move = -1\n tail_sv = 6\n tail_attack_dmg = \"d12 + 2 lethal or stun\"\n when 3\n tail_type = \"Crocodile\"\n tail_length = 1.7\n tail_agility_bonus = d(8)\n tail_move = -1\n tail_move_water = 4\n tail_sv = 5\n tail_attack_dmg = \"d12 stun\"\n when 4\n tail_type = \"Dolphin\"\n tail_length = 1.5\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_move_water = 6\n tail_sv = 4\n tail_attack_dmg = \"d12 stun\"\n when 5\n tail_type = \"Eagle\"\n tail_length = 1\n tail_agility_bonus = d(6)\n tail_move = 1\n tail_sv = 0\n tail_attack_dmg = nil\n when 6\n tail_type = \"Fish\"\n tail_length = 1.3\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_move_water = 5\n tail_sv = 4\n tail_attack_dmg = \"d10 stun\"\n when 7\n tail_type = \"Fox\"\n tail_length = 1.25\n tail_agility_bonus = (d(6) + d(6))\n tail_move = 1.5\n tail_sv = 0\n tail_attack_dmg = nil\n when 8\n tail_type = \"Cat\"\n tail_length = 1.5\n tail_agility_bonus = (d(8) + d(8))\n tail_move = 2\n tail_sv = 0\n tail_attack_dmg = nil\n when 9\n tail_type = \"Whip\"\n tail_length = (3 + d(4))\n tail_agility_bonus = d(6)\n tail_move = -0.25\n tail_sv = 4\n tail_attack_dmg = \"d8\"\n @@character_notes << \"Whip tail can be used as #{tail_length} rope.\"\n when 10..13\n tail_type = \"Prehensile (monkey)\"\n tail_length = 3\n tail_agility_bonus = (d(4) + d(4))\n tail_move = 1\n tail_sv = 0\n tail_attack_dmg = nil\n @@character_notes << \"Prehensile tail can wield dagger or knife for additional melee attack.\"\n when 14\n tail_type = \"Newt\"\n tail_length = 1.5\n tail_agility_bonus = d(8)\n tail_move = -1\n tail_move_water = 4\n tail_sv = 3\n tail_attack_dmg = \"d10 stun\"\n when 15\n tail_type = \"Porcupine\"\n tail_length = 0.75\n tail_agility_bonus = 0\n tail_move = -1\n tail_sv = 5\n tail_attack_dmg = \"d12 + 1\"\n when 16..17\n tail_type = \"Rat\"\n tail_length = 1.8\n tail_agility_bonus = d(6)\n tail_move = 0.5\n tail_sv = 0\n tail_attack_dmg = nil\n @@character_notes << \"Rat tail can wield dagger or knife for additional melee attack.\"\n when 18\n tail_type = \"Scorpion\"\n tail_length = 2\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_sv = 8\n tail_attack_dmg = \"d12 + Type A poison\"\n when 19\n tail_type = \"Spiked\"\n tail_length = 1.75\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_sv = 7\n tail_attack_dmg = \"d12 + 3\"\n when 20\n tail_type = \"Bladed\"\n tail_length = 2\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_sv = 7\n tail_attack_dmg = \"d20\"\n end\n\n @@primary_mutations << \"Tailed: #{tail_type} tail of #{tail_length} m length.\"\n @@appearance += tail_agility_bonus\n @@movement_rate_base += tail_move\n @@movement_rate_swimming += tail_move_water\n if tail_attack_dmg != nil\n @@attacks << {:attack_mode => \"#{tail_type} tail strike\", :SV => tail_sv, :rate => 1, :range => tail_length, :damage => \"#{tail_attack_dmg}\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"74\", :notes => \"\"}\n end\n end\n\n tail_mutation(d(20))\n\n when 925..936\n @@primary_mutations << \"Telekinesis\"\n when 937..961\n @@primary_mutations << \"Telepathy\"\n when 962..967\n def tentacle_mutation(roll)\n case roll\n when 1..28\n number_of_tentacles = (d(4) + d(4) + 2)\n @@primary_mutations << \"Tentacles: Mutant has #{number_of_tentacles} instead of arms.\"\n when 29..100\n number_of_tentacles = (d(4) + d(4))\n @@primary_mutations << \"Tentacles: Mutant has #{number_of_tentacles} in addition to arms.\"\n end\n\n @@appearance = [@@appearance - (number_of_tentacles * 2), 1].max\n 2.times @@skills << \"Climbing\"\n @@character_notes << \"Tentacles add #{number_of_tentacles * 0.5} m to character's climbing & swimming move rates.\"\n @@character_notes << \"Tentacles can wield simple melee weapons but lack the dexterity needed to operate a keyboard, stringed, or triggered weapon.\"\n @@attacks << {:attack_mode => \"Tentacle strike\", :SV => 5, :rate => number_of_tentacles, :range => 0, :damage => \"d8 stun\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"75\", :notes => \"Tentacles gain unarmed combat modifiers, too.\"}\n end\n\n tentacle_mutation(d(100))\n\n when 968..975\n @@primary_mutations << \"Throwing Quills: fire 1/rd, up to 20/day\"\n @@dv -= 18\n @@character_notes << \"Due to quills, mutant cannot wear relic armor (except specially-designed junk or scrap relic armor)\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@attacks << {:attack_mode => \"Throwing Quill\", :SV => 6, :rate => 1, :range => (@@strength / 2), :damage => \"d10\", :ammo => \"20/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"incl. strength and wpn expert skill modifiers\"}\n\n when 976..982\n def thrust_spike_mutation(roll)\n case roll\n when 1\n poison = \"type A death poison\"\n when 2..10\n poison = \"None\"\n end\n thrust_spike_length = (d(4) + d(4))\n @@primary_mutations << \"Thrust Spike #{thrust_spike_length} long.\"\n @@character_notes << \"After seeing thrust spike mutant's appearance score reduced for witness by d1- + 10.\" #obvious typo here\n if poison == \"None\"\n @@attacks << {:attack_mode => \"Thrust Spike\", :SV => 0, :rate => 1, :range => thrust_spike_length, :damage => \"d20\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"+30SV, 2d20 + 10 damage on first attack.\"}\n elsif poison != \"None\"\n @@attacks << {:attack_mode => \"Thrust Spike\", :SV => 0, :rate => 1, :range => thrust_spike_length, :damage => \"d20\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"+30SV, 2d20 + 10 damage on first attack. Also: #{poison}\"}\n end\n end\n\n thrust_spike_mutation(d(10))\n\n\n when 983..986\n @@primary_mutations << \"Tusks\"\n @@attacks << {:attack_mode => \"Tusk bite\", :SV => 6, :rate => 1, :range => 0, :damage => \"2d8 + 2\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"Additional melee attack/rd.\"}\n @@appearance = [@@appearance - (d(8) + 2), 1].max\n when 987..992\n @@primary_mutations << \"Webbed Hands: character nearly impossible to drown & can hold breath 2x normal. Double swim speed.\"\n @@movement_rate_swimming += @@movement_rate_swimming\n\n when 993..1000\n def wings_mutation(roll1,roll2) # Hub Rules p. 76\n case roll1\n when 1\n wing_type = \"Bird\"\n air_speed += 6\n @@character_notes << \"Bird wings are fragile - this character suffers double damage from fire and burst radius explosives like grenades and bombs.\"\n when 2\n wing_type = \"Insect\"\n air_speed += 3\n @@character_notes << \"Due to insect wings, character has -2 MV in enclosed spaces.\"\n when 3..6\n wing_type = \"Bat\"\n end\n\n case roll2\n when 1\n wing_size = \"Tiny\"\n flight_mode = \"Glide only\"\n air_speed += (d(6) + 10)\n flying_dv = -5\n wing_attack_dmg = nil\n wing_weight = 6\n when 2\n wing_size = \"Small\"\n flight_mode = \"Flies poorly\"\n air_speed += (d(6) + 12)\n flying_dv = -10\n wing_attack_dmg = \"d4 stun\"\n wing_weight = 12\n when 3..4\n wing_size = \"Medium\"\n flight_mode = \"Flies normally\"\n air_speed += (d(6) + 15)\n flying_dv = -14\n wing_attack_dmg = \"d6 stun\"\n wing_weight = 20\n when 5\n wing_size = \"Large\"\n flight_mode = \"Flies normally\"\n air_speed += (d(6) + 20)\n flying_dv = -20\n wing_attack_dmg = \"d8 stun\"\n wing_weight = 30\n when 6\n wing_size = \"Vast\"\n flight_mode = \"Flies excellently\"\n air_speed += (d(10) + 25)\n flying_dv = -25\n wing_attack_dmg = \"d10 stun\"\n wing_weight = 40\n end\n\n @@primary_mutations << \"Wings: #{wing_size} #{wing_type} wings. Mutant #{flight_mode} at #{air_speed} MV and #{flying_dv} DV when airborne.\"\n @@movement_rate_flying += air_speed\n\n if wing_attack_dmg != nil\n @@attacks << {:attack_mode => \"Wing bash\", :SV => 0, :rate => 2, :range => 0, :damage => \"#{wing_attack_dmg}\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"\"}\n end\n\n @@character_notes << \"Character able to fly at full air speed with full gear, arms, and armor. See Hub Rules p. 76 for more.\"\n @@character_notes << \"Due to wings, standard and relic armor must be modified and fitted to this character.\"\n\n\n end\n\n wings_mutation(d(6),d(6))\n\n end\nend", "def silly_adjective; 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 specie; end", "def specie; end", "def specie; end", "def specie; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def hook_solution?(a); end", "def internship_passed; end", "def required_positionals; end", "def collection_order(items) #nicer collection method - the unnecessary loops and arrays. (task 6)\n\n item_indexes = []\n collection_order = []\n\n for item in items\n item_indexes << find_index_at_value(item)\n end\n\n sorted_indexes = item_indexes.sort\n\n for index in sorted_indexes\n collection_order = collection_order << WAREHOUSE[index].keys[0].to_s\n end\n\nreturn collection_order\n\nend", "def unusual_sport; end", "def caste_based_details(caste)\n case caste\n when \"Slave, Labor\"\n\n @@endurance += d(10)\n @@strength += d(10)\n @@intelligence = [@@intelligence - d(10), 1].max\n @@perception = [@@perception - d(6), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n puts \"+d10 to Endurance and Strength; -d10 to Intelligence, -d6 to Perception.\"\n bounty_chance(32,(20 + (d(6) + d(6) + d(6))))\n\n\n when \"Slave, Kitchen\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence += d(6)\n @@willpower = [@@willpower - d(12), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n bounty_chance(27,(20 + (d(6) + d(6) + d(6))))\n\n when \"Slave, Servant\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence += d(6)\n @@perception += d(6)\n @@willpower = [@@willpower - d(6), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n @@misc_skill_rolls += 1\n bounty_chance(76,(100 + (d(6) + d(6) + d(6))))\n @@literacy = \"Literate\"\n\n when \"Slave, Whore\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence = [@@intelligence - d(6), 1].max\n @@willpower = [@@willpower - d(6), 1].max\n @@appearance += d(6)\n @@outfittingcode = \"Escaped Prisoner\"\n @@skills << \"Erotic Arts\"\n bounty_chance(82,(100 + (d(4) * 25)))\n\n when \"Slave, Court\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence = [@@intelligence - d(6), 1].max\n @@perception += d(6)\n @@willpower = [@@willpower - d(6), 1].max\n @@appearance += d(6)\n @@outfittingcode = \"Escaped Prisoner\"\n @@misc_skill_rolls += d(3)\n bounty_chance(87,(100 + (d(4) * 25)))\n @@literacy = \"Literate\" # assumption\n @@number_of_languages += d(4)\n @@character_notes << \"Has a fairly accurate knowledge of the political and geographic layout of the region.\"\n\n\n when \"Slave, Gladiator\"\n\n @@endurance += (d(10) + d(10))\n @@strength += (d(10) + d(10))\n @@agility += d(8)\n @@accuracy += d(8)\n @@intelligence = [@@intelligence - d(10), 1].max\n @@perception += d(8)\n @@willpower = [@@willpower - d(4), 1].max\n @@appearance = [@@appearance - (d(8) + d(8)), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n d(3).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += (4+(rand(1..4)))\n bounty_chance(94,(200 + (d(100) + d(100))))\n literacy_chance(2,0)\n\n\n when \"Fisher\"\n\n @@endurance += d(6)\n @@strength += d(6)\n @@perception += d(8)\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Spear Weapons\"\n end\n @@misc_skill_rolls += 1\n @@equipment << \"collapsible wooden fishing rod with reel\";\"30m of fshing line\";\"fishing hooks and lures\";\n \"small fshing net\";\"fishing spear/harpoon\"\n literacy_chance(6,0)\n\n when \"Hunter\"\n\n @@endurance += d(8)\n @@strength += d(8)\n @@agility += d(6)\n @@accuracy += d(6)\n @@perception += d(8)\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Weapons Expert: Bow\"\n end\n @@skills << \"Wilderness Survival\"\n @@misc_skill_rolls += 1\n @@character_notes << \"Accustomed to being outdoors, knows most animals by their tracks, and can start a fre with mere sticks, knows how to conceal the fre at night, make simple shelters, snares and deadfall traps.\"\n\n when \"Miner\"\n\n @@endurance += d(10)\n @@strength += (d(10) + (rand(1..10)))\n @@appearance = [@@appearance - d(6), 1].max\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Weapons Expert: Pickaxe\"\n end\n @@misc_skill_rolls += 1\n @@equipment << \"shovel\"; \"pickaxe\"; \"#{d(20) + d(20) + d(20)} m rope\"; \"lantern and oil\"\n literacy_chance(5,0)\n\n when \"Logger\"\n\n @@endurance += d(8)\n @@strength += d(8)\n @@agility += d(6)\n @@perception += d(6)\n @@appearance = [@@appearance - d(3), 1].max\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Weapons Expert: Axe\"\n end\n @@misc_skill_rolls += 1\n @@equipment << \"hatchet\"; \"logger's double-headed axe (battle axe)\"\n @@character_notes << \"+3 initiative in encounters with carnivorous mutant plants\"\n literacy_chance(6,0)\n\n when \"Farmer\"\n\n @@endurance += d(6)\n @@strength += d(6)\n @@perception += d(6)\n @@outfittingcode = 'Poor'\n d(3).times do\n @@skills << \"Weapons Expert: Pitchfork\"\n end\n @@misc_skill_rolls += 1\n @@character_notes << \"Can throw pitchfork 2x typical range\"\n literacy_chance(4,32)\n\n when \"Nomad\"\n\n @@agility += d(10)\n @@perception += d(6)\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Rider\"\n end\n @@skills << \"Navigate by Stars\"\n @@misc_skill_rolls += d(3)\n literacy_chance(13,18)\n\n when \"Trader\"\n def trader_background(roll)\n case roll\n when 1..34\n \"self-employed traveling peddler\"\n else\n \"merchant's apprentice\"\n end\n end\n def trader_debt(roll)\n case roll\n when 1..23\n @@debts << \"Owes #{(d(1000) + d(1000) + d(1000))} to the merchant's guild of the largest regional free town.\"\n end\n end\n @@intelligence += (d(10) + (d(10)))\n @@perception += d(10)\n @@outfittingcode = \"Well Equipped\"\n @@skills << \"Barter\"\n @@misc_skill_rolls += (1 + d(3))\n @@character_notes << \"Was a #{trader_background(d(100))} before becoming an excavator.\"\n @@number_of_languages += d(4)\n @@literacy = \"Literate\"\n @@do_math = \"Can do math\"\n @@money += (d(100) + d(100))\n trader_debt(d(100))\n\n when \"Craftsperson\"\n def craft_specialty(roll) # Hub Rules p. 14\n case roll\n when 1\n \"glass and plastic jeweler\"\n when 2\n \"potter\"\n when 3\n \"leatherworker\"\n when 4\n \"fletcher/arrow crafter\"\n when 5\n \"beer and wine brewer\"\n when 6\n \"paper maker\"\n when 7..8\n \"cook at an inn\"\n when 9\n \"visual art (maps, signs, insignia, wanted posters, etc.)\"\n when 10\n \"smithy assistant\"\n when 11\n \"weaver\"\n when 12\n \"butcher's assistant\"\n when 13\n \"glass blower\"\n when 14\n \"tattoo artist\"\n when 15..19\n \"carpenter's assistant\"\n when 20\n \"stone mason's assistant\"\n end\n end\n if @@intelligence >= 35\n @@literacy = \"Literate\"\n end\n @@character_notes << \"Before becoming an excavator, worked as a #{craft_specialty(d(20))}\"\n\n when \"Student\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence += (d(10) + d(10) + d(10))\n @@appearance += d(6)\n @@outfittingcode = \"Modest\"\n @@educated_skill_rolls += (d(6) + d(6) + 2)\n @@misc_skill_rolls += d(2)\n @@number_of_languages += d(4)\n @@literacy = \"Literate\"\n @@do_math = \"Can do math\"\n\n when \"Scribe\"\n def scribe_past(roll)\n case roll\n when 1..66\n \"local government\"\n else\n \"powerful merchant\"\n end\n end\n bounty_chance(22,(250 + (d(100) + d(100))))\n if @@bounty_offered == \"Yes\"\n @@bounty_offered = \"Yes (death)\"\n @@character_notes << \"Certain secrets crossed this scribe's desk, resulting in a hefty bounty...\"\n end\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@perception += d(6)\n @@outfittingcode = \"Modest\"\n @@educated_skill_rolls += d(3)\n @@misc_skill_rolls += 1\n @@literacy = \"Literate\"\n @@do_math = \"Advanced math\"\n @@character_notes << \"Scribe worked for a #{scribe_past(d(100))} and has a clear knowledge of regional settlements and political climate.\"\n @@number_of_languages += (d(3) + 1)\n\n when \"Technician\"\n\n @@agility += d(3)\n @@accuracy += d(3)\n @@intelligence += (d(8) + rand(1..8))\n @@outfittingcode = \"Well Equipped\"\n @@tech_skill_rolls += (d(6) + rand(1..6))\n @@educated_skill_rolls += rand(1..2)\n @@misc_skill_rolls += d(3)\n bounty_chance(28,(200 + (d(100) + d(100))))\n\n when \"Street Urchin\"\n def urchin_past(roll)\n case roll\n when 1..26\n \"runaway\"\n else\n \"orphan\"\n end\n end\n def urchin_outlaw(roll)\n case roll\n when 1..6\n @@character_notes << \"Wanted by the law: if arrested in hometown, faces #{(d(6) + d(6))}-year prison sentence\"\n end\n end\n def urchin_debt(roll)\n case roll\n when 1..12\n @@debts << \"Owes #{(d(100) + d(100) + d(100))} to former gang in home town, who'll beat and rob the character if s/he returns.\"\n end\n end\n @@character_notes << \"Character was a/an #{urchin_past(d(100))} before becoming an excavator.\"\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(3), 1].max\n @@agility += d(10)\n @@accuracy += d(6)\n @@appearance = [@@appearance - d(6), 1].max\n @@outfittingcode = \"Impoverished\"\n #skills: brawling d3; criminal d3+1; 1 misc roll\n @@criminal_skill_rolls += d(3)\n @@misc_skill_rolls += 1\n d(3).times do\n @@skills << \"Brawling\"\n end\n urchin_debt(d(100))\n\n when \"Street Thug\"\n\n @@endurance += (d(6) + d(6))\n @@strength += (d(6) + + d(6))\n @@intelligence = [@@intelligence - d(6), 1].max\n @@appearance = [@@appearance - d(6), 1].max\n @@outfittingcode = \"Poor\"\n #skills: brawling d4; criminal 2; warrior 2; 1 roll on misc table\n d(4).times do\n @@skills << \"Brawling\"\n end\n @@criminal_skill_rolls += 2\n @@warrior_skill_rolls += 2\n @@misc_skill_rolls += 1\n literacy_chance(14,19)\n bounty_chance(15,\"Death\")\n\n when \"Raider\"\n def has_horse(roll)\n case roll\n when 1..36\n @@equipment << \"Saddle horse\"\n end\n end\n @@endurance += d(10)\n @@strength += d(10)\n @@outfittingcode = \"Poor\"\n #skills: rider d3; criminal 2; warrior 2; 1 roll on misc table\n d(3).times do\n @@skills << \"Riding\"\n end\n @@criminal_skill_rolls += 2\n @@warrior_skill_rolls += 2\n @@misc_skill_rolls += 1\n has_horse(d(100))\n literacy_chance(16,21)\n @@character_notes << \"9% chance per encounter with any raiders character is recognized, and raiders will (d6: 1-3. try and sell him as a slave/ 4,5. forcibly enlist him and his companions / 6. kill him.)\"\n\n when \"Pirate\"\n\n @@endurance += d(10)\n @@strength += d(10)\n @@outfittingcode = \"Poor\"\n #skills: navigate by stars 1; criminal 2; warrior 2; 1 roll on misc table\n @@skills << \"Navigate by Stars\"\n @@criminal_skill_rolls += 2\n @@warrior_skill_rolls += 2\n @@misc_skill_rolls += 1\n literacy_chance(9,12)\n @@character_notes << \"In any encounters with pirates, character is 46% likely to be recognized by a crew member. If so, she will be deemed a traitor to her caste and either stripped and sold as a slave, after a good flogging (01-79% chance), or (80-00%) drawn and quartered on the spot.\"\n\n when \"Thief\"\n\n @@endurance = [@@endurance - d(3), 1].max\n @@strength = [@@strength - d(3), 1].max\n @@agility += d(12)\n @@accuracy += d(8)\n @@outfittingcode = \"Impoverished\"\n #skills: brawling 1; criminal d3+4; 1 roll on misc table\n @@skills << \"Brawling\"\n @@criminal_skill_rolls += (d(3) + 4)\n @@misc_skill_rolls += 1\n literacy_chance(17,24)\n # @@equipment << \"lock pick set\", \"30m of rope\", \"a dark cloak\", \"soft boots for quiet walking\"\n bounty_chance(57,(d(100) + d(100) + d(100) + d(100)))\n if @@bounty_value > 0\n @@character_notes << \"In hometown, 78% likely character is recognized and 2d6 raiders are sent to cripple and rob her, plus any associates she might travel with.\"\n end\n\n when \"Assassin\"\n\n @@endurance += d(6)\n @@strength += (d(6) + (rand(1..6)))\n @@agility += d(10)\n @@accuracy += d(10)\n @@perception += d(10)\n @@outfittingcode = \"Fully Armed\"\n #skills: martial arts d4; knife throwing d3; criminal d3; warrior d6; 1 roll on misc table\n d(4).times do\n @@skills << \"Martial Arts\"\n end\n d(3).times do\n @@skills << \"Knife Throwing\"\n end\n @@criminal_skill_rolls += d(3)\n @@warrior_skill_rolls += d(6)\n @@misc_skill_rolls += 1\n\n @@equipment << \"black cloak and ninja style outfit (in addition to regular streeth clothes)\"\n def assassin_poison(roll)\n case roll\n when 1..7\n @@equipment << \"100ml of type C death poison (10ml needed to coat a blade and potentially poison anybody who is punctured)\"\n end\n end\n assassin_poison(d(10))\n @@character_notes << \"In each encounter with bounty hunters, 41% chance character wanted dead.\"\n @@character_notes << \"While entering any town while not in disguise, 13% chance per day that the assassin’s brotherhood have located him and will send d6+2 members after him that night.\"\n\n when \"Draftee\"\n def draftee_history(roll)\n case roll\n when 1..87\n \"Drafted for home town militia\"\n else\n \"Drafted while visiting a neighboring town\"\n end\n end\n @@endurance += d(3)\n @@strength += d(3)\n @@outfittingcode = \"Modest\"\n #skills: warrior 1; misc d2\n @@warrior_skill_rolls += 1\n @@misc_skill_rolls += d(2)\n literacy_chance(28,33)\n @@character_notes << \"73% chance upon returning to town where drafted, she'll be recognized and arrested. d6: 1-3. hang her from the nearest tree/ 4,5. sell her as a slave/ 6. put her in jail for 2d6 months before drafting her back into the army, but chain her at night.\"\n\n when \"Militia Soldier\"\n\n @@endurance += d(6)\n @@strength += d(6)\n @@outfittingcode = \"Modest\"\n #skills: warrior d3; misc d2\n @@warrior_skill_rolls += d(3)\n @@misc_skill_rolls += d(2)\n literacy_chance(32,39)\n\n when \"Watchman\"\n\n @@endurance += d(6)\n @@strength += d(10)\n @@perception += d(10)\n @@outfittingcode = \"Well Equipped\"\n #skills: brawling d3; warrior d3; misc d2\n d(3).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += d(3)\n @@misc_skill_rolls += d(2)\n @@character_notes << \"not well liked in his home town, and if he returns, there is a 17% chance that a mob of 2d8 raiders will somehow try to corner him and his associates, and beat them soundly, if not kill them.\"\n literacy_chance(22,31)\n\n when \"Infantryman\"\n def infantry_history(roll)\n case roll\n when 1..68\n @@character_notes << \"Deserter. 47% chance per encounter with city's/nation's army, character recognized and jailed 2d6 years.\"\n @@enemies << \"City/nation army character previously served with.\"\n when 69..89\n @@character_notes << \"Retiree from the army. 47% chance per encounter with city's/nation's army, character recognized, saluted, and assisted.\"\n when 90..100\n @@character_notes << \"AWOL - was sole survivor of an operation and never returned to active duty. 47% chance per encounter with city's/nation's army, character recognized and reassigned to a new unit.\"\n end\n end\n infantry_history(d(100))\n @@endurance += d(12)\n @@strength += d(12)\n @@outfittingcode = \"Well Equipped\"\n #skills: warrior d6; misc d2\n @@warrior_skill_rolls += d(6)\n @@misc_skill_rolls += d(2)\n literacy_chance(15,22)\n\n when \"Cavalry\"\n def cavalry_history(roll)\n case roll\n when 1..68\n @@character_notes << \"Deserter. 47% chance per encounter with city's/nation's army, character recognized and jailed 2d6 years.\"\n when 69..89\n @@character_notes << \"Retiree. 47% chance per encounter with city's/nation's army, character recognized, saluted, and assisted.\"\n when 90..100\n @@character_notes << \"AWOL - was sole survivor of an operation and never returned to active duty. 47% chance per encounter with city's/nation's army, character recognized and reassigned to a new unit.\"\n end\n end\n cavalry_history(d(100))\n @@endurance += d(10)\n @@strength += d(12)\n @@agility += d(3)\n @@outfittingcode = \"Well Equipped\"\n #skills: riding d6; warrior d4; misc d2\n d(6).times do\n @@skills << \"Riding\"\n end\n @@warrior_skill_rolls += d(4)\n @@misc_skill_rolls += d(2)\n literacy_chance(15,22)\n\n when \"Mercenary\"\n def mercenary_bonus_skills(roll1,roll2,roll3,roll4,roll5,roll6)\n case roll1\n when 1..36\n d(3).times do\n @@skills << \"Gambling\"\n end\n end\n case roll2\n when 1..14\n @@skills << \"Negotiation\"\n end\n case roll3\n when 1..32\n d(3).times do\n @@skills << \"Lying\"\n end\n end\n case roll4\n when 1..29\n d(3).times do\n @@skills << \"Riding\"\n end\n end\n case roll5\n when 1..32\n @@criminal_skill_rolls += d(3)\n end\n case roll6\n when 1..43\n @@equipment << \"Riding horse\"\n end\n end\n def mercenary_history(roll)\n case roll\n when 1..87\n @@character_notes << \"Left mercenary employment on good terms.\"\n when 88..100\n @@character_notes << \"14% likely per every meeting with mercenaries in that region that he will run into his own squad, who will be angry that he left and rob and sell him into slavery, along with any companions.\"\n end\n end\n mercenary_bonus_skills(d(100),d(100),d(100),d(100),d(100),d(100))\n mercenary_history(d(100))\n @@endurance += d(10)\n @@strength += d(10)\n @@agility += d(6)\n @@accuracy += d(6)\n @@outfittingcode = \"Well Equipped\"\n #skills: brawling d3; warrior d6; misc d4\n d(3).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += d(6)\n @@misc_skill_rolls += d(4)\n literacy_chance(18,27)\n\n when \"Elite Soldier\"\n def elite_soldier_history(roll)\n case roll\n when 1..38\n @@character_notes << \"Retired from military service.\"\n else\n case bounty_roll(roll)\n when 1..73\n @@bounty_offered = (200 + d(100) + d(100))\n @@enemies << \"Squad of #{d(6) + d(6) + d(6)} from former military company hunting this character.\"\n end\n bounty_roll(d(100))\n end\n end\n elite_soldier_history(d(100))\n @@endurance += (d(8) + (rand(1..8)))\n @@strength += (d(8) + (rand(1..8)))\n @@agility += d(8)\n @@accuracy += d(8)\n @@willpower += d(8)\n @@outfittingcode = \"Well Equipped\"\n #skills: brawling d4; warrior d6+4; misc d4\n d(4).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += (4 + d(6))\n @@misc_skill_rolls += d(4)\n literacy_chance(34,41)\n\n else puts \"Hmm... looks like caste-based attributes and skills assignment screwed up. Debug mofo!\"\n\n end\n\nend", "def strain; end", "def strategy; end", "def compare_reviews_with_questions_responses(reviews, questions)\n review_text_arr = reviews\n #response = Response.find(:first, :conditions => [\"map_id = ?\", map_id])\n #scores = Score.find(:all, :conditions => [\"response_id = ?\", response.id])\n #questions = Array.new\n #fetching the questions for the responses\n# for i in 0..scores.length - 1\n# questions << Question.find_by_sql([\"Select * from questions where id = ?\", scores[i].question_id])[0].txt\n# end\n \n count_copies = 0 #count of the number of responses that are copies either of questions of other responses\n rev_array = Array.new #holds the non-plagiairised responses\n #comparing questions with text\n for i in 0..questions.length - 1\n if(!questions[i].nil? and !review_text_arr[i].nil? and questions[i].downcase == review_text_arr[i].downcase)\n count_copies+=1\n next #skip comparing with other responses\n end\n \n #comparing response with other responses\n flag = 0\n for j in 0..review_text_arr.length - 1\n if(i != j and !review_text_arr[i].nil? and !review_text_arr[j].nil? and review_text_arr[i].downcase == review_text_arr[j].downcase)\n count_copies+=1\n flag = 1\n break\n end\n end\n\n if(flag == 0) #ensuring no match with any of the review array's responses\n rev_array << review_text_arr[i]\n end\n end\n \n #setting @review_array as rev_array\n if(count_copies > 0) #resetting review_array only when plagiarism was found\n auto_metareview.review_array = rev_array\n end\n \n if(count_copies > 0 and count_copies == scores.length)\n return ALL_RESPONSES_PLAGIARISED #plagiarism, with all other metrics 0\n elsif(count_copies > 0)\n return SOME_RESPONSES_PLAGIARISED #plagiarism, while evaluating other metrics\n end\n end", "def passes; end", "def passes; end", "def schumann; end", "def calculated; end", "def calls; end", "def calls; end", "def parts; end", "def parts; end", "def parts; end", "def ghost_mutations_determination(roll)\n case roll\n when 1..4\n @@ghost_mutations << \"Advanced Mind\"\n when 5..6\n @@ghost_mutations << \"Agony Sphere\"\n when 7..8\n @@ghost_mutations << \"Asphyxiation Zone\"\n when 9..10\n @@ghost_mutations << \"Aura of Protection\"\n when 11\n @@ghost_mutations << \"Breath Holding\"\n when 12..13\n @@ghost_mutations << \"Coma Inducement\"\n when 14..15\n @@ghost_mutations << \"Devastator Pulse\"\n when 16..17\n @@ghost_mutations << \"Displacement \"\n when 18..19\n @@ghost_mutations << \"Doom Sphere\"\n when 20..21\n @@ghost_mutations << \"Dread Zone\"\n when 22..23\n @@ghost_mutations << \"Earth Thump\"\n when 24..27\n @@ghost_mutations << \"Electrical Pulse\"\n when 28..30\n @@ghost_mutations << \"Electro MagneticPulse\"\n when 31..37\n @@ghost_mutations << \"Empathy\"\n when 38..41\n @@ghost_mutations << \"Energy Blade\"\n when 42..45\n @@ghost_mutations << \"Force Field\"\n when 46..51\n @@ghost_mutations << \"Heal Touch\"\n when 52..56\n @@ghost_mutations << \"Heat Pulse\"\n when 57..58\n @@ghost_mutations << \"Image Multiplication\"\n when 59..60\n @@ghost_mutations << \"Image Projection\"\n when 61..62\n @@ghost_mutations << \"Light Burst\"\n when 63..64\n @@ghost_mutations << \"Mental Mine\"\n when 65..67\n @@ghost_mutations << \"Mental Screen\"\n when 68..79\n @@ghost_mutations << \"Mind Crush\"\n when 80..81\n @@ghost_mutations << \"Mind Waste\"\n when 82..83\n @@ghost_mutations << \"Peeling Radius\"\n when 84..85\n @@ghost_mutations << \"Radiation Detection\"\n when 86\n @@ghost_mutations << \"Radioactive Pulse\"\n when 87\n @@ghost_mutations << \"Reserve Heart\"\n when 88..89\n @@ghost_mutations << \"Reserve Mind\"\n when 90\n @@ghost_mutations << \"Sonic Wave Radius\"\n when 91\n @@ghost_mutations << \"Stun Ray\"\n when 92..96\n @@ghost_mutations << \"Telekinesis\"\n when 97..00\n @@ghost_mutations << \"Telepathy\"\n end\nend", "def implementation; end", "def implementation; end", "def winner(array)\n\n win_x_combo = nil\n win_o_combo = nil\n xs = []\n os = []\n\n def x_extractor_helper(array, index) \n array.select.with_index.select do |j, index| \n j == \"X\" || j == \" X \"\n end\n end\n\n def o_extractor_helper(array, index) \n array.select.with_index.select do |j, index| #// or each_with_index\n j == \"O\" || j == \" O \"\n end\n end\n\n def array_dividing_helper_method(array) # need to go a level deeper in array to access [\"a\", 1] ?!\n output_array = []\n array.each do | index0 |\n output_array << index0[1] # need output_array to be local variable??! \n end \n #end # OLD ending to array_dividing_helper_method\n return output_array\n end # ends array_dividing_helper_method\n\n\n xs = array_dividing_helper_method(x_extractor_helper(array, array))\n os = array_dividing_helper_method(o_extractor_helper(array, array))\n\n WIN_COMBINATIONS.each do |combo|\n #os.all? # Instead, try \"os contains WIN_COMBINATIONS[i][0] and WIN_COMBINATIONS[i][1] and [i][2] \"\n if ( ( xs.include?(combo[0]) ) && ( xs.include?(combo[1]) ) ) # was win_x_combo, not xs\n if ( xs.include?(combo[2]) )\n #puts \"Winning X Combo is #{combo} \"\n win_x_combo = combo\n #return combo\n else puts \"No x Win Combination. current combo is #{combo}\"\n end\n end\n end\n \n WIN_COMBINATIONS.each do |combo|\n if ( ( os.include?(combo[0]) ) && ( os.include?(combo[1]) ) ) \n if ( os.include?(combo[2]) )\n #puts \"Winning O Combo is #{combo} \"\n win_o_combo = combo\n #return combo\n #else puts \"No o Win Combination\"\n end\n end\n end \n\n\n if ( win_x_combo != nil )\n puts \" X Won!\"\n return \"X\"\n end\n\n if ( win_o_combo != nil )\n puts \" O Won!\"\n return \"O\"\n else puts (\"No winner\") and\n return nil\n end\n\n\nend", "def run_extraction\n\n run_on_all_extractors(@score_card.price) { |e| \n result = e.extract_stock_price()\n @score_card.price = result['price']\n @score_card.currency = result['currency']\n }\n \n run_on_all_extractors(@score_card.return_on_equity) { |e|\n e.extract_roe(@score_card.return_on_equity)\n }\n\n run_on_all_extractors(@score_card.ebit_margin) { |e|\n e.extract_ebit_margin(@score_card.ebit_margin, @score_card.share.financial)\n }\n \n run_on_all_extractors(@score_card.equity_ratio) { |e|\n e.extract_equity_ratio(@score_card.equity_ratio)\n }\n\n run_on_all_extractors(@score_card.current_price_earnings_ratio) { |e|\n e.extract_current_price_earnings_ratio(@score_card.current_price_earnings_ratio)\n }\n\n run_on_all_extractors(@score_card.average_price_earnings_ratio) { |e|\n e.extract_average_price_earnings_ratio(@score_card.average_price_earnings_ratio)\n }\n\n run_on_all_extractors(@score_card.analysts_opinion) { |e|\n e.extract_analysts_opinion(@score_card.analysts_opinion)\n }\n\n run_on_all_extractors(@score_card.reaction) { |e|\n e.extract_reaction_on_figures(@score_card.reaction)\n }\n\n run_on_all_extractors(@score_card.profit_revision) { |e|\n e.extract_profit_revision(@score_card.profit_revision)\n }\n\n run_on_all_extractors(@score_card.stock_price_dev_half_year) { |e|\n e.extract_stock_price_dev_half_year(@score_card.stock_price_dev_half_year)\n }\n \n run_on_all_extractors(@score_card.stock_price_dev_one_year) { |e|\n e.extract_stock_price_dev_one_year(@score_card.stock_price_dev_one_year)\n }\n\n run_on_all_extractors(@score_card.reversal) { |e|\n e.extract_three_month_reversal(@score_card.reversal)\n }\n\n run_on_all_extractors(@score_card.profit_growth) { |e|\n e.extract_profit_growth(@score_card.profit_growth)\n }\n\n run_on_all_extractors(@score_card.insider_info) { |e|\n e.extract_insider_deals(@score_card.insider_info)\n }\n\n end", "def malts; end", "def processor; end", "def celebration; end", "def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n serving_sizes = { \"pie\" => 8, \"cake\" => 6, \"cookie\" => 1 } # Hash of available foods and associated counts\n food_quantities = { \"fav_food\" => 0, \"pie\" => 0, \"cake\" => 0, \"cookie\" => 0 } # Hash of food quantities\n\n # Raise error if serving sizes doesn't contain food\n raise ArgumentError.new(\"You can't make that food\") if !serving_sizes.has_key? (fav_food)\n\n # Returns the necessary number of food items needed to satisfy each serving if the \n # number of people attending is evenly divisible by the quantity of the passed favorite food.\n return \"You need to make #{num_of_people / serving_sizes[fav_food]} #{fav_food}(s).\" if num_of_people % serving_sizes[fav_food] == 0\n\n # Loop through each key in food_quantities to determine how many of each food item is needed.\n food_quantities.each do |key, value|\n if key == \"fav_food\" \n food_quantities[key] = num_of_people / serving_sizes[fav_food] # Setting \"fav_food\" property for future use in food_quantities\n food_quantities[fav_food] = food_quantities[key]\n num_of_people = num_of_people % serving_sizes[fav_food] # Setting remaining amount of people left after fav_food is determined.\n elsif num_of_people / serving_sizes[key] > 0 # key is not fav_food and number of remaining people divided by the next food item serving size is greater than zero\n food_quantities[key] = num_of_people / serving_sizes[key] # Setting count for additional food items needed for remaining people\n num_of_people = num_of_people % serving_sizes[key] # Setting number of remaining people after the additional food item\n end # Ending conditional\n end # Ending .each loop\n\n return \"You need to make #{food_quantities[\"pie\"]} pie(s), #{food_quantities[\"cake\"]} cake(s), and #{food_quantities[\"cookie\"]} cookie(s).\"\nend", "def serving_size_calc(item_to_make, order_quantity)#two arguments , item to make order quantity \n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}# creating a hash called library, \n #the item to make it's the key and the qty the problem\n error_counter = 3#define a variable cable and set it equal to three.\n\n library.each do |food| #iterating over the hash library \n\n return error_counter -= 1 if library[food] != library[item_to_make] #printing error counter - 1\n#we are checking if the library is not equal to the value .\n #printing error counter - 1\n \n end\n\n if error_counter > 0#if error counter is greater than 0 we raise the argument\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n\n serving_size = library.values_at(item_to_make)[0]#set a variable called serving size\n #equal to library.values at to get the values , and get item and index\n serving_size_mod = order_quantity % serving_size#it sets a variable and set it equal to order quantity remainder of serving size.\n\n# case serving_size_mod\n# when 0\n if serving_size_mod == 0 #give me this at position 0\n\n #if serving size is equal to 0 then return the calculations complete\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: #TODO: MAKE THIS FEATURE\"\n end\nend", "def result_of_checking; end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def winter_paralympics_sport; end", "def minor_mutations_determination(roll)\n case roll\n when 1..16\n def blood_color_alteration(roll) # Hub Rules p. 77\n case roll\n when 1\n \"pink\"\n when 2\n \"lavender\"\n when 3\n \"violet\"\n when 4\n \"purple\"\n when 5\n \"white\"\n when 6\n \"copper\"\n when 7\n \"amber\"\n when 8\n \"lime green\"\n when 9\n \"aquamarine\"\n when 10\n \"emerald\"\n when 11\n \"olive\"\n when 12\n \"blue\"\n when 13\n \"green\"\n when 14\n \"turquoise\"\n when 15\n \"black\"\n when 16\n \"orange\"\n when 17\n \"gray\"\n when 18\n \"yellow\"\n when 19\n \"silver\"\n when 20\n \"clear\"\n end\n end\n\n blood_color = blood_color_alteration(d(20))\n\n @@minor_mutations << \"Blood Color Alteration: mutant's blood is #{blood_color}-colored.\"\n when 17..21\n @@minor_mutations << \"Eye Lights: at will, mutant's eyes produce bright light beams, like spotlights, within 20m.\"\n when 22..23\n @@minor_mutations << \"Hibernation: mutant can sleep in a near-death state for up to 5 months, requiring no food or water.\"\n when 24..26\n @@minor_mutations << \"Longevity: Mutant ages at 1/2 typical rate.\"\n when 27..30\n @@minor_mutations << \"Nutriment Cache: mutant's body stores 40 days' worth of supplemental food. Cache refilled by 4 days of full meals.\"\n when 31..33\n @@minor_mutations << \"Offspring Link: an unbreakable telepathic link exists between mutant and parents or children. Only emotions or feelings can be communicated.\"\n when 34..91\n def physical_alterations_mutations(roll) # Hub Rules p. 77-78\n case roll\n when 1\n physical_alteration = \"Three nostrils\"\n @@appearance = [@@appearance - d(3), 1].max\n when 2\n physical_alteration = \"Extra set of ears\"\n @@character_notes << \"2x hearing range; 2x dmg from sonic attacks\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n when 3\n physical_alteration = \"Two mouths, one above the other\"\n @@appearance = [@@appearance - d(6), 1].max\n when 4\n physical_alteration = \"Six fingers per hand.\"\n when 5\n physical_alteration = \"Six toes per foot.\"\n when 6\n physical_alteration = \"Extra breast.\"\n when 7\n physical_alteration = \"Nose grew on forehead.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n when 8\n physical_alteration = \"Pointed ears.\"\n when 9\n physical_alteration = \"Extra joint in fingers and toes.\"\n when 10\n physical_alteration = \"Third eye between others.\"\n @@appearance = [@@appearance - d(6), 1].max\n @@accuracy += (d(4) + d(4))\n when 11\n physical_alteration = \"Only four fingers per hand.\"\n when 12\n physical_alteration = \"Only four toes per foot.\"\n when 13\n physical_alteration = \"Legs 1/4 longer than usual.\"\n @@appearance = [@@appearance - d(3), 1].max\n @@movement_rate_base += 2\n when 14\n extra_ribs = (d(4) + d(4))\n physical_alteration = \"Extra #{extra_ribs} pairs of ribs.\"\n @@appearance = [@@appearance - extra_ribs, 1].max\n @@endurance += (extra_ribs * 2)\n @@character_height += (extra_ribs * 4)\n when 15\n physical_alteration = \"Extra set of lungs.\"\n @@endurance && @@strength += 10\n @@movement_rate_base += 1\n when 16\n physical_alteration = \"Stubby tail, #{5 + d(12)} cm long.\"\n when 17\n physical_alteration = \"Arms twice as long as normal.\"\n @@character_notes << \"In melee: +1 initiative, +5 SV, +4 dmg\" # add SV and dmg bonus to ALL melee attacks...\n # @@initiative += 1 Since bonus applies to melee only, left it in the notes instead of adjusting base initiative value.\n @@appearance = [@@appearance - d(6), 1].max\n when 18\n physical_alteration = \"Longer neck #{(20 + d(20))} cm longer than typical.\"\n @@appearance = [@@appearance - d(2), 1].max\n when 19\n def bulbous_head_mutation(roll)\n case roll\n when 1..77\n ghost_mutations_rolls += d(2)\n physical_alteration = \"Bulbous head with ghost mutations.\"\n when 78..100\n physical_alteration = \"Bulbous head.\"\n end\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@intelligence += (d(20) + d(20))\n end\n\n bulbous_head_mutation(d(100))\n\n when 20\n physical_alteration = \"Sunken, skull-like eye sockets.\"\n @@appearance = [@@appearance - (d(6) + 1), 1].max\n when 21\n physical_alteration = \"Bulbous eyes.\"\n @@appearance = [@@appearance - (d(6) + 2), 1].max\n @@initiative += 1\n when 22\n cone_head_height = (d(20) + d(20))\n physical_alteration = \"Cone head #{cone_head_height} taller than typical.\"\n @@appearance = [@@appearance - (cone_head_height / 4), 1].max\n @@intelligence += d(4)\n @@character_height += cone_head_height\n when 23\n physical_alteration = \"Oversized jaws.\"\n @@appearance = [@@appearance - (d(3) + 1), 1].max\n @@character_notes << \"Bite attack d6 + strength bonus\"\n when 24\n physical_alteration = \"Hunchbacked.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@movement_rate_base -= 0.5\n @@endurance += (d(6) + d(6) + d(6))\n when 25\n physical_alteration = \"Deeply wrinkled skin.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n when 26\n physical_alteration = \"Especially smooth, firm skin.\"\n @@appearance += (d(6) + d(6))\n when 27\n physical_alteration = \"Disheveled body/face.\"\n @@movement_rate_base -= 0.5\n @@agility = [@@agility - d(6), 1].max\n @@appearance = [@@appearance - d(6), 1].max\n when 28\n physical_alteration = \"Very balanced body/face\"\n @@movement_rate_base += 1\n @@agility += d(6)\n @@accuracy += d(6)\n @@strength += d(6)\n @@appearance += (d(6) + d(6))\n when 29\n physical_alteration = \"Chafing voice.\"\n when 30\n physical_alteration = \"Superior hand-eye coordination.\"\n @@accuracy += (d(6) + d(6) + d(6))\n when 31\n physical_alteration = \"Elongated chin\"\n @@appearance = [@@appearance - d(3), 1].max\n when 32\n physical_alteration = \"Mohawk-like ridge of hair down spine.\"\n when 33\n physical_alteration = \"Beard grows in fork pattern (males only)\"\n when 34\n physical_alteration = \"Bony studs cover body\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@dv -= (d(6) + d(6))\n when 35\n physical_alteration = \"Skin and hair constantly oily.\"\n @@appearance = [@@appearance - d(3), 1].max\n when 36\n physical_alteration = \"Spiked forearms\"\n @@appearance = [@@appearance - d(6), 1].max\n @@attacks << {:attack_mode => \"Spiked forearm smash\", :SV => 3, :rate => 2, :range => 0, :damage => \"d10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"77\", :notes => \"Replaces standard punch.\"}\n when 37\n physical_alteration = \"Increased immunity to alcohol - needs 2x to feel effects.\"\n when 38\n physical_alteration = \"Sonic absorption organ, 1/2 dmg from all sonic attacks.\"\n when 39\n physical_alteration = \"Spike on forehead #{5 + d(10)} cm long.\"\n @@appearance = [@@appearance - d(6), 1].max\n @@attacks << {:attack_mode => \"Forehead spike\", :SV => 3, :rate => 1, :range => 0, :damage => \"d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"77\", :notes => \"\"}\n when 40\n physical_alteration = \"Chicken legs.\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@movement_rate_base += 2\n @@attacks << {:attack_mode => \"Chicken leg kick\", :SV => 3, :rate => 1, :range => 0, :damage => \"d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"77\", :notes => \"Additional melee atack\"}\n when 41\n physical_alteration = \"Dog legs.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@movement_rate_base += (d(6) + d(6) + 2)\n when 42\n physical_alteration = \"Goat legs.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@movement_rate_base += (d(8) + d(8) + 2)\n when 43\n physical_alteration = \"Bat wings instead of arms, tipped with human hands.\"\n when 44\n physical_alteration = \"Massive muscles.\"\n @@movement_rate_base -= 0.5\n @@character_weight += 30\n @@strength += (30 + d(20))\n @@endurance += (10 + d(10))\n when 45\n physical_alteration = \"Barrel-shaped torso.\"\n @@appearance = [@@appearance - d(4), 1].max\n @@strength += (d(8) + d(8))\n @@endurance += (d(10) + d(10) + d(10))\n when 46\n physical_alteration = \"Warty skin.\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n when 47\n physical_alteration = \"Large bulbous nose.\"\n @@appearance = [@@appearance - d(4), 1].max\n when 48\n physical_alteration = \"Massive floppy ears.\"\n @@appearance = [@@appearance - d(8), 1].max\n @@character_notes << \"Due to massive floppy ears, 50 percent hearing increase.\"\n when 49\n physical_alteration = \"Protruding veins.\"\n @@appearance -= (d(4) + d(4))\n when 50\n physical_alteration = \"Stocky legs.\"\n @@appearance = [@@appearance - d(3), 1].max\n @@movement_rate_base -= 1\n when 51\n physical_alteration = \"Broad, flat head, eyes wide apart, pancake-like face.\"\n @@appearance = [@@appearance - (d(6) + 3), 1].max\n when 52\n physical_alteration = \"Lion-like mane, looks like a huge beard.\"\n @@dv -= 2\n # females only @@appearance -= (d(6) + d(6))\n when 53\n physical_alteration = \"Horse tail.\"\n @@agility += d(3)\n when 54\n physical_alteration = \"Skull-like face, sunken features.\"\n @@appearance = [@@appearance - (d(6) + d(6) + 5), 1].max\n when 55\n physical_alteration = \"Lizard tongue.\"\n when 56\n physical_alteration = \"Huge, saggy cheeks.\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n when 57\n feeding_tentacles = (d(6) + d(6))\n physical_alteration = \"#{feeding_tentacles} around mutant's mouth.\"\n @@appearance = [@@appearance - (feeding_tentacles * 2), 1].max\n when 58\n physical_alteration = \"Tongue #{(10 + d(20))} cm long.\"\n when 59\n physical_alteration = \"Large, high forehead.\"\n @@appearance = [@@appearance - d(4), 1].max\n @@intelligence += d(4)\n when 60\n extra_eyes = (d(6) + d(6))\n physical_alteration = \"#{extra_eyes} extra eyes.\"\n @@appearance = [@@appearance - (extra_eyes), 1].max\n @@initiative += (extra_eyes / 2)\n @@character_notes << \"Vision acuity increased by #{(extra_eyes / 2) * 5} percent by extra eyes.\"\n when 61\n physical_alteration = \"Hair the thickness of string.\"\n when 62\n physical_alteration = \"Facial order upside down: mouth on forehead, nose, then eyes.\"\n @@appearance = [@@appearance - (d(6) + d(6) + d(6) + d(6)), 1].max\n when 63\n physical_alteration = \"Double-speed hair growth.\"\n when 64\n physical_alteration = \"Eyes are on the sides of the mutant's head.\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@perception += (d(4) + d(4))\n when 65\n physical_alteration = \"Huge toad-like eyes on top of mutant's head.\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@perception += (d(10) + d(10))\n when 66\n extra_finger_location = random_body_location(d(20))\n physical_alteration = \"Extra finger on #{extra_finger_location}. Mutant suffers -#{d(3)} appearance if extra finger isn't concealed.\"\n when 67\n prehensile_tail_location = random_body_location(d(20))\n physical_alteration = \"Prehensile tail on #{prehensile_tail_location}, 3m length. Can wield dagger or knife in combat.\"\n @@agility += (d(4) + d(4))\n @@movement_rate_base += 1\n if prehensile_tail_location == \"head\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n else\n @@appearance = [@@appearance - d(6), 1].max\n end\n when 68\n physical_alteration = \"Strong immune system: mutant gains 2 hazard checks vs. poison, radiation, disease, etc.\"\n @@character_notes << \"Due to strong immune system, 2 hazard checks vs. poison, radiation, disease, etc.\"\n @@endurance_healing_rate += 4\n\n when 69\n physical_alteration = \"Thick bones.\"\n @@endurance += (d(6) + d(6))\n when 70\n physical_alteration = \"Exceedingly flexible.\"\n @@agility += (d(6) + d(6))\n when 71\n physical_alteration = \"Slow metabolism - mutant requires 1/2 as much food as typical human.\"\n when 72\n physical_alteration = \"Ventriloquist vocal chords - mutant can throw voice 5m.\"\n when 73\n physical_alteration = \"Chameleon skin: can change flesh color to blend into surroundings as skill: conceal self or concealed movement as skill level 4 when near naked.\"\n when 74\n physical_alteration = \"Elongated tongue: #{(14 + d(6) + d(6))} cm long.\"\n when 75\n physical_alteration = \"Gorilla-like hair covers entire body.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n when 78\n physical_alteration = \"Four legs, two sets of hips, legs work in unison.\"\n @@movement_rate_base += (d(6) + 1)\n @@endurance += (d(6) + d(6) + d(6))\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n when 79\n physical_alteration = \"Baggy skin on body and face.\"\n @@appearance = [@@appearance - (d(10) + d(10) + 6), 1].max\n when 80\n physical_alteration = \"Fungal skin growth: white patches across mutant's body.\"\n @@appearance = [@@appearance - d(8), 1].max\n when 81\n physical_alteration = \"Fins grow on mutant's back, shoulders and arms - excellent swimmer!\"\n @@character_notes << \"Due to fins, mutant cannot wear combat or shell class relic armors. Unless fins are sawed off...\"\n @@dv -= 4\n @@appearance = [@@appearance - d(6), 1].max\n @@movement_rate_swimming += d(6)\n when 82\n physical_alteration = \"Awesome body - centerfold level.\"\n @@appearance += (10 + d(10))\n @@strength += (10 + d(10))\n @@endurance += d(10)\n @@agility += d(10)\n @@accuracy += d(10)\n when 83\n physical_alteration = \"Huge heart pumps blood more efficiently.\"\n @@strength += (10 + d(10))\n @@endurance += (10 + d(10))\n @@movement_rate_base += 1\n when 84\n physical_alteration = \"Dense skin: mutant's skin is thick and resistant to physical harm.\"\n @@dv -= 5\n @@endurance += (d(10) + d(10))\n when 85\n physical_alteration = \"Carnivore: mutant cannot safely digest plant matter; however, carrion can be eaten safely.\"\n when 86\n physical_alteration = \"Herbivore: mutant cannot digest meat or animal-derived foods. However, mutant can live on scrub weeds, dry grass, cactus, etc.\"\n when 87\n physical_alteration = \"Bristly patches of thick hair cover #{(10 + d(10))} percent of mutant's body.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@dv -= (d(3) + 1)\n when 88\n physical_alteration = \"Patches of lizard scales cover #{(12 + d(12))} percent of mutant's body.\"\n @@appearance = [@@appearance - (d(8) + d(8)), 1].max\n @@dv -= d(8)\n when 89\n physical_alteration = \"Bone spikes on knees and elbows.\"\n @@appearance = [@@appearance - d(4), 1].max\n @@dv -= 1\n @@attacks << {:attack_mode => \"Bone spikes\", :SV => 3, :rate => 2, :range => 0, :damage => \"d8\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"78\", :notes => \"\"}\n @@character_notes << \"Due to bone spikes, mutant cannot wear combat or shell class relic armors. Unless they are sawed off...\"\n when 90\n physical_alteration = \"Bone-studded fists: +3 dmg to punch attack.\"\n when 91\n physical_alteration = \"Bone ridge down back.\"\n @@appearance = [@@appearance - d(4), 1].max\n @@dv -= (6 + d(6))\n when 92\n physical_alteration = \"Pig's nose.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@character_notes << \"Due to pig's nose, mutant has 50 percent enhanced olfactory sense.\"\n when 93\n physical_alteration = \"Two nipples on each breast.\"\n when 94\n physical_alteration = \"Four ears.\"\n @@appearance = [@@appearance - d(6), 1].max\n @@initiative += 1\n @@character_notes << \"Due to additional ears, character has double the chance to hear anything.\"\n when 95\n physical_alteration = \"Bone spines on back.\"\n @@appearance = [@@appearance - d(6), 1].max\n @@dv -= (d(6) + d(6) + 9)\n @@character_notes << \"Due to bone spines, mutant cannot wear combat or shell class relic armors. Unless they're sawed off...\"\n when 96\n physical_alteration = \"Bone frill around base of skull.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@dv -= (d(6) + d(6))\n @@character_notes << \"Due to bone frill, mutant cannot wear combat or shell class relic armors. Unless it's sawed off...\"\n @@attacks << {:attack_mode => \"Bone frill slash\", :SV => 4, :rate => 1, :range => 0, :damage => \"d12 + 2\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"78\", :notes => \"\"}\n when 97\n physical_alteration = \"Dense muscles and bones.\"\n @@strength += (d(6) + d(6) + d(6))\n @@endurance += (d(6) + d(6) + d(6))\n when 98\n physical_alteration = \"Cat-like balance and grace.\"\n @@agility += (d(6) + d(6))\n @@accuracy += (d(6) + d(6))\n @@appearance += (d(4) + d(4))\n when 99\n 2.times physical_alterations_mutations(d(100))\n when 100\n physical_alteration = \"Toughness.\"\n @@strength += (d(6) + d(6))\n @@endurance += (d(6) + d(6))\n 2.times physical_alterations_mutations(d(100))\n end\n\n @@minor_mutations << \"Physical alteration: #{physical_alteration}\"\n end\n\n physical_alterations_mutations(d(100))\n\n when 92..94\n @@minor_mutations << \"Pouch: water-tight abdominal pouch capable of concealing a relic handgun, 2 grenades, a sheathed knife, 1 days' food and water, tinderbox, or similar-sized objects.\"\n when 95..97\n def wakefulness(roll)\n case roll\n when 2\n \"#{d(6)} hours\"\n when 3..5\n \"#{d(4)} hours\"\n when 6..8\n \"#{d(3)} hours\"\n when 9..10\n \"1 hour\"\n when 11\n \"#{d(20)} minutes\"\n when 12\n \"Mutant never sleeps\"\n end\n sleep_needs = wakefulness((d(6) + d(6)))\n @@minor_mutations << \"Wakefulness: mutant requires less sleep - #{sleep_needs} nightly.\"\n end\n\n when 98..100 # Supposed to roll separate INT and WIL scores for each brain... haven't implemented that yet.\n def underdeveloped_limb(roll)\n case roll\n when 1\n @@minor_mutations << \"A handless arm grows from the shoulder. This limb could have an axe or sword lashed to it for an additional melee attack.\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n when 2\n def extra_head_feature(roll)\n case roll\n when 1\n \"only a mouth\"\n when 2\n \"reserve mind\"\n # add reserve mind\n when 3\n \"a single eye\"\n when 4\n \"a nose only\"\n when 5\n \"ears only\"\n when 6\n \"brain with one random mental mutation, TME1-59 p 59\"\n end\n end\n @@minor_mutations << \"The beginnings of an extra head grows from the shoulders with #{extra_head_feature(d(6))}.\"\n @@appearance = [@@appearance - (d(6) + d(6) + 2), 1].max\n when 3\n @@minor_mutations << \"A third leg grows off the hip, ending at the knee.\"\n @@appearance = [@@appearance - (d(6) + d(6) + 2), 1].max\n @@movement_rate_base -= 1\n when 4\n @@minor_mutations << \"#{d(4)} handless arms grow from the shoulders. Can have a melee weapon lashed to each for additional melee attacks.\"\n when 5\n def extra_torso_feature(roll)\n case roll\n when 1\n \"female reproductive system\"\n when 2\n \"male reproductive system\"\n when 3\n \"additional heart and lungs\"\n @@endurance += (d(10) + d(10))\n @@strength += (d(10) + d(10))\n when 4\n \"digestive system\"\n when 5\n \"#{d(4)} reserve minds\"\n when 6\n #not sure whether this will work...\n brain_extra_mutation = ghost_mutations_determination(d(100))\n \"brain with 1 mental mutation: #{brain_extra_mutation}\"\n end\n end\n @@minor_mutations << \"A large extra torso-like bulge grows from mutant's back, including #{extra_torso_feature(d(6))}.\"\n @@character_weight += 20\n @@appearance = [@@appearance - (d(6) + d(6) + 3), 1].max\n when 6\n head_numbers = d(4)\n head_numbers.times do\n @@minor_mutations << \"Underdeveloped extra head number #{head_numbers} with #{extra_head_feature(d(6))}\"\n head_numbers -= 1\n end\n @@appearance = [@@appearance - (d(6) + d(6) + 2), 1].max\n when 7\n def shrunken_arm_location(roll)\n case roll\n when 1\n \"back\"\n when 2\n \"chest\"\n when 3\n \"side\"\n when 4\n \"shoulder\"\n when 5\n \"belly\"\n when 6\n \"hip\"\n end\n end\n @@minor_mutations << \"A shrunken arm and tiny hand grow from mutant's #{shrunken_arm_location(d(6))}. Arm is 1/4 strength of others but can use a small weapon if character wishes.\"\n @@appearance = [@@appearance - d(6), 1].max\n when 8\n def single_eye_mutation(roll1,roll2) # p. 79\n case roll1\n when 1\n \"back of head\"\n when 2\n \"shoulder\"\n when 3\n \"chest\"\n when 4\n \"forehead\"\n when 5\n \"back\"\n when 6\n \"belly\"\n end\n\n case roll2\n when 1..66\n def single_eye_ability(roll3) # need to add in actual mutation attacks here...\n end\n end\n case roll3\n when 1\n \"devastator pulse\"\n when 2\n \"electro magnetic pulse\"\n when 3\n \"beam eyes\"\n when 4\n \"electrical pulse\"\n when 5\n \"light burst\"\n when 6\n \"night vision\"\n end\n end\n single_eye_ability(d(6))\n @@minor_mutations << \"A single eye winks from mutant's #{single_eye_mutation(d(6), d(100))}\"\n\n # @@minor_mutations << \"Underdeveloped Limb\" # I think this line is redundant...\n end\n underdeveloped_limb(d(8))\n end\nend\n##### End Table TME-1-60 #####\n\n @@minor_mutations_rolls.times do\n minor_mutations_determination(d(100))\n end\n\n\n if @@flaw_mutations_rolls > 0\n flaw_mutations = Array.new\n end\n\n##### Table TME-1-61, Flaw Mutations, Hub Rules p. 59 #####\n\n def flaw_mutations_determination(roll)\n case roll\n when 01..02\n @@flaw_mutations << \"Abnormal Anxiety\"\n when 03..04\n @@flaw_mutations << \"Altered Digestive Tract\"\n when 05..06\n @@flaw_mutations << \"Baldness\"\n when 07..17\n @@flaw_mutations << \"Birth Defect\"\n when 18..19\n @@flaw_mutations << \"Blocked Sinuses\"\n when 20..21\n @@flaw_mutations << \"Chronic Acne\"\n when 22..23\n @@flaw_mutations << \"Chronic Dermatitis\"\n when 24..25\n @@flaw_mutations << \"Chronic IngrownHairs\"\n when 26..27\n @@flaw_mutations << \"Chronic Ulcers\"\n when 28..29\n @@flaw_mutations << \"Coronary Thrombosis\"\n when 30..31\n @@flaw_mutations << \"Degenerated Nervous System\"\n when 32..33\n @@flaw_mutations << \"Dizziness\"\n when 34..35\n @@flaw_mutations << \"Early Menopause (females only)\"\n when 36..37\n @@flaw_mutations << \"Excessive Lung Fluid\"\n when 38..39\n @@flaw_mutations << \"Exhaustion\"\n when 40..41\n @@flaw_mutations << \"Extensive Warts\"\n when 42..43\n @@flaw_mutations << \"Extreme Halitosis\"\n when 44..45\n @@flaw_mutations << \"Faulty Immune System\"\n when 46\n @@flaw_mutations << \"Flammable Tissues\"\n when 47\n @@flaw_mutations << \"Hemophilia\"\n when 48..49\n @@flaw_mutations << \"Hormone Disorder\"\n when 50..51\n @@flaw_mutations << \"Inadequate Nerve Endings\"\n when 52\n @@flaw_mutations << \"Increased Aging\"\n when 53\n @@flaw_mutations << \"Increased Flatulence\"\n when 54..57\n @@flaw_mutations << \"Intense Allergy\"\n when 58..59\n @@flaw_mutations << \"Male Menopause (males only)\"\n when 60..61\n @@flaw_mutations << \"Migraine Headaches\"\n when 62..63\n @@flaw_mutations << \"Osteoporosis\"\n when 64..65\n @@flaw_mutations << \"Permanent Rhinitis\"\n when 66..67\n @@flaw_mutations << \"Perpetual Hiccups\"\n when 68..69\n @@flaw_mutations << \"Pre-Senile Dementia\"\n when 70..71\n @@flaw_mutations << \"Psoriasis\"\n when 72..73\n @@flaw_mutations << \"Reactionary Scent\"\n when 74\n @@flaw_mutations << \"Repeat Paralysis\"\n when 75\n @@flaw_mutations << \"Sonic Intolerance\"\n when 76..77\n @@flaw_mutations << \"Sterility\"\n when 78..79\n @@flaw_mutations << \"Tapeworms\"\n when 80..81\n @@flaw_mutations << \"Tooth Decay\"\n when 82..86\n @@flaw_mutations << \"Toxic Susceptibility\"\n when 87..88\n @@flaw_mutations << \"Tranquilizer Agent\"\n when 89..94\n @@flaw_mutations << \"Visual Disorder\"\n when 95..96\n @@flaw_mutations << \"Voice Disorder\"\n when 97..98\n @@flaw_mutations << \"Weeping\"\n when 99..00\n @@flaw_mutations << \"Whistle Croup\"\n end\n end\n\n @@flaw_mutations_rolls.times do\n flaw_mutations_determination(d(100))\n end\n end", "def missed?; end", "def generate_comprehensive\n\n end", "def serving_size_calc(item_to_make, order_quantity)#two arguments , item to make order quantity \n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}# creating a hash called library, \n #the item to make it's the key and the qty the problem\n error_counter = 3#define a variable cable and set it equal to three.\n\n library.each do |food| #iterating over the hash library \n\n if library[food] != library[item_to_make] #printing error counter - 1\n#we are checking if the library is not equal to the value .\n preturn error_counter += -1 #printing error counter - 1\n end\n end\n\n if error_counter > 0#if error counter is greater than 0 we raise the argument\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n \n \n\n serving_size = library.values_at(item_to_make)[0]#set a variable called serving size\n #equal to library.values at to get the values , and get item and index\n serving_size_mod = order_quantity % serving_size#it sets a variable and set it equal to order quantity remainder of serving size.\n\n# case serving_size_mod\n# when 0\n if serving_size_mod == 0#if serving size is equal to 0 then return the calculations complete\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: #TODO: MAKE THIS FEATURE\"\n end\nend", "def spouse; end", "def prapor_quest; end", "def common_code(email_elem, post_url = Constants::SENDGRID_PARSE_URL)\n p \"testing inbound_email.inspect:#{email_elem.inspect}\"\n\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n meantItRel_hash = ControllerHelper.parse_meant_it_input(input_str)\n p \"meantItRel_hash.inspect:#{meantItRel_hash.inspect}\"\n receiver_pii_count = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII].nil? ? 0 : 1\n message_type_str = ControllerHelper.parse_message_type_from_email_addr(email_elem.to)\np \"email_elem.to:#{email_elem.to}\"\np \"message_type_str:#{message_type_str}\"\n endpoint_tag_arr = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_TAGS].dup\n p \"BBBBBBBB #{email_elem.body_text} BBBBBBB endpoint_tag_arr:#{endpoint_tag_arr.inspect}\"\n # Check each tag for existance\n non_exist_endpoint_tag_arr = []\n endpoint_tag_arr.each { |tag_elem|\n non_exist_endpoint_tag_arr << tag_elem if !Tag.exists?(:name => tag_elem)\n } # end input_tag_arr.each ...\n mood_tag_arr = []\n if message_type_str == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n # CODE!!!! Get mood tags using reasoner\n # mood_tag_arr += ...\n else\n mood_tag_arr << message_type_str\n end # end if message_type_str == MeantItMessageTypeValidator:: ...\n p \"mood_tag_arr:#{mood_tag_arr.inspect}\"\n non_exist_mood_tag_arr = []\n mood_tag_arr.each { |tag_elem|\n non_exist_mood_tag_arr << tag_elem if !Tag.exists?(:name => tag_elem)\n } # end mood_tag_arr.each ...\n p \"#AAAA non_exist_mood_tag_arr.inspect:#{non_exist_mood_tag_arr.inspect}\"\n\n receiver_pii_str = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n auto_entity = nil\n if (auto_entity_arr = ControllerHelper.auto_entity_domain?(receiver_pii_str))\n auto_entity = Entity.find(auto_entity_arr[ControllerHelper::AUTO_ENTITY_DOMAIN_ENTITY_ID]) if !auto_entity_arr.nil?\n end # end if (auto_entity_arr = ControllerHelper.auto_entity_domain? ...\n endPoint_count = auto_entity.nil? ? 2 : 3\n\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', endPoint_count],\n ['Pii.count', 1+receiver_pii_count],\n#20110713 ['Entity.count', 1],\n#20110713 ['EntityDatum.count', 1],\n#20110713 ['EntityEndPointRel.count', 1],\n ['Tag.count', non_exist_endpoint_tag_arr.size + non_exist_mood_tag_arr.size],\n ['EndPointTagRel.count', endpoint_tag_arr.size],\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', non_exist_mood_tag_arr.size]\n ]) do\n @request.path = post_url if !post_url.nil?\n post :create, :inbound_email => email_elem.attributes\n end\n\np \"MeantItMoodTagRel.count:#{MeantItMoodTagRel.count}\"\np \"MeantItMoodTagRel.all:#{MeantItMoodTagRel.all.inspect}\"\n\n if post_url == Constants::SENDGRID_PARSE_URL\n assert_response :success\n else\n assert_redirected_to inbound_email_path(assigns(:inbound_email))\n end # end if post_url == Constants::SENDGRID_PARSE_URL\n\n # Check that email is created\n inbound_email_from_db = InboundEmail.find_by_id(assigns(:inbound_email)[\"id\"])\n assert_not_nil inbound_email_from_db\n\n # Check that sender Pii\n sender_pii_email_hash = ControllerHelper.parse_email(email_elem.from)\n sender_pii_str = sender_pii_email_hash[ControllerHelper::EMAIL_STR]\n sender_pii_nick_str = sender_pii_email_hash[ControllerHelper::EMAIL_NICK_STR]\n if post_url != Constants::SENDGRID_PARSE_URL\n sender_pii_str = \"anonymous\"\n sender_pii_nick_str = nil\n end # end if post_url != Constants::SENDGRID_PARSE_URL\n sender_pii_hash = ControllerHelper.get_pii_hash(sender_pii_str)\n sender_pii = Pii.find_by_pii_value(sender_pii_hash[ControllerHelper::PII_VALUE_STR])\n assert_not_nil sender_pii\n\n # Check that sender EndPoint is created\n#20110628a sender_endPoint = sender_pii.endPoint\n#20110628a assert_not_nil sender_endPoint\n sender_endPoint_arr = sender_pii.endPoints\n assert_equal 1, sender_endPoint_arr.size\n sender_endPoint = sender_endPoint_arr[0]\n if post_url != Constants::SENDGRID_PARSE_URL\n assert_equal \"anonymous\", sender_endPoint.pii.pii_value\n else\n assert_equal sender_pii_str, sender_endPoint.pii.pii_value\n end # end if post_url != Constants::SENDGRID_PARSE_URL\n\n#20110713 # Check that sender Entity is created\n#20110713 sender_entities = sender_endPoint.entities\n#20110713 assert_equal 1, sender_entities.size\n#20110713 sender_entity = sender_entities[0]\n#20110713 assert_not_nil sender_entity\n#20110713 # Check that sender Entity has the same pii\n#20110713 person = ControllerHelper.find_person_by_id(sender_entity.property_document_id)\n#20110713 assert_equal person.email, sender_pii.pii_value\n\n#20110713 # Check that verification_type is email\n#20110713 assert_equal 1, sender_entity.entityEndPointRels.size\n#20110713 sender_entity_entityEndPointRel = sender_entity.entityEndPointRels[0]\n#20110713 assert_equal VerificationTypeValidator::VERIFICATION_TYPE_EMAIL, sender_entity_entityEndPointRel.verification_type\n\n # Check receiver_endPoint\n receiver_nick_str = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_NICK]\n receiver_pii_hash = ControllerHelper.get_pii_hash(receiver_pii_str)\n receiver_pii_str = receiver_pii_hash[ControllerHelper::PII_VALUE_STR]\n receiver_endPoint = EndPoint.find_by_creator_endpoint_id_and_nick(sender_endPoint.id, receiver_nick_str) if !receiver_nick_str.nil? and !receiver_nick_str.empty?\n # Try getting by pii if nick is not provided\n if receiver_endPoint.nil? and !receiver_pii_str.nil? and !receiver_pii_str.empty?\n receiver_endPoint_arr = EndPoint.find(:all, :conditions => { :creator_endpoint_id => sender_endPoint.id})\n receiver_endPoint_arr.each { |receiver_ep|\n if !receiver_ep.pii.nil? and receiver_ep.pii.pii_value == receiver_pii_str\n receiver_endPoint = receiver_ep\n break\n end # end if !receiver_ep.pii.nil?\n } # end receiver_endPoint_arr ...\n end # end if receiver_endPoint.nil? ...\n assert_not_nil receiver_endPoint\n if receiver_pii_str.nil? or receiver_pii_str.empty?\n assert_nil receiver_endPoint.pii\n else # else if !receiver_pii_str.nil? and !receiver_pii_str.empty?\n assert_equal receiver_pii_str, receiver_endPoint.pii.pii_value\n end # end # else if !receiver_pii_str.nil? and !receiver_pii_str.empty?\n\n # Check receiver_endPoint tags\n p \"meantItRel_hash.inspect:#{meantItRel_hash.inspect}\"\n tag_str_arr = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_TAGS]\n p \"tag_str_arr:#{tag_str_arr}\"\n tagged_endPoints = EndPoint.tagged(tag_str_arr)\n p \"tagged_endPoints.inspect:#{tagged_endPoints.inspect}\"\n tagged_endPoint = tagged_endPoints[0]\n if tag_str_arr.nil? or tag_str_arr.empty?\n assert_equal 0, tagged_endPoints.size\n else\n assert_equal 1, tagged_endPoints.size\n assert_equal receiver_endPoint, tagged_endPoint\n end # end if tag_str_arr.nil? ...\n \n # Check that MeantItRel is related to sender_endPoint and receiver_endPoint\n assert_equal 1, sender_endPoint.srcMeantItRels.size\n assert_equal receiver_endPoint.id, sender_endPoint.srcMeantItRels[0].dst_endpoint.id\n assert_equal 1, receiver_endPoint.dstMeantItRels.size\n assert_equal sender_endPoint.id, receiver_endPoint.dstMeantItRels[0].src_endpoint.id\n assert_equal sender_endPoint.srcMeantItRels[0], receiver_endPoint.dstMeantItRels[0]\n # Check that MeantItRel is related to email\n assert_equal inbound_email_from_db.id, sender_endPoint.srcMeantItRels[0].inbound_email_id\n assert_equal inbound_email_from_db.id, receiver_endPoint.dstMeantItRels[0].inbound_email_id\n # Check meantIt type\n assert_equal message_type_str, sender_endPoint.srcMeantItRels[0].message_type\n # Check mood tags\n if sender_endPoint.srcMeantItRels[0].message_type == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n # CODE!!!! Check with reaonser\n else\n meantItMoodTags = sender_endPoint.srcMeantItRels[0].tags\n meantItMoodTag = meantItMoodTags[0]\n assert_equal 1, meantItMoodTags.size\n assert_equal MeantItMoodTagRel::MOOD_TAG_TYPE, meantItMoodTag.desc\n assert_equal message_type_str, meantItMoodTag.name\n end # end if sender_endPoint.srcMeantItRels[0].message_type == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n\n # Check auto_entity association\n if auto_entity\n auto_entity.reload\n assert_not_nil auto_entity.endPoints\n auto_entity_endpoint_association_found = false\n auto_entity.endPoints.each { |auto_entity_ep_elem|\n if !auto_entity_ep_elem.pii.nil? and auto_entity_ep_elem.pii.pii_value == receiver_pii_str\n auto_entity_endpoint_association_found = true if auto_entity_ep_elem.creator_endpoint_id == auto_entity_ep_elem.id\n end # end if auto_entity_ep_elem.pii_value == receiver_pii_str\n } # end auto_entity.endPoints.each ...\n assert auto_entity_endpoint_association_found\n end # end if auto_entity\n \np \"#AAAAA MeantItMoodTagRel.count:#{MeantItMoodTagRel.count}\"\np \"#AAAAA MeantItMoodTagRel.all:#{MeantItMoodTagRel.all.inspect}\"\n end", "def match_antcat_taxon valid_hol_taxon\n puts \"Starting to try to match: \" + valid_hol_taxon.name\n if valid_hol_taxon.antcat_name_id.nil?\n if !valid_hol_taxon.year.nil? and valid_hol_taxon.year >= 2014\n puts \"Hey, this might be new! I can't find the name, and it's 2014 or later!\"\n else\n puts \"no name match\"\n return nil\n end\n end\n\n\n #\n # We have a name, what's missing?\n #\n unless valid_hol_taxon.antcat_protonym_id.nil?\n puts \"What the hell - we have a protonym and we can't figure this out?\"\n end\n @antcat_reference=nil\n if valid_hol_taxon.antcat_reference_id\n puts \"We have a full reference.. that includes year, page range, and author.\"\n @antcat_reference = Reference.find valid_hol_taxon.antcat_reference_id\n\n else\n puts \"No reference listed.\"\n end\n\n\n\n candidate_taxa = Taxon.where(name_id: valid_hol_taxon.antcat_name_id)\n puts \"Checking #{candidate_taxa.length} taxa for matches\"\n\n\n candidate_taxa.each do |taxon|\n taxon_id = check_taxon @antcat_reference, valid_hol_taxon, taxon\n\n # Check antcat synonyms\n if taxon_id.nil?\n taxon.junior_synonyms.each do |synonym|\n puts \"Checking synonym as junior_synonyms #{synonym.name_cache}\"\n\n taxon_id = check_taxon @antcat_reference, valid_hol_taxon, synonym\n end\n end\n if taxon_id.nil?\n taxon.senior_synonyms.each do |synonym|\n puts \"Checking synonym as senior_synonyms #{synonym.name_cache}\"\n taxon_id = check_taxon @antcat_reference, valid_hol_taxon, synonym\n end\n end\n unless taxon_id.nil?\n return taxon_id\n end\n end\n\n puts (\"=============== match failed\")\n nil\n end", "def post_match() end", "def qs_about()\n total_arr = cat_count\n randnums = rand_numbers(total_arr)\n $nums = valid_nums(randnums)\n subjects = get_subjects($nums)\nend", "def mambo_no_5; end", "def method_731(base); end", "def analyze_component_breakdown\n\n end", "def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend", "def serving_size_calc(item_to_make, num_of_ingredients)\n # initializes variables\n # library key value represents number of ingredients required to make the key.\n # sets error counter to 3\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n error_counter = 3\n\n#\n library.each do |food|\n puts \"variable food: #{food}\"\n print \"variable library[food]: \"\n p library[food]\n puts \"variable library[item_to_make]: #{library[item_to_make]}\"\n\n puts; puts\n if library[food] != library[item_to_make]\n # iteration 1: if nil != nil\n\n # iteration 1: if nil != 1 #=> true, subtract 1 from error counter (now is 2)\n # iteration 2: if nil != 1 #=> true, subtract 1 from error counter (now is 1)\n # iteration 3: if nil != 1 #=> true, subtract 1 from error counter ( now is 0)\n error_counter += -1\n end\n end\n#\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n#\n # serving_size = library.values_at(item_to_make) #=> [1]\n serving_size = library.values_at(item_to_make)[0] #=> 1\n\n # 0 = 30 % 1\n remaining_ingredients = num_of_ingredients % serving_size\n#\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "def in_law; end", "def offences_by=(_arg0); end", "def arrange\n\t\t\n\tend", "def bizet; end", "def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Hash of avaialble foods and associated counts\n \n pie_qty = 0\n cake_qty = 0 # quantity of the foods equals to 0 \n cookie_qty = 0\n \n has_fave = false # Initializes our has_fave tood to false\n\n my_list.each_key do |key| # iterating over my_list keys to do a comparison \n if key == fav_food # Favorite food comparison\n has_fave = true # confirms fav_food is in the list \n end\n # has_fave = true if key == fav_food\n end\n \n if has_fave == false # my_list does not contain fav_food \n raise ArgumentError.new(\"You can't make that food\") # Raise error if fav_food was not found\n else # Fav_food was in the list\n fav_food_qty = my_list[fav_food] #.values_at(fav_food)[0] # if in the list, return the quantity on hand *** refactor\n if num_of_people % fav_food_qty == 0 # Checks if num_of_people is evenly divisable by the fav_food_qty\n num_of_food = num_of_people / fav_food_qty # returns num_of_food eq to number of people / fav foods \n return \"You need to make #{num_of_food} #{fav_food}(s).\" # Return favorite food along with quantity\n else #num_of_people % fav_food_qty != 0 # num_of_people was not evenly divisable by fav_food_qty\n while num_of_people > 0 # while num_of_people is greater than zero \n if num_of_people / my_list[\"pie\"] > 0 # At least more people than the quantity of pie will feed \n pie_qty = num_of_people / my_list[\"pie\"] # quantity of pie is equal the number of people divided by my_list of pie \n num_of_people = num_of_people % my_list[\"pie\"] # number of people ramaining after distributing pies\n elsif num_of_people / my_list[\"cake\"] > 0 # At least more people than the quantity of cake \n cake_qty = num_of_people / my_list[\"cake\"] # quantity of cake is equal to the number of people divided by qty of people cake will feed\n num_of_people = num_of_people % my_list[\"cake\"] # number of people remaining after distributing cakes \n else # num_of_people is less than both qty that pie and cake will feed\n cookie_qty = num_of_people # cookie quantity is equal to the number of people \n num_of_people = 0 # Set num_of_people to 0 in order to end the loop\n end # Ending if-else conditions\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def probers=(_arg0); end", "def bakery_num(num_of_people, fav_food) # this is defining bakery_num and takes 2 inputs\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # creates hash, keys are baked goods, values are how many you can feed\n pie_qty = 0 # sets pie_qty to zero\n cake_qty = 0\n cookie_qty = 0\n \n has_fav = false # rename?\n\n my_list.each_key do |k| # iterates through each key in my_list\n if k == fav_food # if they key matches fav_food input\n has_fav = true # change has_fav to true\n end\n end\n \n if has_fav == false # If food isn't in stock/ isn't found\n raise ArgumentError.new(\"You can't make that food\")\n \n else\n fav_food_qty = my_list.values_at(fav_food)[0] # quantity of people favorite food can feed\n \n if num_of_people % fav_food_qty == 0 # if num_of_people can be divided evenly by fav_food_qty\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else\n num_of_fav_food = num_of_people / fav_food_qty\n num_of_people = num_of_people % fav_food_qty\n \n while num_of_people > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n if num_of_people % my_list[\"cake\"] > 0\n cookie_qty = num_of_people\n num_of_people = 0\n end \n end\n \n if fav_food == \"pie\"\n pie_qty = num_of_fav_food\n elsif fav_food == \"cake\"\n cake_qty = num_of_fav_food\n else\n cookie_qty = num_of_fav_food\n end\n\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n \n end \n end\nend", "def prepare_preferred_algorithms!; end" ]
[ "0.58899784", "0.5832999", "0.5825437", "0.5734952", "0.5607078", "0.5379304", "0.53591335", "0.53591335", "0.53446674", "0.53311086", "0.53199476", "0.53168017", "0.5308121", "0.52303857", "0.5219724", "0.52077264", "0.5207246", "0.5196998", "0.51668805", "0.5161702", "0.5153069", "0.5150299", "0.5149931", "0.51437205", "0.5122425", "0.5120479", "0.5112158", "0.509214", "0.5086898", "0.5075263", "0.506926", "0.50688905", "0.50489956", "0.5048843", "0.50266147", "0.50266147", "0.50266147", "0.50266147", "0.5021815", "0.5021815", "0.5021815", "0.5021815", "0.5021815", "0.50112945", "0.50056976", "0.5001894", "0.49860033", "0.49846283", "0.49718133", "0.49676406", "0.4966648", "0.49630517", "0.49623153", "0.49597228", "0.49597228", "0.4957772", "0.49570096", "0.4956752", "0.4956752", "0.4944646", "0.4944646", "0.4944646", "0.49405155", "0.493243", "0.493243", "0.49314865", "0.4929178", "0.49241906", "0.49197942", "0.49094614", "0.49066013", "0.4906534", "0.49043015", "0.49030486", "0.49030486", "0.49030486", "0.49030486", "0.48986527", "0.48962072", "0.48940298", "0.48883736", "0.48798677", "0.48698294", "0.4863917", "0.48591495", "0.4852204", "0.4852164", "0.48392248", "0.48386994", "0.48341644", "0.4833517", "0.48328096", "0.48322827", "0.48266363", "0.48196977", "0.48181075", "0.48109835", "0.48045576", "0.48025307", "0.48024082", "0.48015898" ]
0.0
-1
Yep, the munsters are in trouble. The param is sent as a pointer Their data is toasted Question: 7 Method calls and expressions as arguments
def rps(fist1, fist2) if fist1 == 'rock' (fist2 == 'paper') ? 'paper' : 'rock' elsif fist1 == 'paper' (fist2 == 'scissors') ? 'scissors' : 'paper' else (fist2 == 'rock') ? 'rock' : 'scissors' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method(p0) end", "def probers=(_arg0); end", "def PO114=(arg)", "def PO105=(arg)", "def PO104=(arg)", "def PO109=(arg)", "def PO110=(arg)", "def mech=(_arg0); end", "def mech=(_arg0); end", "def PO113=(arg)", "def PO115=(arg)", "def PO107=(arg)", "def call(*args); end", "def PO101=(arg)", "def call(*) end", "def call(*) end", "def PO108=(arg)", "def PRF04=(arg)", "def PRF02=(arg)", "def PO111=(arg)", "def ITD07=(arg)", "def pass=(_arg0); end", "def PO103=(arg)", "def data=(_arg0); end", "def data=(_arg0); end", "def data=(_arg0); end", "def data=(_arg0); end", "def SAC07=(arg)", "def mdr; sparam(7); end", "def called_from=(_arg0); end", "def called_from=(_arg0); end", "def PO106=(arg)", "def args(*) end", "def postproc=(_arg0); end", "def whiny=(_arg0); end", "def PRF01=(arg)", "def mev; xparam(4); end", "def AMT02=(arg)", "def PO102=(arg)", "def &(arg0)\n end", "def &(arg0)\n end", "def &(arg0)\n end", "def SAC05=(arg)", "def PO112=(arg)", "def parameters=(_arg0); end", "def SE02=(arg)", "def *(p0) end", "def *(p0) end", "def *(p0) end", "def application=(_arg0); end", "def application=(_arg0); end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def CTT07=(arg)", "def call() end", "def params=(_arg0); end", "def params=(_arg0); end", "def y=(_arg0); end", "def MTX02=(arg)", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def argue(argument)\n argument\nend", "def /(arg0)\n end", "def /(arg0)\n end", "def arg; end", "def CTT04=(arg)", "def PRF03=(arg)", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def origin=(_arg0); end", "def return_value=(_arg0); end", "def param; end", "def param; end", "def calls; end", "def calls; end", "def method(arg0)\n end", "def method(arg0)\n end", "def meth(\n\n\n\n *args)\n\nend", "def SAC02=(arg)", "def isolated=(_arg0); end", "def isolated=(_arg0); end", "def pdr; sparam(6); end", "def method(*p1)\n\nend", "def ITD02=(arg)", "def SAC04=(arg)", "def action=(_arg0); end", "def returns=(_arg0); end", "def arguments=(_arg0); end", "def SAC06=(arg)", "def extra=(_arg0); end", "def what_am_i arg arg2\n \nend" ]
[ "0.69950706", "0.68640774", "0.6839202", "0.6766216", "0.6753842", "0.6682509", "0.667608", "0.6633849", "0.6633849", "0.6625599", "0.66199726", "0.6606844", "0.6606266", "0.6594485", "0.6583766", "0.6583766", "0.6579545", "0.65688384", "0.65301424", "0.65045786", "0.650179", "0.6491291", "0.6454722", "0.64316875", "0.64316875", "0.64316875", "0.64316875", "0.64082795", "0.6406884", "0.6391595", "0.6391595", "0.6379763", "0.63743746", "0.63701737", "0.6359353", "0.6353208", "0.63507926", "0.6327033", "0.63197076", "0.6319385", "0.6319385", "0.6319385", "0.6315631", "0.6298127", "0.629395", "0.62936527", "0.6287413", "0.6287413", "0.6285915", "0.6285408", "0.6285408", "0.6278438", "0.6278438", "0.6278438", "0.6278438", "0.6278438", "0.6278438", "0.6278438", "0.6278438", "0.6266817", "0.6265519", "0.6263121", "0.6263121", "0.62482214", "0.62480086", "0.62428194", "0.62428194", "0.62428194", "0.62416106", "0.6238527", "0.6238527", "0.623755", "0.6227206", "0.6224951", "0.6221041", "0.6221041", "0.6221041", "0.6221041", "0.6221041", "0.6194819", "0.6183912", "0.6181485", "0.6181485", "0.61795545", "0.61795545", "0.6179221", "0.6179221", "0.6177594", "0.61718404", "0.6171017", "0.6171017", "0.6159654", "0.61553204", "0.6155047", "0.6152506", "0.6149913", "0.61465734", "0.6146424", "0.61452985", "0.6138967", "0.61363745" ]
0.0
-1
=> I expect paper Question 8: Consider these two methods
def foo(param = 'no') 'yes' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def probers; end", "def same; end", "def private; end", "def offences_by; end", "def silly_adjective; end", "def internship_passed; end", "def schubert; end", "def p15\n\t\nend", "def king_richard_iii; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def herald; end", "def formation; end", "def who_we_are\r\n end", "def suivre; end", "def offences_by=(_arg0); end", "def rassoc(p0) end", "def original_result; end", "def diff2; end", "def returns; end", "def terpene; end", "def stderrs; end", "def hiss; end", "def method_731(base); end", "def jack_handey; end", "def isolated; end", "def isolated; end", "def y; end", "def y; end", "def y; end", "def original; end", "def required_positionals; end", "def in_law; end", "def missed?; end", "def implementation; end", "def implementation; end", "def diff1; end", "def another; return []; end", "def schumann; end", "def romeo_and_juliet; end", "def sharp; accidental; end", "def missing?; end", "def alg; end", "def overload; end", "def villian; end", "def r; end", "def r; end", "def isp; end", "def isp; end", "def berlioz; end", "def ismn; end", "def leeway; end", "def leeway; end", "def celebration; end", "def slop!; end", "def slop!; end", "def positive; end", "def positive; end", "def too_complex; end", "def cardinal; end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def nonstriker_perimartium(pronunciation_crotched)\n end", "def rest_positionals; end", "def alternatives; end", "def ignores; end", "def big_bad; end", "def surge; end", "def bs; end", "def pass; end", "def pass; end", "def strain; end", "def passes; end", "def passes; end", "def exercise_1113 (matrix)\n end", "def kids_musical; end", "def probers=(_arg0); end", "def gounod; end", "def normal(p)\n return nil # FIX ME\n end", "def op; end", "def spice; end", "def malts; end", "def scientist; end", "def issn; end", "def starship; end", "def internal; end", "def missing; end", "def hook_solution?(a); end", "def star; end", "def verdi; end", "def calculated; end", "def how_it_works\r\n end", "def dh; end", "def positive?; end", "def postproc; end", "def spouse; end" ]
[ "0.6544556", "0.63925976", "0.6364433", "0.632286", "0.618429", "0.6174567", "0.6070858", "0.60633785", "0.60516167", "0.58584106", "0.57876784", "0.57876784", "0.57876784", "0.57876784", "0.57749796", "0.5757714", "0.57507384", "0.5699419", "0.56896853", "0.5680971", "0.5674077", "0.56639624", "0.565388", "0.56470805", "0.5631992", "0.5631537", "0.5613286", "0.5608074", "0.56060684", "0.56060684", "0.5574992", "0.5574992", "0.5574992", "0.557222", "0.55628264", "0.555107", "0.55435354", "0.5540931", "0.5540931", "0.5537729", "0.55340457", "0.5526247", "0.55180395", "0.5514083", "0.5507019", "0.54922634", "0.5491879", "0.5485177", "0.54784966", "0.54784966", "0.54773355", "0.54773355", "0.5465984", "0.5460695", "0.5457383", "0.5457383", "0.54525584", "0.5447263", "0.5447263", "0.5445971", "0.5445971", "0.54392016", "0.54346037", "0.54313546", "0.54313546", "0.54313546", "0.54313546", "0.5423397", "0.54169726", "0.5414367", "0.54092044", "0.540919", "0.53999555", "0.53980607", "0.53935754", "0.53935754", "0.538423", "0.53837204", "0.53837204", "0.53815174", "0.53638226", "0.5360357", "0.53600997", "0.53569824", "0.53552693", "0.53515905", "0.53474104", "0.5342698", "0.5342128", "0.53269666", "0.53186786", "0.53167266", "0.5309525", "0.5303514", "0.53006756", "0.5300448", "0.52984303", "0.52856046", "0.5284974", "0.52830863", "0.5279964" ]
0.0
-1
def display_html html = ""
def find_and_mark_done(name) item = items.find{|e| e.name == name} puts "finding |#{name}|" if item item.mark_done! else puts "item not found: #{name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html *args\n @html = true if args.size > 0\n @html\n end", "def html?; end", "def html?; end", "def html?; end", "def html=(b); end", "def html_markup_html(text); end", "def inner_html(*args); end", "def inner_html(*args); end", "def html\n @html ||= process_html!\n end", "def bp_html_print html\n if html.blank?\n out = 'The helper <b>bp_html_print</b> received <b>empty</b> or <b>null</b>.'\n else\n out = html.gsub(/ /, ' ')\n out = out.gsub('id=\"\"', '')\n out = out.gsub('class=\"\"', '')\n out = out.gsub('style=\"\"', '')\n end\n\n out.try(:html_safe)\n end", "def show_html(out = nil)\n print out if out\n exit 205\n end", "def html_open; \"<html>\"; end", "def to_html(*args); end", "def to_html(*args); end", "def to_html(*args); end", "def to_html(*args); end", "def to_html; end", "def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end", "def inner_html(options = T.unsafe(nil)); end", "def html source=nil\n to_html text(source)\n end", "def to_html\n @html ||= format_html\n end", "def html_string\n @html.join(\"\")\n end", "def html\n @html ||= args.dig(:html) || doc.to_html\n end", "def display(text, html_options = nil)\n if html_options\n html_options = html_options.stringify_keys\n tag_options = tag_options(html_options)\n else\n tag_options = nil\n end\n #sanitize(text).to_html.gsub(\"<p>\", \"<p#{tag_options}>\")\n markdown(sanitize(text.gsub(\"\\n\",\"<br/>\"))).gsub(\"<p>\", \"<p#{tag_options}>\")\n end", "def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end", "def setup\n @html = <<-TEXTILE\n<h1>Give RedCloth a try!</h1>\n<p>A <strong>simple</strong> paragraph with<br />\na line break, some <em>emphasis</em> and a <a href=\"http://redcloth.org\">link</a></p>\n<ul>\n\t<li>an item</li>\n\t<li>and another</li>\n</ul>\n<ol>\n\t<li>one</li>\n\t<li>two</li>\n</ol>\nTEXTILE\n \n end", "def html(args)\n str = \"\"\n str << (@inden * level(args)) if pretty?(args)\n str << html_content\n str << @nl if pretty?(args)\n str\n end", "def showInHtml(data)\n \"<div>#{data}</div>\"\n end", "def to_html()\n @html ||= cmark(\"--to\", \"html\")\n @html\n end", "def get_body_for_html_display\n text = self.body.strip\n text = CGI.escapeHTML(text)\n text = MySociety::Format.make_clickable(text, :contract => 1)\n text = text.gsub(/\\n/, '<br>')\n return text\n end", "def html_markup_text(text); end", "def html_markup_org(text); end", "def show_html(html)\n @show_zone.setHtml(html.force_encoding('utf-8'))\n end", "def to_html\n end", "def html(x)\n \"<html>\" + x + \"</html>\"\nend", "def description_html\n convert_html description\n end", "def html(args = nil)\n if args and args[:edit]\n url = self.url_edit\n else\n url = self.url\n end\n\n return \"<a href=\\\"#{Knj::Web.ahref_parse(url)}\\\">#{self.name_html}</a>\"\n end", "def html\n if FUNCTION != 'none'\n if self.md.value != nil\n hm = self.md.value\n else\n hm = INDEX\n end\n @me = YAML.load(self.yaml.value)\n [\n ERB.new(HEAD).result(binding),\n Kramdown::Document.new(ERB.new(hm).result(binding)).to_html,\n \"</body></html>\"\n ].flatten.join('')\n end\n end", "def garnish(html)\n template{ html }\n end", "def to_html(rawtext)\n return \"\" if rawtext.nil?\n \n r = RedCloth.new h(rawtext)\n r.to_html \n end", "def html\n return @html if defined? @html\n\n @html = Henkei.read :html, data\n end", "def to_html\n render_file(main)\n end", "def html\n @html\nend", "def to_html(options = T.unsafe(nil)); end", "def to_html(options = T.unsafe(nil)); end", "def inner_html\n # This sets up the inner html for the to_html call\n end", "def as_displayed\n strip_html.unescape_html.strip_squeeze\n end", "def html\n @browser.html()\n end", "def html_markup_textile(text); end", "def to_html\n @to_html ||= traite_to_html\n end", "def html_simple\n HtmlFormatter.new(self, options).to_s\n end", "def generate_html(individual_files=false)\n return self.to_s\n end", "def generate_html(individual_files=false)\n return self.to_s\n end", "def html\n session.html\n end", "def _(data=\"\"); self.__ self.escape_html(data.to_s); end", "def html\n `$q(this.__native__.innerHTML)`\n end", "def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end", "def show_html\n\t\t# things to be done\n\t\tif @mode == 'saveconf' then\n\t\t\tcase @current_mode\n\t\t\twhen Options\n\t\t\t\tupdate_options\n\t\t\twhen RefList\n\t\t\t\tupdate_tables\n\t\t\tend\n\t\tend\n\n\t\t# update cache\n\t\tif not @setup.secure then\n\t\t\tif not @setup['no_cache'] then\n\t\t\t\tunless @cache then\n\t\t\t\t\t@need_cache_update = true\n\t\t\t\t\t@cache = DispRef2Cache.new( @setup )\n\t\t\t\tend\n\t\t\t\tif not 'never' == @cgi.params['dr2.cache.update'][0] and ('force' == @cgi.params['dr2.cache.update'][0] or @need_cache_update) then\n\t\t\t\t\t@updated_url = @cache.update\n\t\t\t\telsif 'scan' == @cgi.params['dr2.cache.update'][0] then\n\t\t\t\t\t@scanned_url = @cache.scan\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif @setup['no_cache'] then\n\t\t\t\t\t@cache = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# result\n\t\tr = show_description\n\t\tcase @current_mode\n\t\twhen Options\n\t\t\tr << show_options\n\t\twhen RefList\n\t\t\tr << show_unknown_list\n\t\tend\n\t\tr\n\tend", "def display_body \n # mostly taken from JunebugWiki, regexps this beautiful should be shared\n content = self.body.gsub(/\\[\\[([\\w0-9A-Za-z -]+)[|]?([^\\]]*)\\]\\]/) do\n page = title = $1.strip\n title = $2 unless $2.empty?\n page_url = page.gsub(/ /, '_')\n \n if Page.find(:name => page_url).first\n %Q{<a href=\"/show/#{page_url}\">#{title}</a>}\n else\n %Q{<span>#{title}<a href=\"/new/#{page_url}\">?</a></span>}\n end\n end\n RedCloth.new(content, []).to_html\n end", "def wrap(html); end", "def wrap(html); end", "def html!\n @grpc.type = :HTML\n end", "def to_html(entypo: false)\n html_type(entypo:entypo) + \" \" + html_body(inline:true)\n end", "def html\n #this is a way to create longer strings in place easily.\n x = <<DELIM\n<html>\n<body>\n#{yield}\n</body>\n</html>\nDELIM\nend", "def html= html\n native.load_html_string html, nil\n end", "def definition_as_html() \"default html #{self.class}\" end", "def print_html_definition()\n @noko.css(\"li.g:first-of-type\").each {|e| puts e}\n end", "def api_html page\n <<-STR\n<html>\n <head>\n <title>#{self.class} Api Documentation</title>\n <style>\n#{API_CSS}\n </style>\n </head>\n <body class=\"indexpage\">\n <div>\n #{RDoc::Markup::ToHtml.new.convert page.to_s}\n </div>\n </body>\n</html>\n STR\n end", "def display_my_html(book, opts={})\n\n\t\tif book == 999\n\t\t\tname = 'Reach user'\n\t\telse\t\n\t\t theid = book.id\n\t\t name = book.email.upcase\n\t\t html_class = opts.key?(:html_class) ? opts[:html_class] : \"normal\"\n\n\t \tend\n\t render \"shared/chatbot\", name: name, theid: theid, html_class: html_class\n\tend", "def html(include_ocr: false)\n return @html if defined? @html\n\n @html = Henkei.read :html, data, include_ocr: include_ocr\n end", "def html_options; @html_opts end", "def htmlify(text, markup = T.unsafe(nil)); end", "def inner_html= html\n `#@native.innerHTML = html`\n end", "def plain_html\n self.class.to_html.to_html(text.dup)\n end", "def html\n @doc.to_s\n end", "def html\n @doc.to_s\n end", "def add_html message\n # message.gsub(/</,HTML_LT).gsub(/>/,HTML_GT).gsub(/\\t/,HTML_TAB)\n message\n end", "def to_html\n fail NoMethodError, \"Engines need to implement this method\"\n end", "def display\n\t\t\"\"\n\tend", "def to_html(*)\n self\n end", "def html()\r\n $jssh_socket.send(\"var htmlelem = #{DOCUMENT_VAR}.getElementsByTagName('html')[0]; htmlelem.innerHTML;\\n\", 0)\r\n #$jssh_socket.send(\"#{BODY_VAR}.innerHTML;\\n\", 0)\r\n result = read_socket()\r\n return \"<html>\" + result + \"</html>\"\r\n end", "def html_out(*args, &block)\n self.html_out_proc = block\n self.html_out_args = args\n end", "def html_safe\n self\n end", "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end", "def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end", "def _display(replace)\n\t\treturn @contents._display(replace)\n\tend", "def html\n @session.html\n end", "def create_html(options)\n if(options[:html_template] && options[:html_template] == :scientific) then\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Academic Interests<\\/h2>\\r\\n' +\n '<p>Add information about academic fields of interest.<\\/p>\\r\\n' +\n '<h2>Teaching<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Link to programme of study/course&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Link to programme of study/course&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Higher education and employment history<\\/h2>\\r\\n' +\n '<p>Brief introduction to previous education and employment.<\\/p>\\r\\n' +\n '<h2>Honoraria<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Name of prize and (if applicable) link 1&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Name of prize and (if applicable) link 2&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Appointments<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Title and (if applicable) link 1&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Title and (if applicable) link 2&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Cooperation<\\/h2>\\r\\n' +\n '<p>&nbsp;<\\/p>'\n else\n html = '<h2>Faglige interesser<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om faglige interesser.<\\/p>\\r\\n' +\n '<h2>Undervisning<\\/h2>\\r\\n<p>' +\n '&lt;Lenke til studieprogram/emne&gt; <br />\\r\\n' +\n '&lt;Lenke til studieprogram/emne&gt; <br />\\r\\n...<\\/p>\\r\\n' +\n '<h2>Bakgrunn<\\/h2>\\r\\n' +\n '<p>Kort om tidligere arbeidserfaring og utdanning<\\/p>\\r\\n' +\n '<h2>Priser<\\/h2>\\r\\n' +\n '<p>&lt;Navn og eventuelt lenke til pris 1&gt; <br />\\r\\n' +\n '&lt;Navn og eventuelt lenke til pris 2&gt; <br />\\r\\n' +\n '...<\\/p>\\r\\n' +\n '<h2>Verv<\\/h2>\\r\\n<p>' +\n '&lt;Navn og eventuelt lenke til verv 1&gt; <br />\\r\\n' +\n '&lt;Navn og eventuelt lenke til verv 2&gt; <br />\\r\\n...' +\n '<\\/p>\\r\\n' +\n '<h2>Samarbeid<\\/h2>\\r\\n' +\n '<p>&nbsp;<\\/p>'\n end\n else\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Tasks performed<\\/h2>\\r\\n' +\n '<p>Add information about job duties, as a short text or a bulleted list:<\\/p>' +\n '\\r\\n<ul>\\r\\n' +\n ' <li>&lt;Task 1&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Task 1&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Background<\\/h2>\\r\\n' +\n '<p>Add information about previous education and employment.<\\/p>'\n else\n html = '<h2>Arbeidsomr&aring;der<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om arbeidsomr&aring;der, ' +\n 'enten som kort tekst eller som listepunkter:</p>' +\n '\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Arbeidsomr&aring;de 1&gt;</li>\\r\\n' +\n ' <li>&lt;Arbeidsomr&aring;de 1&gt;</li>\\r\\n' +\n ' <li>...</li>\\r\\n' +\n '</ul>' +\n '\\r\\n' +\n '<h2>Bakgrunn</h2>\\r\\n' +\n '<p>Eventuelt kort om tidligere arbeidserfaring og utdanning.</p>'\n end\n end\n return html\n end", "def standard_html( state, encoding = nil, &body_filller )\n html(:language => state.fetch(\"request.language\"), :direction => state.fetch(\"html.direction\", \"ltr\") do\n head do\n meta :charset => @parameters.fetch(:encoding, Encoding.default_internal)\n state.fetch(\"html.headscripts\").each do |script|\n fail_todo \"what now?\"\n end\n state.fetch(\"html.css\").each do |css|\n fail_todo \"what now?\"\n end\n end\n body do\n capture(&body_filler)\n \n state.fetch(\"html.tailscripts\").each do |script|\n fail_todo \"what now?\"\n end\n end\n end\n end\n\n\n #\n # Starts an HTML stream.\n \n def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end\n\n\n #\n # Outputs raw text to the stream.\n \n def raw( text )\n @buffer << text\n end", "def html_page\n <<-END.gsub(/^\\s+/, '')\n <html><head>\n <title>Why Fixturing Is Annoying</title>\n <script src='/app-ui.js'></script>\n </head>\n <body class=\"webapp\">\n <div class=\"app-content-holder\"></div>\n </body></html>\n END\n end", "def custom_display_as_html(code, file_url)\n begin\n review_scores = self.scores\n\n #********************Learning Targets******************\n code = code + \"<h2>Learning Targets</h2><hr>\"\n if review_scores[0].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\" \n end\n\n if review_scores[1].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are specific<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are specific<br/>\"\n end\n\n if review_scores[2].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n end\n\n if review_scores[3].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n end\n\n code = code + \"<br/><i>Number of Learning Targets: </i>#{review_scores[4].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/><i>Grade: </i>#{review_scores[5].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/><i>Comment: </i> <dl><dd>#{review_scores[6].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n #*******************Content************************\n code = code + \"<h2>Content</h2><hr>\"\n code = code + \"<i>File:</i>\"\n if file_url.nil?\n code = code + \"File has not been uploaded<br/>\"\n else\n code = code + file_url.to_s + \"<br/>\"\n end\n \n code = code + \"<i>Compliment:</i>\"\n code = code + \"<ul><li>#{review_scores[8].comments.gsub(/\\\"/,'&quot;').to_s}</li><li>#{review_scores[9].comments.gsub(/\\\"/,'&quot;').to_s}</li></ul>\"\n code = code + \"<i>Suggestion:</i>\"\n code = code + \"<ul><li>#{review_scores[10].comments.gsub(/\\\"/,'&quot;').to_s}</li><li>#{review_scores[11].comments.gsub(/\\\"/,'&quot;').to_s}</li></ul>\"\n\n #*******************Sources and Use of Source Material************************\n code = code + \"<h2>Sources and Use of Source Material</h2><hr>\"\n code = code + \"<br/>How many sources are in the references list?: #{review_scores[12].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/>List the range of publication years for all sources, e.g. 1998-2006: <b>#{review_scores[13].comments.gsub(/\\\"/,'&quot;').to_s} - #{review_scores[14].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/><br/>\"\n\n if review_scores[15].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n end\n\n if review_scores[16].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n end\n\n if review_scores[17].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The citations are in APA format<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The citations are in APA format<br/>\"\n end\n\n if review_scores[18].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n end\n\n if review_scores[19].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n end\n\n if review_scores[20].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n end\n\n if review_scores[21].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The sources represent different viewpoints<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The sources represent different viewpoints<br/>\"\n end\n\n code = code + \"<br/><b>What other sources or perspectives might the author want to consider?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[22].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n \n if review_scores[23].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible. <br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible<br/>\"\n end\n\n code = code + \"<br/><b>If not, which one(s) may infringe copyrights, or what areas of text may need citations, revisions or elaboration?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[24].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n code = code + \"<br/>Please make a comment about the sources. Explain how the author can improve the use of sources in the lesson.<br/>\"\n code = code + \"<dl><dd>#{review_scores[25].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n #*******************Multiple Choice Questions************************\n code = code + \"<h2>Multiple Choice Questions</h2><hr>\"\n if review_scores[26].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n end\n\n if review_scores[27].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n end\n\n if review_scores[28].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n end\n\n if review_scores[29].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions assess the learning target(s)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions assess the learning target(s)<br/>\"\n end\n\n if review_scores[30].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n end\n\n if review_scores[31].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n end\n\n if review_scores[32].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n end\n\n if review_scores[33].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n end\n\n code = code + \"<br/><h3>Questions</h3>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[34].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[35].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[36].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[37].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[38].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[39].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[40].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[41].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[42].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[43].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[44].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[45].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n\n #*******************Rubric************************\n code = code + \"<h2>Rubric</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code +\n \"<div align=\\\"center\\\">The information selected by the author:</div><table class='general'>\n <tr>\n <th>5 - Very Important </th>\n <th>4 - Quite Important </th>\n <th>3 - Some Importance </th>\n <th>2 - Little Importance</th>\n <th>1 - No Importance </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[46].comments == \"1\"\n code = code + \"<li>Is very important for future teachers to know</li>\"\n end\n if review_scores[47].comments == \"1\"\n code = code + \"<li>Is based on researched information</li>\"\n end\n if review_scores[48].comments == \"1\"\n code = code + \"<li>Is highly relevant to current educational practice</li>\"\n end\n if review_scores[49].comments == \"1\"\n code = code + \"<li>Provides an excellent overview and in-depth discussion of key issues</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[50].comments == \"1\"\n code = code + \"<li>Is relevant to future teachers</li>\"\n end\n if review_scores[51].comments == \"1\"\n code = code + \"<li>Is mostly based on researched information</li>\"\n end\n if review_scores[52].comments == \"1\"\n code = code + \"<li>Is applicable to today's schools</li>\"\n end\n if review_scores[53].comments == \"1\"\n code = code + \"<li>Provides a good overview and explores a few key ideas</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[54].comments == \"1\"\n code = code + \"<li>Has useful points but some irrelevant information</li>\"\n end\n if review_scores[55].comments == \"1\"\n code = code + \"<li>Is half research; half the author's opinion</li>\"\n end\n if review_scores[56].comments == \"1\"\n code = code + \"<li>Is partially out-dated or may not reflect current practice</li>\"\n end\n if review_scores[57].comments == \"1\"\n code = code + \"<li>Contains good information but yields an incomplete understanding</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[58].comments == \"1\"\n code = code + \"<li>Has one useful point</li>\"\n end\n if review_scores[59].comments == \"1\"\n code = code + \"<li>Is mostly the author's opinion.</li>\"\n end\n if review_scores[60].comments == \"1\"\n code = code + \"<li>Is mostly irrelevant in today's schools</li>\"\n end\n if review_scores[61].comments == \"1\"\n code = code + \"<li>Focused on unimportant subtopics OR is overly general</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\" \n if review_scores[62].comments == \"1\"\n code = code + \"<li>Is not relevant to future teachers</li>\"\n end\n if review_scores[63].comments == \"1\"\n code = code + \"<li>Is entirely the author's opinion</li>\"\n end\n if review_scores[64].comments == \"1\"\n code = code + \"<li>Is obsolete</li>\"\n end\n if review_scores[65].comments == \"1\"\n code = code + \"<li>Lacks any substantive information</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code +\n \"<div align=\\\"center\\\">To attract and maintain attention, the lesson has:</div><table class='general'>\n <tr>\n <th>5 - Extremely Interesting </th>\n <th>4 - Quite Interesting </th>\n <th>3 - Reasonably Interesting </th>\n <th>2 - Little Interest</th>\n <th>1 - No Interest </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[66].comments == \"1\"\n code = code + \"<li>A sidebar with new information that was motivating to read/view</li>\"\n end\n if review_scores[67].comments == \"1\"\n code = code + \"<li>Many creative, attractive visuals and engaging, interactive elements</li>\"\n end\n if review_scores[68].comments == \"1\"\n code = code + \"<li>Multiple perspectives</li>\"\n end\n if review_scores[69].comments == \"1\"\n code = code + \"<li>Insightful interpretation & analysis throughout</li>\"\n end\n if review_scores[70].comments == \"1\"\n code = code + \"<li>Many compelling examples that support the main points (it \\\"shows\\\" not just \\\"tells\\\")</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[71].comments == \"1\"\n code = code + \"<li>A sidebar that adds something new to the lesson</li>\"\n end\n if review_scores[72].comments == \"1\"\n code = code + \"<li>A few effective visuals or interactive elements</li>\"\n end\n if review_scores[73].comments == \"1\"\n code = code + \"<li>At least one interesting, fresh perspective</li>\"\n end\n if review_scores[74].comments == \"1\"\n code = code + \"<li>Frequent interpretation and analysis</li>\"\n end\n if review_scores[75].comments == \"1\"\n code = code + \"<li>Clearly explained and well supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[76].comments == \"1\"\n code = code + \"<li>A sidebar that repeats what is in the lesson</li>\"\n end\n if review_scores[77].comments == \"1\"\n code = code + \"<li>An effective visual or interactive element</li>\"\n end\n if review_scores[78].comments == \"1\"\n code = code + \"<li>One reasonable (possibly typical) perspective</li>\"\n end\n if review_scores[79].comments == \"1\"\n code = code + \"<li>Some interpretation and analysis</li>\"\n end\n if review_scores[80].comments == \"1\"\n code = code + \"<li>Supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[81].comments == \"1\"\n code = code + \"<li>A quote, link, etc. included as a sidebar, but that is not in a textbox</li>\"\n end\n if review_scores[82].comments == \"1\"\n code = code + \"<li>Visuals or interactive elements that are distracting</li>\"\n end\n if review_scores[83].comments == \"1\"\n code = code + \"<li>Only a biased perspective</li>\"\n end\n if review_scores[84].comments == \"1\"\n code = code + \"<li>Minimal analysis or interpretation</li>\"\n end\n if review_scores[85].comments == \"1\"\n code = code + \"<li>At least one clear and supported point</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[86].comments == \"1\"\n code = code + \"<li>No side bar included</li>\"\n end\n if review_scores[87].comments == \"1\"\n code = code + \"<li>No visuals or interactive elements</li>\"\n end\n if review_scores[88].comments == \"1\"\n code = code + \"<li>No perspective is acknowledged</li>\"\n end\n if review_scores[89].comments == \"1\"\n code = code + \"<li>No analysis or interpretation</li>\"\n end\n if review_scores[90].comments == \"1\"\n code = code + \"<li>No well-supported points</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Credibility</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To demonstrate its credibility the lesson:</div><table class='general'>\n <tr>\n <th>5 - Completely Credible </th>\n <th>4 - Substantial Credibility </th>\n <th>3 - Reasonable Credibility </th>\n <th>2 - Limited Credibility</th>\n <th>1 - Not Credible </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[91].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources in proper APA format</li>\"\n end\n if review_scores[92].comments == \"1\"\n code = code + \"<li>Provides citations for all presented information</li>\"\n end\n if review_scores[93].comments == \"1\"\n code = code + \"<li>Readily identifies bias: both the author's own and others</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[94].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources with few APA errors</li>\"\n end\n if review_scores[95].comments == \"1\"\n code = code + \"<li>Provides citations for most information</li>\"\n end\n if review_scores[96].comments == \"1\"\n code = code + \"<li>Clearly differentiates between opinion and fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[97].comments == \"1\"\n code = code + \"<li>Cites 5 or more reputable sources</li>\"\n end\n if review_scores[98].comments == \"1\"\n code = code + \"<li>Supports some claims with citation</li>\"\n end\n if review_scores[99].comments == \"1\"\n code = code + \"<li>Occasionally states opinion as fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[100].comments == \"1\"\n code = code + \"<li>Cites 4 or more reputable sources</li>\"\n end\n if review_scores[101].comments == \"1\"\n code = code + \"<li>Has several unsupported claims</li>\"\n end\n if review_scores[102].comments == \"1\"\n code = code + \"<li>Routinely states opinion as fact and fails to acknowledge bias</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[103].comments == \"1\"\n code = code + \"<li>Cites 3 or fewer reputable sources</li>\"\n end\n if review_scores[104].comments == \"1\"\n code = code + \"<li>Has mostly unsupported claims</li>\"\n end\n if review_scores[105].comments == \"1\"\n code = code + \"<li>Is very biased and contains almost entirely opinions</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n\n code = code + \"<h3>Pedagogy</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To help guide the reader:</div><table class='general'>\n <tr>\n <th>5 - Superior </th>\n <th>4 - Effective </th>\n <th>3 - Acceptable </th>\n <th>2 - Deficient</th>\n <th>1 - Absent </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[106].comments == \"1\"\n code = code + \"<li>Specific, appropriate, observable learning targets establish the purpose of the lesson</li>\"\n end\n if review_scores[107].comments == \"1\"\n code = code + \"<li>The lesson accomplishes its established goals</li>\"\n end\n if review_scores[108].comments == \"1\"\n code = code + \"<li>Excellent knowledge and application MC questions align with learning targets and assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[109].comments == \"1\"\n code = code + \"<li>Specific and reasonable learning targets are stated</li>\"\n end\n if review_scores[110].comments == \"1\"\n code = code + \"<li>The lesson partially meets its established goals</li>\"\n end\n if review_scores[111].comments == \"1\"\n code = code + \"<li>Well constructed MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[112].comments == \"1\"\n code = code + \"<li>Reasonable learning targets are stated</li>\"\n end\n if review_scores[113].comments == \"1\"\n code = code + \"<li>The content relates to its goals</li>\"\n end\n if review_scores[114].comments == \"1\"\n code = code + \"<li>MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[115].comments == \"1\"\n code = code + \"<li>A learning target is included</li>\"\n end\n if review_scores[116].comments == \"1\"\n code = code + \"<li>Content does not achieve its goal, or goal is unclear</li>\"\n end\n if review_scores[117].comments == \"1\"\n code = code + \"<li>4 questions are included</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[118].comments == \"1\"\n code = code + \"<li>Learning target is missing/ not actually a learning target</li>\"\n end\n if review_scores[119].comments == \"1\"\n code = code + \"<li>Lesson has no goal/ content is unfocused</li>\"\n end\n if review_scores[120].comments == \"1\"\n code = code + \"<li>Questions are missing</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n code = code + \"<h3>Writing Quality</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">The writing:</div><table class='general'>\n <tr>\n <th>5 - Excellently Written </th>\n <th>4 - Well Written </th>\n <th>3 - Reasonably Written </th>\n <th>2 - Fairly Written</th>\n <th>1 - Poorly Written </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[121].comments == \"1\"\n code = code + \"<li>Is focused, organized, and easy to read throughout</li>\"\n end\n if review_scores[122].comments == \"1\"\n code = code + \"<li>Uses rich, descriptive vocabulary and a variety of effective sentence structures</li>\"\n end\n if review_scores[123].comments == \"1\"\n code = code + \"<li>Contains few to no mechanical errors</li>\"\n end\n if review_scores[124].comments == \"1\"\n code = code + \"<li>Has an effective introduction and a conclusion that synthesizes all of the material presented</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[125].comments == \"1\"\n code = code + \"<li>Is organized and flows well</li>\"\n end\n if review_scores[126].comments == \"1\"\n code = code + \"<li>Uses effective vocabulary and sentence structures</li>\"\n end\n if review_scores[127].comments == \"1\"\n code = code + \"<li>Contains a few minor mechanical errors</li>\"\n end\n if review_scores[128].comments == \"1\"\n code = code + \"<li>Has an effective introduction and conclusion based on included information</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[129].comments == \"1\"\n code = code + \"<li>Is mostly organized</li>\"\n end\n if review_scores[130].comments == \"1\"\n code = code + \"<li>Uses properly constructed sentences</li>\"\n end\n if review_scores[131].comments == \"1\"\n code = code + \"<li>Has a few distracting errors</li>\"\n end\n if review_scores[132].comments == \"1\"\n code = code + \"<li>Includes an introduction and a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[133].comments == \"1\"\n code = code + \"<li>Can be difficult to follow</li>\"\n end\n if review_scores[134].comments == \"1\"\n code = code + \"<li>Contains several awkward sentences</li>\"\n end\n if review_scores[135].comments == \"1\"\n code = code + \"<li>Has several distracting errors</li>\"\n end\n if review_scores[136].comments == \"1\"\n code = code + \"<li>Lacks either an introduction or a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[137].comments == \"1\"\n code = code + \"<li>Has minimal organization</li>\"\n end\n if review_scores[138].comments == \"1\"\n code = code + \"<li>Has many poorly constructed sentences</li>\"\n end\n if review_scores[139].comments == \"1\"\n code = code + \"<li>Has many mechanical errors that inhibit comprehension</li>\"\n end\n if review_scores[140].comments == \"1\"\n code = code + \"<li>Has neither a clear introduction nor a conclusion</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n #*******************Ratings************************\n code = code + \"<h2>Ratings</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[141].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[142].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[143].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[144].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Credibility</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[145].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[146].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Pedagogy</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[147].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[148].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Writing Quality</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[149].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[150].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n rescue\n code += \"Error \" + $! \n end \n code\nend", "def html_parser; end", "def display\n @body\n end", "def escape_once(html); end", "def placeholder_html\n to_html\n end", "def render(no_follow = false)\n sanitize = no_follow ?\n @wiki.history_sanitizer :\n @wiki.sanitizer\n\n data = extract_tex(@data.dup)\n data = extract_code(data)\n data = extract_tags(data)\n begin\n data = GitHub::Markup.render(@name, data)\n if data.nil?\n raise \"There was an error converting #{@name} to HTML.\"\n end\n rescue Object => e\n data = %{<p class=\"gollum-error\">#{e.message}</p>}\n end\n data = process_tags(data)\n data = process_code(data)\n if sanitize || block_given?\n doc = Nokogiri::HTML::DocumentFragment.parse(data)\n doc = sanitize.clean_node!(doc) if sanitize\n yield doc if block_given?\n data = doc_to_html(doc)\n end\n data = process_tex(data)\n data.gsub!(/<p><\\/p>/, '')\n data\n end", "def render\n <<-HTML\n <div class=\"relative\">\n <a href=\"#{url}\"class=\"#{position_classes}f6 link dim br2 ph3 pv2 dib white bg-blue\" data-help-link=\"Y\" target=\"cbf-help\">#{Icon.new(:question).render} #{text}</a>\n </div>\n HTML\n end", "def display(text, html_options = nil)\n begin\n if html_options\n html_options = html_options.stringify_keys\n tag_opts = tag_options(html_options)\n else\n tag_opts = nil\n end\n processed_text = format(sanitize(text))\n rescue\n # Sometimes Markdown throws exceptions, so rescue gracefully.\n processed_text = content_tag(:p, sanitize(text))\n end\n add_tag_options(processed_text, tag_opts)\n end", "def display(text, html_options = nil)\n begin\n if html_options\n html_options = html_options.stringify_keys\n tag_opts = tag_options(html_options)\n else\n tag_opts = nil\n end\n processed_text = format(sanitize(text))\n rescue\n # Sometimes Markdown throws exceptions, so rescue gracefully.\n processed_text = content_tag(:p, sanitize(text))\n end\n add_tag_options(processed_text, tag_opts)\n end", "def md_include_html(html)\n res = \"{::options parse_block_html=\\\"true\\\" /}\\n\"\n res << html\n res << \"\\n{::options parse_block_html=\\\"false\\\" /}\\n\"\n return res\nend" ]
[ "0.7678645", "0.7624033", "0.7624033", "0.7624033", "0.7325592", "0.73001677", "0.728522", "0.728522", "0.7198892", "0.7196845", "0.7144725", "0.7139788", "0.71388805", "0.71388805", "0.71388805", "0.71388805", "0.7114885", "0.70977515", "0.70740926", "0.703106", "0.7012978", "0.69647324", "0.6913548", "0.68842125", "0.68818545", "0.68797404", "0.68706185", "0.6859446", "0.68458503", "0.68392134", "0.6813588", "0.6786453", "0.67358047", "0.67286015", "0.6721184", "0.66995716", "0.6677281", "0.666917", "0.66624117", "0.66311675", "0.6630809", "0.6624749", "0.66112256", "0.66026574", "0.66026574", "0.66001576", "0.6583067", "0.6580479", "0.657506", "0.6523417", "0.6512021", "0.6489537", "0.6489537", "0.6486886", "0.6471953", "0.64697915", "0.64399797", "0.64394367", "0.6436324", "0.6429294", "0.6429294", "0.64274096", "0.64216125", "0.64118445", "0.6399064", "0.6396663", "0.6384207", "0.63807994", "0.637935", "0.6376346", "0.63757765", "0.63742036", "0.63677686", "0.63654864", "0.63574785", "0.63574785", "0.63524324", "0.6350346", "0.6346543", "0.63381386", "0.63371694", "0.63349587", "0.6333926", "0.63240623", "0.6323344", "0.6323344", "0.6315129", "0.63149846", "0.6301903", "0.6299653", "0.62871265", "0.62825024", "0.6274389", "0.62718606", "0.6270926", "0.62678385", "0.6264099", "0.62615323", "0.623811", "0.623811", "0.6232533" ]
0.0
-1
GET /test_results/1 GET /test_results/1.json
def show @test_result = TestResult.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @test_result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_results(test_id)\n if !(/\\A\\d+\\z/ === test_id.to_s)\n print \"ERROR: get_results called with non-numeric :test_id = '#{test_id}'\\n\"\n exit -1\n end\n uri = \"get_results/#{test_id}\"\n begin\n @all_results = @tr_con.send_get(uri)\n rescue Exception => ex\n print \"EXCEPTION occurred on TestRail API 'send_get(#{uri})':\\n\"\n print \"\\t#{ex.message}\\n\"\n print \"\\tFailed to retrieve list of results; exiting\\n\"\n exit -1\n end\n @all_results.each_with_index do |next_result,ndx_result|\n print ' '*14\n print \" result-%02d:\" % [ndx_result+1]\n print \" id=%-3d\" % [next_result['id']]\n print \" test_id=%d\" % [next_result['test_id']]\n print \" comment=%s\" % [next_result['comment']]\n print \" defects=%s\" % [next_result['defects']]\n print \"\\n\"\n end\n return\nend", "def index\n @test_results = TestResult.all\n end", "def index\n render status: :ok, json: @tests\n end", "def test_result(test_id)\n test_params = Hashie::Mash.new({test: test_id, pagespeed: 1})\n response = make_request(Response::RESULT_BASE, test_params)\n return not_available (response) unless response.status == 200\n @response = Response.new(self, HashieResponse.new(JSON.parse(response.body)), false)\n end", "def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end", "def results(test_id, day, month, year, options={})\n args = {testId: test_id, day: day, month: month, year: year}\n .merge(options)\n get('testresult', args)\n end", "def index\n @test_example_results = TestExampleResult.all\n end", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end", "def index\n @ptest_results = PtestResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ptest_results }\n end\n end", "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end", "def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_run_results/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def show\n @scenario = Scenario.find(params[:scenario_id])\n @result = @scenario.results.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n\n test_script_result = TestScriptResult.find(params[:id])\n\n respond_to do |format|\n format.xml{render xml: test_script_result.to_xml(root:\n 'test_script_result', skip_types: 'true', include: {test_results: {}})}\n format.json{render json: test_script_result\n .to_json(include: {test_results: {}})}\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end", "def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end", "def fetch_result\n connection = @client.connection\n response = connection.get do |req|\n req.url RESULT_BASE\n req.params['test'] = test_id\n req.params['pagespeed'] = 1\n end\n response_body = HashieResponse.new(JSON.parse(response.body))\n response_body.data.status_code = response_body.statusCode\n response_body.data.status_text = response_body.statusText\n @result = response_body.data\n end", "def results_info\n render json: {results: @experiment.results, error_reason: @experiment.error_reason}\n end", "def show\n @ptest_result = PtestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def show\n submission = Submission.get_submission_by_grouping_id_and_assignment_id(\n params[:group_id], params[:assignment_id])\n\n test_result = submission.test_group_results\n .includes(:test_results)\n .find(params[:test_group_result_id])\n .test_results.find(params[:id])\n\n respond_to do |format|\n format.xml{render xml: test_result.to_xml(root:\n 'test_result', skip_types: 'true')}\n format.json{render json: test_result.to_json}\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result or test result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def fetch_result\n connection = get_connection\n response = connection.get do |req|\n req.url RESULT_BASE\n req.params['test'] = test_id\n req.params['pagespeed'] = 1\n end\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n response_body.data.status_code = response_body.statusCode\n response_body.data.status_text = response_body.statusText\n @result = response_body.data\n end", "def new\n @test_result = TestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_result }\n end\n end", "def show\n @performance_test = PerformanceTest.find(params[:id])\n # @performance_test_results = @performance_test.performance_test_results\n @performance_test_results = PerformanceTestResult.show_query(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @performance_test }\n end\n end", "def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end", "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end", "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def test_result_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_result_response(TEST_ID).to_json)\n end", "def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def show\n @test_results = @test_run.test_results\n end", "def show\n @test_results = Paginate.get_records(\n relation_object: @test_results_from_file.test_results,\n page: params[:page],\n per_page: params[:per_page]\n )\n end", "def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end", "def json_to_results(json)\n json.map do |jr|\n uri = URI(jr['url'])\n # ignore the query string, since it may have some randomness\n uri.query = nil\n Result.new(project.name, jr['confidence'], jr['risk'], uri.to_s, jr['param'], jr['alert'])\n end\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def index\n get_results\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def get_tests(run_id)\n if !(/\\A\\d+\\z/ === run_id.to_s)\n print \"ERROR: get_tests called with non-numeric :run_id = '#{run_id}'\\n\"\n exit -1\n end\n uri = \"get_tests/#{run_id}\"\n @all_tests = @tr_con.send_get(uri)\n #print \" tests found: '#{@all_tests.length}'\\n\" if @all_tests.length > 0\n @all_tests.each_with_index do |next_test,ndx_test|\n print ' '*10\n print \" test-%02d:\" % [ndx_test+1]\n print \" id=%3d\" % [next_test['id']]\n print \" run_id=%s\" % [next_test['run_id']]\n print \" case_id=%s\" % [next_test['case_id']]\n print \" title=%-20s\" % [next_test['title']]\n print \"\\n\"\n get_results(next_test['id'])\n end\n return\nend", "def print_results(response)\n puts response.to_json\nend", "def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end", "def index\n submission = Submission.find(params[:submission_id])\n @test_case_results = submission.test_case_results\n end", "def other_test_result_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_result_response(OTHER_TEST_ID).to_json)\n end", "def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end", "def show\n render status: :ok, json: @test\n end", "def get_synthetics_results(test_id)\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests/#{test_id}/results\", nil, nil, false)\n end", "def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend", "def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end", "def test\n render json: { test: 'Tested.' }\n end", "def test\n render json: { test: 'Tested.' }\n end", "def results\n response['data']\n end", "def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n end", "def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def search\n # bail out if doing an unauthenticated API request\n failures = []\n respond_to do |format|\n format.html do\n @test_instances, failures = \n TestInstance.query(params[:query_text]) if params[:query_text]\n if @test_instances\n @test_instances = @test_instances.page(params[:page])\n end\n unless failures.empty?\n flash.now[:warning] = 'Invalid search parameters: ' + \n failures.join(', ') + '.'\n end\n @show_instructions = @test_instances.nil?\n end\n format.json do\n if authenticated?\n @test_instances, failures = \n TestInstance.query(params[:query_text]) if params[:query_text]\n if @test_instances\n render json: {\"results\" => @test_instances,\n \"failures\" => failures}.to_json\n else\n render json: {\"results\" => [], \"failures\" => failures}.to_json\n end\n else\n fail_authenticate_json\n end\n end\n end\n end", "def test_result_running_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_running_response(OTHER_TEST_ID).to_json)\n end", "def index\n @results = Result.all\n\n end", "def index\n render json: @test_module.test_questions, status: :ok\n end", "def index\r\n render json: { status: \"Test API\"}\r\n end", "def get_results\n case_id = params[:case_id]\n lab_external_id = params[:lab_id]\n consumer_id = get_consumer_id()\n lab = Lab.find_by(lab_external_id: lab_external_id, api_consumer_id: consumer_id)\n lab_id = lab.id.to_s\n tmp_file = File.join('Data/tmp/', lab_id, case_id + '.json')\n data = File.read(tmp_file)\n send_data(data,\n disposition: 'inline',\n type: 'application/json')\n\n File.delete(tmp_file)\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def show\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester }\n end\n end", "def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def index\n render status: :ok, json: @test_guide_scenarios\n end", "def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def show\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test10 }\n end\n end", "def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end", "def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end", "def index\n @gt_metrix_tests = apply_scopes(GtMetrixTest).all\n\n render json: @gt_metrix_tests\n end", "def index\n @utests = index_search\n flash_on_empty @utests\n\n @multi_objs = [@project.unit_tests.new]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @utests }\n format.rss # index.rss.builder\n end\n end", "def index\n @results = Result.all\n end", "def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end", "def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\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 show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result1 = Result1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result1 }\n end\n end", "def index\n @test_results = TestResult.all#.order('created_at DESC')\n end", "def index\n @test_scores = @participant.test_scores.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_scores }\n end\n end", "def index\n @results = Result.all\n @results = Result.paginate(:per_page => 15, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def get_test_plan\n @takt = Taktinfo.find(params[:id])\n @testplans = @takt.testplans.where(:format =>params[:testp])\n\n respond_to do |format|\n format.json{render json:@testplans.as_json(root:false),:callback =>params[:callback]}\n end\n end", "def index\n @runtests = Runtest.all\n end", "def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def index\n @assertions = Assertion.all.sample(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @assertions }\n end\n end", "def index\n @testurls = Testurl.all\n end", "def index\n puts \"test/index\"\n ap params\n done 404\n end", "def get_result\n validate(\n point: :security_json\n )\n\n result = @experiment.get_result_for(Utils::parse_json_if_string(params[:point]))\n\n respond_to do |format|\n format.json do\n if result\n render json: {status: 'ok', result: result}\n else\n render json: {status: 'error', message: 'Point not found'}\n end\n end\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n render json: @test\n end", "def show\n @suite_result = SuiteResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @suite_result }\n end\n end", "def index\n @tests = Test.all\n end" ]
[ "0.7090772", "0.7015706", "0.69446945", "0.6914466", "0.69076174", "0.68909407", "0.6815277", "0.6809064", "0.67920184", "0.67350894", "0.6675372", "0.6635104", "0.66128606", "0.6562649", "0.6532864", "0.6493189", "0.6473844", "0.6472095", "0.6424695", "0.63957787", "0.6358416", "0.63467354", "0.6343455", "0.63266635", "0.63231015", "0.62843317", "0.6280676", "0.6280676", "0.6277795", "0.62741655", "0.6268147", "0.6251325", "0.6234853", "0.6214238", "0.6213662", "0.62135696", "0.6199876", "0.6181972", "0.616917", "0.61450964", "0.6131076", "0.61292386", "0.6125735", "0.61198884", "0.6118559", "0.61185175", "0.6112401", "0.61012864", "0.61012864", "0.60898656", "0.6081735", "0.6073708", "0.6073708", "0.6063854", "0.60436547", "0.6027909", "0.6027636", "0.60244024", "0.6023499", "0.6014999", "0.6014577", "0.6008831", "0.600788", "0.60033196", "0.5998647", "0.59974277", "0.5978814", "0.5975576", "0.5967469", "0.5964402", "0.59616226", "0.59600174", "0.5953733", "0.594473", "0.5944474", "0.5939064", "0.5928529", "0.59216106", "0.58995473", "0.58995473", "0.58995473", "0.58995473", "0.5898681", "0.58934957", "0.58889526", "0.5883434", "0.5872075", "0.5869041", "0.5867085", "0.5862798", "0.5860659", "0.5857782", "0.58556867", "0.58489317", "0.58487654", "0.5848173", "0.5848173", "0.5845225", "0.58449334", "0.58359" ]
0.7047055
1
GET /test_results/new GET /test_results/new.json
def new @test_result = TestResult.new respond_to do |format| format.html # new.html.erb format.json { render json: @test_result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end", "def new\n @test_summary = TestSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_summary }\n end\n end", "def new\n @result = Result.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end", "def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @test_submission = TestSubmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_submission }\n end\n end", "def new\n @test10 = Test10.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test10 }\n end\n end", "def new\n @test_class = TestClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_class }\n end\n end", "def new\n @performance_test = PerformanceTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @performance_test }\n end\n end", "def new\n @tktest = Tktest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tktest }\n end\n end", "def new\n @testdb = Testdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testdb }\n end\n end", "def new\n @team_test = TeamTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_test }\n end\n end", "def new\n @test_page = TestPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_page }\n end\n end", "def new\n @result_item = ResultItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result_item }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan }\n end\n end", "def new\n @test_run = current_user.test_runs.new\n @scenario = Scenario.new\n @registration_scenario = @scenario.registration_scenario || Scenario.new\n @profile = Profile.new\n @target = Target.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def new\n @test_file = TestFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_file }\n end\n end", "def new\n @suite_result = SuiteResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suite_result }\n end\n end", "def new\n @result = Result.new\n @available_states = State.all\n @root = EventType.find(2)\n @add_event_types = @result.event_types\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @utest = @project.unit_tests.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @utest }\n end\n end", "def new\n @test_post = TestPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_post }\n end\n end", "def new\n @expectation = Expectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expectation }\n end\n end", "def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @fixturestat = Fixturestat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixturestat }\n end\n end", "def create\n @test_result = TestResult.new(params[:test_result])\n\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render json: @test_result, status: :created, location: @test_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @result1 = Result1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result1 }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @section_test = SectionTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_test }\n end\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end", "def new\n @software_test = SoftwareTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @software_test }\n end\n end", "def new\n @testis = Teste.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testis }\n end\n end", "def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @experiment }\n end\n end", "def new\n @survey_result = SurveyResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_result }\n end\n end", "def new\n @drug_test = DrugTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drug_test }\n end\n end", "def new\n @test_weight = TestWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_weight }\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end", "def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end", "def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end", "def new\n @dummy_table = DummyTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy_table }\n end\n end", "def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase }\n end\n end", "def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def new\n @query_history = QueryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @query_history }\n end\n end", "def new\n @testcase = Testcase.new\n 3.times { @testcase.scripts.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @testcase }\n end\n end", "def new\n @test_score = @participant.test_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_score }\n end\n end", "def new\n @match_stat = MatchStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match_stat }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @student_test = StudentTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_test }\n end\n end", "def new\n @dtest = Dtest.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dtest }\n end\n end", "def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end", "def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end", "def new\n @test_test = TestTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_test }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end", "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "def new\n @dummy_record = DummyRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dummy_record }\n end\n end", "def new\n @usertest = Usertest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usertest }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_suite }\n end\n end", "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def create\n @test_result = TestResult.new(test_result_params)\n\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render :show, status: :created, location: @test_result }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n #@matches = Match.all\n @title = \"New Ticket\"\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "def new\n\t\t@report = Report.new\n\t\t@report.build_cell\n\t\t@p = params[:test]\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @report }\n\t\tend\n\tend", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @criterion = Criterion.new\n render json: @criterion\n end", "def new\n @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end", "def new\n @checkresult = Checkresult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkresult }\n end\n end", "def new\n @saved_search = SavedSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @saved_search }\n end\n end", "def new\n @task_stat = TaskStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_stat }\n end\n end", "def new\n @mistake = Mistake.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mistake }\n end\n end", "def new\n @inventory_check_result = InventoryCheckResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_check_result }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end", "def new\n @research_item = ResearchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @research_item }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @hit = Hit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hit }\n end\n end" ]
[ "0.7486512", "0.7464759", "0.7310779", "0.7304909", "0.71513826", "0.7114189", "0.7114189", "0.71105796", "0.70877385", "0.70877385", "0.70877385", "0.70877385", "0.70831954", "0.70797867", "0.70424134", "0.7036366", "0.6900908", "0.68955636", "0.68915385", "0.68748975", "0.68512166", "0.6827748", "0.68204606", "0.6820376", "0.6801671", "0.67974436", "0.67687863", "0.67268443", "0.6726123", "0.66910404", "0.6665894", "0.66575295", "0.66575295", "0.6653357", "0.6641733", "0.6627789", "0.6627441", "0.6619936", "0.6619936", "0.6616177", "0.6606452", "0.6603894", "0.660324", "0.6601717", "0.65833604", "0.65817386", "0.657913", "0.6559255", "0.65480334", "0.6539734", "0.6530916", "0.6530916", "0.65271264", "0.6513991", "0.65139157", "0.65132636", "0.64985484", "0.64973146", "0.6497032", "0.64805883", "0.647374", "0.64653486", "0.6454165", "0.6450187", "0.64464176", "0.6441795", "0.6441175", "0.6437717", "0.6412786", "0.64127606", "0.6410725", "0.640864", "0.64046913", "0.6392835", "0.6387462", "0.6386572", "0.6384988", "0.63749456", "0.6374114", "0.6366533", "0.6352197", "0.6351256", "0.6349868", "0.6346204", "0.63449675", "0.6336164", "0.6335291", "0.6331752", "0.6328026", "0.6326635", "0.6320178", "0.6319525", "0.6319525", "0.6319525", "0.6319525", "0.6319525", "0.63191116", "0.6318465", "0.63154685", "0.63126713" ]
0.78427535
0
POST /test_results POST /test_results.json
def create @test_result = TestResult.new(params[:test_result]) respond_to do |format| if @test_result.save format.html { redirect_to @test_result, notice: 'Test result was successfully created.' } format.json { render json: @test_result, status: :created, location: @test_result } else format.html { render action: "new" } format.json { render json: @test_result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @test_result = TestResult.new(test_result_params)\n\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render :show, status: :created, location: @test_result }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if has_missing_params?([:test_output, :test_run_id])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n test_run = TestRun.find(params[:test_run_id])\n begin\n test_run.create_test_script_results_from_json(params[:test_output])\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n rescue\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def report_results(result, score)\n api_token = ENV[\"API_TOKEN\"]\n test_url = ENV[\"API_URL\"]\n track_id = ENV[\"TRACK_ID\"]\n\n test_number = result.name[5..6]\n if test_number == \"58\" #final test code\n puts \"Congratulations on passing the tests!\"\n passed_tests = true\n end\n\n if api_token && test_url && (result.result_code != '.' || passed_tests)\n puts \"Reporting results...\"\n require \"net/http\"\n params = {'test_number'=> score,\n 'api_token' => api_token,\n 'track_id' => track_id\n }\n begin\n res = Net::HTTP.post_form(URI.parse(test_url), params)\n if res.code == \"200\"\n puts \"Results successfully submitted to #{test_url}\"\n end\n rescue\n puts \"Failed to submit results.\"\n end\n end\n end", "def v2_tests_post(test_detail, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: TestsApi#v2_tests_post ...\"\n end\n \n # verify the required parameter 'test_detail' is set\n fail \"Missing the required parameter 'test_detail' when calling v2_tests_post\" if test_detail.nil?\n \n # resource path\n path = \"/v2/tests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json', 'application/xml', 'text/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(test_detail)\n \n\n auth_names = []\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TestSummary')\n if Configuration.debugging\n Configuration.logger.debug \"API called: TestsApi#v2_tests_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @test_example_result = TestExampleResult.new(test_example_result_params)\n\n respond_to do |format|\n if @test_example_result.save\n format.html { redirect_to @test_example_result, notice: 'Test example result was successfully created.' }\n format.json { render :show, status: :created, location: @test_example_result }\n else\n format.html { render :new }\n format.json { render json: @test_example_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end", "def create\n submission = Submission.get_submission_by_grouping_id_and_assignment_id(\n params[:group_id], params[:assignment_id])\n\n test_group_result = submission.test_group_results\n .includes(:test_results)\n .find(params[:test_group_result_id])\n\n if test_group_result.test_results.create(test_result_params)\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n else\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def results(test_id, day, month, year, options={})\n args = {testId: test_id, day: day, month: month, year: year}\n .merge(options)\n get('testresult', args)\n end", "def add_test_results(test_phase, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_addTestResults])\n @payload = JSON.generate(test_suite_result_list)\n @params = Hash.new\n @params[Constants::PARAM_TEST_PHASE] = test_phase\n ReportLog.info('Set up the RTC REST client and start adding test results...')\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n rtc_client.run_successfully ? ReportLog.info('Add completed.') : (raise construct_api_failure_msg(rtc_client))\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end", "def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end", "def test_result(test_id)\n test_params = Hashie::Mash.new({test: test_id, pagespeed: 1})\n response = make_request(Response::RESULT_BASE, test_params)\n return not_available (response) unless response.status == 200\n @response = Response.new(self, HashieResponse.new(JSON.parse(response.body)), false)\n end", "def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end", "def index\n @test_results = TestResult.all\n end", "def index\n render status: :ok, json: @tests\n end", "def create\n @runtest = Runtest.new(runtest_params)\n\n respond_to do |format|\n if @runtest.save\n format.html { redirect_to @runtest, notice: 'Runtest was successfully created.' }\n format.json { render :show, status: :created, location: @runtest }\n else\n format.html { render :new }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ptest_result = PtestResult.new(params[:ptest_result])\n\n respond_to do |format|\n if @ptest_result.save\n format.html { save_html }\n format.json { render :json => @ptest_result, :status => :created, :location => @ptest_result }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ptest_result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_case_result = TestCaseResult.new(test_case_result_params)\n\n respond_to do |format|\n if @test_case_result.save\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_case_result }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_transaction\n @results = []\n result_params = params.fetch(:result, {})\n\n result_params.each do |rp|\n permitted_rp = rp.permit(*Api::V1::Result::STRONG_PARAMETERS)\n result = Api::V1::Result.new(permitted_rp)\n result.save!\n\n @results << result\n end\n\n #session.commit_transaction\n #end\n\n render json: @results\n end", "def upload_results(yaml, results_url='http://localhost:3000/test_results')\n begin\n url = URI.parse(results_url)\n response = Net::HTTP.post_form url, {:results => yaml}\n rescue Errno::ECONNREFUSED => e\n say 'Unable to post test results. Can\\'t connect to the results server.'\n rescue => e\n say e.message\n else\n case response\n when Net::HTTPSuccess\n body = YAML::load(response.body)\n url = body[:data][0] if body[:data]\n say \"Test results posted successfully! \\n\\t#{url}\"\n when Net::HTTPRedirection\n upload_results yaml, response.fetch('Location')\n when Net::HTTPNotFound\n say %q[Unable to find where to put the test results. Try: `gem update rubygems-test`]\n when Net::HTTPClientError\n say %q[Results server didn't like the results submission. Try: `gem update rubygems-test`]\n when Net::HTTPServerError\n say %q[Oof. Something went wrong on the results server processing these results. Sorry!]\n else\n say %q[Something weird happened. Probably a bug.]\n end\n end\n end", "def get_results(test_id)\n if !(/\\A\\d+\\z/ === test_id.to_s)\n print \"ERROR: get_results called with non-numeric :test_id = '#{test_id}'\\n\"\n exit -1\n end\n uri = \"get_results/#{test_id}\"\n begin\n @all_results = @tr_con.send_get(uri)\n rescue Exception => ex\n print \"EXCEPTION occurred on TestRail API 'send_get(#{uri})':\\n\"\n print \"\\t#{ex.message}\\n\"\n print \"\\tFailed to retrieve list of results; exiting\\n\"\n exit -1\n end\n @all_results.each_with_index do |next_result,ndx_result|\n print ' '*14\n print \" result-%02d:\" % [ndx_result+1]\n print \" id=%-3d\" % [next_result['id']]\n print \" test_id=%d\" % [next_result['test_id']]\n print \" comment=%s\" % [next_result['comment']]\n print \" defects=%s\" % [next_result['defects']]\n print \"\\n\"\n end\n return\nend", "def create\n @test_run = TestRun.new(params[:test_run])\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render json: @test_run, status: :created, location: @test_run }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_result_params\n params.require(:test_result).permit(:answers, :test_items, :score,:status, :start_time)\n end", "def test_post_success_with_param\n post \"/\", {:data => @test_obj} do |response|\n assert response.ok?, \"Create test object failed\"\n assert_equal response.body, @test_obj.to_json, \"Did not get @test_obj back\"\n end\n end", "def create\n @performance_test = PerformanceTest.new(params[:performance_test])\n\n respond_to do |format|\n if @performance_test.save\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully created.' }\n format.json { render :json => @performance_test, :status => :created, :location => @performance_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @test_result = TestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_result }\n end\n end", "def test_result_params\n params.permit(:name, :status, :marks_earned, :output)\n end", "def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n if @test.is_online \n @test.status = \"Not Started\" \n else\n @test.status = \"Ended\" \n end\n respond_to do |format|\n if @test.save \n\n @students = @test.subject_class.students #create student test result and set to zero to be edited by instructor\n \n @students.each do |student|\n result = TestResult.new(test_id: @test.id, student_id: student.id, score: 0, status: TestResult::STATUS_LIST[0], last_time_online: Date.today, time_finished: Date.today, reason: TestResult::REASON_LIST[3])\n if result.save\n puts \"==============================================\"\n puts \"test result created\"\n puts \"==============================================\"\n else\n puts \"==============================================\"\n puts result.errors.full_messages\n puts \"==============================================\"\n \n end\n \n \n end \n\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testtest = Testtest.new(testtest_params)\n\n respond_to do |format|\n if @testtest.save\n format.html { redirect_to @testtest, notice: 'Testtest was successfully created.' }\n format.json { render :show, status: :created, location: @testtest }\n else\n format.html { render :new }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_index \n post :index \n assert_response :success \n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ptest_results = PtestResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ptest_results }\n end\n end", "def create\n @test_run = TestRun.new(test_run_params)\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render :show, status: :created, location: @test_run }\n format.js { render action: 'show', status: :created, location: @test_run }\n else\n format.html { render :new }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n format.js { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n result = Test.new.create_test(test_params)\n if result\n return render json: {message: 'Test was created succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not created succesfully', error: true }\n end\n end", "def post\n j :pass\nlabel :fail\n RVTEST_FAIL()\nlabel :pass\n RVTEST_PASS()\n RVTEST_CODE_END()\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def create\n @jsontest = Jsontest.new(jsontest_params)\n\n respond_to do |format|\n if @jsontest.save\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully created.' }\n format.json { render :show, status: :created, location: @jsontest }\n else\n format.html { render :new }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_test_results\n test_target_instance = get_new_test_target_instance(\"example2\", \"2012112802\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1)\n end", "def create\n @test_result = TestResult.new(test_result_params)\n @test_result.user_id = current_user.id\n #@test_result.date = Time.now.strftime(\"%d%m%Y\")\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render :show, status: :created, location: @test_result }\n else\n format.html { render :new }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_result_params\n params.require(:test_result).permit(:v1, :v2, :v3, :v4, :v5, :v6, :date)\n end", "def test_result_params\n params.require(:test_result).permit(:ext_id, :tests_count, :tests_passed, :tests_failed, :tests_skipped, :release_id,\n :split_id, :config_id, :asssignee_id)\n end", "def create\n @test = Test.new(params[:test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render json: @test, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @test_example_results = TestExampleResult.all\n end", "def test_should_create_test_result\n test_target_instance = get_new_test_target_instance(\"example1\", \"2012112801\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n assert_response :success\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n end", "def create\n @runscope_test = RunscopeTest.new(runscope_test_params)\n\n respond_to do |format|\n if @runscope_test.save\n format.html { redirect_to @runscope_test, notice: 'Runscope test was successfully created.' }\n format.json { render :show, status: :created, location: @runscope_test }\n else\n format.html { render :new }\n format.json { render json: @runscope_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def run\n @test_run = TestRun.find(params[:id])\n @test_run.run\n\n respond_to do |format|\n format.html { redirect_to @test_run }\n format.json { head :no_content }\n end\n end", "def test_example_result_params\n params.require(:test_example_result).permit(:result, :run_time, :test_example_id, :test_suite_result_id)\n end", "def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def create\n #p params\n if params[:results].present? && params[:results][:answers].present?\n answers = params[:results][:answers] \n params[:results].delete :answers\n #params[:aspects]=params[:aspects]+1\n end\n\n #p \"Array?: \" + params[:results][:aspects].is_a?(Array).to_s\n #p \"String?: \" + params[:results][:aspects].is_a?(String).to_s\n \n @results = Result.create(params[:results])\n if answers\n answers.each do |answer|\n @results.answers.build(answer)\n end\n end\n\n if @results.save\n\n # @results.send_email\n @results.delay.send_email\n end\n\n respond_with(@results)\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Prueba creada exitosamente.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def create\r\n @phr = Phr.find(params[:phr_id])\r\n @user = current_user\r\n @test = @phr.tests.create(test_params)\r\n\r\n if @test.save\r\n flash[:success] = \"Test Result Saved\"\r\n redirect_to(phr_tests_path(@phr, @test))\r\n else\r\n flash[:failure] = \"Please fill in all fields as required\"\r\n render 'new'\r\n end\r\n end", "def test_case_result_params\n params.require(:test_case_result).permit(:status, :submission_id, :test_case_id)\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 @terra_nova_test_benchmark = TerraNovaTestBenchmark.new(terra_nova_test_benchmark_params)\n\n respond_to do |format|\n if @terra_nova_test_benchmark.save\n format.html { redirect_to @terra_nova_test_benchmark, notice: 'Terra nova test benchmark was successfully created.' }\n format.json { render :show, status: :created, location: @terra_nova_test_benchmark }\n else\n format.html { render :new }\n format.json { render json: @terra_nova_test_benchmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def report_test_results(test_name, results)\n status = true\n message = \"\"\n for result in results\n # print (\"Status: \"+result[0].to_s+\"\\n\")\n status = (status && result[0])\n if (result[1].is_a?(Array))\n for m in result[1]\n message += m.to_s + \"\\n\\t\"\n end\n else\n message += result[1] + \"; \"\n end\n end\n\n report_test_result(test_name, status, message)\nend", "def create\n @test_detail = TestDetail.new(test_detail_params)\n\n respond_to do |format|\n if @test_detail.save\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully created.' }\n format.json { render :show, status: :created, location: @test_detail }\n else\n format.html { render :new }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testing_algorithm = TestingAlgorithm.new(params[:testing_algorithm])\n\n if @testing_algorithm.save\n render json : @testing_algorithm, status : :created, location : @testing_algorithm\n else\n render json : @testing_algorithm.errors, status : :unprocessable_entity\n end\n end", "def publish_test_results(test_category, test_phase, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n\n test_suite_result_list.each do |test_suite_result|\n test_suite_name = test_suite_result['TestSuiteName']\n test_count = test_suite_result['TestCount'].to_i\n error_count = test_suite_result['ErrorCount'].to_i\n failure_count = test_suite_result['FailureCount'].to_i\n\n pass_rate = 1 - (error_count.to_f + failure_count.to_f)/test_count.to_f\n\n input = Hash.new\n input[:RTCConfig] = data_for(:RTC_config)\n\n if pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:minor_threshold])\n # pass rate standard not met, create or update existing defect\n if pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:blocker_threshold])\n defect_severity = Constants::RTC_SEVERITY_BLOCKER\n elsif pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:major_threshold])\n defect_severity = Constants::RTC_SEVERITY_MAJOR\n elsif pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:normal_threshold])\n defect_severity = Constants::RTC_SEVERITY_NORMAL\n else\n defect_severity = Constants::RTC_SEVERITY_MINOR\n end\n\n # Check from the TEST DB whether there is already an open defect for this test suite\n # if yes, update it\n # if no, create a new one\n\n # set up RTC client and run /getOpenTestAutoDefect API\n ReportLog.info('Pass rate beneath standard. Update existing open defect or create a new one.')\n ReportLog.info(\"Looking for open defect for test suite #{test_suite_name} ...\")\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getOpenTestAutoDefect])\n @payload = JSON.generate(input)\n @params = Hash.new\n @params[Constants::PARAM_TEST_SUITE_NAME] = test_suite_name\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n @params = Hash.new\n @params[Constants::PARAM_TEST_CATEGORY] = test_category\n @params[Constants::PARAM_TEST_PHASE] = test_phase\n @params[Constants::PARAM_DEFECT_SEVERITY] = defect_severity\n input['TestSuiteResult'] = test_suite_result\n @payload = JSON.generate(input)\n if rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).nil?\n # no existing open defect, create a new one\n ReportLog.info('Open defect not found. Creating a new one...')\n # set up RTC client and run /createTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_createTestAutoDefect])\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Created a new defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n else\n # existing open defect found, update it\n ReportLog.info('Open defect found. Updating its content...')\n # set up RTC client and run /updateTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_updateTestAutoDefect])\n @params[Constants::PARAM_DEFECT_NUM] = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Defect Number').to_s\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Updated the open defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n else\n raise construct_api_failure_msg(rtc_client)\n end\n else\n # pass rate reached standard, close open defect automatically\n # Check from the TEST DB whether there is already an open defect for this test suite\n # if yes, close it\n # if no, do nothing, you are good\n\n # set up RTC client for /getOpenTestAutoDefect API\n ReportLog.info('Pass rate reached standard. Close open defect if there is any.')\n ReportLog.info(\"Looking for open defect for test suite #{test_suite_name} ...\")\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getOpenTestAutoDefect])\n @payload = JSON.generate(input)\n @params = Hash.new\n @params[Constants::PARAM_TEST_SUITE_NAME] = test_suite_name\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n @params = Hash.new\n if rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).nil?\n # do nothing\n else\n # existing open defect found, close it\n ReportLog.info('Open defect found. Closing it...')\n # set up RTC client and run /closeTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_closeTestAutoDefect])\n @params[Constants::PARAM_DEFECT_NUM] = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Defect Number').to_s\n @params[Constants::PARAM_COMMENT] = \"Closed defect upon test execution at #{test_suite_result['ExecutionTimestamp']} \"\n + \"from build #{test_suite_result['Build']['BuildName']} \"\n + \"with an acceptable pass rate of #{pass_rate}.\"\n @params[Constants::PARAM_BUILD_NAME] = test_suite_result['Build']['BuildName']\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Closed the open defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n end\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend", "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end", "def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def unitTests\n #handle unexpected error with status code 500\n begin\n system(\"rake test:units > output.txt\")\n aFile = File.new(\"output.txt\", \"r\")\n data = aFile.readlines\n aFile.close()\n totalTests = Integer(data[-1].split(\",\")[0].split(\" \")[0])\n nrFailed = Integer(data[-1].split(\",\")[-2].split(\" \")[0]) + Integer(data[-1].split(\",\")[-3].split(\" \")[0])\n if nrFailed == 0\n dic = {:totalTests => totalTests, :nrFailed => 0, :output => \"unitTests all passes\"}\n else\n aFile = File.new(\"output.txt\", \"r\")\n output = aFile.read.split(\"\\n\").join\n aFile.close()\n dic = {:totalTests => totalTests, :nrFailed => nrFailed, :output => output}\n end\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n rescue\n render :json => { :errors => \"Unknown Errors\" }, :status => 500\n end\n end", "def create\n @application_test = ApplicationTest.new(application_test_params)\n\n respond_to do |format|\n if @application_test.save\n format.html { redirect_to @application_test, notice: 'Application test was successfully created.' }\n format.json { render :show, status: :created, location: @application_test }\n else\n format.html { render :new }\n format.json { render json: @application_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @smoke_test = SmokeTest.new(params[:smoke_test])\n\n respond_to do |format|\n if @smoke_test.save\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully created.') }\n format.json { render :json => @smoke_test, :status => :created, :location => @smoke_test }\n format.xml { render :xml => @smoke_test, :status => :created, :location => @smoke_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test\n render json: { test: 'Tested.' }\n end", "def test\n render json: { test: 'Tested.' }\n end", "def create\n @tktest = Tktest.new(params[:tktest])\n\n respond_to do |format|\n if @tktest.save\n format.html { redirect_to @tktest, notice: 'Tktest was successfully created.' }\n format.json { render json: @tktest, status: :created, location: @tktest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n @benchmark_test = BenchmarkTest.new(benchmark_test_params)\n\n respond_to do |format|\n if @benchmark_test.save\n format.html { redirect_to @benchmark_test, notice: 'Benchmark test was successfully created.' }\n format.json { render :show, status: :created, location: @benchmark_test }\n else\n format.html { render :new }\n format.json { render json: @benchmark_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def postResult(caseId, comment, statusId, testRunId)\n url = \"add_result_for_case/#{testRunId}/#{caseId}\"\n @client.send_post(url, {:status_id => statusId, :comment => \"#{comment}\"})\n end", "def create\n @test10 = Test10.new(params[:test10])\n\n respond_to do |format|\n if @test10.save\n format.html { redirect_to @test10, notice: 'Test10 was successfully created.' }\n format.json { render json: @test10, status: :created, location: @test10 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @suite_result = SuiteResult.new(params[:suite_result])\n\n respond_to do |format|\n if @suite_result.save\n format.html { redirect_to @suite_result, notice: 'Suite result was successfully created.' }\n format.json { render json: @suite_result, status: :created, location: @suite_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @suite_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_process_results(original_results_directory = nil)\n puts ' ========================= Starting Results Post Process ================================'\n puts \"Current directory: #{@base_dir}\"\n puts \"Test results will be stored in: #{test_results_dir}\"\n\n results = OpenStudioMeasureTester::OpenStudioTestingResult.new(@base_dir, test_results_dir, original_results_directory)\n results.save_results # one single file for dashboard\n\n # call the create dashboard command now that we have results\n dashboard\n\n # return the results exit code\n return results.exit_code\n end", "def to_json\n # TODO: The tests array should be converted to an array of test ids rather than the actual test objects for insertion into the database\n # the tests will be written to the database independently and will be referenced instead of keeping 2 copies of the data in the database\n # JSON.generate to_hash\n hash = to_hash\n results = {primary: nil, rerun: nil}\n results[:primary] = hash[:results][:primary].to_json unless hash[:results][:primary].nil?\n results[:rerun] = hash[:results][:rerun].to_json unless hash[:results][:rerun].nil?\n hash[:results] = results\n JSON.generate hash\n end", "def create\n @validation_test = ValidationTest.new(validation_test_params)\n\n respond_to do |format|\n if @validation_test.save\n format.html { redirect_to @validation_test, notice: 'Validation test was successfully created.' }\n format.json { render :show, status: :created, location: @validation_test }\n else\n format.html { render :new }\n format.json { render json: @validation_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def postResult(caseId,comment,statusId,testRunId)\n\t\t\turl = \"add_result_for_case/#{testRunId}/#{caseId}\"\n\t\t\t@client.send_post(url, { :status_id => statusId, :comment => \"#{comment}\" })\n\t\tend", "def create\n @test_post = TestPost.new(test_post_params)\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render :show, status: :created, location: @test_post }\n else\n format.html { render :new }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end", "def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_datum = TestDatum.new(test_datum_params)\n\n respond_to do |format|\n if @test_datum.save\n format.html { redirect_to @test_datum, notice: 'Test datum was successfully created.' }\n format.json { render :show, status: :created, location: @test_datum }\n else\n format.html { render :new }\n format.json { render json: @test_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testing_ = Testing.new(testing__params)\n\n respond_to do |format|\n if @testing_.save\n format.html { redirect_to @testing_, notice: 'Testing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testing_ }\n else\n format.html { render action: 'new' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_post = TestPost.new(params[:test_post])\n\n respond_to do |format|\n if @test_post.save\n format.html { redirect_to @test_post, notice: 'Test post was successfully created.' }\n format.json { render json: @test_post, status: :created, location: @test_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_post.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.752083", "0.6911543", "0.6891898", "0.664816", "0.65713704", "0.6549887", "0.653845", "0.6536352", "0.6436746", "0.6381427", "0.6362798", "0.63226426", "0.62948805", "0.6285781", "0.62823325", "0.6278133", "0.6271401", "0.62658215", "0.62624955", "0.6257092", "0.6234423", "0.62258166", "0.6206354", "0.6188039", "0.61775", "0.61500996", "0.6090356", "0.6073212", "0.6040537", "0.60242295", "0.601273", "0.6012383", "0.59967405", "0.5989662", "0.5986208", "0.5976084", "0.59721345", "0.5943709", "0.5943709", "0.5943709", "0.5943709", "0.5943709", "0.5943709", "0.5936203", "0.5932982", "0.5931495", "0.59018975", "0.5899104", "0.5898372", "0.58963305", "0.5893995", "0.5879707", "0.58775616", "0.5849333", "0.5849017", "0.58375615", "0.5831981", "0.5827997", "0.58038294", "0.5788665", "0.57862955", "0.57771814", "0.5770146", "0.57597065", "0.575608", "0.5753044", "0.5752741", "0.5745151", "0.5737771", "0.5736308", "0.5729692", "0.5721838", "0.57209855", "0.5719237", "0.56948924", "0.5685973", "0.56828725", "0.567861", "0.56684107", "0.56684107", "0.5666518", "0.566527", "0.56545377", "0.56513125", "0.56501234", "0.56428295", "0.5640369", "0.5639701", "0.5635568", "0.56339586", "0.56317574", "0.5621804", "0.5621358", "0.56174034", "0.5609894", "0.5605613", "0.5603499", "0.5602951", "0.5600962", "0.55902994" ]
0.679325
3
PUT /test_results/1 PUT /test_results/1.json
def update @test_result = TestResult.find(params[:id]) respond_to do |format| if @test_result.update_attributes(params[:test_result]) format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @test_result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end", "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n if has_missing_params?([:id, :test_output, :test_run_id])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n\n test_script_result = TestScriptResult.find(params[:id])\n test_run = TestRun.find(params[:test_run_id])\n if test_run.create_test_script_results_from_json(params[:test_output]) && test_script_result.destroy\n render 'shared/http_status', locals: {code: '200', message: HttpStatusHelper::ERROR_CODE['message']['200']},\n status: 200\n else\n # Some other error occurred\n render 'shared/http_status', locals: {code: '500', message: HttpStatusHelper::ERROR_CODE['message']['500']},\n status: 500\n end\n end", "def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n respond_to do |format|\n if @test_example_result.update(test_example_result_params)\n format.html { redirect_to @test_example_result, notice: 'Test example result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_example_result }\n else\n format.html { render :edit }\n format.json { render json: @test_example_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def test_single_user_should_update_test_results_under_c1\n test_target_instance = get_new_test_target_instance(\"example3\", \"2012112803\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 2, 3, 2)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 2, 3, 2)\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n respond_to do |format|\n if @test_case_result.update(test_case_result_params)\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n submission = Submission.get_submission_by_grouping_id_and_assignment_id(\n params[:group_id], params[:assignment_id])\n\n test_result = submission.test_group_results\n .includes(:test_results)\n .find(params[:test_group_result_id])\n .test_results.find(params[:id])\n\n # Update filename if provided\n if test_result.update(test_result_params)\n # Everything went fine; report success\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200']}, status: 200\n else\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or test script result or test result\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def update\n @ptest_result = PtestResult.find(params[:id])\n\n respond_to do |format|\n if @ptest_result.update_attributes(params[:ptest_result])\n format.html { redirect_to @ptest_result, :notice => 'Ptest result was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ptest_result.errors, :status => :unprocessable_entity }\n end\n end\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_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "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 @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_run.update(test_run_params)\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_run }\n else\n format.html { render :edit }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n if @test.update(test_params)\n return render json: {message: 'Test was updated succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not updated succesfully', error: true }\n end\n end", "def update\n @performance_test = PerformanceTest.find(params[:id])\n\n respond_to do |format|\n if @performance_test.update_attributes(params[:performance_test])\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test1.update(test1_params)\n format.html { redirect_to @test1, notice: \"Test1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @runtest.update(runtest_params)\n format.html { redirect_to @runtest, notice: 'Runtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @runtest }\n else\n format.html { render :edit }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testing_algorithm = TestingAlgorithm.find(params[:id])\n\n if @testing_algorithm.update(params[:testing_algorithm])\n head :no_content\n else\n render json : @testing_algorithm.errors, status : :unprocessable_entity\n end\n end", "def set_test_result\n @test_result = TestResult.find(params[:id])\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @testtest.update(testtest_params)\n format.html { redirect_to @testtest, notice: 'Testtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @testtest }\n else\n format.html { render :edit }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_test_result\n @test_result = TestResult.find(params[:id])\n end", "def set_test_result\n @test_result = TestResult.find(params[:id])\n end", "def update\n respond_to do |format|\n if @benchmark_test.update(benchmark_test_params)\n format.html { redirect_to @benchmark_test, notice: 'Benchmark test was successfully updated.' }\n format.json { render :show, status: :ok, location: @benchmark_test }\n else\n format.html { render :edit }\n format.json { render json: @benchmark_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end", "def set_test_and_result\n @test = set_test\n @result = @test.results.find(params[:id])\n end", "def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_test_result\n test_target_instance = get_new_test_target_instance(\"example1\", \"2012112801\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n assert_response :success\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n end", "def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_test_results\n test_target_instance = get_new_test_target_instance(\"example2\", \"2012112802\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1)\n end", "def test_multiple_users_should_update_test_result_under_c1_0\n test_target_instance = get_new_test_target_instance(\"example5\", \"2012112805\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_PASS, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b01, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def test_multiple_users_should_update_test_results_under_c2\n test_target_instance = get_new_test_target_instance(\"example7\", \"2012112807\")\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b10, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b01, 0b11)\n end", "def update!(**args)\n @results = args[:results] if args.key?(:results)\n end", "def update!(**args)\n @results = args[:results] if args.key?(:results)\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_multiple_users_should_update_test_result_under_c1_1\n test_target_instance = get_new_test_target_instance(\"example6\", \"2012112806\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b10, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end", "def update\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:load_test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @terra_nova_test_benchmark.update(terra_nova_test_benchmark_params)\n format.html { redirect_to @terra_nova_test_benchmark, notice: 'Terra nova test benchmark was successfully updated.' }\n format.json { render :show, status: :ok, location: @terra_nova_test_benchmark }\n else\n format.html { render :edit }\n format.json { render json: @terra_nova_test_benchmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test.update(test_params)\n respond_to do |format|\n format.html { redirect_to admin_tests_path }\n format.json { render :show, status: :ok, location: admin_tests_path }\n end\n else\n respond_to do |format|\n format.html { render :edit, notice: \"Please do you test again. An unexpected error has occured!\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Prueba actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_result(run_id, case_id, result, error_message = '', options = {})\n unless !error_message.nil?\n error_message = 'PASSED'\n end\n options[:basic_auth] = @auth\n options[:body] = {\n executed_step: {\n actual_result: error_message,\n passed: result\n }\n }\n self.class.patch(\"/projects/id/runs/#{run_id}/executed_steps/#{case_id}.json\", options)\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def update\n respond_to do |format|\n if @test_detail.update(test_detail_params)\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_detail }\n else\n format.html { render :edit }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n if @test_suite.update_attributes(params[:test_suite])\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_test_example_result\n @test_example_result = TestExampleResult.find(params[:id])\n end", "def update\n respond_to do |format|\n @test.update_question_details(test_params)\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n format.html { redirect_to @test_instance, notice: 'Test instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json { render json: @test_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_suite.update(test_suite_params)\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_suite }\n else\n format.html { render :edit }\n format.json { render json: @test_suite.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 update\n @test_test = TestTest.find(params[:id])\n\n respond_to do |format|\n if @test_test.update_attributes(params[:test_test])\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @result1 = Result1.find(params[:id])\n\n respond_to do |format|\n if @result1.update_attributes(params[:result1])\n format.html { redirect_to @result1, notice: 'Result1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @what_test.update(what_test_params)\n format.html { redirect_to @what_test, notice: 'What test was successfully updated.' }\n format.json { render :show, status: :ok, location: @what_test }\n else\n format.html { render :edit }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def run\n @test_run = TestRun.find(params[:id])\n @test_run.run\n\n respond_to do |format|\n format.html { redirect_to @test_run }\n format.json { head :no_content }\n end\n end", "def update\n @test_run.scenarios.map! do |s|\n s.test_run = @test_run\n s.config_template = @test_run.config\n s\n end\n if @test_run.update(test_run_params)\n redirect_to @test_run, notice: 'Test run was successfully updated.'\n else\n render action: 'edit'\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @test_submission = TestSubmission.find(params[:id])\n\n respond_to do |format|\n if @test_submission.update_attributes(params[:test_submission])\n format.html { redirect_to @test_submission, :notice => 'Test submission was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_submission.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @utest.update_attributes(params[:unit_test])\n flash[:notice] = 'Unit test was successfully updated.'\n format.html { redirect_to [@project, @utest] }\n format.xml { head :ok }\n else\n logger.error @utest.errors.full_messages.join('; ')\n flash[:error] = 'Error updating unit test: ' + view_model_errors(@utest)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @utest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @results = args[:results] if args.key?(:results)\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @results = args[:results] if args.key?(:results)\n end", "def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_stuff.update(test_stuff_params)\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jquery_test.update(jquery_test_params)\n format.html { redirect_to @jquery_test, notice: 'Jquery test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jquery_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @runscope_test.update(runscope_test_params)\n format.html { redirect_to @runscope_test, notice: 'Runscope test was successfully updated.' }\n format.json { render :show, status: :ok, location: @runscope_test }\n else\n format.html { render :edit }\n format.json { render json: @runscope_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n @scenario = @test_run.scenario || Scenario.new\n @registration_scenario = @scenario.registration_scenario || Scenario.new\n @profile = @test_run.profile || Profile.new\n @target = @test_run.target || Target.new\n flash[:error] = @test_run.errors.full_messages\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: 422 }\n end\n end\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @testing_.update(testing__params)\n format.html { redirect_to @testing_, notice: 'Testing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alram_test.update(alram_test_params_for_update)\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully updated.' }\n format.json { render :show, status: :ok, location: @alram_test }\n else\n format.html { render :edit }\n format.json { render json: @alram_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suite_result = SuiteResult.find(params[:id])\n\n respond_to do |format|\n if @suite_result.update_attributes(params[:suite_result])\n format.html { redirect_to @suite_result, notice: 'Suite result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suite_result.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6577382", "0.65503144", "0.6545797", "0.6506658", "0.63523626", "0.6328727", "0.63231087", "0.6296146", "0.62795126", "0.61922", "0.6187594", "0.61627996", "0.6160539", "0.61596817", "0.61444026", "0.61444026", "0.61444026", "0.6138076", "0.6122951", "0.6120557", "0.6085827", "0.60792744", "0.60357696", "0.60316324", "0.6002528", "0.59948814", "0.5958524", "0.5958524", "0.5958524", "0.5958524", "0.5958524", "0.5958524", "0.5958524", "0.5954602", "0.5950695", "0.5937379", "0.59061897", "0.5889046", "0.5889046", "0.5875061", "0.5871955", "0.58700705", "0.5866024", "0.5859224", "0.5858156", "0.5850377", "0.58424425", "0.5837872", "0.58329743", "0.5831046", "0.5829189", "0.58149713", "0.58149713", "0.5814248", "0.5814248", "0.5814248", "0.5814248", "0.58093095", "0.57901573", "0.5788375", "0.57610834", "0.5758122", "0.57371", "0.57346976", "0.5731831", "0.5728291", "0.57268405", "0.57224345", "0.5721099", "0.5711287", "0.5707245", "0.5696134", "0.5694969", "0.5689768", "0.5673705", "0.5673021", "0.56729317", "0.5670056", "0.5667471", "0.5661177", "0.56576586", "0.5636897", "0.5636596", "0.5625181", "0.5624651", "0.56214935", "0.5620241", "0.56193715", "0.561012", "0.56071526", "0.5606877", "0.56022507", "0.5600072", "0.55850005", "0.55844957", "0.55718", "0.55718", "0.55681247", "0.555791", "0.5556822" ]
0.6770564
0
DELETE /test_results/1 DELETE /test_results/1.json
def destroy @test_result = TestResult.find(params[:id]) @test_result.destroy respond_to do |format| format.html { redirect_to test_results_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case_result.destroy\n respond_to do |format|\n format.html { redirect_to test_case_results_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @test_result.destroy\n respond_to do |format|\n format.html { redirect_to test_results_url, notice: 'Test result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_result.destroy\n respond_to do |format|\n format.html { redirect_to test_results_url, notice: 'Test result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_summary = TestSummary.find(params[:id])\n @test_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to test_summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_example_result.destroy\n respond_to do |format|\n format.html { redirect_to test_example_results_url, notice: 'Test example result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @performance_test = PerformanceTest.find(params[:id])\n @performance_test.destroy\n\n respond_to do |format|\n format.html { redirect_to performance_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Prueba eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Mg::Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_results_from_file.destroy\n respond_to do |format|\n format.html { redirect_to uploaded_test_results_url, notice: 'Document destroyed successfully.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @runtest.destroy\n respond_to do |format|\n format.html { redirect_to runtests_url, notice: 'Runtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ptest_result = PtestResult.find(params[:id])\n @ptest_result.destroy\n\n respond_to do |format|\n format.html { redirect_to ptest_results_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_test = TestTest.find(params[:id])\n @test_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @smoke_test = SmokeTest.find(params[:id])\n @smoke_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(smoke_tests_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @testtest.destroy\n respond_to do |format|\n format.html { redirect_to testtests_url, notice: 'Testtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jquery_test.destroy\n respond_to do |format|\n format.html { redirect_to jquery_tests_url }\n format.json { head :no_content }\n end\n end", "def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def delete(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_run_results/#{id}\", :delete) do |req|\n req.body = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dtest = Dtest.find(params[:id])\n @dtest.destroy\n\n respond_to do |format|\n format.html { redirect_to dtests_url, notice: t(:dest_test) }\n format.json { head :no_content }\n end\n end", "def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test10 = Test10.find(params[:id])\n @test10.destroy\n\n respond_to do |format|\n format.html { redirect_to test10s_url }\n format.json { head :no_content }\n end\n end", "def delete\n if @test.destroy\n return render json: { message: 'Test was removed succesfully.', error: false }\n else\n return render json: { message: 'Error :Something went wrong. Test was not removed.', error: true }\n end\n end", "def destroy\n @test_detail.destroy\n respond_to do |format|\n format.html { redirect_to test_details_url, notice: 'Test detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @benchmark_test.destroy\n respond_to do |format|\n format.html { redirect_to benchmark_tests_url, notice: 'Benchmark test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alram_test.destroy\n respond_to do |format|\n format.html { redirect_to alram_tests_url, notice: 'Alram test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_call.destroy\n respond_to do |format|\n format.html { redirect_to test_calls_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @usertest = Usertest.find(params[:id])\n @usertest.destroy\n\n respond_to do |format|\n format.html { redirect_to usertests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_submission = TestSubmission.find(params[:id])\n @test_submission.destroy\n\n respond_to do |format|\n format.html { redirect_to test_submissions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fixit_test.destroy\n respond_to do |format|\n format.html { redirect_to fixit_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = TkdTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n end\n end", "def destroy\n @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @runscope_test.destroy\n respond_to do |format|\n format.html { redirect_to runscope_tests_url, notice: 'Runscope test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @testurl.destroy\n respond_to do |format|\n format.html { redirect_to testurls_url, notice: 'Testurl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @crash_test = CrashTest.find(params[:id])\n @crash_test.destroy\n\n respond_to do |format|\n format.html { redirect_to crash_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_test = Admin::Test.find(params[:id])\n @admin_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url(subject_class_id: @test.subject_class_id), notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_item.destroy\n respond_to do |format|\n format.html { redirect_to test_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reacttest.destroy\n respond_to do |format|\n format.html { redirect_to reacttests_url, notice: 'Reacttest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @httparty_test.destroy\n respond_to do |format|\n format.html { redirect_to httparty_tests_url, notice: 'Httparty test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @result1 = Result1.find(params[:id])\n @result1.destroy\n\n respond_to do |format|\n format.html { redirect_to result1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ab_test.destroy\n respond_to do |format|\n format.html { redirect_to ab_tests_url, notice: 'Ab test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run.destroy\n redirect_to test_runs_url\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_speedtest.destroy\n respond_to do |format|\n format.html { redirect_to metric_speedtests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nginxtest.destroy\n respond_to do |format|\n format.html { redirect_to nginxtests_url, notice: \"Nginxtest was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find_by_id(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to user_subject_tests_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @testsuite.destroy\n respond_to do |format|\n format.html { redirect_to testsuites_url, notice: 'Testsuite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @copyeditor_test.destroy\n respond_to do |format|\n format.html { redirect_to copyeditor_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end", "def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end", "def delete_retry_test id\n uri = URI(HOST + \"/retry_test/#{id}\")\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Delete.new(uri.path)\n http.request(req)\n end", "def destroy\n @test_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_data_url, notice: 'Test datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @terra_nova_test_benchmark.destroy\n respond_to do |format|\n format.html { redirect_to terra_nova_test_benchmarks_url, notice: 'Terra nova test benchmark was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_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 @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_team_stat.destroy\n respond_to do |format|\n format.html { redirect_to test_team_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dovetest.destroy\n respond_to do |format|\n format.html { redirect_to dovetests_url, notice: 'Dovetest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_record.destroy\n respond_to do |format|\n format.html { redirect_to test_records_url, notice: 'Test record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_set = TestSet.find(params[:id])\n permitted_to! :destroy, @test_set\n @test_set.destroy\n\n respond_to do |format|\n format.html { redirect_to test_sets_url }\n format.json { head :ok }\n end\n end" ]
[ "0.7386734", "0.7290677", "0.72806805", "0.7278433", "0.7278433", "0.72536355", "0.7250621", "0.721006", "0.72016776", "0.72016776", "0.7165767", "0.71167696", "0.70826536", "0.7032146", "0.70120174", "0.7005103", "0.6998391", "0.6984183", "0.6984183", "0.6984183", "0.6984183", "0.6984183", "0.6984183", "0.6984183", "0.6982916", "0.6979895", "0.6958563", "0.6945028", "0.6935268", "0.6932429", "0.6930011", "0.6918738", "0.691493", "0.69068193", "0.6901996", "0.690176", "0.6882294", "0.6863789", "0.68506587", "0.68503624", "0.6848475", "0.68458205", "0.6827198", "0.68211055", "0.6811895", "0.6797169", "0.6782992", "0.67816854", "0.6775335", "0.67695165", "0.6759167", "0.675331", "0.6752256", "0.6743246", "0.67413425", "0.6736382", "0.67356795", "0.6731844", "0.67260456", "0.67250705", "0.6717523", "0.67072904", "0.66981024", "0.66910785", "0.6685753", "0.6684096", "0.6663599", "0.66590637", "0.6656603", "0.6652404", "0.66470987", "0.66462", "0.6644698", "0.66414046", "0.66404027", "0.6638021", "0.6636399", "0.6630976", "0.6616605", "0.6611437", "0.6609634", "0.6606004", "0.6605438", "0.6605401", "0.66004205", "0.65993315", "0.65992206", "0.65977633", "0.65934366", "0.6583285", "0.6583285", "0.6582352", "0.65797424", "0.6578631", "0.6571427", "0.65686387", "0.6562936", "0.6552571", "0.6552227", "0.6545571" ]
0.7513926
0
Adding a Constructor here!
def initialize(name, color, mass_kg, distance_from_the_sun_km, fun_fact) unless mass_kg > 0 raise ArgumentError 'Mass must be a number greater than zero.' end unless distance_from_the_sun_km > 0 raise ArgumentError 'Distance from sun must be a number greater than zero.' end @name = name @color = color @mass_kg = mass_kg @distance_from_the_sun_km = distance_from_the_sun_km @fun_fact = fun_fact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constructor; end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def construct\n end", "def initialize() end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n \n end", "def initialize( * )\n super\n end", "def initialize *args\n super\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n\t\t\n\tend", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\r\n\r\n end", "def initialize(*args)\n super\n end", "def initialize(*args)\n super\n end", "def initialize(*args)\n super\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize(*args)\r\n super(*args)\r\n end", "def initialize(*_)\n super\n end", "def initialize(*args)\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n # nothing here for now\n end", "def initialize()\n end", "def initialize(*)\n end", "def initialize(*)\n end", "def initialize\n \n end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize\n end", "def initialize(*) \n end", "def initialize(*args)\n super *args\n end", "def initialize(*args)\n super\n end", "def initialize(*args); end", "def initialize(*args)\n super(*args)\n end", "def initialize(*args)\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize(*args)\n #This is a stub, used for indexing\n end", "def initialize()\n # override parent\n end", "def initialize\nend", "def initialize\n super(true)\n end", "def initialize\n\n\n\n end", "def initialize()\n\t\tend", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end" ]
[ "0.8899815", "0.81922567", "0.81922567", "0.81922567", "0.81922567", "0.81922567", "0.81420296", "0.8036487", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7979096", "0.7928958", "0.7842268", "0.7709798", "0.76861876", "0.76861876", "0.76861876", "0.76861876", "0.76861876", "0.76861876", "0.76861876", "0.76861876", "0.76861876", "0.768214", "0.76697046", "0.7635302", "0.7635302", "0.7635302", "0.7635302", "0.7635302", "0.7635302", "0.7635302", "0.763039", "0.762263", "0.762263", "0.762263", "0.7617312", "0.7617312", "0.7617312", "0.7617312", "0.7617312", "0.7617312", "0.76162374", "0.76162374", "0.75907516", "0.75861406", "0.757874", "0.75653684", "0.75653684", "0.75653684", "0.75410604", "0.75326717", "0.753177", "0.753177", "0.7519933", "0.7516814", "0.7515672", "0.7515672", "0.7514701", "0.7514701", "0.7513592", "0.7513592", "0.7513592", "0.7513592", "0.7513592", "0.7513592", "0.7513592", "0.7513592", "0.75053173", "0.7500806", "0.7499662", "0.7497792", "0.74855906", "0.7468779", "0.7461415", "0.7441819", "0.7441819", "0.7441819", "0.7436417", "0.7427696", "0.74256897", "0.74221087", "0.7409722", "0.7400389", "0.73901665", "0.73901665", "0.73901665", "0.73901665", "0.73901665", "0.73901665", "0.73901665", "0.73901665", "0.73901665" ]
0.0
-1
You probably want to override this method to return a realistic date
def soonest_delivery_date_for_order(order) Date.today end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date; end", "def date; end", "def date; end", "def date; end", "def get_date()\n @date\n end", "def get_date()\n @date\n end", "def to_date()\n #This is a stub, used for indexing\n end", "def date() self[:date]; end", "def easy_date; date; end", "def get_date\n format_date DateTime.new(2011, 1, 1, 17, 9, 59)\n end", "def date\n @date\n end", "def date\n @date\n end", "def date\n object.date.strftime('%a %b %e') rescue nil\n end", "def date\n @date\n end", "def date\n @date\n end", "def date\n self.publicized_or_packaged || super\n end", "def date\n self.publicized_or_packaged || super\n end", "def date\n now.to_date\n end", "def get_date\n\t\t@date = Date.today.to_s\n\tend", "def read_date; end", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def date()\n\t\t(@start_date.to_time + (10**9)).to_date\n\tend", "def date\n set_function_and_argument(:date, nil)\n end", "def date\n Date.today\n end", "def born_date\n super.to_s(:long)\n end", "def to_date\n begin\n super\n rescue\n Date.null_date\n end\n end", "def start_date\n date\n end", "def date\n @date ||= Time.new\n end", "def date\n raise NotImplementedError.new(\"date() must be implemented by subclasses of AbstractChangeset.\")\n end", "def date\n if (self.datetime_observation) then self.datetime_observation.to_date\n else @date ||= self.observation.date #default\n end\n end", "def date\n Time.now\n end", "def date\n dreport.date_format\n end", "def creation_date\n raise NotImplemented\n end", "def creation_date\n raise NotImplemented\n end", "def duedate\n @date\n end", "def creation_date\n raise NotImplementedError\n end", "def get_date()\n @time\n end", "def date\n @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)\n end", "def get_date_scraped\n\n return Date.today.to_s\n\nend", "def get_date_scraped\n\n return Date.today.to_s\n\nend", "def return_date\n (created_at + 2.day).strftime(\"%d/%m/%Y\")\n end", "def current_date()\r\n return Time.new.strftime(\"%Y-%m-%d\")\r\n end", "def start_date\n\t\tDate.new( @year, @month, 1 )\n\tend", "def date\n object.date.strftime(\"%m/%d/%Y\")\n end", "def dates\n end", "def start_date\n return start\n end", "def to_date string\n \n end", "def publication_date\n end", "def date\n (birthday.to_time + 10**9).to_date\n end", "def get_date_scraped\n return Date.today.to_s\nend", "def get_date_scraped\n return Date.today.to_s\nend", "def initial_date\n self.start_date.strftime('%m-%d-%Y')\n end", "def return_date\n\t\tif(last_line_modified_date && last_modified_date != nil)\n\t\t\tif(last_line_modified_date <= last_modified_date)\n\t\t\t\treturn last_line_modified_date()\n\t\t\telse\n\t\t\t\treturn last_modified_date()\n\t\t\tend\n\t\telse\n\t\t\treturn '2000-01-01'\n\t\tend\n\tend", "def date\n request Net::NNTP::Date.new\n end", "def date\n Date.civil(year, month, 1)\n end", "def date\n team.date_format\n end", "def date\n pay_date.nil? ? ex_date : pay_date\n end", "def date\n moment.floor\n end", "def birthdate\n Date.parse(super) if super\n end", "def date\n competition.start_date\n end", "def ris_date\n return @ris_date if defined?(@ris_date)\n\n @ris_date ||= begin\n if start_d = @citable_attributes.date && @citable_attributes.date.parts.first\n self.class.formatted_ris_date(year: start_d.year, month: start_d.month, day: start_d.day)\n end\n end\n end", "def publication_date\n super(:dc_date)\n end", "def date\n page.version.authored_date.strftime(\"%B %d, %Y\")\n end", "def read_date=(_); end", "def creation_date=(_); end", "def f_start_date\n\t\tself.expected_start_date.strftime(\"%d / %m / %Y\")\n\tend", "def day; end", "def to_date\n ::Date.new(year, month, day)\n end", "def date\n party_time = (@date_of_birth.to_time + SECONDS)\n party_time.to_date\n end", "def getLogDate()\n return self.getDateStr()\n end", "def date\n time_table_date || @date\n end", "def date\n get_scm_data if @_date.nil?\n @_date\n end", "def date\n @date ||= @config['date']\n end", "def date\n parse!\n @date\n end", "def getPostDate\r\n\t\t\t\t\treturn @postDate\r\n\t\t\t\tend", "def getPostDate\r\n\t\t\t\t\treturn @postDate\r\n\t\t\t\tend", "def get_date()\n strip = self;\n return strip.created_at.strftime( \"%d%m%y\" );\n end", "def httpdate\n Time.now.httpdate\n end", "def modification_date; end", "def date\n\t\treturn Time.at( @date[0] )\n\tend", "def create_date\n\t\tcreated_at.to_date\n\tend", "def date\n Time.now.in_time_zone\n end", "def intiation_date\n self.initiation\n end", "def date\n model.created_at.strftime(\"%d-%b-%Y\")\n end", "def readable_date\n date.strftime(\"%B %d, %Y\")\n end", "def create_date\n data.create_date\n end", "def create_date\n data.create_date\n end", "def create_date\n data.create_date\n end", "def human_readable_date\n d = self.date\n d.strftime(\"%B %d, %Y\")\n end", "def date\n (@birth_date.to_time + 1_000_000_000).to_date\n end", "def date \n \"date\" \n end", "def released_on=date\n super DateTime.strptime(date, '%m/%d/%Y')\n end", "def accounting_date()\n return cash_date()\n end", "def log_date\n self.well_info.date_logged\n end", "def sighted_date\n\t\tif @sighted_date\n\t\t\t@sighted_date\n\t\telsif sighted_at\n\t\t\tsighted_at.to_date\n\t\tend\n\tend", "def httpdate\n utc.httpdate\n end", "def date\n @completed_date = created_at.strftime(\"%m/%d/%Y\")\n return @completed_date\n end", "def created_at # overwriting what this method returns\n object.created_at.strftime('%B %d, %Y') # Object represents the instance\n end", "def start_date_as_date\n return USDateParse(self.start_date)\n end", "def date\n \"#{day} #{month.capitalize} #{year}\"\n end", "def book_checkout_date\n start_date = self[:start]\n if !start_date.nil?\n return start_date.to_date.strftime(\"%b-%d-%Y\")\n end\n end" ]
[ "0.81774956", "0.81774956", "0.81774956", "0.81774956", "0.7845115", "0.7845115", "0.77335334", "0.77163243", "0.770608", "0.7659976", "0.7540777", "0.7540777", "0.7504187", "0.7501587", "0.7501587", "0.7485098", "0.7485098", "0.74611413", "0.73561656", "0.7317922", "0.73139846", "0.72948235", "0.7227591", "0.72006357", "0.71764207", "0.716655", "0.7158085", "0.71562827", "0.7118439", "0.7116259", "0.7111818", "0.7063266", "0.70436215", "0.70436215", "0.70404696", "0.700913", "0.69967216", "0.6989049", "0.6951522", "0.6951522", "0.69424367", "0.6929808", "0.69265807", "0.691626", "0.69115734", "0.69114923", "0.69085616", "0.6890506", "0.68872535", "0.68801016", "0.68801016", "0.6863882", "0.68587315", "0.6844682", "0.6830347", "0.68271434", "0.6824142", "0.68138325", "0.68116", "0.6799558", "0.6796367", "0.6792", "0.67737687", "0.6771183", "0.6770197", "0.67679", "0.67353463", "0.6725886", "0.6722694", "0.67176175", "0.67120785", "0.6709518", "0.6700554", "0.6696917", "0.66965884", "0.66965884", "0.6690399", "0.66767734", "0.6672334", "0.66715467", "0.6670245", "0.6659211", "0.6658833", "0.6654422", "0.6652735", "0.6647719", "0.6647719", "0.6647719", "0.66448724", "0.66428936", "0.6639832", "0.6635511", "0.6633878", "0.66262674", "0.6624075", "0.6622993", "0.6621305", "0.6615826", "0.6609116", "0.6605889", "0.66039383" ]
0.0
-1
GET /schools GET /schools.xml
def index @countries = Country.has_cities @country = @countries.first @states = @country.states @state = @states.first @cities = @state.cities @city = @cities.first if params[:school] @school = School.new(params[:school]) if params[:state] country_id = params[:state][:country_id] end if params[:city] state_id = params[:city][:state_id] end city_id = params[:school][:city_id] end if country_id country = Country.find_by_id(country_id) @states = country.states @state = State.new @state.country_id = country_id end if state_id state = State.find_by_id(state_id) @cities = state.cities @city = City.new @city.state_id = state_id end cond = School.paginated_schools_conditions_with_search(params) @schools = School.paginate :include => [{:city => {:state => :country}}], :conditions => cond.to_sql, :page => params[:page], :per_page => 10 respond_to do |format| format.html # index.html.erb format.xml { render :xml => @schools } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end", "def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @school }\n end\n end", "def show\n @schools_user = SchoolsUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schools_user }\n end\n end", "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "def show\n @schooling = Schooling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schooling }\n end\n end", "def index\n @cms_schools = Cms::School.all\n end", "def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end", "def show\n @school_rec = SchoolRec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school_rec }\n end\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = Admin::School.all\n end", "def index\r\n @schools = School.all\r\n\r\n end", "def index\n @schools = School.all\n end", "def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school }\n end\n end", "def index\n @movies = @school.movies.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @movies }\n end\n end", "def index\n @schools = @city.schools\n end", "def index\n @teams = Team.all(:order => \"school\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end", "def index\n @students = Student.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end", "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scholarship }\n end\n end", "def index\n @standards = Standard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @standards }\n end\n end", "def show\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def show\n if params[:teacher_id]\n @school = Teacher.find(params[:teacher_id]).school\n else\n @school = School.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n @graduate_school_ranking = GraduateSchoolRanking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @graduate_school_ranking }\n end\n end", "def index\n @scholarships = Scholarship.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scholarships }\n end\n end", "def index\n @schools = School.default\n end", "def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end", "def show\n @semester = Semester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @semester }\n end\n end", "def show\n @student_howuknowusship = StudentHowuknowusship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_howuknowusship }\n end\n end", "def show\n @student_correspondence = StudentCorrespondence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_correspondence }\n end\n end", "def show\n @semester_subject = SemesterSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @semester_subject }\n end\n end", "def by_saison\n @saison = Saison.find_by_year(params[:id])\n respond_to do |format|\n format.xml\n end\n end", "def new\n @schools_user = SchoolsUser.new\n @schools = current_user.ladmin.schools\n respond_to do |format|\n\n format.html # new.html.erb\n format.xml { render :xml => @schools_user }\n end\n end", "def show\n @movie = @school.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend", "def show\n @student_referee = StudentReferee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_referee }\n end\n end", "def show\n @student_relation = StudentRelation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_relation }\n end\n end", "def show\n @school = School.find(params[:id])\n end", "def show\n @strelki = Strelki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @strelki }\n end\n end", "def get_school\n @school = School.find_by_id(params[:school_id])\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student_whylearnship = StudentWhylearnship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_whylearnship }\n end\n end", "def show\n @scout_master = ScoutMaster.find(params[:id])\n @scouts = Scouter.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scout_master }\n end\n end", "def show\n @school = School.find(params[:id])\n @owner = User.find(@school.owned_by)\n \n @json = @school.to_gmaps4rails\n\n @school_types = [ \"District\", \"Charter\", \"Private\", \"Other\" ]\n @grades = [ \"Pre-K\", \"Elementary\", \"Middle\", \"High School\", \"Adult School\", \"Other\", \"K-6\", \"K-8\", \"6-12\", \"K-12\" ]\n @calendar = [ \"Year-round\", \"Track\", \"Semester\", \"Traditional\" ]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def index\n @lessons = current_user.organization.lessons.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def school\n School.find(params[:id])\n end", "def index\n @high_schools = HighSchool.all\n end", "def index\n @high_schools = HighSchool.all\n end", "def show\n if params[:school_id]\n @district = School.find(params[:school_id]).district\n else\n @district = District.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end", "def schools_map\n @departments = @city.departments.schools\n render action: :department_map\n end", "def show\n @student_improveship = StudentImproveship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_improveship }\n end\n end", "def show\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_setup }\n end\n end", "def index\n @lessons = Lesson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def show\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institute }\n end\n end", "def show\n redirect_to \"index\", alert: \"Debes introducir una ciudad\" if params[:query].blank?\n find_results\n\n # FIXME: no se visualiza, test falla\n redirect_to \"index\", alert: \"No se han encontrado centros\" if @schools.nil?\n end", "def index\n @school_setups = SchoolSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_setups }\n end\n end", "def show\n @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "def index\n @graduate_school_rankings = GraduateSchoolRanking.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graduate_school_rankings }\n end\n end", "def index\n @students = Student.search @year_selected, @degree_selected\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @college }\n end\n end", "def index\n @school_class = SchoolClass.find(params[:school_class_id])\n @day_templates = @school_class.day_templates.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @day_templates }\n end\n end", "def show\n @student_publication = StudentPublication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_publication }\n end\n end", "def show\n @school = School.find_by(id: params[:id])\n end", "def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end", "def show\n @student_relationship = StudentRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_relationship }\n end\n end", "def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @university }\n end\n end", "def show # probably not used\n @standard = Standard.find(params[:id])\n @subject = @standard.subject\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @standards }\n end\n end", "def show\n @workshops_course = WorkshopsCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workshops_course }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end", "def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end", "def index\n @students = Student.find(:all, :order => \"last_name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def show\n @nces06_school = Portal::Nces06School.find(params[:id])\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (found instance)\n # authorize @nces06_school\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nces06_school }\n end\n end", "def index\n \n if params[:student_id]\n @student = Student.find(params[:student_id]);\n else\n @lessons = Lesson.all\n end\n \n if params[:classroom_id]\n @classroom = Classroom.find(params[:classroom_id])\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end", "def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def students\n Rollcall::Student.find_all_by_school_id schools\n end", "def show\n @class_student = ClassStudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @class_student }\n end\n end", "def show\n @student_grade_personality = StudentGradePersonality.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_grade_personality }\n end\n end", "def show\n @senhas = Senha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @senhas }\n end\n end", "def show\n @course_student_profile = CourseStudentProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_student_profile }\n end\n end", "def show\n \n begin\n @topic_activity_summaries = \n TopicActivitySummary.find_all_by_student_id_and_grade(params[:id], params[:grade])\n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n\t \n respond_to do |format|\n format.xml { render :xml => @topic_activity_summaries.to_xml(:dasherize => false) }\n end\n end", "def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end" ]
[ "0.74211276", "0.68780357", "0.68492496", "0.68069446", "0.66417164", "0.6547339", "0.6533931", "0.64007646", "0.6354918", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.6288763", "0.62600386", "0.62482214", "0.62381995", "0.6223732", "0.6195978", "0.6169252", "0.6128378", "0.61228395", "0.61146474", "0.60923135", "0.60919946", "0.6083225", "0.60723585", "0.6061758", "0.6036182", "0.5974424", "0.59740233", "0.59593505", "0.5958071", "0.5949107", "0.59482217", "0.59371364", "0.59313136", "0.5927546", "0.5916462", "0.59078556", "0.5902835", "0.58984965", "0.58960825", "0.58903444", "0.5887445", "0.58819795", "0.5877789", "0.5877789", "0.5877789", "0.5877789", "0.5877789", "0.58724797", "0.58478355", "0.58374447", "0.5822701", "0.5821366", "0.58131754", "0.58087385", "0.58087385", "0.58049977", "0.5802491", "0.57886046", "0.5780745", "0.5780223", "0.57684547", "0.5767546", "0.5763945", "0.57585156", "0.5754128", "0.57399803", "0.57319427", "0.5731841", "0.57292175", "0.572671", "0.57188666", "0.57098955", "0.570793", "0.5704602", "0.5701461", "0.56939214", "0.56884235", "0.56874055", "0.5678453", "0.56784225", "0.56743306", "0.5673544", "0.5672331", "0.5671823", "0.5671823", "0.5671823", "0.5671823", "0.5671823", "0.5667593", "0.56647617", "0.56553924", "0.5654564", "0.5652651", "0.5652403", "0.5646887" ]
0.0
-1
GET /schools/1 GET /schools/1.xml
def show @school = School.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @school } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @school }\n end\n end", "def show\n @schools_user = SchoolsUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schools_user }\n end\n end", "def show\n @schooling = Schooling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schooling }\n end\n end", "def show\n @school_rec = SchoolRec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school_rec }\n end\n end", "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "def show\n if params[:teacher_id]\n @school = Teacher.find(params[:teacher_id]).school\n else\n @school = School.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school }\n end\n end", "def show\n @graduate_school_ranking = GraduateSchoolRanking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @graduate_school_ranking }\n end\n end", "def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end", "def show\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def index\n @cms_schools = Cms::School.all\n end", "def index\n @students = Student.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def index\n @movies = @school.movies.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @movies }\n end\n end", "def show\n @student_correspondence = StudentCorrespondence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_correspondence }\n end\n end", "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def show\n @student_referee = StudentReferee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_referee }\n end\n end", "def show\n @semester = Semester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @semester }\n end\n end", "def by_saison\n @saison = Saison.find_by_year(params[:id])\n respond_to do |format|\n format.xml\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def index\r\n @schools = School.all\r\n\r\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n @school = School.find(params[:id])\n end", "def show\n @semester_subject = SemesterSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @semester_subject }\n end\n end", "def get_school\n @school = School.find_by_id(params[:school_id])\n end", "def show\n @student_howuknowusship = StudentHowuknowusship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_howuknowusship }\n end\n end", "def show\n @student_relation = StudentRelation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_relation }\n end\n end", "def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end", "def show\n @movie = @school.movies.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def school\n School.find(params[:id])\n end", "def index\n @schools = School.all\n end", "def show\n if params[:school_id]\n @district = School.find(params[:school_id]).district\n else\n @district = District.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end", "def index\n @schools = Admin::School.all\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n @school = School.find_by(id: params[:id])\n end", "def index\n @teams = Team.all(:order => \"school\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end", "def show\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institute }\n end\n end", "def index\n @standards = Standard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @standards }\n end\n end", "def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end", "def show\n @student_whylearnship = StudentWhylearnship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_whylearnship }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scholarship }\n end\n end", "def show\n @student_publication = StudentPublication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_publication }\n end\n end", "def index\n @schools = @city.schools\n end", "def show\n @student_improveship = StudentImproveship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_improveship }\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 @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "def index\n \n if params[:student_id]\n @student = Student.find(params[:student_id]);\n else\n @lessons = Lesson.all\n end\n \n if params[:classroom_id]\n @classroom = Classroom.find(params[:classroom_id])\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def show\n @class_student = ClassStudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @class_student }\n end\n end", "def show\n @student_relationship = StudentRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_relationship }\n end\n end", "def show\n @student_class = StudentClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_class }\n end\n end", "def show\n @strelki = Strelki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @strelki }\n end\n end", "def new\n @schools_user = SchoolsUser.new\n @schools = current_user.ladmin.schools\n respond_to do |format|\n\n format.html # new.html.erb\n format.xml { render :xml => @schools_user }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @university }\n end\n end", "def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @college }\n end\n end", "def show\n \n begin\n @topic_activity_summaries = \n TopicActivitySummary.find_all_by_student_id_and_grade(params[:id], params[:grade])\n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n\t \n respond_to do |format|\n format.xml { render :xml => @topic_activity_summaries.to_xml(:dasherize => false) }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end", "def show\n @student_grade_personality = StudentGradePersonality.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_grade_personality }\n end\n end", "def index\n @schools = School.default\n end", "def show\n @student_profile = StudentProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_profile }\n end\n end", "def show\n @scout_master = ScoutMaster.find(params[:id])\n @scouts = Scouter.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scout_master }\n end\n end", "def show\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_setup }\n end\n end", "def index\n @school_class = SchoolClass.find(params[:school_class_id])\n @day_templates = @school_class.day_templates.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @day_templates }\n end\n end", "def show # probably not used\n @standard = Standard.find(params[:id])\n @subject = @standard.subject\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @standards }\n end\n end", "def show\n set_grade_list\n set_sex_list\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student }\n end\n end", "def show_school\n\t\tschool = params[:id]\n\tend", "def index\n @lessons = Lesson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end", "def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end", "def show\n @lookup_set = LookupSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def show\n @education = Education.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @education }\n end\n end", "def show\n @simperson = Simperson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simperson }\n end\n end", "def show\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @researcher }\n end\n end", "def show\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lesson }\n end\n end", "def index\n @scholarships = Scholarship.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scholarships }\n end\n end", "def show\n @nces06_school = Portal::Nces06School.find(params[:id])\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (found instance)\n # authorize @nces06_school\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nces06_school }\n end\n end", "def show\n @student_qualification = StudentQualification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_qualification }\n end\n end", "def show\n @school = School.find(params[:id])\n @owner = User.find(@school.owned_by)\n \n @json = @school.to_gmaps4rails\n\n @school_types = [ \"District\", \"Charter\", \"Private\", \"Other\" ]\n @grades = [ \"Pre-K\", \"Elementary\", \"Middle\", \"High School\", \"Adult School\", \"Other\", \"K-6\", \"K-8\", \"6-12\", \"K-12\" ]\n @calendar = [ \"Year-round\", \"Track\", \"Semester\", \"Traditional\" ]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def index\n @school_info = SchoolInfo.first\n end", "def show\n @student_group_rule = StudentGroupRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @student_group_rule }\n end\n end", "def index\n @graduate_school_rankings = GraduateSchoolRanking.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graduate_school_rankings }\n end\n end", "def show\n @course_student_profile = CourseStudentProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_student_profile }\n end\n end", "def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend", "def index\n @students = Student.search @year_selected, @degree_selected\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end", "def index\n @students = Student.find(:all, :order => \"last_name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def show\n @staffgrade = Staffgrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @staffgrade }\n end\n end", "def show\n @ss_type = SsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ss_type }\n end\n end", "def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end", "def show\n @school_class = SchoolClass.find(params[:school_class_id])\n @day_template = @school_class.day_templates.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @day_template }\n end\n end" ]
[ "0.7350768", "0.69110984", "0.679336", "0.6679314", "0.6603744", "0.65010524", "0.633042", "0.6311579", "0.62451464", "0.62447923", "0.6243469", "0.6231281", "0.623046", "0.6227592", "0.61801016", "0.617874", "0.61722845", "0.61722845", "0.61722845", "0.61722845", "0.61722845", "0.61722845", "0.61722845", "0.6170621", "0.61646736", "0.61557835", "0.6153982", "0.6153982", "0.6153982", "0.6153982", "0.6153982", "0.6147936", "0.6145626", "0.6144524", "0.61444664", "0.6140041", "0.613533", "0.6126857", "0.6124178", "0.61207443", "0.61171687", "0.61148006", "0.6102361", "0.6089283", "0.6071889", "0.6043164", "0.6042979", "0.6038962", "0.60335416", "0.6016982", "0.601397", "0.60098463", "0.60098416", "0.6008771", "0.6008453", "0.59811324", "0.59729666", "0.59529036", "0.5949425", "0.5944438", "0.59339195", "0.5933546", "0.59205335", "0.59178716", "0.5917816", "0.5913979", "0.59131235", "0.59045607", "0.5888063", "0.58861345", "0.58776355", "0.58737594", "0.5868843", "0.5866967", "0.5865614", "0.5858941", "0.5853983", "0.58425677", "0.5841818", "0.58409864", "0.58370817", "0.58359504", "0.5832869", "0.58316755", "0.58296925", "0.58260316", "0.5823885", "0.58156335", "0.5807331", "0.580179", "0.58002883", "0.57974356", "0.5787591", "0.57824075", "0.57783955", "0.57766455", "0.5776553", "0.57752174", "0.5773788", "0.5769469" ]
0.70818865
1
GET /schools/new GET /schools/new.xml
def new @countries = Country.has_cities @country = @countries.first @states = @country.states @state = @states.first @cities = @state.cities @city = @cities.first @school = School.new @school.type_school = "University" @department_categories = DepartmentCategory.find(:all) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @school } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end", "def new\n @schooling = Schooling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schooling }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n get_school\n @school_request = @school.requests.new\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "def new\n @school_property = SchoolProperty.new\n list\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school_property }\n end\n end", "def create\n\n respond_to do |format|\n if @school.save\n flash[:notice] = 'School was successfully created.'\n format.html { redirect_to(@school) }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student }\n end\n end", "def new\n @semester = Semester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @semester }\n end\n end", "def new\n @ss_type = SsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ss_type }\n end\n end", "def new\n @movie = @school.movies.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @strelki = Strelki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @strelki }\n end\n end", "def new\n @semester_subject = SemesterSubject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @semester_subject }\n end\n end", "def new\n @student_publication = StudentPublication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_publication }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def new\n @college = College.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @college }\n end\n end", "def new\n @student_class = StudentClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_class }\n end\n end", "def new\n @simperson = Simperson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simperson }\n end\n end", "def new\n @institute = Institute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @institute }\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 @ministry = Ministry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministry }\n end\n end", "def new\n @student_relationship = StudentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_relationship }\n end\n end", "def new\n @student_referee = StudentReferee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_referee }\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 @ministries = Ministries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def new\n @student_howuknowusship = StudentHowuknowusship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_howuknowusship }\n end\n end", "def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lesson }\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 @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @student_correspondence = StudentCorrespondence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_correspondence }\n end\n end", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_class }\n end\n end", "def new\n @schools_user = SchoolsUser.new\n @schools = current_user.ladmin.schools\n respond_to do |format|\n\n format.html # new.html.erb\n format.xml { render :xml => @schools_user }\n end\n end", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @school_class }\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 @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def new\n @student_whylearnship = StudentWhylearnship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_whylearnship }\n end\n end", "def new\n @tutorials = Tutorials.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorials }\n end\n end", "def new\n @student_improveship = StudentImproveship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_improveship }\n end\n end", "def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @researcher }\n end\n end", "def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end", "def new\n @school_setup = SchoolSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_setup }\n end\n end", "def new\n @schoolclass = Schoolclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schoolclass }\n end\n end", "def new\n @sprint = Sprint.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Nces06School\n @nces06_school = Portal::Nces06School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nces06_school }\n end\n end", "def new\n @staff_shift = StaffShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staff_shift }\n end\n end", "def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sm }\n end\n end", "def new\n @scout_master = ScoutMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scout_master }\n end\n end", "def new\n @staffgrade = Staffgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staffgrade }\n end\n end", "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\n end\n end", "def new\n @lookup_cohort = LookupCohort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_cohort }\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end", "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end", "def new\n @kingdom = Kingdom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kingdom }\n end\n end", "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end", "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end", "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end", "def new\n @student_noticeship = StudentNoticeship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_noticeship }\n end\n end", "def new\n @student_profile = StudentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_profile }\n end\n end", "def new\n @segment = Segment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @staffcourse = Staffcourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staffcourse }\n end\n end", "def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def new\n @subway = Subway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subway }\n end\n end", "def new\n @serie = Serie.new\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 @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @sitetype = Sitetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitetype }\n end\n end", "def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiel }\n end\n end", "def new\n @spit = Spit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spit }\n end\n end", "def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end", "def new\n @senhas = Senha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @senhas }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @thesis_proposal = ThesisProposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thesis_proposal }\n end\n end", "def new\n @st_use = StUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @st_use }\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @homework }\n end\n end", "def new\n @staffclassification = Staffclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staffclassification }\n end\n end", "def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @site }\n format.xml { render :xml => @site }\n end\n end", "def new\n @sofa = Sofa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sofa }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end" ]
[ "0.76038694", "0.75779456", "0.75358725", "0.72791266", "0.7045811", "0.6938775", "0.69360745", "0.69360745", "0.6888402", "0.68505174", "0.6841738", "0.68319005", "0.68319005", "0.68319005", "0.68319005", "0.6770987", "0.6739526", "0.6737027", "0.6721689", "0.67190343", "0.67190343", "0.67190343", "0.67190343", "0.67190343", "0.67190343", "0.67190343", "0.67190343", "0.6696159", "0.6686188", "0.6679085", "0.6674858", "0.6673105", "0.6671731", "0.6670809", "0.6667902", "0.6650564", "0.66371727", "0.6605404", "0.66036963", "0.6602611", "0.65988904", "0.65899384", "0.6574735", "0.6568009", "0.6566187", "0.6566187", "0.6563678", "0.6559021", "0.6557235", "0.65537786", "0.65511715", "0.6538679", "0.6535058", "0.6533427", "0.65259045", "0.651136", "0.65067726", "0.65056986", "0.6505631", "0.6503426", "0.65032303", "0.6502341", "0.6499111", "0.64957005", "0.64706004", "0.6469574", "0.64618534", "0.6458387", "0.64572585", "0.6455789", "0.64498156", "0.6445797", "0.6445797", "0.6445797", "0.6445771", "0.64438176", "0.64423984", "0.6442007", "0.64400184", "0.6439307", "0.6437813", "0.6436477", "0.6432497", "0.6430327", "0.64279467", "0.64244896", "0.64213896", "0.64213365", "0.64078873", "0.6407723", "0.6407723", "0.6407723", "0.64019006", "0.64006346", "0.6398026", "0.6397603", "0.63960516", "0.6395169", "0.6394902", "0.63938475", "0.6392415" ]
0.0
-1
POST /schools POST /schools.xml
def create params[:school][:department_ids] = params[:department_select] @school = School.new(params[:school]) respond_to do |format| if @school.save flash[:notice] = 'School was successfully created.' format.html { redirect_to(@school) } format.xml { render :xml => @school, :status => :created, :location => @school } else format.html { render :action => "new" } format.xml { render :xml => @school.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n respond_to do |format|\n if @school.save\n flash[:notice] = 'School was successfully created.'\n format.html { redirect_to(@school) }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Nces06School\n @nces06_school = Portal::Nces06School.new(portal_nces06_school_strong_params(params[:nces06_school]))\n\n respond_to do |format|\n if @nces06_school.save\n flash['notice'] = 'Portal::Nces06School was successfully created.'\n format.html { redirect_to(@nces06_school) }\n format.xml { render :xml => @nces06_school, :status => :created, :location => @nces06_school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nces06_school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n respond_to do |format|\n if @school.save\n format.html { redirect_to schools_path }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cms_school = Cms::School.new(cms_school_params)\n\n respond_to do |format|\n if @cms_school.save\n format.html { redirect_to @cms_school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @cms_school }\n else\n format.html { render :new }\n format.json { render json: @cms_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'La sede ha sido creada exitosamente.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n\n format.html { redirect_to @school, notice: 'School founding successful.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n\n #-CONNECT THE SCHOOL AND THE STUDENT IF @school IS PRESENT\n @student.schools << @school if @school\n\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student creation successful.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @school = School.new(school_params)\r\n respond_to do |format|\r\n if @school.save\r\n format.html { redirect_to @school, notice: 'Skolan har skapats!' }\r\n format.json { render action: 'show', status: :created, location: @school }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n get_school\n @school_request = @school.requests.create(params[:school_request])\n\n redirect_to school_school_request_path(@school, @school_request)\n end", "def create\n @schooling = Schooling.new(params[:schooling])\n\n respond_to do |format|\n if @schooling.save\n format.html { redirect_to(@schooling, :notice => 'Schooling was successfully created.') }\n format.xml { render :xml => @schooling, :status => :created, :location => @schooling }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schooling.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @school = @city.schools.build(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to city_schools_path(@city), notice: \"School was successfully created.\" }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n if @school.save\n render :show, status: :created, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end", "def create\n respond_to do |format|\n if @school.save\n flash[:notice] = \"#{@school.name} was successfully created.\"\n format.html { redirect_to @person }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n format.js { render :layout => false }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end", "def create\n @school = School.new(params[:school])\n @school.creator = \"sys_creator\"\n @school.modifier = \"sys_modifier\"\n respond_to do |format|\n if @school.save\n format.html { redirect_to cms_school_path(@school), notice: 'School was successfully created.' }\n format.json { render json: cms_school_path(@school), status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.create(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n StudentMailer.mailer_inschool(@student, @inschool).deliver\n format.html { redirect_to :back, notice: 'Inschool was successfully created and an email sent was sent to the teacher.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school_rec = SchoolRec.new(params[:school_rec])\n\n respond_to do |format|\n if @school_rec.save\n flash[:notice] = 'SchoolRec was successfully created.'\n format.html { redirect_to(@school_rec) }\n format.xml { render :xml => @school_rec, :status => :created, :location => @school_rec }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school_rec.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name, :address, :city, :state, :zip)\n end", "def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:school][:school_type] = params[:school][:school_type].strip.downcase.gsub(\" \",\"_\")\n @admin_school = City.find(session[:current_city_id]).utility.schools.new(admin_school_params)\n\n respond_to do |format|\n if @admin_school.save\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_school }\n else\n format.html { render :new }\n format.json { render json: @admin_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @todo deprecate?\n @school = School.new(params[:school])\n if self.current_user.is_shared\n u = SharedUsers.where(:user_id => self.current_user.id).first\n @school.owned_by = u.owned_by\n else\n @school.owned_by = self.current_user.id\n end\n @school.gmaps = 1\n\n respond_to do |format|\n count=self.current_user.organization.totalschools\n if self.current_user.organization.school_allowance <= count\n redirect_to :root, :notice => 'Your current school allowance is too small to create this school. Please contact support in order to increase it.'\n return\n end\n if @school.save\n self.current_user.organization.update_attribute(:totalschools,count+1)\n format.html { redirect_to(@school, :notice => 'School was successfully created.') }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @semester_subject = SemesterSubject.new(params[:san_semester])\n\n respond_to do |format|\n if @semester_subject.save\n flash[:notice] = 'SemesterSubject was successfully created.'\n format.html { redirect_to(@san_semester) }\n format.xml { render :xml => @san_semester, :status => :created, :location => @san_semester }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @san_semester.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n @tournament = Tournament.find(school_params[:tournament_id])\n respond_to do |format|\n if @school.save\n format.html { redirect_to @tournament, notice: 'School was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school }\n else\n format.html { render action: 'new' }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @school_setup = SchoolSetup.new(params[:school_setup])\n\n respond_to do |format|\n if @school_setup.save\n format.html { redirect_to @school_setup, notice: 'School setup was successfully created.' }\n format.json { render json: @school_setup, status: :created, location: @school_setup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:school][:user_id] = session[:user_id]\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to \"/schools\", notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n # TODO show error\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to schools_url, notice: 'Sekolah berhasil dibuat.' }\n else\n format.html { render :new }\n flash[\"alert\"] = @school.errors.full_messages\n end\n end\n end", "def create\n @school_info = SchoolInfo.new(school_info_params)\n\n respond_to do |format|\n if @school_info.save\n format.html { redirect_to @school_info, notice: 'School info was successfully created.' }\n format.json { render :show, status: :created, location: @school_info }\n else\n format.html { render :new }\n format.json { render json: @school_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @schools_students = SchoolsStudent.new\n @schools_students.student_id = @student.id\n @schools_students.school_id = params[:school_id]\n @schools_students.save!\n\n @contract = Contract.new\n @contract.student_id = @student.id\n @contract.save!\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schools_user = SchoolsUser.new(params[:schools_user])\n @schools_user.user = current_user\n respond_to do |format|\n if @schools_user.save\n format.html { redirect_to(schools_users_path, :notice => 'Schools user was successfully created.') }\n format.xml { render :xml => @schools_user, :status => :created, :location => @schools_user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schools_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name)\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def school_params\n params.require(:school).permit(:name, :city, :state, :phone, :url, :rating)\n end", "def create\n @membership = Membership.new(membership_params)\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.school, notice: 'School Account was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::SchoolMembership\n @school_membership = Portal::SchoolMembership.new(portal_school_membership_strong_params(params[:school_membership]))\n\n respond_to do |format|\n if @school_membership.save\n flash['notice'] = 'Portal::SchoolMembership was successfully created.'\n format.html { redirect_to(@school_membership) }\n format.xml { render :xml => @school_membership, :status => :created, :location => @school_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school_membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @inschool = Inschool.new(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n format.html { redirect_to @inschool, notice: 'Inschool was successfully created.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name, :address, :capacity, :principal, :private_school)\n end", "def school_params\n params.require(:school).permit(:name, :address, :phone_no)\n end", "def create\n @survey = Survey.new(survey_params)\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey.school, notice: 'Survey was successfully created.' }\n else\n format.html { redirect_to School.find(survey_params[:school_id]) }\n end\n end\n end", "def create\n @school = School.new(school_params)\n \n if @school.save\n redirect_to @school\n else\n render 'new'\n end\n end", "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(students_url) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def school_params\n params.require(:school).permit(:username, :email, :password, :name, :country_id, :responsible_school, :phone)\n end", "def create\n @kingdom = Kingdom.new(params[:kingdom])\n\n respond_to do |format|\n if @kingdom.save\n flash[:notice] = 'Kingdom was successfully created.'\n format.html { redirect_to(@kingdom) }\n format.xml { render :xml => @kingdom, :status => :created, :location => @kingdom }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kingdom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:IDSchool, :NameSchool, :Principal, :Street, :City, :State, :Zip, :Phone, :Fax, :District, :Region)\n end", "def create\n @semester = Semester.new(params[:semester])\n\n respond_to do |format|\n if @semester.save\n flash[:notice] = 'Semester was successfully created.'\n format.html { redirect_to(semesters_url) }\n format.xml { render :xml => @semester, :status => :created, :location => @semester }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @semester.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @college.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:principal_id, :name, :state, :active)\n end", "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:success] = t('student.created')\n format.html { redirect_to(students_path) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @student_howuknowusship = StudentHowuknowusship.new(params[:student_howuknowusship])\n\n respond_to do |format|\n if @student_howuknowusship.save\n format.html { redirect_to(@student_howuknowusship, :notice => 'Student howuknowusship was successfully created.') }\n format.xml { render :xml => @student_howuknowusship, :status => :created, :location => @student_howuknowusship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_howuknowusship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end", "def create\n get_school\n @school_vocational = @school.vocationals.create(params[:school_vocational])\n end", "def create\n @student_site = StudentSite.new(student_site_params)\n\n respond_to do |format|\n if @student_site.save\n format.html { redirect_to @student_site, notice: 'Student site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_site }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @strelki = Strelki.new(params[:strelki])\n\n respond_to do |format|\n if @strelki.save\n flash[:notice] = 'Strelki was successfully created.'\n format.html { redirect_to(@strelki) }\n format.xml { render :xml => @strelki, :status => :created, :location => @strelki }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @strelki.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:code, :name, :address, :neighborhood, :zone, :contact_name, :contact_position, :phone, :email, :headquarter, :foundation_present, :establishment_id, :pic)\n end", "def school_params\n params.require(:school).permit(:name, :schooldistrict_id)\n end", "def create\n \t@school = School.new(model_params)\n \tif @school.save\n \t\tredirect_to schools_path\n \telse\n \t\trender :new\n \tend\n end", "def create\n @school_type = SchoolType.new(school_type_params)\n\n respond_to do |format|\n if @school_type.save\n format.html { redirect_to @school_type, notice: 'School type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @school_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name, :num, :lat, :lng)\n end", "def create\n @student_correspondence = StudentCorrespondence.new(params[:student_correspondence])\n\n respond_to do |format|\n if @student_correspondence.save\n format.html { redirect_to(@student_correspondence, :notice => 'Student correspondence was successfully created.') }\n format.xml { render :xml => @student_correspondence, :status => :created, :location => @student_correspondence }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_correspondence.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @schoolb = Schoolb.new(schoolb_params)\n\n if @schoolb.save\n render :show, status: :created, location: @schoolb\n else\n render json: @schoolb.errors, status: :unprocessable_entity\n end\n end", "def create\n @registration = Registration.find(params[:registration_id])\n @event = @registration.event\n @scholarship = Scholarship.new(params[:scholarship])\n\n respond_to do |format|\n if @scholarship.save\n flash[:notice] = 'Scholarship was successfully created.'\n format.html { redirect_back(url_for([@event, @registration, @scholarship])) }\n format.xml { render :xml => @scholarship, :status => :created, :location => @scholarship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scholarship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name, :score, :tournament_id, :baums_text)\n end", "def school_params\n params.require(:school).permit(:name, :state_rank, :national_rank, :college_readiness_score, :tested_ap_ib, :pass_ap_ib, :math_score, :math_proficient, :math_not_proficient, :reading_score, :reading_proficient, :reading_not_proficient, :student_teacher_ratio, :street_address, :city, :state, :zip, :latitude, :longitude, :total_enrollment, :total_economically_disadvantaged, :receives_title_i_funding, :ap_student_performance_participation_rate, :ap_student_performance_participant_passing_rate, :ap_student_performance_exam_per_test_taker, :ap_student_performance_exam_pass_rate, :district_id)\n end", "def school_params\n params.require(:school).permit(:name, :city_id)\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end", "def school_params\n params.require(:school).permit(:name, :address, :telephone, :website, :logo, :education_level_id)\n end", "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(@student) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params[:school]\n end", "def school_params\n params.require(:school).permit(:schoolname, :address, :city, :state, :pincode, :board)\n end", "def create\n @student_referee = StudentReferee.new(params[:student_referee])\n\n respond_to do |format|\n if @student_referee.save\n format.html { redirect_to(@student_referee, :notice => 'Student referee was successfully created.') }\n format.xml { render :xml => @student_referee, :status => :created, :location => @student_referee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_referee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:headmaster_id, :name, :summary, :student_count)\n end", "def create\n @student_improveship = StudentImproveship.new(params[:student_improveship])\n\n respond_to do |format|\n if @student_improveship.save\n format.html { redirect_to(@student_improveship, :notice => 'Student improveship was successfully created.') }\n format.xml { render :xml => @student_improveship, :status => :created, :location => @student_improveship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_improveship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:full_name, :screen_name, :icon, :color, :email, :website, :description)\n end", "def new\n @schooling = Schooling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schooling }\n end\n end", "def school_params\n params.require(:admin_school).permit(:school)\n end", "def create\n @studen = Studen.new(studen_params)\n\n respond_to do |format|\n if @studen.save\n format.html { redirect_to @studen, notice: 'Studen was successfully created.' }\n format.json { render :show, status: :created, location: @studen }\n else\n format.html { render :new }\n format.json { render json: @studen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @simperson = Simperson.new(params[:simperson])\n\n respond_to do |format|\n if @simperson.save\n flash[:notice] = 'Simperson was successfully created.'\n format.html { redirect_to(@simperson) }\n format.xml { render :xml => @simperson, :status => :created, :location => @simperson }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @simperson.errors, :status => :unprocessable_entity }\n end\n end\n end", "def POST; end", "def add_student(student, school)\t\t\t\t\t\t\t\t\t\t\t\t#ci. create method to add stuents\n\tschool[:students].push({:name=>student})\nend", "def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end", "def create\n @student_relationship = StudentRelationship.new(params[:student_relationship])\n\n respond_to do |format|\n if @student_relationship.save\n flash[:notice] = 'StudentRelationship was successfully created.'\n format.html { redirect_to(@student_relationship) }\n format.xml { render :xml => @student_relationship, :status => :created, :location => @student_relationship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_relationship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schoolclass = Schoolclass.new(params[:schoolclass])\n\n respond_to do |format|\n if @schoolclass.save\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }\n format.json { render json: @schoolclass, status: :created, location: @schoolclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name, :address, :lati, :longi, :state_id, :city_id, :neighborhood, :cep, :avatar)\n end", "def create\n @school_day = SchoolDay.new(params[:school_day])\n respond_to do |format|\n if @school_day.save\n format.html { redirect_to @school_day, notice: 'School day was successfully created.' }\n format.json { render json: @school_day, status: :created, location: @school_day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Alumno creado con éxito.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ref_pysician = RefPysician.new(ref_pysician_params)\n\n respond_to do |format|\n if @ref_pysician.save\n format.html { redirect_to @ref_pysician, notice: 'Ref pysician was successfully created.' }\n format.json { render :show, status: :created, location: @ref_pysician }\n else\n format.html { render :new }\n format.json { render json: @ref_pysician.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n get_school\n @school_request = @school.requests.new\n end", "def update\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = 'School was successfully updated.'\n format.html { redirect_to(@school) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def cms_school_params\n params.require(:cms_school).permit(:chapter_id, :name, :code, :website, :representative, :rep_email)\n end" ]
[ "0.62098026", "0.61278695", "0.6075107", "0.6022573", "0.6015177", "0.5993964", "0.5993964", "0.5993964", "0.59937733", "0.5983247", "0.5975131", "0.5913685", "0.58924127", "0.5887726", "0.5885334", "0.58570224", "0.5855509", "0.5842103", "0.58084106", "0.576172", "0.5755077", "0.5694456", "0.5685678", "0.5680759", "0.5680759", "0.56546754", "0.5653432", "0.564535", "0.56420165", "0.5601041", "0.5594756", "0.5586388", "0.55619097", "0.5560043", "0.55592704", "0.55574846", "0.5553819", "0.5541837", "0.5534771", "0.55307513", "0.5522805", "0.5522263", "0.55150896", "0.55108356", "0.54835534", "0.5479908", "0.54741764", "0.5471879", "0.546438", "0.54608434", "0.54600793", "0.54595375", "0.5454413", "0.5449722", "0.54471713", "0.5436499", "0.5430432", "0.54253775", "0.54252166", "0.5412949", "0.54062283", "0.5393413", "0.5392057", "0.5387624", "0.5387388", "0.535984", "0.53541493", "0.5350914", "0.53505224", "0.5345142", "0.5334901", "0.5331773", "0.5331248", "0.5328956", "0.5327969", "0.53246695", "0.53233635", "0.5313609", "0.5313014", "0.53129715", "0.53113997", "0.529974", "0.529516", "0.52946454", "0.5281025", "0.5273423", "0.52694714", "0.52656364", "0.5264069", "0.52596724", "0.5258772", "0.5256074", "0.5254672", "0.52505803", "0.52369505", "0.5234567", "0.52284783", "0.52081966", "0.52054054", "0.519832" ]
0.5934205
11
PUT /schools/1 PUT /schools/1.xml
def update params[:school][:department_ids] = params[:department_select] params[:school][:department_ids] ||= [] @school = School.find(params[:id]) respond_to do |format| if @school.update_attributes(params[:school]) flash[:notice] = 'School was successfully updated.' format.html { redirect_to(@school) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @school.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = 'School was successfully updated.'\n format.html { redirect_to(@school) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.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 @school = School.find(params[:id])\n @school.gmaps = 1\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to(@school, :notice => 'School was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n get_school\n @school_request = @school.requests.find(params[:id])\n @school_request.update_attributes(params[:school_request])\n\n redirect_to school_school_request_path(@school, @school_request)\n end", "def update\n @schools_user = SchoolsUser.find(params[:id])\n\n respond_to do |format|\n if @schools_user.update_attributes(params[:schools_user])\n format.html { redirect_to(schools_users_path, :notice => 'Schools user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schools_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @school.update(school_params)\n render :show, status: :ok, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end", "def update\n get_school\n @school_vocational = @school.vocationals.find(params[:id])\n @school_vocational.update_attributes(params[:school_vocational])\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'La sede ha sido actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n params[:school][:creator] = \"sys_creator\"\n params[:school][:modifier] = \"sys_modifier\"\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to cms_school_path(@school), notice: 'School was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to :back, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School update successful.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.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 @schooling = Schooling.find(params[:id])\n\n respond_to do |format|\n if @schooling.update_attributes(params[:schooling])\n format.html { redirect_to(@schooling, :notice => 'Schooling was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schooling.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = \"#{@school.name} was successfully updated.\"\n format.html { redirect_to @person }\n format.xml { head :ok }\n format.js { @school.reload and render :layout => false }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @school.update(school_params)\r\n format.html { redirect_to @school, notice: 'Skolan har uppdaterats!' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n if @school_setup.update_attributes(params[:school_setup])\n format.html { redirect_to @school_setup, notice: 'School setup was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cms_school.update(cms_school_params)\n format.html { redirect_to @cms_school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_school }\n else\n format.html { render :edit }\n format.json { render json: @cms_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nces06_school = Portal::Nces06School.find(params[:id])\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (found instance)\n # authorize @nces06_school\n\n respond_to do |format|\n if @nces06_school.update(portal_nces06_school_strong_params(params[:nces06_school]))\n flash['notice'] = 'Portal::Nces06School was successfully updated.'\n format.html { redirect_to(@nces06_school) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nces06_school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to city_school_path(@city), notice: \"School was successfully updated.\" }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tournament = @school.tournament\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @tournament, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_school\n @school = @city.schools.find(params[:id])\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 if @school.update(school_params)\n redirect_to super_path\n else\n redirect_to schools_path\n end\n end", "def update\n @school_property = SchoolProperty.find(params[:id])\n list\n\n respond_to do |format|\n if @school_property.update_attributes(params[:school_property])\n format.html { redirect_to(@school_property, :notice => 'SchoolProperty was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @school_property.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:success] = t('student.updated')\n format.html { redirect_to(students_path) }\n format.xml { head :ok }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ss_type = SsType.find(params[:id])\n\n respond_to do |format|\n if @ss_type.update_attributes(params[:ss_type])\n format.html { redirect_to(@ss_type, :notice => 'Ss type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ss_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @school_rec = SchoolRec.find(params[:id])\n\n respond_to do |format|\n if @school_rec.update_attributes(params[:school_rec])\n flash[:notice] = 'SchoolRec was successfully updated.'\n format.html { redirect_to(@school_rec) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @school_rec.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @standard = Standard.find(params[:id])\n\n respond_to do |format|\n if @standard.update_attributes(params[:standard])\n flash[:notice] = 'Standard was successfully updated.'\n format.html { redirect_to subject_url(@standard.subject, :anchor=>\"standards\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @standard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @high_school.update(high_school_params)\n format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }\n format.json { render :show, status: :ok, location: @high_school }\n else\n format.html { render :edit }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @high_school.update(high_school_params)\n format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }\n format.json { render :show, status: :ok, location: @high_school }\n else\n format.html { render :edit }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scholarship.update_attributes(params[:scholarship])\n flash[:notice] = 'Scholarship was successfully updated.'\n format.html { redirect_back(url_for([@event, @registration, @scholarship])) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scholarship.errors, :status => :unprocessable_entity }\n end\n end\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 @kingdom = Kingdom.find(params[:id])\n\n respond_to do |format|\n if @kingdom.update_attributes(params[:kingdom])\n flash[:notice] = 'Kingdom was successfully updated.'\n format.html { redirect_to(@kingdom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kingdom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to @inschool, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_school\r\n @school = School.find(params[:id])\r\n end", "def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to my_schools_path, notice: 'School class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n if @schoolclass.update_attributes(params[:schoolclass])\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:notice] = 'Student was successfully updated.'\n format.html { redirect_to(@student) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n if @school.update(model_params)\n redirect_to school_path(@school)\n else\n render :edit\n end\n end", "def update\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n if @studentset.update_attributes(params[:studentset])\n format.html { redirect_to @studentset, notice: 'Studentset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n if @scaff.update_attributes(params[:scaff])\n format.html { redirect_to @scaff, notice: 'Scaff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Student was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n @student.update_attributes(params[:student])\n end", "def set_school_info\n @school_info = SchoolInfo.find(params[:id])\n end", "def update\n @strelki = Strelki.find(params[:id])\n\n respond_to do |format|\n if @strelki.update_attributes(params[:strelki])\n flash[:notice] = 'Strelki was successfully updated.'\n format.html { redirect_to(@strelki) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @strelki.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @schoolb.update(schoolb_params)\n render :show, status: :ok, location: @schoolb\n else\n render json: @schoolb.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student update successful.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n if @spouse.update_attributes(params[:spouse])\n flash[:notice] = 'Spouse was successfully updated.'\n format.html { redirect_to(@spouse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spouse.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @scout_master = ScoutMaster.find(params[:id])\n\n respond_to do |format|\n if @scout_master.update_attributes(params[:scout_master])\n format.html { redirect_to(@scout_master, :notice => 'Scout master was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scout_master.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school_info.update(school_info_params)\n format.html { redirect_to school_infos_path, notice: 'School info was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_info }\n else\n format.html { render :edit }\n format.json { render json: @school_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @sofa = Sofa.find(params[:id])\n\n respond_to do |format|\n if @sofa.update_attributes(params[:sofa])\n flash[:notice] = 'Sofa was successfully updated.'\n format.html { redirect_to(@sofa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student_improveship = StudentImproveship.find(params[:id])\n\n respond_to do |format|\n if @student_improveship.update_attributes(params[:student_improveship])\n format.html { redirect_to(@student_improveship, :notice => 'Student improveship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_improveship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tutorials = Tutorials.find(params[:id])\n\n respond_to do |format|\n if @tutorials.update_attributes(params[:tutorials])\n flash[:notice] = 'Tutorials was successfully updated.'\n format.html { redirect_to(@tutorials) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutorials.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to(@student, :notice => 'Alumno guardado con éxito.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school_type.update(school_type_params)\n format.html { redirect_to @school_type, notice: 'School type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @simperson = Simperson.find(params[:id])\n\n respond_to do |format|\n if @simperson.update_attributes(params[:simperson])\n flash[:notice] = 'Simperson was successfully updated.'\n format.html { redirect_to(@simperson) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @simperson.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n Student.find(params[:id]).update(student_params)\n redirect_to \"/dojos\"\n end", "def update\n @student_correspondence = StudentCorrespondence.find(params[:id])\n\n respond_to do |format|\n if @student_correspondence.update_attributes(params[:student_correspondence])\n format.html { redirect_to(@student_correspondence, :notice => 'Student correspondence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_correspondence.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student_referee = StudentReferee.find(params[:id])\n\n respond_to do |format|\n if @student_referee.update_attributes(params[:student_referee])\n format.html { redirect_to(@student_referee, :notice => 'Student referee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_referee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n if @lookup_scantask.update(lookup_scantask_params)#params[:lookup_scantask], :without_protection => true)\n format.html { redirect_to(@lookup_scantask, :notice => 'Lookup scantask was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_scantask.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_sec702_school\n @sec702_school = Sec702School.find(params[:id])\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n params[:school][:school_type] = params[:school][:school_type].strip.downcase.gsub(\" \",\"_\")\n @school_types = ((SCHOOL_DEFAULTS + City.find(session[:current_city_id]).utility.schools.map(&:school_type)).uniq.sort!).join(\",\").humanize.titleize\n if @admin_school.update(admin_school_params)\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola è stato aggiornato con successo.' }\n format.json { render :show, status: :ok, location: @admin_school }\n else\n format.html { render :edit }\n format.json { render json: @admin_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end", "def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thesis_proposal = ThesisProposal.find(params[:id])\n\n respond_to do |format|\n if @thesis_proposal.update_attributes(params[:thesis_proposal])\n format.html { redirect_to(@thesis_proposal, :notice => 'ThesisProposal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thesis_proposal.errors, :status => :unprocessable_entity }\n end\n end\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 update\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n if @institute.update_attributes(params[:institute])\n format.html { redirect_to(@institute, :notice => 'Institute was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n if @sasmap.update_attributes(params[:sasmap])\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6344708", "0.62049484", "0.61586577", "0.60317445", "0.60317445", "0.59912884", "0.5926353", "0.5900351", "0.58999753", "0.5894096", "0.5848122", "0.58429426", "0.58210665", "0.57818854", "0.5775242", "0.5775242", "0.5775242", "0.5775242", "0.57613486", "0.5742668", "0.5735101", "0.5709416", "0.56909", "0.5676103", "0.5654254", "0.5651307", "0.5646638", "0.56448716", "0.5641211", "0.5612206", "0.5595849", "0.55474484", "0.5530773", "0.5504236", "0.5500908", "0.54980856", "0.54980856", "0.5496098", "0.54938394", "0.54912317", "0.548717", "0.54832697", "0.54762185", "0.54637897", "0.54574174", "0.54574174", "0.54574174", "0.54476887", "0.5441128", "0.5440129", "0.5439378", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.54353553", "0.5434918", "0.54343253", "0.5434054", "0.5427552", "0.5426129", "0.5416735", "0.5415474", "0.54146403", "0.54035735", "0.5401997", "0.53929", "0.53870183", "0.5385862", "0.53848517", "0.5383737", "0.5379243", "0.53748316", "0.53711456", "0.53705794", "0.5367595", "0.53641903", "0.5361798", "0.53561926", "0.5355175", "0.53541505", "0.5351836", "0.5351727", "0.5350631", "0.53401524", "0.53395563", "0.533308", "0.53316635", "0.5330181" ]
0.5356405
89
DELETE /schools/1 DELETE /schools/1.xml
def destroy @school = School.find(params[:id]) @school.destroy respond_to do |format| format.html { redirect_to(schools_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school_rec = SchoolRec.find(params[:id])\n @school_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(school_recs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_schools_url }\n format.json { head :ok }\n end\n end", "def destroy\n @schools_user = SchoolsUser.find(params[:id])\n @schools_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n get_school\n @school_request = @school.requests.find(params[:id])\n @school_request.destroy\n end", "def destroy\n @student_relation = StudentRelation.find(params[:id])\n @student_relation.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_relations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_referee = StudentReferee.find(params[:id])\n @student_referee.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_referees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nces06_school = Portal::Nces06School.find(params[:id])\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (found instance)\n # authorize @nces06_school\n @nces06_school.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_nces06_schools_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @senhas = Senha.find(params[:id])\n @senhas.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_correspondence = StudentCorrespondence.find(params[:id])\n @student_correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_correspondences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School deletion successful.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schooling = Schooling.find(params[:id])\n @schooling.destroy\n\n respond_to do |format|\n format.html { redirect_to(schoolings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'Sekolah berhasil dihapus.' }\n end\n end", "def destroy\n @school.destroy\n end", "def destroy\n \t@school = School.find(params[:id])\n \t@school.destroy\n \tredirect_to schools_path\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @cms_school.destroy\n respond_to do |format|\n format.html { redirect_to cms_schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_relationship = StudentRelationship.find(params[:id])\n @student_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_relationships_path) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @schoolb.destroy\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to my_schools_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = current_user.students.find(params[:id])\n @student.destroy\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @kingdom = Kingdom.find(params[:id])\n @kingdom.destroy\n\n respond_to do |format|\n format.html { redirect_to(kingdoms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to @student.school, notice: 'Student deletion successful.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to establishments_url, notice: 'La sede y todos sus estudiantes han sido borrados' }\n format.json { head :no_content }\n end\n end", "def destroy\n @seccion = Seccion.find(params[:id])\n @seccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(seccions_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @sa = Sa.find(params[:id])\n @sa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @scaff = Scaff.find(params[:id])\n @scaff.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @standard = Standard.find(params[:id])\n @standard.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_url(@standard.subject, :anchor=>'standards')) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_publication = StudentPublication.find(params[:id])\n @student_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_publications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @helibasis = Helibase.find(params[:id])\n @helibasis.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school_setup = SchoolSetup.find(params[:id])\n @school_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to school_setups_url }\n format.json { head :ok }\n end\n end", "def destroy\n get_school\n @school_vocational = @school.vocationals.find(params[:id])\n @school_vocational.destroy\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @strelki = Strelki.find(params[:id])\n @strelki.destroy\n\n respond_to do |format|\n format.html { redirect_to(strelkis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_site.destroy\n respond_to do |format|\n format.html { redirect_to student_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n flash[:notice] = _('Student was successfully deleted.')\n format.html { redirect_to(:action => 'index') }\n format.xml { head :ok }\n end\n end", "def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n delete_with_references(@student,students_path)\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy rescue flash[:notice] = 'No se puede borrar el alumno'\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to city_schools_path(@city), notice: \"School was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @semester_subject = SemesterSubject.find(params[:id])\n @semester_subject.destroy\n\n respond_to do |format|\n format.html { redirect_to(semester_subjects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_howuknowusship = StudentHowuknowusship.find(params[:id])\n @student_howuknowusship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_howuknowusships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to(subways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shelf = Shelf.find(params[:id])\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(shelves_url) }\n format.xml { head :ok }\n end\n end", "def remove\n @site = Site.find(params[:id])\n @study.sites.delete(@site)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @lookup_scantask = LookupScantask.find(params[:id])\n @lookup_scantask.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_scantasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @studentset = Studentset.find(params[:id])\n @studentset.destroy\n\n respond_to do |format|\n format.html { redirect_to studentsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_type.destroy\n\n head :no_content\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 @student_regedship = StudentRegedship.find(params[:id])\n @student_regedship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_regedships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_school.destroy\n respond_to do |format|\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola cancellata con successo!.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_qualification = StudentQualification.find(params[:id])\n @student_qualification.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_qualifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n @supervisor_estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(supervisor_estagios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @school_property = SchoolProperty.find(params[:id])\n @school_property.destroy\n\n respond_to do |format|\n format.html { redirect_to(school_properties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @college = College.find(params[:id])\n @college.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_colleges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @school = School.find_by_id(params[:id])\n if @school.belongs_to_me(self.current_user) || @school.shared_to_me(self.current_user)\n @school.remove_associated_data\n @school.destroy\n \n respond_to do |format|\n format.html { redirect_to('/my_schools', :notice => 'School removed.') }\n format.xml { head :ok }\n end\n end\n end", "def destroy\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to inschools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff_rec = StaffRec.find(params[:id])\n @staff_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(staff_recs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solicitation = Solicitation.find(params[:id])\n @solicitation.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_improveship = StudentImproveship.find(params[:id])\n @student_improveship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_improveships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @simperson = Simperson.find(params[:id])\n @simperson.destroy\n\n respond_to do |format|\n format.html { redirect_to(simpeople_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @scout_master = ScoutMaster.find(params[:id])\n @scout_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(scout_masters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:student_id])\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @staffd = Staffd.find(params[:id])\n @staffd.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exalumno = @alumno.exalumno\n @exalumno.destroy\n\n respond_to do |format|\n format.html { redirect_to(alumno_path(@alumno)) }\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 destroy\n @sim_staff = SimStaff.find(params[:id])\n @sim_staff.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_staffs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_whylearnship = StudentWhylearnship.find(params[:id])\n @student_whylearnship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_whylearnships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @topic_attribute = TopicAttribute.find(params[:id])\n \n @topic_attribute.opinions.each do |opinion|\n opinion.destroy\n end\n \n @topic_attribute.destroy\n\n respond_to do |format|\n format.html { \n redirect_to(root_path)\n #topic_attributes_url\n }\n format.xml { head :ok }\n end\n end", "def destroy\n @sofa = Sofa.find(params[:id])\n @sofa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sofas_url) }\n format.xml { head :ok }\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 destroy\n @institute = Institute.find(params[:id])\n @institute.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to(students_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7277967", "0.69591266", "0.6726892", "0.6639786", "0.6625366", "0.66029966", "0.65740836", "0.6548256", "0.6548256", "0.6548256", "0.6548256", "0.6548256", "0.6548256", "0.65432864", "0.65332454", "0.65332454", "0.65231234", "0.6508441", "0.65078074", "0.6503284", "0.64849395", "0.648344", "0.64614403", "0.64541996", "0.64457655", "0.6417017", "0.63704634", "0.6369061", "0.6368469", "0.6348727", "0.6338118", "0.6324406", "0.6324406", "0.6324406", "0.6324406", "0.63231397", "0.63184917", "0.6312666", "0.62968445", "0.62878096", "0.62842536", "0.62827337", "0.62816894", "0.62812483", "0.6277323", "0.6274347", "0.6270124", "0.6260973", "0.62592155", "0.62578005", "0.62487876", "0.62433517", "0.62404305", "0.6238111", "0.62344545", "0.6233174", "0.62328553", "0.6232638", "0.6231958", "0.62304515", "0.62269145", "0.6225689", "0.62213784", "0.6218202", "0.62119454", "0.6203498", "0.6195869", "0.6187457", "0.61874104", "0.61825085", "0.6173846", "0.6172147", "0.6170329", "0.61702794", "0.6157769", "0.61566144", "0.61516345", "0.61498475", "0.61489046", "0.61482227", "0.6146514", "0.6143686", "0.6142386", "0.6140176", "0.6136786", "0.61364746", "0.61307", "0.61274034", "0.6127059", "0.61233", "0.61204916", "0.6119559", "0.61173755", "0.61158586", "0.61156845", "0.61141235", "0.6109023", "0.6107926", "0.6104547", "0.6103937" ]
0.7190573
1
Create a new Session object.
def initialize ext_initialize @headers = {} @timeout = 5 @connect_timeout = 1 @max_redirects = 5 @auth_type = :basic end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session\n @connection.create_session(@config || {})\n end", "def new\n @session = Session.new\n end", "def new\n @session = Session.new('')\n end", "def new\n @session = Session.new\n end", "def create!(*args)\n session = new(*args)\n session.save!\n 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!(*args)\n session = new(*args)\n session.save!\n end", "def create!(*args)\n session = new(*args)\n session.save!\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 new(api_key = nil, secret_key = nil, session_key = nil)\n Session.create(api_key, secret_key, session_key)\n end", "def create_session\n raise NotImplementedError\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\n Puppet::HTTP::Session.new(self, build_resolvers)\n end", "def create(*args, &block)\n session = new(*args)\n session.save(&block)\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 new\n @session = User::Session.new\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 new(*)\n # return new mock session\n BunnyMock::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 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 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 session #:nodoc:\n @session ||= Session.new\n end", "def session\n @session ||= Session.new(req)\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 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\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 new_session\n session = IntegrationSession.new\n session.test_case = self\n return 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 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 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 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_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 new\n @taster_session = TasterSession.new\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 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\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 open_session\n s = Session.wrap(Cproton.pn_session(@impl))\n s.open\n return s\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 session\n @session ||= Puffs::Session.new(req)\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\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 create_session(start, opts = {})\n data, _status_code, _headers = create_session_with_http_info(start, opts)\n return data\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\n @user_session = UserSession.new\n end", "def new\n @user_session = UserSession.new\n end", "def new\n @user_session = UserSession.new\n end", "def new\n @user_session = UserSession.new\n end", "def new\n @user_session = UserSession.new\n end", "def new\n\t\t@user_session = UserSession.new\n\tend", "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\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 @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 session\n @session ||= OpenStruct.new\n end", "def initialize(session, option=nil)\n if @session = @@session_class.find_session(session.session_id)\n @data = unmarshalize(@session.data)\n else\n @session = @@session_class.create_session(session.session_id, marshalize({}))\n @data = {}\n end\n end", "def initialize(session)\n self.session = session\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_consumer_session\n connection.create_session(@config || {})\n end", "def new_session\n IntegrationSession.new\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(options={}, &block)\n self.class.session self, &block\n end", "def session\n @session ||= establish_connection\n end", "def session\n @session ||= Session.new(@request)\n @session\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 new_user_session(user)\n session = new_session\n session.login!(user)\n return session\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_pool(params={})\n require 'hornetq/client/session_pool'\n SessionPool.new(self, params)\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 initialize(session)\n @session = session\n end", "def initialize(session)\n @session = session\n end", "def initialize(session)\n @session = 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 session\n @session ||= Session.new(request)\n end", "def initialize(session); end", "def new\n @email_field = email_field\n @session = 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 load_session\n session = Session.new(nil, nil)\n if session.load\n @session = session ; true\n end\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 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 session\n @session ||= Session.new(@request)\n end", "def session\n response = Stanza::Iq.new :set\n response.to = @to\n response << (sess = XMPPNode.new('session', response.document))\n sess.namespace = SESSION_NS\n\n @stream.send response\n end", "def session\n # lazy assign so session persists for entire controller life\n @session ||= Session.new(@req)\n end", "def initialize(name:, owner:, ttl:)\n @endpoint = [\"sessions\", name]\n\n # create session\n @@api.post(endpoint: @endpoint, params: {'owner' => owner, 'ttl' => ttl})\n\n @addressbook = Addressbook.new(endpoint: @endpoint)\n @services = Services.new(endpoint: @endpoint)\n @rules = Rules.new(endpoint: @endpoint)\n @interfaces = Interfaces.new(endpoint: @endpoint)\n @chains = Chains.new(endpoint: @endpoint)\n @checks = Checks.new(endpoint: @endpoint)\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 session\n\t\tunless @session\n\t\t\t# Load the session from the associated request if there is one.\n\t\t\t# If there isn't an associated request, this will just create a\n\t\t\t# new blank session.\n\t\t\tif self.request.session?\n\t\t\t\tself.log.debug \"Getting the request's session.\"\n\t\t\t\tself.session = request.session\n\t\t\telse\n\t\t\t\tself.log.debug \"No session loaded in the request; creating it in the response.\"\n\t\t\t\tself.session = Strelka::App::Sessions.session_class.new\n\t\t\tend\n\t\tend\n\n\t\treturn @session\n\tend", "def initialize\n\t\t\t\tcgi = CGI.new('html4')\n\n\t\t\t\t# We make sure to delete an old session if one exists,\n\t\t\t\t# not just to free resources, but to prevent the session\n\t\t\t\t# from being maliciously hijacked later on.\n\t\t\t\tbegin\n\t\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => false)\n\t\t\t\t\t@session.delete\n\t\t\t\trescue ArgumentError # if no old session\n\t\t\t\tend\n\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => true)\n\t\t\t\t@session['datastore'] = {}\n\t\t\tend", "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", "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 initialize(session, option=nil)\n @session = Session.find_first([\"sessid = '%s'\", session.session_id])\n if @session\n @data = @session.data\n else\n @session = Session.new(\"sessid\" => session.session_id, \"data\" => {})\n end\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 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 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 create_session\n session[:who_is_this] = \"admin\"\n end", "def start_session\n session_tracker.start_session\n end" ]
[ "0.81259", "0.8082606", "0.80345243", "0.78859913", "0.7856406", "0.76827085", "0.7644303", "0.7644303", "0.7546965", "0.7520553", "0.7477961", "0.7416137", "0.7335377", "0.72374004", "0.72347605", "0.7223382", "0.70416176", "0.7013106", "0.6928517", "0.68244666", "0.6803797", "0.67953527", "0.67947716", "0.6794209", "0.6777692", "0.6777692", "0.6777692", "0.6777692", "0.6777692", "0.6765725", "0.6744216", "0.6744216", "0.6742852", "0.6721913", "0.6720868", "0.6720868", "0.6720868", "0.66913646", "0.6684252", "0.66507727", "0.66219115", "0.66203326", "0.65841216", "0.6582585", "0.6549301", "0.65243876", "0.6519519", "0.6510409", "0.65045923", "0.6490597", "0.64618826", "0.6454388", "0.6454388", "0.6454388", "0.6454388", "0.6454388", "0.6451717", "0.64491665", "0.6446688", "0.64414424", "0.64294744", "0.642939", "0.6413549", "0.63941914", "0.6382715", "0.6381713", "0.6350902", "0.63363105", "0.6318598", "0.6316264", "0.63068515", "0.63038045", "0.63019586", "0.62990594", "0.62944096", "0.62797177", "0.62797177", "0.62797177", "0.62771153", "0.6271648", "0.626698", "0.6265553", "0.62631595", "0.6262389", "0.62460536", "0.6245725", "0.62371767", "0.62229383", "0.62188077", "0.61866325", "0.61807716", "0.6173377", "0.61596745", "0.6149931", "0.6147506", "0.61470044", "0.6124712", "0.6090823", "0.60905504", "0.6088998", "0.6082856" ]
0.0
-1
Makes this session handle cookies and store them in in +file+. If file is nil they will be stored in memory. Otherwise the +file+ must be readable and writable. Calling multiple times will add more files.
def handle_cookies(file = nil) if file path = Pathname(file).expand_path unless File.exists?(file) and File.writable?(path.dirname) raise ArgumentError, "Can't create file #{path} (permission error)" end unless File.readable?(file) or File.writable?(path) raise ArgumentError, "Cant read or write file #{path} (permission error)" end end enable_cookie_session(path.to_s) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_cookies(file_path = nil)\n if file_path\n path = Pathname(file_path).expand_path\n \n if !File.exist?(file_path) && !File.writable?(path.dirname)\n raise ArgumentError, \"Can't create file #{path} (permission error)\"\n elsif File.exist?(file_path) && !File.writable?(file_path)\n raise ArgumentError, \"Can't read or write file #{path} (permission error)\"\n end\n else\n path = nil\n end\n \n # Apparently calling this with an empty string sets the cookie file,\n # but calling it with a path to a writable file sets that file to be\n # the cookie jar (new cookies are written there)\n add_cookie_file(path.to_s)\n \n self\n end", "def save(file = '.cookies')\n File.write(file, to_a.to_yaml)\n end", "def store(file, dependencies = nil)\n @mutex.synchronize do\n @data[file.to_s] = File.new(file, dependencies: dependencies)\n end\n end", "def load(file = '.cookies')\n YAML.safe_load_file(file, permitted_classes: [::Symbol, ::Time]).each do |c|\n add(c.delete(:name), c.delete(:value), c)\n end\n end", "def save_cookie(cookie)\n dputs __method__.to_s\n File.open($CONF['cookie'], \"w\") do |fc|\n fc.write(cookie)\n end\nend", "def cookies\n call_once\n @cookies\n end", "def <<( cookies )\n [cookies].flatten.compact.each do |cookie|\n ((@domains[cookie.domain] ||= {})[cookie.path] ||= {})[cookie.name] = cookie.dup\n end\n self\n end", "def close\n handle.finish if handle.started?\n self.cookies = {}\n end", "def get_cookiefile(login=nil)\n # autoreg has a special file\n if login == 'autoreg'\n @cookiefile = '/root/.nventory_cookie_autoreg'\n if ! File.directory?('/root')\n Dir.mkdir('/root')\n end\n end\n # Create the cookie file if it doesn't already exist\n if !File.exist?(@cookiefile)\n warn \"Creating #{@cookiefile}\"\n File.open(@cookiefile, 'w') { |file| }\n end\n # Ensure the permissions on the cookie file are appropriate,\n # as it will contain a session key that could be used by others\n # to impersonate this user to the server.\n st = File.stat(@cookiefile)\n if st.mode & 07177 != 0\n warn \"Correcting permissions on #{@cookiefile}\"\n File.chmod(st.mode & 0600, @cookiefile)\n end\n @cookiefile\n end", "def writers\n keys = self.class.cookie_index\n Module.new do\n keys.each_pair do |method_name, key|\n define_method \"#{method_name}=\" do |value|\n @cookie[key] = value\n end\n end\n end\n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def update( cookies )\n [cookies].flatten.compact.each do |c|\n self << case c\n when String\n begin\n Cookie.from_string( ::Arachni::Options.url.to_s, c )\n rescue\n Cookie.from_set_cookie( ::Arachni::Options.url.to_s, c )\n end\n\n when Hash\n Cookie.new( ::Arachni::Options.url.to_s, c ) if c.any?\n\n when Cookie\n c\n end\n end\n self\n end", "def cookies\n @cookies_proxy ||= Class.new do\n attr_reader :controller, :response\n\n def initialize controller\n @controller, @response = controller, controller.response\n end\n\n # set cookie header\n #\n # @param [String, Symbol] key\n # @param [String, Hash] val\n # @return [Boolean]\n def []= key, val\n return if readonly?\n response.set_cookie key, val\n end\n\n # get cookie by key\n def [] key\n controller.orig_cookies[key]\n end\n\n # instruct browser to delete a cookie\n #\n # @param [String, Symbol] key\n # @param [Hash] opts\n # @return [Boolean]\n def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end\n\n # prohibit further cookies writing\n #\n # @example prohibit writing for all actions\n # before do\n # cookies.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # cookies.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n controller.orig_cookies.send *args\n end\n end.new @ctrl\n end", "def cookies; @cookies ||= CookieJar.new; end", "def save\n if @data && @data.length > 0\n File.write( session_path, @data.to_yaml )\n @request.response.set_cookie( 'session_id',\n :value => session_id, :path => '/',\n :expires => Time.now + Waves.config.session[:duration] )\n end\n end", "def set_cookie\n if File.exist?('cookie.txt')\n puts 'Cookie exists'\n File.read('cookie.txt')\n else\n ''\n end\nend", "def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end", "def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end", "def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def write_pidfile(file)\n File.open file, \"w\" do |file|\n file << Process.id\n end\n end", "def cookies\n CookieJar.new(self)\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def set(resource)\n @cookies.signed[cookie_name] = {value: [resource.id, Time.now.to_i]}.merge(cookie_options)\n end", "def store(session_cookie)\n @db.insert(\"session_cookies\", session_cookie.attributes)\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json)\n res.cookies << cookie\n end", "def cookies(path=\"/\")\n _cookies(path_to_array(path))\n end", "def initialize(file)\n ext = File.extname(file.original_filename).downcase\n @path = \"#{Rails.public_path}/temp_files/#{Time.now.to_f}#{ext}\"\n File.open(@path, \"wb\") { |f| f.write(file.read) }\n end", "def store(file)\n sharefile_file = file.to_file\n @content_type ||= file.content_type\n root_folder = @config[:sharefile_root]\n @file = @client.store_document(root_folder, @path, sharefile_file)\n end", "def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend", "def <<( cookie )\n\t\t@cookie_set.delete( cookie )\n\t\t@cookie_set.add( cookie )\n\n\t\treturn self\n\tend", "def store_file(key, klass, file)\n raise MogileFS::ReadOnlyError if readonly?\n\n new_file key, klass do |mfp|\n if file.respond_to? :sysread then\n return sysrwloop(file, mfp)\n else\n\tif File.size(file) > 0x10000 # Bigass file, handle differently\n\t mfp.big_io = file\n\t return\n\telse\n return File.open(file, \"rb\") { |fp| sysrwloop(fp, mfp) }\n end\n end\n end\n end", "def set_cookie(options) #:doc:\n options[\"path\"] = \"/\" unless options[\"path\"]\n cookie = CGI::Cookie.new(options)\n @controller.logger.info \"Cookie set: #{cookie}\" unless @controller.logger.nil?\n @controller.response.headers[\"cookie\"] << cookie\n end", "def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n case headers['Set-Cookie']\n when nil\n headers['Set-Cookie'] = [cookie]\n when Array\n headers['Set-Cookie'] << cookie\n end\n end", "def merge(raw_cookies, uri = nil)\n return unless raw_cookies\n\n if raw_cookies.is_a? String\n raw_cookies = raw_cookies.split(\"\\n\")\n raw_cookies.reject!(&:empty?)\n end\n\n raw_cookies.each do |raw_cookie|\n cookie = Cookie.new(raw_cookie, uri, @default_host)\n self << cookie if cookie.valid?(uri)\n end\n end", "def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end", "def store(key, data)\n store = Storage.new\n store.data = data\n\n if store.save \n session[key] = store.id\n cookies[key] = store.id\n end\n end", "def initialize( *cookies )\n\t\t@cookie_set = Set.new( cookies.flatten )\n\tend", "def write_cache!(session)\n FileUtils.mkdir_p(Config.cache_path)\n File.open(cached_file, \"w\") do |cache_file|\n cache_file.write(session.serialize)\n end\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def store\n File.store(uuid)\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def store_session(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app', @hash.to_json)\n end", "def store_session(res)\n attributes = { path: '/', value: @cookie.to_json }\n res.set_cookie('_rails_lite_app', attributes)\n #store_session(response) that will put the session into a cookie\n# and set it using Rack::Response#set_cookie.\n# The first argument to #set_cookie is the name of the cookie which\n# should be _rails_lite_app.\n# The second argument is the cookie attributes. These are merely a hash\n# of path: ..., value: ..., where path is the path where our cookie is\n# available and value is a string. Since we want to pass a collection\n# (our session store) in the cookie, we can serialize our instance\n# variable using JSON. The path should be / (our root url) so the cookie\n# will available at every path.\n# NB: In order for this to work properly, the path and value keys in\n# your hash must be symbols, not strings.\n end", "def persist!\n self.expires_at = Authie.config.persistent_session_length.from_now\n self.save!\n set_cookie!\n end", "def save( response )\n\t\tself.log.debug \"Saving session %s\" % [ self.session_id ]\n\t\tself.class.save_session_data( self.session_id, @hash )\n\t\tself.log.debug \"Adding session cookie to the response.\"\n\n\t\tsession_cookie = Strelka::Cookie.new(\n\t\t\tself.class.cookie_name,\n\t\t\tself.session_id,\n\t\t\tself.class.cookie_options || {}\n\t\t)\n\n\t\tresponse.cookies << session_cookie\n\tend", "def file_handle\n @file_handle ||= File.open(filename,'w')\n end", "def save(file=nil)\n @file = file if file\n FileUtils.mkdir_p(File.dirname(@file))\n File.open(@file,'w') do |f|\n f.write(JSON.pretty_generate(@h))\n end\n self\n end", "def file=(file)\n @file = file.respond_to?(:tempfile) ? file.tempfile : file\n end", "def cookies(cookies); end", "def store_session(res)\n res.set_cookie(:_rails_lite_app, {path:'/', value: @cookie.to_json})\n end", "def import\n Cookie.import(params[:file])\n redirect_to root_url\n end", "def cookie_persistence_method\n super\n end", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def store(filename, data, options = {})\n options = DEFAULT_STORE_OPTIONS.merge(options)\n\n case data\n when String\n io = StringIO.new(data)\n else\n # data is assumed to be an IO (#read)\n io = data\n end\n\n digest = options[:sha1digest]\n sha1 = Digest::SHA1.new unless digest\n size = 0\n tmpname0 = File.join(permanent_dir, \"tmp#{Process.pid}-#{Thread.object_id}\")\n File.open(tmpname0, \"wb\") do |f|\n until io.eof?\n dat = io.read(65536)\n f.write(dat)\n sha1 << dat if sha1\n size += dat.size\n end\n end\n digest ||= sha1.hexdigest\n\n levels, rest = split_sha1(digest)\n relpath = File.join(File.join(*levels), rest)\n path = File.join(transient_dir, relpath)\n\n FileUtils.mkdir_p(path)\n basename = options[:preserve_name] ? filename : @default_name\n dest = File.join(path, basename)\n\n unless File.exist?(dest)\n tmpname = File.join(path, \"tmp#{Process.pid}-#{Thread.object_id}\")\n FileUtils.mv(tmpname0, tmpname)\n File.rename(tmpname, dest)\n\n FileUtils.mkdir_p(File.join(permanent_dir, *levels))\n link_dst = File.join(permanent_dir, relpath)\n unless File.exist?(link_dst)\n FileUtils.ln_s(path, link_dst)\n end\n end\n\n FileSelector.new(:path => File.join(relpath, basename), \n :full_path => dest,\n :sha1digest => digest, :size => size)\n end", "def cookie_add(name, value=nil)\n return dup_without_response.cookie_add(name, value) if response\n\n cookies_string = HTTY::CookiesUtil.cookies_to_string(cookies +\n [[name.to_s, value]])\n if cookies_string\n @headers[COOKIES_HEADER_NAME] = cookies_string\n else\n @headers.delete COOKIES_HEADER_NAME\n end\n self\n end", "def record(filename)\n contents = File.read(filename) rescue nil\n files[filename] = contents unless files.has_key? filename\n end", "def new_store_file(option={}) # :nodoc:\n dir = option['tmpdir'] || Dir::tmpdir\n prefix = option['prefix']\n suffix = option['suffix']\n require 'digest/md5'\n md5 = Digest::MD5.hexdigest(session_id)[0,16]\n path = dir+\"/\"\n path << prefix if prefix\n path << md5\n path << suffix if suffix\n if File::exist? path\n hash = nil\n elsif new_session\n hash = {}\n else\n raise NoSession, \"uninitialized session\"\n end\n return path, hash\n end", "def store!(file_path)\n\n filename = File.basename(file_path)\n file = File.open(file_path, 'r')\n\n object_name = \"#{Date.today.strftime('%Y-%m-%d')}_#{filename}\"\n object = container.create_object(object_name)\n object.write(file)\n\n file.close\n\n puts \" -> Stored #{file_path} as #{object_name}\"\n\n end", "def add_cookie(opts = {})\n driver.manage.add_cookie(opts)\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def install_persistent_cookie(name, cookie)\n cookies[name] = {\n :value => cookie,\n :expires => 10.years.from_now\n }\n end", "def store!(file)\n f = File.new(uploader, self, uploader.store_path)\n f.store(file.read, 'Content-Type' => file.content_type)\n f\n end", "def serialize_into_cookie(record); end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @session.to_json)\n res.cookies << cookie\n end", "def session_remember\n httpsession = Thread.current[:hayabusa][:httpsession]\n raise \"Could not figure out HTTP-session.\" if !httpsession\n session = httpsession.session\n raise \"Could not get session-variable from HTTP-session.\" if !session\n session[:remember] = 1\n \n self.cookie(\n \"name\" => \"HayabusaSession\",\n \"value\" => _httpsession.session_id,\n \"path\" => \"/\",\n \"expires\" => Time.now + 32140800 #add around 12 months\n )\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def initialize (name, value = nil, maxage = nil, path = nil, domain = nil, secure = false)\n\t\t# {{{\n\t\t# HTTP headers (Cookies are a HTTP header) can only set, while no content\n\t\t# is send. So an exception will be raised, when @@allowed is set to false\n\t\t# and a new cookie has set.\n\t\tunless defined?(@@allowed)\n\t\t\t@@allowed = true\n\t\tend\n\t\tunless @@allowed\n\t\t\traise \"You can't set cookies after the HTTP headers are send.\"\n\t\tend\n\n\t\tunless defined?(@@list)\n\t\t\t@@list = []\n\t\tend\n\t\t@@list += [self]\n\n\t\tunless defined?(@@type)\n\t\t\t@@type = \"netscape\"\n\t\tend\n\n\t\tunless name.class == String\n\t\t\traise TypeError, \"The name of a cookie must be a string\", caller\n\t\tend\n\t\tif value.class.superclass == Integer || value.class == Float\n\t\t\tvalue = value.to_s\n\t\telsif value.class != String && value != nil\n\t\t\traise TypeError, \"The value of a cookie must be a string, integer, float or nil\", caller\n\t\tend\n\t\tif maxage.class == Time\n\t\t\tmaxage = maxage - Time.now\n\t\telsif !maxage.class.superclass == Integer || !maxage == nil\n\t\t\traise TypeError, \"The maxage date of a cookie must be an Integer or Time object or nil.\", caller\n\t\tend\n\t\tunless path.class == String || path == nil\n\t\t\traise TypeError, \"The path of a cookie must be nil or a string\", caller\n\t\tend\n\t\tunless domain.class == String || domain == nil\n\t\t\traise TypeError, \"The value of a cookie must be nil or a string\", caller\n\t\tend\n\t\tunless secure == true || secure == false\n\t\t\traise TypeError, \"The secure field of a cookie must be true or false\", caller\n\t\tend\n\n\t\t@name, @value, @maxage, @path, @domain, @secure = name, value, maxage, path, domain, secure\n\t\t@comment = nil\n\t\t# }}}\n\tend", "def saveSessionId(session_file, username, session_id)\n if session_file.to_s.empty? || session_id.to_s.empty?\n return\n end\n File.open(session_file, \"w\") {\n |f|\n f.write(\"#{username}\\n\")\n f.write(\"#{session_id}\\n\")\n }\n end", "def do_write!(cookie_name, spec)\n @controller.write_cookie! cookie_name, spec.merge(same_site: self.class.cookie_same_site)\n @controller.write_cookie! \"#{cookie_name}_legacy\", spec\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def set_cookie(name, value, path = '/', httponly = true, secure = true)\n \n cookie = WEBrick::Cookie.new(name, value)\n cookie.path = path\n cookie.httponly = httponly\n cookie.secure = secure\n \n # add cookie to response header\n @header['Set-Cookie'] = cookie.to_s\n end", "def set(file)\n self.file = file\n end", "def hubssolib_set_secure_cookie_data(name, value)\n if (@hubssolib_have_written_cookie)\n raise \"HubSsoLib: Attmept to set cookie '#{name}' more than once\"\n end\n\n @hubssolib_have_written_cookie = true\n\n # Using cookies.delete *should* work but doesn't. Set the\n # cookie with nil data instead.\n\n data = value.nil? ? nil : HubSsoLib::Crypto.encode_object(value, request.remote_ip)\n\n # No expiry time; to aid security, use session cookies only.\n\n cookies[name] = {\n :value => data,\n :path => HUBSSOLIB_COOKIE_PATH,\n :secure => true\n }\n end", "def read_cookiefile(cookiefile)\n warn \"Using cookies from #{cookiefile}\" if (@debug)\n cookies = []\n IO.foreach(cookiefile) do |line|\n cookie = parse_cookie(line)\n if cookie && cookie[:attributes] && cookie[:attributes][\"expires\"]\n if DateTime.parse(cookie[:attributes][\"expires\"]) < DateTime.now\n warn \"Cookie expired: #{cookie[:line]}\" if @debug\n next\n end\n end\n if cookie\n cookies << cookie\n end\n end\n cookies\n end", "def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end", "def create(cookies, options = {})\n return nil if self.class.site_key.nil?\n expires = (options.delete(:expires) || 1.week.from_now).to_i # we want unix time\n cookies[:tender_email] = cookie_value(@user.email)\n cookies[:tender_expires] = cookie_value(expires)\n\n # Optionally set the user's name. This is also signed.\n if options[:name_field]\n options[:name] = @user.send(options[:name_field])\n end\n options.each do |key, value|\n cookies[:\"tender_#{key}\"] = cookie_value(value)\n end\n cookies[:tender_hash] = cookie_value(expiring_token(expires, options[:name]))\n cookies\n end", "def _set_file(name, contents)\n File.open(\"%s/%s\" % [uri, name], \"w\") { |io| io.write contents }\n end", "def store_session(res)\n cookie = { path: '/', value: @cookie_hash.to_json }\n res.set_cookie(\"_rails_lite_app\", cookie )\n end", "def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end", "def write\n\t\tfile = File.new(@lock_file, \"w\")\n\t\tyield(file)\n\t\tfile.close\n\tend", "def save(file_token, file)\n create(file, {\n :RedirectWhenExpiredUrl => file_token.redirect_when_expired_url,\n :Unlimited => file.unlimited,\n :MaxDownloadAttempts => file.max_download_attempts,\n :MaxDownloadSuccesses => file.max_download_successes\n })\n end", "def lock_file file\n file_lock = file + \".lock\"\n open(file_lock, \"w\") {}\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def store_session(res)\n path = \"\\\\\"\n value = \n res.set_cookie(\"_rails_lite_app\", \"\") \n end", "def set_cookie(name, value, expires)\n (headers['Set-Cookie'] ||=[]) << (Merb::Const::SET_COOKIE % [\n name.to_s, \n ::Merb::Request.escape(value.to_s), \n # Cookie expiration time must be GMT. See RFC 2109\n expires.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n ])\n end", "def write_to_file_cache(file, payload)\n puts \"direct access, storing in #{file}\"\n File.open( file, 'w' ) do |out|\n Marshal.dump(payload, out)\n end\n payload\n end", "def set_cookie(cookie, uri = nil)\n cookie_jar.merge(cookie, uri)\n end" ]
[ "0.7640086", "0.6427692", "0.5976608", "0.58384496", "0.5711887", "0.5650596", "0.5573927", "0.5558675", "0.5527936", "0.54916537", "0.54678315", "0.54678315", "0.54677385", "0.5453353", "0.5447955", "0.54229385", "0.53891724", "0.5345292", "0.5298096", "0.5278311", "0.52641857", "0.5259196", "0.5256453", "0.5249439", "0.52378386", "0.5222721", "0.5222721", "0.52189326", "0.5190247", "0.51842856", "0.5179804", "0.5166025", "0.5159142", "0.5157879", "0.51577806", "0.51559263", "0.5154956", "0.5148481", "0.5139037", "0.51380324", "0.5137329", "0.5129722", "0.51262295", "0.51216567", "0.5108941", "0.5101473", "0.5101473", "0.5101473", "0.5101473", "0.5101473", "0.5101473", "0.5101473", "0.50894636", "0.5085803", "0.50765276", "0.50675106", "0.50607324", "0.5056237", "0.50472844", "0.50384307", "0.50375", "0.503136", "0.502069", "0.5015135", "0.50081927", "0.4999911", "0.4994171", "0.4993328", "0.49822864", "0.49821672", "0.49788797", "0.496565", "0.49499545", "0.49473116", "0.49406984", "0.49388996", "0.49298382", "0.49237987", "0.49225187", "0.4916955", "0.4916039", "0.49148142", "0.4914432", "0.49069056", "0.4902283", "0.48901856", "0.48893377", "0.4876695", "0.48744282", "0.48684427", "0.4862616", "0.48588112", "0.48532885", "0.48519534", "0.4848614", "0.4830651", "0.48279247", "0.48273894", "0.48270345", "0.48188838" ]
0.7927546
0
Enable debug output to stderr or to specified +file+.
def enable_debug(file = nil) set_debug_file(file.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_debug(file = nil)\n set_debug_file(file.to_s)\n self\n end", "def debug_output_file\n \"debug.log\"\nend", "def toggle_debug!\n stream = @config[:debug]\n\n if stream.respond_to?(:<<)\n self.class.debug_output(stream)\n else\n self.class.debug_output\n end\n end", "def debug(message)\n $stderr.puts(message) if @options[:debug]\nend", "def set_debug_output(arg); end", "def debug!\n self.severity = :DEBUG\n end", "def debug!\n @client.debug_dev = STDOUT\n end", "def debug_msg(msg=\"\")\n if(@config.debug)\n puts(\"Debug: #{msg}\")\n @file.puts(\"Debug: #{msg}\")\n end\n end", "def debug\n Puppet::Util::Log.level = :debug\n end", "def debug=(new_debug)\n LOGGER.debug = new_debug\n end", "def debug=(new_debug)\n LOGGER.debug = new_debug\n end", "def debug=(val)\n Handsoap::Service.logger = (val ? $stdout : nil)\n @@debug = val\n end", "def debug(msg)\n STDERR.puts msg if options.key? :debug\n end", "def debug_on(debug=true)\n ap \"Debugging is ON\"\n @debug = debug\n end", "def log_to(file)\n @log_file = file\n end", "def debug!(value = true)\n if options.key?(:trace) && options[:trace] != false\n Vedeu.log(\"Configuration::API debug: true\")\n\n options[:debug] = true\n\n else\n Vedeu.log(\"Configuration::API debug: #{value}\")\n\n options[:debug] = value\n\n end\n end", "def debug=(truthy=false)\n\t@debug=truthy\n end", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def write_debug( f )\n f.puts( $debug_buf )\n $debug_buf = \"\"\nend", "def force_debug\n self.level = :debug\n @level_frozen = true\n end", "def toggle_debug\n @debug = @debug == false ? true : false\n end", "def debug(msg)\n STDERR.puts msg if @debug\n end", "def debug(error)\n return if @debug.nil? or @debug.empty?\n begin\n File.open(@debug, \"a\"){|f| f.puts(error)}\n rescue\n warn(\"Error: debug: Failed to open #{@debug} for logging.\")\n end\n nil \n end", "def do_attach\n \n @options.files.each { |file|\n \n next if not File.exists? file\n \n @open = false\n @open_proc = ''\n @lines = ''\n \n File.new(file).each { |line|\n \n if line =~ /^\\s*call\\s+([a-z0-9_.]+)\\s*\\(/i then\n if not $1.include? 'debug'\n @open = true\n @open_proc = $1\n @lines += sprintf(\"CALL debug.on('%s');\", $1) + \" -- added by ghetto_profile\\n\"\n @lines += line\n end_debug(line)\n\n else\n @lines += line\n end_debug(line)\n \n end\n else\n @lines += line\n end_debug(line)\n\n end\n \n }\n \n File.new(file, 'w').write(@lines)\n \n }\n \n end", "def setDebugStream(stream)\n\t\t\t@_debug_stream = stream\n\t\tend", "def debug(str)\n $stderr.puts(str) if @debug\n end", "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end", "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end", "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end", "def debug(*args, &block)\n add_with_options(DEBUG, *args, &block)\n end", "def debug=(value); end", "def debug?; run_options[:debug]; end", "def with_debug\n @debug = true\n self\n end", "def debugging(debug_bool)\n Facter::Options[:debug] = debug_bool\n end", "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def setDebugLog(value)\n @fields['debug_log'] = value\n self\n end", "def debug=(flag)\n ENV['debug'] = nil\n ENV['DEBUG'] = flag.to_s\n end", "def debug(message = nil)\n log(:debug, message) unless message.nil?\n end", "def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end", "def debug_output=(arg); end", "def debug(*args)\n self.level = DEBUG if $DEBUG\n super\n end", "def debug! \n $DEBUG = true\n end", "def debug_logging=(value)\n if value\n log.level = Logger::DEBUG\n elsif log.is_a?(Datadog::Logger)\n log.level = Logger::WARN\n end\n end", "def set_debug(request_path, response_path)\n @debug = true\n @debug_request_path = request_path\n @debug_response_path = response_path\n end", "def debug_mode\n @configuration[:debug_mode] = true\n end", "def debug_mode=(flag)\r\n self.conf[:debug] = flag\r\n end", "def read_debug=(value); @debug = value; end", "def debug(msg)\n puts \"[watchr debug] #{msg}\" if options.debug\n end", "def debug(msg=nil)\n log \"DEBUG: #{msg}\" if $debug\n end", "def debug(message)\n if DEBUG\n log message\n end\nend", "def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end", "def debug (msg = \"\")\n if Object.const_defined?('Puppet')\n Puppet.debug 'facter(extra_modulepath):'+msg\n else\n if ENV['FACTER_DEBUG'] == 'true'\n $stdout.puts msg\n $stdout.flush\n end\n end\nend", "def log_debug(*debug_infos)\r\n options = debug_infos.extract_options!\r\n options[:development_only] ||= true\r\n\r\n if options[:development_only]\r\n if Rails.env != 'production'\r\n infos = create_info_log_string debug_infos\r\n end\r\n else\r\n infos = create_info_log debug_infos\r\n end\r\n\r\n if options[:write_to] && options[:write_to].to_sym == :error\r\n $log.error infos.join(\"\\n\")\r\n else\r\n $arb_log.info infos.join(\"\\n\")\r\n end\r\nend", "def debug(*args)\n log(:debug, *args)\n end", "def debug=(_)\n Nitro.mode = :debug\n end", "def debug_emit(fname = \"output\")\n file = File.new(fname+\".debug\", \"w+\")\n @instr.each{|i|\n file.puts \"#{i.to_s}\"\n }\n file.close \n end", "def debug(dev=$stdout)\n current_logger = Grit.logger\n current_debug = Grit.debug\n begin\n Grit.logger = Logger.new(dev)\n Grit.debug = true\n yield\n ensure\n Grit.logger = current_logger\n Grit.debug = current_debug\n end\n end", "def debug(message, options = { })\n unless ENV['GUARD_ENV'] == 'test'\n reset_line if options[:reset]\n STDERR.puts color(\"DEBUG (#{Time.now.strftime('%T')}): \", :yellow) + message if ::Guard.options && ::Guard.options[:debug]\n end\n end", "def debug(info)\n puts(info) if @debug\n end", "def setDebugFlag(flag)\n\t\t\t@_debug_flag = flag\n\t\tend", "def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\n `rm #{log_file} && touch #{log_file}`\nend", "def debug(message)\n puts message if debug?\n end", "def debug(*args)\n log&.debug(*args)\n end", "def file_log(level, lines)\n Array(lines).each do |line|\n if Omnitest.logger.debug?\n Omnitest.logger.debug(line)\n else\n Omnitest.logger.logdev && Omnitest.logger.logdev.public_send(level, line)\n end\n end\n end", "def logfile=(dev)\n @logfile = dev\n @logger = nil\n end", "def set_debug_level(val)\n super\n end", "def set_debug_level(val)\n super\n end", "def log(file)\n RestClient.log = file\n end", "def debug_mode=(debug_mode)\n ConsoleDisplay.debug = debug_mode\n end", "def sparkLogDebugToFile(fileName, sync = false)\n sparkEnableLog(fileName, 'eDebug', sync)\nend", "def enable_logging(opts); end", "def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend", "def debug(message)\n log(0, message)\n end", "def debug message, opts = {}, &block\n log message, opts.merge(:debug => !opts[:log]), &block\n end", "def http_debug(http_debug_bool)\n Facter::Options[:http_debug] = http_debug_bool\n end", "def debug; end", "def debug; end", "def debug; end", "def debug; end", "def debug(message)\n ostream.puts message if $DEBUG\n end", "def debug(options = T.unsafe(nil)); end", "def debug(log)\n output.puts log if log_level <= DEBUG\n end", "def enable_advanced_debugging_tools; end", "def debug message; write DEBUG, message, caller[0] unless level > @level end", "def debug_msg msg\n puts msg if @options[:debug]\n end", "def log\n STDERR.puts \"DEBUG: #{yield}\" if ENV[\"DEBUG\"] == \"1\"\n end", "def log_debug(message) # :nodoc:\n @logger.debug(message) if @logger\n end", "def do_debug\n # debugging = true\n debugging = false\n puts yield if debugging\n end", "def debug(message) ; @log.debug(message) ; end", "def update!(**args)\n @enable_debugging = args[:enable_debugging] if args.key?(:enable_debugging)\n end", "def update!(**args)\n @enable_debugging = args[:enable_debugging] if args.key?(:enable_debugging)\n end", "def log_debug(log_entry = \"\")\n entry(Gml::LOG_LEVEL_DEBUG, log_entry, 1)\n end" ]
[ "0.82929975", "0.62470144", "0.6213392", "0.60847056", "0.6025371", "0.6018709", "0.6002329", "0.59215146", "0.5903736", "0.58767444", "0.58767444", "0.57986104", "0.57913", "0.57783", "0.5774603", "0.5730017", "0.5712333", "0.5695378", "0.5695378", "0.5695378", "0.5693432", "0.56696635", "0.5663574", "0.56257755", "0.5601654", "0.5597918", "0.5585043", "0.55685043", "0.55624986", "0.55624986", "0.55624986", "0.55564755", "0.55307543", "0.55262655", "0.552449", "0.5518695", "0.55033875", "0.55012363", "0.55012363", "0.55012363", "0.55012363", "0.55012363", "0.55012363", "0.55012363", "0.5490152", "0.5475005", "0.5470515", "0.5468567", "0.54540884", "0.54505664", "0.5439654", "0.5428291", "0.542748", "0.5404281", "0.5403958", "0.5391483", "0.5383359", "0.5379708", "0.5363203", "0.5355567", "0.5337374", "0.53275716", "0.53128135", "0.53119284", "0.5306435", "0.5304885", "0.5303959", "0.5296814", "0.5293801", "0.52810997", "0.5276696", "0.5275908", "0.5265508", "0.52601236", "0.52601236", "0.5255062", "0.52467954", "0.52401614", "0.5238739", "0.52301943", "0.52201134", "0.52188504", "0.52180713", "0.5215653", "0.5215653", "0.5215653", "0.5215653", "0.52150846", "0.52086663", "0.52034765", "0.52022487", "0.51978374", "0.51877946", "0.5185155", "0.51837194", "0.51830494", "0.5179192", "0.5174881", "0.5174881", "0.51703066" ]
0.8562488
0
Standard HTTP methods Retrieve the contents of the specified +url+ optionally sending the specified headers. If the +base_url+ varaible is set then it is prepended to the +url+ parameter. Any custom headers are merged with the contents of the +headers+ instance variable. The results are returned in a Response object.
def get(url, headers = {}) request(:get, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_get(url, headers = nil)\r\n if @debug\r\n puts \"Url:\"\r\n puts url\r\n puts \"Headers:\"\r\n puts headers\r\n puts \"Method: get\"\r\n end\r\n return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)\r\n end", "def get(url, query = nil, headers = nil)\n headers = headers ? @headers.merge(headers) : @headers\n #Log.t(\"GET: #{url}\\n#{query.inspect}\\n#{headers.inspect}\")\n content = @client.get_content(URI.join(@base, url), query, headers) rescue ''\n Nokogiri::HTML(content)\n end", "def get(url, headers={})\n RestClient.get url, headers\n end", "def get(url, headers)\n conn = create_connection_object(url)\n\n http = conn.get(:head => add_authorization_to_header(headers, @auth))\n\n action = proc do\n response = Response.new(http.response.parsed, http)#.response.raw)\n yield response if block_given?\n end\n\n http.callback &action\n http.errback &action \n end", "def make_get_request url, headers = []\n make_request url, headers: headers\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end", "def request_with_headers(url, headers = {}, https = false)\n uri = URI.parse(url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = https\n\n request = Net::HTTP::Get.new(uri.path)\n\n headers.each do |header|\n request[header[0].to_s] = header[1]\n end\n\n response = http.request(request)\n\n return response\n end", "def get(url, headers: {}, params: {}, options: {}, &block)\n url = encode_query(url, params)\n\n request = Net::HTTP::Get.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options, &block)\n end", "def get_response(url = nil, headers = nil)\n options = {:headers => headers}.merge(ssl_option)\n Typhoeus::Request.get(url || default_url, options)\n end", "def http_get(url)\n response = client.get(url, follow_redirect: true)\n\n raise HTTPClient::BadResponseError, response.reason unless HTTP::Status.successful?(response.status)\n\n response\n end", "def get(url, params = nil, headers = nil)\n faraday_response = faraday.get(url, params, headers) do\n _1.options[:proxy] = random_proxy\n end\n Response.new(faraday_response)\n end", "def http_get(path, headers = { })\n clear_response\n path = process_path(path)\n @success_code = 200\n @response = http.get(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def get(query_url,\r\n headers: {})\r\n HttpRequest.new(HttpMethodEnum::GET,\r\n query_url,\r\n headers: headers)\r\n end", "def get(url, params=nil, headers={})\n if params and params.count > 0\n params.keys.to_a.each {|k|\n params.delete(k) if params[k].nil?\n }\n query_string = Util.query_params(params)\n url += \"?#{query_string}\"\n end\n request(:get, url, nil, headers)\n end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get(uri, request_headers)\n request('get', uri, request_headers)\n end", "def get(url, options={})\n rest_connection.get do |req|\n req.url build_url(url)\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n req.params = options[:params] if options.has_key?(:params) && !options[:params].empty?\n req.options.timeout = config.rest_timeout\n req.options.open_timeout = config.rest_open_timeout\n end\n end", "def get(url, options)\n headers = options[:headers] || {}\n params = options[:params] || {}\n url = url_with_params(url, params)\n req = Net::HTTP::Get.new(url)\n request_with_headers(req, headers)\n end", "def http_get(base, uri)\n faraday_with_default_adapter(base) { | connection |\n connection.use FaradayMiddleware::FollowRedirects, limit: 1\n }.get(uri)\n end", "def get_wrapper(url, headers)\n [parse_response(RestClient.get(resource + url, headers)), true]\n rescue RestClient::Exception => e\n [parse_error(e.response), false]\n end", "def get\n res = connection.get url.to_s\n Response.const_get(class_basename).new res.body, res.status\n end", "def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end", "def get(path, options={})\n url = build_url path, options\n headers = options[:headers] || {}\n Response.new(@client[url].get headers)\n rescue RestClient::Exception => e\n Response.new e.response\n end", "def get(path, headers = {})\n request = Net::HTTP::Get.new(path)\n @default_headers.merge(headers).each do |key, value|\n request[key] = value\n end\n @http.request(request)\n end", "def get(url, params={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n # add URL parameters\n uri.query = URI.encode_www_form(params)\n\n debug(\"GET #{uri} #{headers.inspect}\")\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Get.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n get_raw(response['location'], params, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def perform_request url\n response = self.class.get(url)\n raise NotFound.new(\"404 Not Found\") if response.respond_to?(:code) && response.not_found?\n raise InvalidAPIResponse.new(response[\"status\"][\"message\"]) if response.is_a?(Hash) && response[\"status\"]\n\n response\n end", "def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil, redirect_limit = 5)\n cachekey = url_s.to_s\n\n cached_value = @cache[cachekey]\n if cached_value\n sock = Net::BufferedIO.new(StringIO.new(cached_value))\n info = Net::HTTPResponse.read_new(sock)\n info.reading_body(sock, true) {}\n\n if method == Net::HTTP::Put and info.key? 'etag' and not headers['If-Match']\n headers['If-Match'] = info['etag']\n end\n end\n\n if cached_value and not [Net::HTTP::Get, Net::HTTP::Head].member? method\n @cache.delete(cachekey)\n elsif cached_value\n entry_disposition = _entry_disposition(info, headers)\n\n if entry_disposition == :FRESH\n info.extend Atom::HTTPResponse\n\n return info\n elsif entry_disposition == :STALE\n if info.key? 'etag' and not headers['If-None-Match']\n headers['If-None-Match'] = info['etag']\n end\n if info.key? 'last-modified' and not headers['Last-Modified']\n headers['If-Modified-Since'] = info['last-modified']\n end\n end\n end\n\n req, url = new_request(url_s, method, headers)\n\n # two reasons to authenticate;\n if @always_auth\n self.send(\"#{@always_auth}_authenticate\", req, url)\n elsif www_authenticate\n dispatch_authorization www_authenticate, req, url\n end\n\n http_obj = Net::HTTP.new(url.host, url.port)\n http_obj.use_ssl = true if url.scheme == \"https\"\n\n res = http_obj.start do |h|\n h.request(req, body)\n end\n\n # a bit of added convenience\n res.extend Atom::HTTPResponse\n\n case res\n when Net::HTTPUnauthorized\n if @always_auth or www_authenticate or not res[\"WWW-Authenticate\"] # XXX and not stale (Digest only)\n # we've tried the credentials you gave us once\n # and failed, or the server gave us no way to fix it\n raise Unauthorized, \"Your authorization was rejected\"\n else\n # once more, with authentication\n res = http_request(url_s, method, body, headers, res[\"WWW-Authenticate\"])\n\n if res.kind_of? Net::HTTPUnauthorized\n raise Unauthorized, \"Your authorization was rejected\"\n end\n end\n when Net::HTTPRedirection\n if res.code == \"304\" and method == Net::HTTP::Get\n res.end2end_headers.each { |k| info[k] = res[k] }\n\n res = info\n\n res[\"Content-Length\"] = res.body.length\n\n res.extend Atom::HTTPResponse\n\n _updateCache(headers, res, @cache, cachekey)\n elsif res[\"Location\"] and (allow_all_redirects or [Net::HTTP::Get, Net::HTTP::Head].member? method)\n raise HTTPException, \"Too many redirects\" if redirect_limit.zero?\n\n res = http_request res[\"Location\"], method, body, headers, nil, (redirect_limit - 1)\n end\n when Net::HTTPOK, Net::HTTPNonAuthoritativeInformation\n unless res.key? 'Content-Location'\n res['Content-Location'] = url_s\n end\n _updateCache(headers, res, @cache, cachekey)\n end\n\n res\n end", "def consume(url, options = {}, with_status = false)\n base_uri, path = extract_base_uri_and_path(url)\n\n method = (options[:method] || 'GET').to_s.downcase\n\n _options = build_httpparty_options(options, method)\n _options[:base_uri] = base_uri\n\n if with_status\n verbose_perform_request_to(method, path, _options)\n else\n perform_request_to(method, path, _options)\n end\n end", "def http_get(curl, data, url)\n\n # Define the url we want to hit\n curl.url=url\n\n # Specify the headers we want to hit\n curl.headers = data['header']\n\n # perform the call\n curl.http_get\n\n # Set headers to nil so none get reused elsewhere\n curl.headers = nil\n\n # return the curl object\n return curl\nend", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def http_get(url)\n # get proxy info\n proxy_host, proxy_port = find_http_proxy\n # $stderr.puts \"DEBUG: proxy: host = #{proxy_host}, port = #{proxy_port}\"\n\n # get host, port, and base URI for API queries\n uri = URI.parse(@base_uri)\n base = uri.request_uri\n\n # prepend base to url\n url = \"#{base}/#{url}\"\n\n # connect to delicious\n http = Net::HTTP.Proxy(proxy_host, proxy_port).new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n # check to make sure we have SSL support\n raise NoSSLError, \"Unsupported URI scheme 'https'\" unless HAVE_SSL\n init_http_ssl(http)\n end\n\n # start HTTP connection\n http = http.start\n\n # get URL, check for error\n resp = http.get(url, @headers)\n raise HTTPError, \"HTTP #{resp.code}: #{resp.message}\" unless resp.code =~ /2\\d{2}/\n\n # close HTTP connection, return response\n http.finish\n resp.body\n end", "def get(uri, request_headers)\n raise NotImplementedError\n end", "def get(path, headers: {}, query: {})\n (headers, query) = preprocess(headers, query)\n respond_with super(path, headers: headers, query: query)\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def get(url, options = {})\n options[\"apikey\"] = @api_key\n uri = generate_uri(url, @default_options.merge(options))\n\n response = Net::HTTP.get_response(uri)\n json? ? JSON.parse(response.body) : response.body\n end", "def get\n @response = Net::HTTP.get_response(URI(@url))\n end", "def get(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpGetWithEntity, url, options, &block\n end", "def make_request(url,headers,query)\n c = HTTPClient.new\n c.get_content(url,query,headers)\nend", "def get options={}, &block\n handle_exceptions do\n Chimps.log.info(\"GET #{url}\")\n Response.new(super(options, &block))\n end\n end", "def http(url, opts = {})\n method = opts[:method] || :get\n response = HTTParty.send(method, url, opts)\n if (200..299).include?(response.code)\n response.body\n else\n raise HttpError.new(\"Bad response: #{response.code} #{response.body}\", response)\n end\n end", "def http_get(uri:, additional_headers: {}, debug: false)\n return nil if uri.blank?\n\n HTTParty.get(uri, options(additional_headers: additional_headers,\n debug: debug))\n rescue URI::InvalidURIError => e\n handle_uri_failure(method: \"BaseService.http_get #{e.message}\",\n uri: uri)\n nil\n rescue HTTParty::Error => e\n handle_http_failure(method: \"BaseService.http_get #{e.message}\",\n http_response: nil)\n nil\n end", "def http_get(uri)\n req = Net::HTTP::Get.new uri\n @additional_headers.keys.each do |k|\n req[k] = @additional_headers[k]\n end\n #STDERR.puts \"Trace: #{caller[0]} req: #{req.inspect}\"\n temp_uri = URI.parse(self.polldaddy)\n body=''\n Net::HTTP.start(temp_uri.hostname, temp_uri.port, proxyhost, proxyport) do |http|\n http.request(req) do |res|\n res.read_body do |segment|\n body << segment # this will retrieve the parts if the response is chunked\n end\n end\n end\n body#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end", "def get(url, options = {})\n self.class.default_params.merge!(options)\n response = self.class.get(url)\n handle_response(response)\n end", "def fetch(url, headers={})\n @url_cache ||= Hash.new\n return @url_cache[url] if @url_cache.has_key?(url)\n\n uri = URI.parse(url)\n\n path = uri.path == \"\" ? \"/\" : uri.path\n\n req = Net::HTTP::Get.new(path)\n res = Net::HTTP.start(uri.host, uri.port) {|http|\n http.request(req)\n }\n\n @url_cache[url] = res\n \n return res\n end", "def get(params = {})\n response = prepare_response(make_url(params).open('User-Agent' => USER_AGENT).read)\n check_error(response)\n return parse_response(response)\n rescue OpenURI::HTTPError => e\n check_error(prepare_response(e.io.read))\n raise\n end", "def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def get(resource, headers = {})\n prepare_request(:get, resource, nil, headers)\n end", "def request(base_url, params)\n RestClient.get base_url, { params: params }\n end", "def get\n subclass(:Response).new connection.get do |req|\n req.url uri\n end\n end", "def get(url, options={}, &block)\n http_options = options.merge(@basic_options)\n if block_given?\n RestClient.get(url, http_options, &block)\n else\n RestClient.get(url, http_options)\n end\n end", "def request\n uri = URI(final_url)\n response = Net::HTTP.get(uri)\n ResponseAdapter.new(response: response)\n end", "def request\n self.http_response = http_client.get(url, request_options)\n self\n end", "def get(url, version: nil, locale: nil)\n @client.get(url, headers: headers(version: version, locale: locale))\n end", "def get(url)\n request(:get, url, {}, nil)\n end", "def get(url='/', vars={})\n send_request url, vars, 'GET'\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => KAKAOCERT_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise KakaocertException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def get(uri, request_headers)\n request('get', uri, request_headers) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def make_request\n\t\t\tresponse = nil\n\t\t\tif self.respond_to? :headers\n\t\t\t\turi = URI.parse(request_string)\n\n\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\thttp.set_debug_output $stderr if @test_request\n\t\t\t\thttp.use_ssl = true\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t\t\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\t\t\theaders.each do |k,v|\n\t\t\t\t\trequest[k] = v\n\t\t\t\tend\n\n\t\t\t\tresponse = http.request(request).body\n\t\t\telse\n\t\t\t\t$stderr.puts(request_string) if @test_request\n\n\t\t\t\tresponse = open(request_string)\n\t\t\tend\n\n\t\t\treturn process_response(response)\n\t\tend", "def get(uri, options = {})\n build_response(request.get(uri, build_request_options({:input => options.to_params})))\n end", "def get(resource_url, params)\n headers = {'Authorization' => authorization('GET', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n res = URI.open(url, headers)\n Response.new(res)\n end", "def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end", "def fetch(url, body=nil, headers=nil, redirect_limit=10)\n url, url_stringified = URI::parse(url), url.dup\n \n h = headers || {}\n \n raise_on_external url, @browser_getter\n \n camping_controller_with_response = (body.blank? ? get(url.request_uri, h) : post(url.request_uri, h, body))\n ::OpenID::HTTPResponse._from_net_response(FakeResponse.new(camping_controller_with_response), url_stringified)\n end", "def get(headers = {}, path = '', parameters = {})\n full_path = [path, URI.encode_www_form(parameters)].join(PARAM_STARTER)\n uri = URI.parse(\"#{@url}#{full_path}\")\n request = Net::HTTP::Get.new(uri.request_uri)\n request.body = nil\n send_request(uri, request, headers)\n end", "def get(url, resource_name, options = {})\n build_response(resource_name) do\n connection.get do |req|\n req.url url\n req.params = options\n end\n end\n end", "def send_get(url)\r\n result = @client.get(self.target_uri(url))\r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200')\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def get(url, params = {})\n client.get(url, params).body\n end", "def fetch_from_url url\n require \"net/http\"\n\n uri = URI.parse(url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n\n request['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 OPR/36.0.2130.46'\n \n response = http.request(request)\n \n return response.body # => The body (HTML, XML, blob, whatever)\n end", "def get(http: HTTParty)\n http.get(url)\n end", "def get(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('get')\n end\n end", "def get url\n url = URI url\n request = HTTP::Get.new url.path\n\n dispatch request, to: url\n end", "def get(url)\n result = JSON.parse self.class.get(url, @request_options).body\n status = result['status']\n fail StandardError, \"Returned status: #{status}\" unless status == 'OK'\n result['response']\n end", "def http_get(url)\n # set HTTP version to 1.2\n Net::HTTP::version_1_2\n\n urls = %w{api proxy}.inject({}) do |ret, key|\n if url_val = @opt[\"#{key}_url\"] \n uri = parse_url(url_val, \"#{key} URL\")\n [:host, :port].each { |m| ret[\"#{key}_#{m}\"] = uri.send(m) }\n end\n\n ret\n end\n\n # connect to technorati\n http = Net::HTTP.Proxy(urls['proxy_host'], urls['proxy_port']).new(urls['api_host'], urls['api_port'])\n http.start\n\n # $stderr.puts \"DEBUG URL: #{url}\"\n\n # create HTTP headers hash\n http_headers = {\n 'User-Agent' => @opt['user_agent']\n }\n\n # get URL, check for error\n resp = http.get(url, http_headers)\n raise Technorati::HTTPError, \"HTTP #{resp.code}: #{resp.message}\" unless resp.code =~ /2\\d{2}/\n\n # close HTTP connection, return response\n http.finish\n resp.body\n end", "def get(url); end", "def http_get(url)\n opts = {\n followlocation: false,\n timeout: @time_out,\n accept_encoding: 'gzip',\n headers: {\n 'User-Agent' => \"wgit/#{Wgit::VERSION}\",\n 'Accept' => 'text/html'\n }\n }\n\n # See https://rubydoc.info/gems/typhoeus for more info.\n Typhoeus.get(url, opts)\n end", "def get(options={}, &block)\n response = http.get_uri(options, &block)\n handle_response(response)\n end", "def get\n begin\n response = Net::HTTP.get_response(URI.parse(uri))\n rescue => e\n raise InterfaceError, \"#{e.message}\\n\\n#{e.backtrace}\"\n end\n response.code == '200' ? response.body : response_error(response)\n end", "def get(uri)\r\n request(Net::HTTP::Get.new(uri)) \r\n end", "def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end", "def request(params = {})\n params.merge!(default_params)\n\n uri = URI.parse(base_uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n encoded = URI.encode_www_form(params)\n path = [uri.path, encoded].join(\"?\")\n\n request = Net::HTTP::Get.new(path)\n\n STDERR.puts path if debug?\n\n response = http.request(request) \n\n case response.code.to_i\n when 200\n STDERR.puts response.body if debug?\n\n response = MultiXml.parse(response.body)\n if response[\"interface_response\"][\"ErrCount\"].to_i == 0\n return response\n else\n raise InterfaceError, response[\"interface_response\"][\"errors\"].values.join(\", \")\n end\n end\n end", "def get(resource)\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"GET request Url: #{url}\")\n @logger.debug(\"-- Headers: #{base_headers}\")\n\n HTTParty.get(url, headers: base_headers)\n end", "def get(uri, params = {})\n send_request(uri, :get, params)\n end", "def get(uri, parameters = T.unsafe(nil), referer = T.unsafe(nil), headers = T.unsafe(nil)); end", "def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end", "def get(relative_path, request_headers, request_parameters, response_type, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n\n request_headers = [] if request_headers.nil?\n add_generic_headers('GET', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.get(uri, request_headers) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = content.read.force_encoding('UTF-8')\n end\n process_response(response_body, response_status_code, response_headers, response_type, relative_path, context)\n end", "def get(endpoint, headers = {})\n headers = { accept: :json }.merge(headers)\n @rest_resource[endpoint].get headers\n end", "def get(url)\n uri = URI.parse(url)\n response = nil\n opt = {:use_ssl => true}\n #start(address, port=nil, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt, &block)\n Net::HTTP.start(uri.host, uri.port, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt) { |http|\n request = Net::HTTP::Get.new uri\n request['Referer'] = REFERER\n response = http.request request # Net::HTTPResponse object\n }\n return response\nend", "def request(method, url, headers = nil, payload = nil)\n headers ||= create_headers\n response = {response: nil, error: nil}\n begin\n resp = RestClient::Request.new(method: method,\n url: url,\n headers: headers,\n payload: payload).execute\n\n\n if resp.code == 404\n raise RestClient::ExceptionWithResponse\n elsif (resp.code >= 200) && (resp.code < 204)\n response[:response] = JSON.parse(resp.body.to_s)\n elsif resp.code == 204\n response[:response] = {'success': true}\n end\n\n rescue RestClient::ExceptionWithResponse => err\n err.http_code == 404 ? response[:error] = {'message': err.response.to_s} : JSON.parse(err.response)\n end\n response\n end", "def get(path, query = { }, headers = { })\n clear_response\n path = process_path(path, query)\n @success_code = 200\n @response = http.get(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def http_get(url)\n require \"open-uri\"\n URI.parse(url).read\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get(url)\n uri = normalize_url(url)\n\n # Ensure the parsed URL is an HTTP one\n raise HTTPError::ClientError.new(\"Invalid URL #{url}\") unless uri.is_a?(URI::HTTP)\n\n req = Net::HTTP::Get.new(uri.request_uri)\n handle_request(uri, req)\n end", "def get(url, params = {})\n get_auth_hash = {\n \"oauth_consumer_key\" => \"#{@consumer_key}\",\n \"oauth_token\" => \"#{@access_token[\"oauth_token\"]}\",\n \"oauth_signature_method\" => \"HMAC-SHA1\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => \"1.0\",\n }\n\n # set signature\n get_auth_hash[\"oauth_signature\"] = generate_access_signature(generate_signature_base_string(\"GET\", url, get_auth_hash, params))\n\n # get with auth header\n return MyHttp.get(url, params, {\n \"Authorization\" => \"OAuth #{generate_auth_header(get_auth_hash)}\",\n })\n end", "def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def get(api_route, url_params_hash={})\n @request_class = Net::HTTP::Get\n set_api_url(api_route, url_params_hash)\n send\n end", "def http_response \n url = @options['url'] || @options[:url]\n\n uri = URI.parse(url)\n\n response = nil\n retry_url_trailing_slash = true\n retry_url_execution_expired = true\n begin\n Net::HTTP.start(uri.host) {|http|\n http.open_timeout = TIMEOUT_LENGTH\n req = Net::HTTP::Get.new((uri.path != '' ? uri.path : '/' ) + (uri.query ? ('?' + uri.query) : ''))\n if uri.user && uri.password\n req.basic_auth uri.user, uri.password\n end\n response = http.request(req)\n }\n rescue Exception => e\n # forgot the trailing slash...add and retry\n if e.message == \"HTTP request path is empty\" and retry_url_trailing_slash\n url += '/'\n uri = URI.parse(url)\n h = Net::HTTP.new(uri.host)\n retry_url_trailing_slash = false\n retry\n elsif e.message =~ /execution expired/ and retry_url_execution_expired\n retry_url_execution_expired = false\n retry\n else\n response = e.to_s\n end\n end\n \n return response\n end" ]
[ "0.7283731", "0.71932936", "0.7192051", "0.71860546", "0.7093546", "0.703312", "0.6989699", "0.69417363", "0.682362", "0.6663895", "0.65506315", "0.65404683", "0.64748234", "0.6418373", "0.6376168", "0.6369659", "0.63430905", "0.63385147", "0.63332516", "0.63318837", "0.63154554", "0.63111866", "0.62997895", "0.6245102", "0.6227893", "0.6226279", "0.6205042", "0.616439", "0.6153701", "0.6152974", "0.6152827", "0.61508566", "0.61430126", "0.61351776", "0.6124742", "0.6120251", "0.61034256", "0.6071379", "0.60706246", "0.60646236", "0.6057445", "0.60567653", "0.60356534", "0.6033855", "0.6031626", "0.602248", "0.6016352", "0.60063607", "0.6005827", "0.6002634", "0.599812", "0.5994534", "0.59833366", "0.59830296", "0.5967185", "0.5963168", "0.59413594", "0.5925118", "0.5916625", "0.5915811", "0.5900868", "0.58582395", "0.5855823", "0.5841685", "0.58043987", "0.58042413", "0.5796486", "0.57818484", "0.57701904", "0.57635534", "0.57625395", "0.5757874", "0.5742972", "0.57402223", "0.57338524", "0.57257384", "0.5725553", "0.5719447", "0.5718392", "0.5702625", "0.57007986", "0.56830114", "0.56782454", "0.56676644", "0.56673425", "0.5661985", "0.56522185", "0.56497455", "0.5649506", "0.56466186", "0.56438106", "0.56427675", "0.5637001", "0.5637001", "0.5634687", "0.5627148", "0.56135565", "0.5612199", "0.56104255" ]
0.70560026
6
Retrieve the contents of the specified +url+ as with get, but the content at the URL is downloaded directly into the specified file.
def get_file(url, filename, headers = {}) request(:get, url, headers, :file => filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(url)\n get(url).body\n end", "def download(url)\n base.get(url, @file_path)\n end", "def get_file(url); end", "def get(url)\n p = URI.parse url\n case p.scheme\n when /https?/\n http_get p, @resource[:path]\n when \"file\"\n FileUtils.copy p.path, @resource[:path]\n end\n end", "def download(url)\n Net::HTTP.get_response(url)\n end", "def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend", "def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend", "def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend", "def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end", "def fetch_file_from_url(url)\n logger.debug \"Starting GET of file from #{url}\"\n start_time = Time.now\n uri = URI.parse(url)\n if (uri.kind_of?(URI::HTTP))\n resp = Net::HTTP.get_response(uri)\n case resp\n when Net::HTTPSuccess then\n filename = File.basename(uri.path)\n tmpfile = Tempfile.new(filename,Dir.tmpdir)\n File.open(tmpfile.path,'wb+') do |f|\n f.write resp.body\n end\n tmpfile.flush\n file= ActionDispatch::Http::UploadedFile.new(tempfile: tmpfile)\n file.original_filename = filename\n file.content_type = resp.content_type\n logger.debug \"GET took #{Time.now - start_time} seconds\"\n return file\n else\n logger.error \"Could not get file from location #{url} response is #{resp.code}:#{resp.message}\"\n return nil\n end\n else\n return nil\n end\n rescue URI::InvalidURIError\n logger.error \"Invalid URI #{url}\"\n nil\n rescue => e\n logger.error \"error in fetch_file_from_url #{url}\"\n logger.error e.backtrace.join(\"\\n\")\n nil\n end", "def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end", "def fetch_html_file(url)\n file = open(normalize_url(url), read_timeout: READ_TIMEOUT)\n response_uri = response_uri(file)\n doc = Nokogiri::HTML.parse(file)\n HtmlFile.new(doc, response_uri)\n end", "def get_content\n send_get_content(url)\n end", "def download(url)\n response = client.send(:get, url, {}, 'Content-Type': 'text/html')\n raise ::Errors::BadRequest unless response.success?\n\n response.body\n end", "def download(url, file)\n # First, open the remote file. (FD == 'File Descriptor', a C term)\n #\n # If we first open the remote file, if there are any exceptions in\n # attempting to open it, we won't lose the contents of the local file.\n open(url) do |remoteFD|\n # Open the local file, purging the contents.\n File.open(file, \"w\") do |genericFD|\n remoteFD.each_line do |line|\n # Take each line, stick it in the file.\n genericFD.puts line\n end\n end\n end\n @repo.add(file) # add the file to the list to be committed\nend", "def http_get(uri, download_path)\n\n # We'll save to a tempfile in case something goes wrong in the download\n # process. This avoids accidentally overwriting an old version, or\n # leaving a partially downloaded file in place\n begin\n tempfile = Tempfile.new('remote_file')\n tempfile.binmode\n response = http(uri) do |resp|\n resp.read_body do |chunk|\n tempfile.write(chunk)\n end\n end\n\n # If download was successful, copy the tempfile over to the resource path.\n if response.kind_of?(Net::HTTPSuccess)\n tempfile.flush\n\n # Try to move the file from the temp location to the final destination.\n # If the move operation fails due to permission denied, try a copy\n # before giving up. On some platforms (Windows) file locking or weird\n # permissions may cause the mv operation to fail but will still allow\n # the copy operation to succeed.\n begin\n FileUtils.mv(tempfile.path, download_path)\n rescue Errno::EACCES\n FileUtils.cp(tempfile.path, download_path)\n end\n\n # If the fileserver supports the last-modified header, make sure the\n # file saved has a matching timestamp. This may be used later to do a\n # very rough ensure=latest kind of check.\n if response.header['last-modified']\n time = Time.parse(response.header['last-modified'])\n File.utime(time, time, download_path)\n end\n end\n ensure\n tempfile.close\n tempfile.unlink\n response\n end\n end", "def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end", "def download(url)\n STDERR.print \"loading #{url}\"\n response = Faraday.get(url)\n STDERR.puts ' (done)'\n response.body\n end", "def fetchURL(url)\n open(url) {|response| response.read}\nend", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end", "def fetch_file(uri)\n res = Net::HTTP.get_response(uri)\n raise \"#{file_url} ended with #{res.code} #{res.message}\" unless res.is_a?(Net::HTTPSuccess)\n\n res.body\n end", "def fetch_url_data(url)\n open(url).read\n end", "def fetch_url_data(url)\n open(url).read\n end", "def get_file_via_http url, file_name, try\n\n @config.logger.trace(\"Downloading \" + url + \" to \" + file_name )\n p = URI::Parser.new\n uri = URI.parse( p.escape( url ) )\n req = Net::HTTP::Get.new(uri.request_uri)\n req[\"User-Agent\"] = NicInfo::VERSION_LABEL\n req[\"Accept\"] = NicInfo::JSON_CONTENT_TYPE\n req[\"Connection\"] = \"close\"\n http = Net::HTTP.new( uri.host, uri.port )\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode=OpenSSL::SSL::VERIFY_NONE\n end\n res = http.start do |http_req|\n http_req.request(req)\n end\n\n case res\n when Net::HTTPSuccess\n File.write(file_name, res.body)\n else\n if res.code == \"301\" or res.code == \"302\" or res.code == \"303\" or res.code == \"307\" or res.code == \"308\"\n res.error! if try >= 5\n location = res[\"location\"]\n return get_file_via_http( location, file_name, try + 1)\n end\n res.error!\n end\n end", "def download\n open(download_url, \"rb\")\n end", "def http_get(url)\n require \"open-uri\"\n URI.parse(url).read\n end", "def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end", "def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end", "def download!(source_url, destination_file); end", "def fetch()\n @result = open(@url,@headers)\n end", "def fetch_from_url url\n require \"net/http\"\n\n uri = URI.parse(url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n\n request['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 OPR/36.0.2130.46'\n \n response = http.request(request)\n \n return response.body # => The body (HTML, XML, blob, whatever)\n end", "def download(url)\n resp = http.get(url, :follow_redirect => true)\n\n unless resp.ok?\n raise(\n HTTPClient::BadResponseError,\n \"Got HTTP #{resp.status}: #{resp.body}\"\n )\n end\n\n return resp.body.force_encoding('UTF-8')\n end", "def read_url_file(url)\n uri = URI.parse url\n uri.read\n end", "def download\n @doc = Nokogiri::HTML(open(@url))\n\tend", "def download(path)\n if File.exists?(path)\n puts \"#{path} already exists\"\n\n return\n end\n\n File.open(path, \"w\") do |file|\n file.binmode\n HTTParty.get(self['href'], stream_body: true) do |fragment|\n file.write(fragment)\n end\n end\n end", "def download_file(path, url, size: nil)\n File.open(path, 'wb') do |f|\n uri = URI(url)\n current = 0\n last_print_update = 0\n print_progress = UI.interactive? || U3dCore::Globals.verbose?\n Net::HTTP.start(uri.host, uri.port, http_opts(use_ssl: uri.scheme == 'https')) do |http|\n request = Net::HTTP::Get.new uri\n http.request request do |response|\n begin\n # override with actual results, this should help with\n # innacurrate declared sizes, especially on Windows platform\n size = Integer(response['Content-Length'])\n rescue ArgumentError\n UI.verbose 'Unable to get length of file in download'\n end\n started_at = Time.now.to_i - 1\n response.read_body do |segment|\n f.write(segment)\n current += segment.length\n # wait for Net::HTTP buffer on slow networks\n # FIXME revisits, this slows down download on fast network\n # sleep 0.08 # adjust to reduce CPU\n next unless print_progress\n\n print_progress_now = Time.now.to_f - last_print_update > 0.5\n # force printing when done downloading\n print_progress_now = true if !print_progress_now && size && current >= size\n next unless print_progress_now\n\n last_print_update = Time.now.to_f\n Utils.print_progress(current, size, started_at)\n print \"\\n\" unless UI.interactive?\n end\n end\n end\n print \"\\n\" if print_progress\n end\n end", "def fetch\n open(to_url) { |io| io.read }\n end", "def retrieve_http(options)\n file_size = options.fetch(:file_size)\n headers = options.fetch(:headers)\n url = options.fetch(:url)\n retrieved = 0\n\n request = Typhoeus::Request.new(url.to_s, method: :get, headers: headers)\n request.on_headers do |response|\n raise DownloadError.new(\"#{self.class}: Failed to download #{url}: Status Code: #{response.code}\", response) unless response.code == 200\n end\n request.on_body do |chunk|\n retrieved += chunk.bytesize\n yield(chunk, retrieved, file_size)\n end\n request.run\n end", "def save_file(url, file)\n puts \"Downloading http://...#{url[-8..-1]} -> #{file}\"\n File.open(file, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend", "def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend", "def download!(file)\n login\n warn \"DEBUG: downloading #{file}\" if debug\n if dry_run\n warn \"DEBUG: download skipped for dry run\" if dry_run\n filename = file\n body = \"no body\"\n else\n page = agent.get(file)\n filename = page.filename\n body = page.body\n end\n [ filename, body ]\n end", "def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend", "def get_file(path, options={})\n remove_file path\n resource = File.join(prefs[:remote_host], prefs[:remote_branch], 'files', path)\n replace_file path, download_resource(resource, options)\nend", "def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end", "def download(uri)\n target = File.join(@cache_dir, filename(uri))\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n Net::HTTP.start(rich_uri.host, rich_uri.port, use_ssl: rich_uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end", "def download(args = {})\n\t # \n\t # parse arguments\n\t # \n\t if args.keys.size == 1 and args.values.size == 1\n\t url = args.keys.first\n\t output_path = args.values.first\n\t else\n\t raise \"download() currently only accepts one {URL => location} pair\"\n\t end\n\t \n\t # \n\t # perform the download\n\t # \n\t \n\t # https://stackoverflow.com/questions/2263540/how-do-i-download-a-binary-file-over-http\n\t # instead of http.get\n\t require 'open-uri'\n\t \n\t File.open(output_path, \"wb\") do |saved_file|\n\t # the following \"open\" is provided by open-uri\n\t open(url, \"rb\") do |read_file|\n\t saved_file.write(read_file.read)\n\t end\n\t end\n\t \n\t return output_path\n\tend", "def get(url); end", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def download_html_file(url)\n\t\tputs \"Downloading html page\"\n\t\twget_options = [\n\t\t\t'wget',\n\t\t\t'--continue',\n\t\t\t\"'#{url}'\",\n\t\t\t\"-O #{@tmp_html.shellescape}\",\n\t\t\t'--quiet'\n\t\t]\n\t\t%x[#{wget_options.join(' ')}]\n\tend", "def download_file(url, destination)\n raw_file = server_api.streaming_request(url)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end", "def download_content(object_url, filename)\n raw_html = open(object_url, :read_timeout => 60).read\n puts object_url\n puts filename\n File.open(filename, \"w\") { |file| file.write(raw_html) }\nend", "def download_file(url, show_progress = false)\n if show_progress\n pbar = nil\n begin\n require 'progressbar'\n rescue LoadError => e\n Fog::Logger.warning \"progressbar rubygem not found. Install it for fancier progress.\"\n pbar = :noop\n end\n open(\n url,\n :content_length_proc => lambda { |total|\n if pbar != :noop\n if total && 0 < total\n pbar = ProgressBar.new(\"Downloading\", total)\n pbar.file_transfer_mode\n end\n end\n },\n :progress_proc => lambda { |read_size|\n if pbar != :noop\n pbar.set read_size if pbar\n else\n print \"\\rDownloading... #{\"%.2f\" % (read_size/1024.0**2)} MB\"\n end\n }\n )\n else\n open(url)\n end\n end", "def forced_file_from_url(url)\n data = open URI.parse(url)\n return data if data.is_a? Tempfile\n\n extname = File.extname url\n basename = File.basename url, extname\n\n file = Tempfile.new [basename, extname]\n file.binmode\n file.write data.read\n file.rewind\n file\n end", "def get(url)\n request(:get, url, {}, nil)\n end", "def download_and_save_file(url, path)\n options = {}\n\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n uri = URI.parse(proxy)\n proxy_host = uri.scheme + \"://\" + uri.host + \":\" + uri.port.to_s\n proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo\n options[:proxy_http_basic_authentication] = [proxy_host,proxy_user,proxy_pass]\n end\n\n open_and_save_file(path, open(url, options).read)\nend", "def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end", "def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend", "def download\n return file if file\n\n self.file = retrieve_file\n end", "def save_to_tempfile(url)\n verbose(\"Downloading #{url}\")\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n http.start do |http|\n resp = http.get(uri.path)\n file = Tempfile.new('master.zip')\n file.binmode\n file.write(resp.body)\n file.flush\n file.close\n\n verbose(\"Saved to #{file.path}\")\n\n file\n end\n end", "def download_file(uristr)\n uri = URI.parse(uristr) # parse the url string\n http = Net::HTTP.new(uri.host, uri.port) # create a connection to the http server\n http.open_timeout = 5\n\n DocumentHelper.verify_ssl(uristr, http)\n\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # get the response\n\n status_code = res.code\n if status_code != '200' # checking status code\n raise \"Document editing service returned status: #{status_code}\"\n end\n data = res.body # and take its body\n\n if data == nil\n raise 'stream is null'\n end\n data\n end", "def download_file_to_filename(filename, url)\n puts \"Downloading #{url}...\"\n uri = URI(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: uri.scheme == 'https'\n ) do |http|\n request = Net::HTTP::Get.new uri.request_uri\n\n http.request request do |response|\n if response.is_a?(Net::HTTPRedirection) || response.is_a?(Net::HTTPFound)\n return download_file_to_filename(filename, response['location'])\n end\n\n open filename, 'wb' do |io|\n response.read_body do |chunk|\n io.write(chunk)\n end\n end\n end\n end\nend", "def get_file(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\t# TODO add handles for searching based upon stats\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:source => \"fl[source]\", # dungeon, badges, arena, etc\n\t\t\t\t:dungeon => \"fl[dungeon]\", # seems it needs the dungeons id rather than name\n\t\t\t\t:difficulty => \"fl[difficulty]\", # normal, heroic, etc\n\t\t\t\t:item_type => \"fl[type]\", # weapon, armor, trinket, etc\n\t\t\t\t:item_slot => \"fl[slot]\", # head, shoulders, etc\n\t\t\t\t:item_sub_type => \"fl[subTp]\", # leather, mail, etc\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'gn',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group',\n\t\t\t\t:callback => 'callback',\n\t\t\t\t:calendar_type => 'type',\n\t\t\t\t:month => 'month',\n\t\t\t\t:year => 'year',\n\t\t\t\t:event => 'e',\n :now => 'now',\n\t\t\t\t:achievement_category => 'c'\n\t\t\t} \n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = ''\n\t\t\tquery = query + '?' + params.join('&') if params.size > 0\n\t\t\t#query = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\tend", "def download_file(url, dest)\n if File.exist?(dest)\n say \"File already downloaded #{dest}\"\n return dest\n end\n\n say \"Downloading...\"\n FileUtils.mkdir_p(File.dirname(dest)) # ensure parent folder exists\n\n File.open(dest, 'wb') do |saved_file|\n URI.open(url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n dest\n end", "def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end", "def download_from_original_url\n return if self.original_url.blank?\n\n self.contents = begin\n Timeout::timeout(300) do\n io = open(URI.parse(self.original_url))\n def io.original_filename\n base_uri.path.split('/').last\n end\n io.original_filename.blank? ? nil : io\n end\n rescue\n errors.add :original_url, \"unable to download url\"\n nil\n end\n end", "def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend", "def http_get(url)\n opts = {\n followlocation: false,\n timeout: @time_out,\n accept_encoding: 'gzip',\n headers: {\n 'User-Agent' => \"wgit/#{Wgit::VERSION}\",\n 'Accept' => 'text/html'\n }\n }\n\n # See https://rubydoc.info/gems/typhoeus for more info.\n Typhoeus.get(url, opts)\n end", "def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\n end", "def retrieve_file(options)\n file_uri = options.fetch(:url)\n file_size = options.fetch(:file_size)\n\n retrieved = 0\n File.open(file_uri.path, 'rb') do |f|\n until f.eof?\n chunk = f.read(chunk_size)\n retrieved += chunk.length\n yield(chunk, retrieved, file_size)\n end\n end\n end", "def file_by_url(url)\n return file_by_id(url_to_id(url))\n end", "def getfile(host, path)\n puts \"getting https://#{host}#{path}\"\n https = Net::HTTP.new(host, 443)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n https.start { |w| w.get2(path).body }\nend", "def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end", "def get(filename)\n @sftp.download!(remote_path(filename), nil, progress: ProgressHandler)\n end", "def retrieve(url)\n response = @connection.get(url)\n\n if response.success?\n response.body\n else\n raise RuntimeError, \"Failed to retrieve #{url}: HTTP #{response.code} #{response.body}\"\n end\n end", "def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end", "def download(path)\n downloader.get do |req|\n req.url path\n end.body\n end", "def download_file(url, dest_dir)\n @log.info(\"== Ensuring file is cached: #{url} to #{dest_dir}\")\n require 'down'\n filename = File.basename(url)\n downloaded_file = File.join(dest_dir,filename)\n remote_file = Down.open(url)\n unless File.exist?(downloaded_file) && File.size(downloaded_file) == remote_file.size\n @log.verbose(\"Downloading #{url} to #{downloaded_file}\")\n Down.download(url, destination: downloaded_file)\n else\n @log.verbose(\"Skipping download, already in cache: #{downloaded_file}\")\n end\n remote_file.close\n downloaded_file\n end", "def fetch_file(file_path)\n client.get_file(file_path)\n end", "def download(uri, target)\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n if File.exist?(uri)\n FileUtils.cp uri, target\n else\n proxy(rich_uri).start(rich_uri.host, rich_uri.port, use_ssl: secure?(rich_uri)) do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end", "def get_file(path)\n uri = URI.join('https://stellar.mit.edu', path)\n @mech.get_file uri\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def download_files(url, path)\n client = RightSupport::Net::HTTPClient.new\n response = client.get(url, :timeout => 10)\n File.open(path, \"wb\") { |file| file.write(response) } unless response.empty?\n File.exists?(path)\n rescue Exception => e\n Log.error(\"#{e.class.name}: #{e.message} - #{e.backtrace.first}\")\n false\n end", "def fetch(uri)\n unless uri.is_a?(URI)\n uri = uri.to_s\n\n unless uri.include?(\"rafb.net\")\n uri = MainURI.to_s + \"results/#{uri}.html\"\n end\n\n unless uri.include?(\"http\")\n uri = \"http://\" + uri\n end\n end\n\n uri = URI(uri.to_s.sub(/\\.html$/, \".txt\"))\n\n unless uri.host == \"rafb.net\"\n raise(ArgumentError, \"Invalid host %p\" % uri.host)\n end\n\n unless uri.path[%r{^/paste/results/[^/.]+\\.txt$}]\n raise(ArgumentError, \"Invalid path %p\" % uri.path)\n end\n\n open(uri) { |res| res.read }\n end", "def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend", "def fetch(base_url, file_name, dst_dir)\n FileUtils.makedirs(dst_dir)\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if File.exists?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n end\n return dst\n end", "def get_file(filename, &block)\n if block_given?\n http.get(200, luwak, escape(filename), &block)\n nil\n else\n tmpfile = LuwakFile.new(escape(filename))\n begin\n response = http.get(200, luwak, escape(filename)) do |chunk|\n tmpfile.write chunk\n end\n tmpfile.content_type = response[:headers]['content-type'].first\n tmpfile\n ensure\n tmpfile.close\n end\n end\n end", "def file_data\n @client.get_file @file_url\n end", "def http_get(url)\n FaviconParty::HTTPClient.get(url)\n end", "def process_url(url)\n # add timestamp to buffer file name\n # (in order to avoid file conflicts when running multiple program instances)\n buffer_file_name = \"url_response_buffer_#{DateTime.now.strftime('%Q')}.txt\"\n uri = URI(url)\n begin\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n request = Net::HTTP::Get.new uri\n http.request request do |response|\n File.open(buffer_file_name, 'w') do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n rescue StandardError => e\n return \"Network error: #{e}\"\n end\n process_file(buffer_file_name)\n File.delete(buffer_file_name) if File.exist?(buffer_file_name)\n 'Done processing'\n end", "def read_page(url)\n download(url, Downloader.cookie).read\n end", "def get(url)\n call(url: url)\n end", "def get(url, headers: {}, params: {}, options: {}, &block)\n url = encode_query(url, params)\n\n request = Net::HTTP::Get.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options, &block)\n end", "def by_http(url, destination_path)\n begin\n open(url, :allow_redirections => :safe) do |input|\n if @accepted_content_types.include?(input.content_type)\n\n if File.exists?(destination_path)\n return destination_path\n else\n file = File.open(destination_path, 'wb') do |output|\n output << input.read\n end\n return file.path\n end\n else\n # need to send this to the logger at some point\n #logger.error \"Content type for #{url} not accepted by this downloader instance.\"\n puts \"[FileDownloader] Content type for #{url} not accepted by this downloader instance.\"\n return nil\n end\n end\n rescue Errno::ENOENT\n puts \"[FileDownloader] Can't open file for writing\"\n return nil\n rescue Exception => e\n puts \"[FileDownloader] Couldn't retrieve file #{url} due to an error: #{e.to_s}\"\n return nil\n end\n end", "def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end", "def download\n send_file @cfile.path.to_s\n end", "def open(url)\n Net::HTTP.get(URI.parse(url))\nend", "def open(url)\n Net::HTTP.get(URI.parse(url))\nend", "def url(path)\n uri, details = @api.cmd_to_url(:file_download, path: remote_file(path))\n @api.full_uri(uri, details[:params])\n end" ]
[ "0.79038", "0.7791441", "0.769305", "0.75306726", "0.74581724", "0.73947024", "0.73778355", "0.7324321", "0.7290571", "0.7229452", "0.72261715", "0.71676457", "0.71401834", "0.71383923", "0.71097827", "0.7089557", "0.7012982", "0.7004438", "0.6993213", "0.6952971", "0.69416493", "0.6890288", "0.68776506", "0.68776506", "0.6868018", "0.6831463", "0.6827827", "0.6821695", "0.67995995", "0.67510533", "0.673169", "0.67238575", "0.6706439", "0.6689455", "0.6667607", "0.66419655", "0.6627301", "0.6598004", "0.65927804", "0.659212", "0.6579622", "0.6568169", "0.65547013", "0.65282357", "0.65183926", "0.6482414", "0.6472035", "0.6454534", "0.644737", "0.64174706", "0.6409957", "0.6406083", "0.63897514", "0.6370204", "0.6368723", "0.63608336", "0.63426334", "0.63417923", "0.6328489", "0.6298155", "0.6295396", "0.6287436", "0.6283349", "0.6278927", "0.62766004", "0.6275867", "0.62637424", "0.62323356", "0.62281513", "0.6217723", "0.6217304", "0.6212736", "0.620237", "0.61940634", "0.6192905", "0.61898947", "0.6189261", "0.61840355", "0.6181101", "0.61760366", "0.61569357", "0.61539257", "0.6152128", "0.6147235", "0.6146853", "0.6146384", "0.61413497", "0.61334705", "0.6128082", "0.6127669", "0.6122812", "0.611623", "0.6114934", "0.6104083", "0.61034966", "0.6099912", "0.6098745", "0.6098745", "0.60975444" ]
0.7537253
4
As get but sends an HTTP HEAD request.
def head(url, headers = {}) request(:head, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_head(uri)\n http(uri, :http_method => 'head')\n end", "def head(path)\n request 'HEAD', path\n end", "def http_head\n return @head if defined?(@head)\n begin\n @head = conn.request(http_request(:head, resource[:source]))\n fail \"#{resource[:http_verb].to_s.upcase} #{resource[:source]} \" +\n \"returned #{@head.code}\" unless @head.code == '200'\n rescue Exception => e\n fail \"Failed to fetch file: #{resource[:source]} - #{e.message}\"\n end\n @head\n end", "def head!\n request! :head\n end", "def head(path,headers={})\n request(:head,path,headers)\n end", "def head(query_url,\r\n headers: {})\r\n HttpRequest.new(HttpMethodEnum::HEAD,\r\n query_url,\r\n headers: headers)\r\n end", "def http_head(url, options={}, &block)\n return FeedTools::RetrievalHelper.http_request(\n :head, url, options, &block)\n end", "def http_head_with_tingyun(*args, &blk)\n self._ty_http_verb = :HEAD\n http_head_without_tingyun(*args, &blk)\n end", "def head(path, headers = {})\n request(:head, path, build_request_headers(headers, :head))\n end", "def http_head(request, response)\n # This is implemented by changing the HEAD request to a GET request,\n # and dropping the response body.\n sub_request = request.clone\n sub_request.method = 'GET'\n\n begin\n @server.invoke_method(sub_request, response, false)\n response.body = ''\n rescue Exception::NotImplemented => e\n # Some clients may do HEAD requests on collections, however, GET\n # requests and HEAD requests _may_ not be defined on a collection,\n # which would trigger a 501.\n # This breaks some clients though, so we're transforming these\n # 501s into 200s.\n response.status = 200\n response.body = ''\n response.update_header('Content-Type', 'text/plain')\n response.update_header('X-Sabre-Real-Status', e.http_code)\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def head(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpHead, url, options, &block\n end", "def head(request)\n do_request(request) { |client| client.http_head }\n end", "def head(path, data={})\n request(:head, path, data)\n end", "def head query = nil\n\t\tif (query = make_query query)\n\t\t\t@uri.query = @uri.query ? @uri.query+\"&\"+query : query\n\t\tend\n\t\tfull_path = @uri.path + (@uri.query ? \"?#{@uri.query}\" : \"\")\n\t\t\t\n\t\treq = Net::HTTP::Head.new(full_path)\n\t\t# puts Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pwd).get(@uri)\n\t\tdo_http req\n\tend", "def head\n options, subprocess_options = self.options\n options.unshift(\"-I\")\n options << @source\n\n @logger.info(\"HEAD: #{@source}\")\n result = execute_curl(options, subprocess_options)\n result.stdout\n end", "def head(request)\n _request(request) { |client, options| client.head options }\n end", "def head(path, headers = {})\n with_auth { request(:head, path, nil, build_request_headers(headers, :head, build_uri(path))) }\n end", "def head(url, headers: {}, options: {})\n request_without_payload(:head, url, headers, options)\n end", "def head(url, options = {}, &block)\n run! Request.new(url, :head, options.slice(:headers, :params, :payload), &block)\n end", "def head\n self.class.head(url)\n end", "def head(path = \"\", &handler)\n route(\"HEAD\", path, handler)\n end", "def head(path, options={})\n url = build_url path, options\n headers = options[:headers] || {}\n Response.new(@client[url].head headers)\n rescue RestClient::Exception => e\n Response.new e.response\n end", "def head\n \"HEAD\"\n end", "def head(url, headers: {}, params: {}, options: {})\n url = encode_query(url, params)\n\n request = Net::HTTP::Head.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options)\n end", "def head(url, params={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n # add URL parameters\n uri.query = URI.encode_www_form(params)\n\n @logger.debug(\"HEAD #{uri} #{headers.inspect}\")\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Head.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n head(response['location'], params, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n head(url, params, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def head(path, options = {})\n options = options.merge(:head => true) # No parsing!\n execute('HEAD', path, options)\n end", "def test_head_collection\n request = Http::Request.new('HEAD', '/dir')\n response = self.request(request)\n\n assert_equal(200, response.status)\n end", "def head\n \"HEAD\"\n end", "def head(request, response)\n OK\n end", "def head(path, headers = {})\n process :head, path, headers\n end", "def head_and_get(path, codes = [200], params = {})\n url_to_get = url(path)\n head_params = (params[:head] || {}).merge(head_or_get_params)\n\n head_res = NS::Browser.forge_request(url_to_get, head_params).run\n\n codes.include?(head_res.code) ? NS::Browser.get(url_to_get, params[:get] || {}) : head_res\n end", "def HEAD()\n self.class.open @dir, \"HEAD\"\n end", "def head(uri, options = T.unsafe(nil)); end", "def head\n if(resource.exist?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Last-Modified'] = resource.last_modified.httpdate\n OK\n else\n NotFound\n end\n end", "def head(url, params={}, headers={}, http_options={})\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n # add URL parameters\n uri.query = URI.encode_www_form(params)\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Head.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n # handle 302\n when Net::HTTPRedirection then\n if redirect_limit == -1\n HttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n head(response['location'], params, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n HttpResponse.new(response)\n elsif gateway_retries == 0\n Kinetic::Platform.logger.info(\"HTTP response: #{response.code} #{response.message}\")\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n Kinetic::Platform.logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n head(url, params, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n Kinetic::Platform.logger.info(\"HTTP response code: 0\")\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n HttpResponse.new(e)\n else\n Kinetic::Platform.logger.info(\"HTTP response code: #{response.code}\")\n HttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n Kinetic::Platform.logger.info(\"HTTP bad response: #{e.inspect}\")\n HttpResponse.new(e)\n rescue StandardError => e\n Kinetic::Platform.logger.info(\"HTTP error: #{e.inspect}\")\n HttpResponse.new(e)\n end\n end", "def get_head(project)\n get(\"/projects/#{project}/HEAD\")\n end", "def head?\r\nHTTP_METHOD_LOOKUP[request_method] == :head\r\nend", "def head(options = nil)\n options ||= {}\n options[:method] = :head\n call options\n end", "def preflight\n head 200\n end", "def head(request, adapter = nil)\n request = Request.new :url => request if request.kind_of? String\n\n with_adapter :head, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.head request\n end\n end", "def handle_head(env)\n status, headers, body = *yield\n headers['Content-Length'] = body.sum(&:bytesize).to_s\n [status, headers, env['REQUEST_METHOD'].casecmp('head').zero? ? [] : body]\n end", "def write_head(method, output, options={})\n headers = {\n \"User-Agent\" =>\n \"retrieve/#{Retrieve::VERSION::STRING} (#{RUBY_PLATFORM})\",\n \"Accept\" => \"*/*\"\n }.merge(options[:headers] || {})\n\n # We always need these headers.\n headers[\"Host\"] = @normalized_uri.authority\n if options[:body]\n headers[\"Content-Length\"] = options[:body].bytesize\n end\n\n if options[:connections] && !headers[\"Connection\"]\n # We've been passed a connections hash, so keep the connections\n # alive.\n headers[\"Connection\"] = \"Keep-Alive\"\n end\n\n if options[:range]\n if !options[:range].kind_of?(Range)\n raise TypeError, \"Expected Range, got #{options[:range].class}.\"\n end\n if options[:range].last < -1 ||\n (options[:range].exclude_end? && options[:range].last <= -1)\n raise ArgumentError, \"Invalid Range: #{options[:range].inspect}\"\n end\n first = options[:range].first\n last = options[:range].last\n last -= 1 if options[:range].exclude_end?\n headers[\"Range\"] = \"#{first}-#{last == -1 ? \"\" : last}\"\n end\n\n # Merge cookies with headers.\n if headers[\"Cookie\"].kind_of?(String)\n headers[\"Cookie\"] = [headers[\"Cookie\"]]\n else\n headers[\"Cookie\"] ||= []\n end\n for key, value in (options[:cookies] || {})\n next if value == nil\n if value.kind_of?(Array)\n value.each do |subvalue|\n headers[\"Cookie\"] << \"#{escape(key)}=#{escape(subvalue)}\"\n end\n else\n headers[\"Cookie\"] << \"#{escape(key)}=#{escape(value)}\"\n end\n end\n\n # Write to the socket.\n output.write(\"%s %s HTTP/1.1\\r\\n\" % [\n method.to_s.upcase, @normalized_uri.omit(\n :scheme, :authority, :fragment\n )\n ])\n output.write(encode_headers(headers))\n output.write(CRLF)\n nil\n end", "def head(*args, &block)\n args = web_dav_args args\n map_method :head, args, &block\n end", "def head(path, options={}, &b)\n event(:head, path, options, &b)\n end", "def head(request, adapter = nil)\n request = Request.new :url => request if request.kind_of? String\n \n with request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.head request\n end\n end", "def get_head\n raise \"Not implemented\"\n end", "def head_request(request_data = {}, errback = DEFAULT_ERROR, &blk)\n req = create_test_request(request_data).head(request_data)\n hookup_request_callbacks(req, errback, &blk)\n end", "def getHTTPHdrs(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n request = Net::HTTP::Head.new(uri.request_uri)\n http.request(request)\nend", "def head(status, options = {})\n super status, options.merge(content_type: 'application/json')\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def fetch_http(uri, last_modified = nil, head = false, depth = 0)\n fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get\n # beginning of change\n response = request uri, fetch_type, last_modified do |req|\n headers.each {|k, v| req.add_field(k, v) } if headers\n end\n # end of change\n\n case response\n when Net::HTTPOK, Net::HTTPNotModified then\n response.uri = uri if response.respond_to? :uri\n head ? response : response.body\n when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,\n Net::HTTPTemporaryRedirect then\n raise FetchError.new(\"too many redirects\", uri) if depth > 10\n\n location = URI.parse response[\"Location\"]\n\n if https?(uri) && !https?(location)\n raise FetchError.new(\"redirecting to non-https resource: #{location}\", uri)\n end\n\n fetch_http(location, last_modified, head, depth + 1)\n else\n raise FetchError.new(\"bad response #{response.message} #{response.code}\", uri)\n end\n end", "def agencies_head_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_head ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_head\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:HEAD, 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: AgenciesApi#agencies_head\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def head(status, additional_headers = {})\n @response_status = status\n response_headers.merge!(additional_headers)\n response_headers.merge!({\"Access-Control-Allow-Origin\": ENV[\"ACCESS_CONTROL_ALLOW_ORIGIN\"]})\n end", "def getHeadTag\n head_commit_id = @gop.revparse(\"HEAD\")\n\n begin\n @gop.describe(head_commit_id, :contains => true)\n rescue Git::GitExecuteError => giterror\n # do nothing, continue\n end\n end", "def request(method, path, **kwargs)\n verbs = %w(put get post delete options head move copy patch)\n method = method.to_s.downcase\n raise HTTPBadRequest(\"Unsupported HTTP method #{method}\") unless verbs.include?(method)\n resp = self.class.send(method.to_sym, path, **kwargs)\n if method == 'head'\n handle_response resp, head_instead: true\n else\n handle_response resp\n end\n end", "def head(status, headers, env)\n [status, update_headers(headers), []]\n end", "def get(path, headers = {})\n cached_response = fetch_cached_response(path)\n if cached_response\n headers = headers.merge 'If-None-Match' => cached_response['Etag']\n end\n response = super(path, headers)\n case response\n when Net::HTTPNotModified then cached_response\n else\n cache_response(path, response)\n response\n end\n end", "def test_get_with_host_header\n uri = default_uri\n uri.host = '127.0.0.1'\n res = nil\n\n in_transaction do\n res = get_response(uri.to_s, 'Host' => 'test.local')\n end\n\n assert_match %r{<head>}i, body(res)\n assert_externals_recorded_for('test.local', 'GET')\n end", "def local_content_head\n response.headers['Content-Length'] = local_file_size.to_s\n head :ok, content_type: local_file_mime_type\n end", "def fresh(options)\n conditional_get = ConditionalGet.new(@_env, options)\n\n headers.merge!(conditional_get.headers)\n\n conditional_get.fresh? do\n halt 304\n end\n end", "def exists?\n request :head\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def head(path, **args); end", "def set_head(project, branch)\n url = \"/projects/#{project}/HEAD\"\n body = {\n ref: 'refs/heads/' + branch\n }\n put(url, body)\n end", "def head(pattern, &hndlr)\n @j_del.head(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end", "def index\n head params[:response_status]\n end", "def head\n @head\n end", "def head\n\t\t@head\n\tend", "def check_http_status(href)\n url = href.split(\".com/\")\n response = nil\n Net::HTTP.start(url[0].split(\"https://\").last + \".com\", 80) {|http|\n response = http.head(\"/\" + url[1])\n }\n if(response.code != \"200\")\n fail(href + \" returned code: \" + response.code)\n end\nend", "def head\n {\n \"Host\" => HOST,\n \"Content-Type\" => CONTENT_TYPE,\n \"Accept-Encoding\" => ACCEPT_ENCODINGS.join(','),\n \"User-Agent\" => USER_AGENT,\n \"Authorization\" => \"#{ authorization }\",\n }\n end", "def headers_fetch(uri)\n # Fetch the result at that location\n if (loc = ensure_uri(uri)).relative?\n headers_fetch(relative_uri(uri))\n else\n response = Net::HTTP.start(loc.host, loc.port) do |http|\n headers = @cookie ? {'Cookie' => @cookie} : {}\n http.head(loc.path, headers)\n end\n end\n end", "def head\n git.get_head(branch)\n end", "def head\n git.get_head(branch)\n end", "def on_head(*opts, &block)\n define_head(*opts, &block)\n self\n end", "def http_get(request, response)\n path = request.path\n node = @server.tree.node_for_path(path)\n\n return nil unless node.is_a?(IFile)\n\n body = node.get\n\n # Converting string into stream, if needed.\n if body.is_a?(String)\n stream = StringIO.new\n stream.write(body)\n stream.rewind\n body = stream\n end\n\n # TODO: getetag, getlastmodified, getsize should also be used using\n # this method\n http_headers = @server.http_headers(path)\n\n # ContentType needs to get a default, because many webservers will otherwise\n # default to text/html, and we don't want this for security reasons.\n unless http_headers.key?('Content-Type')\n http_headers['Content-Type'] = 'application/octet-stream'\n end\n\n if http_headers.key?('Content-Length')\n node_size = http_headers['Content-Length'].to_i\n\n # Need to unset Content-Length, because we'll handle that during figuring out the range\n http_headers.delete('Content-Length')\n else\n node_size = 0\n end\n\n response.add_headers(http_headers)\n\n range = @server.http_range\n if_range = request.header('If-Range')\n ignore_range_header = false\n\n # If ifRange is set, and range is specified, we first need to check\n # the precondition.\n if node_size > 0 && range && if_range\n # if IfRange is parsable as a date we'll treat it as a DateTime\n # otherwise, we must treat it as an etag.\n\n if_range_date = Chronic.parse(if_range)\n\n if if_range_date\n # It's a date. We must check if the entity is modified since\n # the specified date.\n if !http_headers.key?('Last-Modified')\n ignore_range_header = true\n else\n modified = Time.parse(http_headers['Last-Modified'])\n ignore_range_header = true if modified > if_range_date\n end\n else\n # It's an entity. We can do a simple comparison.\n if !http_headers.key?('ETag')\n ignore_range_header = true\n elsif http_headers['ETag'] != if_range\n ignore_range_header = true\n end\n end\n end\n\n # We're only going to support HTTP ranges if the backend provided a filesize\n if !ignore_range_header && node_size && range\n # Determining the exact byte offsets\n if range[0]\n start = range[0]\n ending = range[1] ? range[1] : node_size - 1\n if start >= node_size\n fail Exception::RequestedRangeNotSatisfiable, \"The start offset (#{range[0]}) exceeded the size of the entity (#{node_size})\"\n end\n\n if ending < start\n fail Exception::RequestedRangeNotSatisfiable, \"The end offset (#{range[1]}) is lower than the start offset (#{range[0]})\"\n end\n\n ending = node_size - 1 if ending >= node_size\n else\n start = node_size - range[1]\n ending = node_size - 1\n\n start = 0 if start < 0\n end\n\n # for a seekable body stream we simply set the pointer\n # for a non-seekable body stream we read and discard just the\n # right amount of data\n if body.respond_to?(:seek)\n body.seek(start)\n else\n consume_block = 8192\n consumed = 0\n loop do\n break unless start - consumed > 0\n\n if body.eof?\n fail Exception::RequestedRangeNotSatisfiable, \"The start offset (#{start}) exceeded the size of the entity (#{consumed})\"\n end\n\n consumed += body.read([start - consumed, consume_block].min)\n end\n end\n\n response.update_header('Content-Length', ending - start + 1)\n response.update_header('Content-Range', \"bytes #{start}-#{ending}/#{node_size}\")\n response.status = 206\n response.body = body\n else\n response.update_header('Content-Length', node_size) if node_size > 0\n response.status = 200\n response.body = body\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def head(params)\n raise Couchdbtools::Error::DocumentRevisionRequired unless params['_rev']\n request.method = :put\n execute(params)\n end", "def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil, redirect_limit = 5)\n cachekey = url_s.to_s\n\n cached_value = @cache[cachekey]\n if cached_value\n sock = Net::BufferedIO.new(StringIO.new(cached_value))\n info = Net::HTTPResponse.read_new(sock)\n info.reading_body(sock, true) {}\n\n if method == Net::HTTP::Put and info.key? 'etag' and not headers['If-Match']\n headers['If-Match'] = info['etag']\n end\n end\n\n if cached_value and not [Net::HTTP::Get, Net::HTTP::Head].member? method\n @cache.delete(cachekey)\n elsif cached_value\n entry_disposition = _entry_disposition(info, headers)\n\n if entry_disposition == :FRESH\n info.extend Atom::HTTPResponse\n\n return info\n elsif entry_disposition == :STALE\n if info.key? 'etag' and not headers['If-None-Match']\n headers['If-None-Match'] = info['etag']\n end\n if info.key? 'last-modified' and not headers['Last-Modified']\n headers['If-Modified-Since'] = info['last-modified']\n end\n end\n end\n\n req, url = new_request(url_s, method, headers)\n\n # two reasons to authenticate;\n if @always_auth\n self.send(\"#{@always_auth}_authenticate\", req, url)\n elsif www_authenticate\n dispatch_authorization www_authenticate, req, url\n end\n\n http_obj = Net::HTTP.new(url.host, url.port)\n http_obj.use_ssl = true if url.scheme == \"https\"\n\n res = http_obj.start do |h|\n h.request(req, body)\n end\n\n # a bit of added convenience\n res.extend Atom::HTTPResponse\n\n case res\n when Net::HTTPUnauthorized\n if @always_auth or www_authenticate or not res[\"WWW-Authenticate\"] # XXX and not stale (Digest only)\n # we've tried the credentials you gave us once\n # and failed, or the server gave us no way to fix it\n raise Unauthorized, \"Your authorization was rejected\"\n else\n # once more, with authentication\n res = http_request(url_s, method, body, headers, res[\"WWW-Authenticate\"])\n\n if res.kind_of? Net::HTTPUnauthorized\n raise Unauthorized, \"Your authorization was rejected\"\n end\n end\n when Net::HTTPRedirection\n if res.code == \"304\" and method == Net::HTTP::Get\n res.end2end_headers.each { |k| info[k] = res[k] }\n\n res = info\n\n res[\"Content-Length\"] = res.body.length\n\n res.extend Atom::HTTPResponse\n\n _updateCache(headers, res, @cache, cachekey)\n elsif res[\"Location\"] and (allow_all_redirects or [Net::HTTP::Get, Net::HTTP::Head].member? method)\n raise HTTPException, \"Too many redirects\" if redirect_limit.zero?\n\n res = http_request res[\"Location\"], method, body, headers, nil, (redirect_limit - 1)\n end\n when Net::HTTPOK, Net::HTTPNonAuthoritativeInformation\n unless res.key? 'Content-Location'\n res['Content-Location'] = url_s\n end\n _updateCache(headers, res, @cache, cachekey)\n end\n\n res\n end", "def normalized_request_method\n method = @env[\"REQUEST_METHOD\"]\n method == 'HEAD' ? 'get' : method.downcase\n end", "def head?\n @head\n end", "def _head?\n _execution_id == head_execution(reload: true).id\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def name=(name)\n @name = (name || 'HEAD').strip\n end", "def http_get(url)\n opts = {\n followlocation: false,\n timeout: @time_out,\n accept_encoding: 'gzip',\n headers: {\n 'User-Agent' => \"wgit/#{Wgit::VERSION}\",\n 'Accept' => 'text/html'\n }\n }\n\n # See https://rubydoc.info/gems/typhoeus for more info.\n Typhoeus.get(url, opts)\n end", "def http_status(hs=nil)\n @_http_status = hs unless hs.nil?\n @_http_status\n end", "def head_path\n \"#{path}/refs/heads/#{branch}\"\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def last_modified\n url = make_uri\n http = Net::HTTP.new(url.host, url.port)\n request = Net::HTTP::Head.new(url)\n request['if-modified-since'] = ''\n response = http.request(request)\n response['last-modified']\n end", "def get_Head()\n return @head\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def get(url); end", "def http_get(url, headers = nil)\r\n if @debug\r\n puts \"Url:\"\r\n puts url\r\n puts \"Headers:\"\r\n puts headers\r\n puts \"Method: get\"\r\n end\r\n return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)\r\n end", "def default_http_header; end", "def head\n HEADER\n end", "def head\n\tversion\n end", "def request_get(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"GET\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Get.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\trequest.add_field(\"x-hp-hmac-algorithm\", \"SHA256\")\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def update\n head :no_content\n end", "def update\n head :no_content\n end", "def has_new?\n return true if @last_post_time.nil?\n \n Net::HTTP.start @thread_url.host, 80 do |http|\n response = http.head(@thread_url.path)\n raise Thread404dError if response.code.to_i == 404 # .to_i because net/http is retarded.\n Time.parse(response['Last-Modified']) > @last_post_time\n end\n end" ]
[ "0.837392", "0.8187441", "0.79853916", "0.79156905", "0.79047054", "0.7839666", "0.78246075", "0.7803132", "0.7708244", "0.76019067", "0.75893474", "0.757676", "0.7562139", "0.7516168", "0.74991333", "0.7486548", "0.74862504", "0.74763346", "0.7430044", "0.7418557", "0.73863006", "0.73790085", "0.7333922", "0.7297616", "0.7228226", "0.7185641", "0.71429044", "0.7107437", "0.7078475", "0.7073882", "0.7016511", "0.6979935", "0.68032265", "0.6802546", "0.677246", "0.6712731", "0.66344297", "0.6520241", "0.64272785", "0.6339556", "0.6324659", "0.6296166", "0.6241148", "0.62302524", "0.61892796", "0.6187285", "0.61746264", "0.6160098", "0.61235046", "0.6113434", "0.6113434", "0.6091101", "0.6005685", "0.58744156", "0.58354026", "0.58352304", "0.5833818", "0.577037", "0.57389027", "0.56650233", "0.56319785", "0.56234646", "0.5622382", "0.5584556", "0.55754834", "0.5569964", "0.5565657", "0.55656195", "0.5457881", "0.54363877", "0.5410283", "0.5392651", "0.5392651", "0.538451", "0.5373883", "0.53632015", "0.53452784", "0.5316901", "0.52928", "0.5274946", "0.5260581", "0.52502626", "0.5245397", "0.52392554", "0.5236079", "0.52280676", "0.52280676", "0.52186316", "0.5203336", "0.5181229", "0.51761395", "0.5168351", "0.5165145", "0.5158012", "0.5154597", "0.5153633", "0.51356703", "0.51356703", "0.51347995" ]
0.78779715
6
As get but sends an HTTP DELETE request.
def delete(url, headers = {}) request(:delete, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 delete\n request(:delete)\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 http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\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 endpoint\n do_request :delete, endpoint\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def do_delete(uri = '')\n build_request(:delete, uri)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete!\n request! :delete\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 do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def delete(uri = nil)\n requestor(Net::HTTP::Delete.new(build_uri(uri)))\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end", "def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "def delete(request)\n request.method = :delete\n request.call\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end", "def delete(uri, params = {})\n send_request(uri, :delete, params)\n end", "def delete\n request('delete').auth_required!\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(*args)\n Request.delete(*args)\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(uri, request_headers)\n request('delete', uri, request_headers)\n end", "def delete\n api(\"Delete\")\n end", "def delete(request)\n _request(request) { |client, options| client.delete options }\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpDeleteWithEntity, url, options, &block\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def http_delete(path, headers = {})\n clear_response\n path = process_path(path)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def delete(path)\n request 'DELETE', path\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, data={})\n request(:delete, path, data)\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 delete(path, options = {})\n request = Net::HTTP::Delete.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end", "def delete options\n rest_request({ method: :delete }.merge(options))\n end", "def delete options\n rest_request({ method: :delete }.merge(options))\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete(uri, options = {})\n build_response(request.delete(uri, build_request_options({:input => options.to_params})))\n end", "def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(url, headers: {}, options: {})\n request_without_payload(:delete, url, headers, options)\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete(url)\n call(url: url, action: :delete)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def delete\n api_client.delete(url)\n end", "def delete(path, options={}, raw=false)\n request(:delete, path, options, raw)\n end", "def delete_request(uri)\n http = build_http(uri)\n request = Net::HTTP::Delete.new(uri.request_uri, initheader = build_headers())\n return http.request(request)\n end", "def delete(path, options={})\n send_request 'delete', path, options\n end", "def delete(path, accept, content = {})\n execute HttpConnect::HttpDelete.new(path, nil, accept, content)\n end", "def delete(url, headers: {}, params: {}, options: {})\n url = encode_query(url, params)\n\n request = Net::HTTP::Delete.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options)\n end", "def delete(url, options = {}, &block)\n run! Request.new(url, :delete, options.slice(:headers, :params, :payload), &block)\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 delete(path, options={})\n url = build_url path, options\n headers = options[:headers] || {}\n # nothing returned in response body for DELETE\n Response.new(@client[url].delete headers)\n rescue RestClient::Exception => e\n Response.new e.response\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 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 delete(path, options = {})\n request(:delete, path, options)\n end", "def delete(uri, request_headers)\n raise NotImplementedError\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete(path, opts = {})\n request(:delete, path, opts).body\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete(path, options={}, format=format)\n request(:delete, path, options, format)\n end", "def deleteRequest\n\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def delete options={}, &block\n handle_exceptions do\n Chimps.log.info(\"DELETE #{url}\")\n Response.new(super(options, &block))\n end\n end" ]
[ "0.83651096", "0.83651096", "0.83648396", "0.8294889", "0.8294889", "0.81782633", "0.8162452", "0.8137911", "0.8127244", "0.80570513", "0.802647", "0.8014162", "0.7993609", "0.79910666", "0.79335636", "0.79335636", "0.79335636", "0.79335636", "0.78423196", "0.7830619", "0.7783558", "0.7765474", "0.77515274", "0.7751272", "0.7719871", "0.7641974", "0.7639154", "0.7623602", "0.7620126", "0.76002645", "0.75573295", "0.75025165", "0.75023466", "0.74844116", "0.747703", "0.74748236", "0.7457115", "0.7457115", "0.74570596", "0.74568534", "0.7453146", "0.74527806", "0.7447686", "0.74335057", "0.74298316", "0.7427403", "0.7426361", "0.7421759", "0.7421759", "0.7421759", "0.7420913", "0.74194795", "0.74194795", "0.74194795", "0.74194795", "0.74194795", "0.74194795", "0.74194795", "0.74150854", "0.7404282", "0.73872924", "0.7385346", "0.7385262", "0.7383211", "0.7383211", "0.73828775", "0.73774534", "0.73768014", "0.7376614", "0.737104", "0.7365261", "0.7364404", "0.7345572", "0.73236775", "0.732259", "0.73225844", "0.73178965", "0.7305125", "0.72947264", "0.7272578", "0.72561705", "0.72375506", "0.7222828", "0.7207152", "0.7199888", "0.7196004", "0.7190438", "0.71882296", "0.7178191", "0.7177022", "0.7176176", "0.71747774", "0.7171027", "0.7167914", "0.71672463", "0.7166321", "0.7158473", "0.7149581", "0.7141611" ]
0.7492192
33
Uploads the passed +data+ to the specified +url+ using HTTP PUT. +data+ must be a string.
def put(url, data, headers = {}) request(:put, url, headers, :data => data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n put_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end", "def put(data = nil, options = nil)\n options ||= {}\n options[:method] = :put\n call data, options\n end", "def put(path, data, headers = { })\n path = \"/#{path}\" unless path.start_with?('/')\n request = Net::HTTP::Put.new(path, headers)\n process_put_and_post_requests(request, data)\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 PUT(uri, data, type, credentials)\n put = Net::HTTP::Put.new(uri.path)\n put.content_type = type\n\n set_upload_body(put, data)\n\n response = submit(put, uri, credentials)\n\n case response\n when Net::HTTPOK, Net::HTTPAccepted\n # We've either set a parameter or started a run so we get 200 or 202\n # back from the server, respectively. Return true to indicate success.\n true\n when Net::HTTPCreated\n # We've uploaded data so we get 201 back from the server. Return the\n # uri of the created resource.\n URI.parse(response['location'])\n when Net::HTTPNoContent\n # We've modified data so we get 204 back from the server. Return the\n # uri of the modified resource.\n uri\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"PUT\", uri.path, response, credentials)\n end\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def put(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Put.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def put(data = \"\")\n submit :Put, data\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def put(path, data={})\n request(:put, path, data)\n end", "def put(data)\n end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def put(request_uri, data = nil)\n url = base_uri + request_uri\n logger.debug(\"PUT #{url}\")\n\n uri = URI.parse(url)\n\n response = http_request(:put, uri, data)\n\n parse_body(response)\n end", "def make_put_request(url, data)\n headers = {\n \"Content-Type\" => \"application/json\",\n }\n\n response = HTTParty.put(url, body: data.to_json, headers: headers)\n\n if response.success?\n response\n else\n puts \"Request failed with response code: #{response.code}\"\n puts \"Response message: #{response.message}\"\n nil\n end\nend", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def put(object, url, headers={})\n do_request(\"put\", url, object, headers)\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def api_put_request(url_prefix, data, raw_response = false)\n to_put = URI.escape(url_prefix)\n request = Net::HTTP::Put.new(to_put)\n request.body = data\n @logger.info \"PUT #{to_put}\"\n exec_request(request, raw_response, data)\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put(path, *data, &block)\n map(path, R3::PUT, *data, &block)\n end", "def blob_put(table, digest, data)\n uri = blob_path(table, digest)\n @logger.debug(\"BLOB PUT #{uri}\")\n req = Net::HTTP::Put.new(blob_path(table, digest), headers)\n req.body = data\n response = request(req)\n case response.code\n when '201'\n true\n else\n @logger.info(\"Response #{response.code}: \" + response.body)\n false\n end\n end", "def put(path, data = {})\n self.class.put path, :body => data.merge(:u => access_token)\n end", "def put(url, body, headers: {}, params: {}, options: {})\n raise ArgumentError, \"'put' requires a string 'body' argument\" unless body.is_a?(String)\n url = encode_query(url, params)\n\n request = Net::HTTP::Put.new(url, @default_headers.merge(headers))\n request.body = body\n request.content_length = body.bytesize\n\n raise ArgumentError, \"'put' requires a 'content-type' header\" unless request['Content-Type']\n\n execute_streaming(request, options: options)\n end", "def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end", "def store(data, headers = {})\n r = conn.put(escaped_path, data) do |req|\n req.headers = headers\n token = CarrierWave::UCloud::Digest.authorization(@uploader, req)\n req.headers['Authorization'] = token\n end\n r\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def update(data)\n options = {\n \"url\" => @location,\n \"data\" => data\n }\n\n @connector.apply(:post, self, options)\n end", "def put(url, data={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n\n @logger.debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n put(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n put(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def put(url, payload, headers: {}, options: {})\n request_with_payload(:put, url, payload, headers, options)\n end", "def direct_put(uri,data, wait = true, opts = {})\n id = @utils.id_generate\n options = {\"Identifier\" => id, \"URI\" => uri ,\"UploadFrom\" => \"direct\", \"DataLength\" => data.bytesize }.merge(opts)\n send_packet @utils.packet_mangler(options,\"ClientPut\").sub! \"EndMessage\\n\", \"Data\\n#{data}\"\n if wait\n wait_for id,/PutFailed|PutSuccessful/\n else\n id\n end\n end", "def put_json(url, data)\n JSON.parse(put(url, data, :json, :json))\n end", "def put(data)\n enter(canonical(data))\n nil\n end", "def put(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:put, url, payload, headers)\n end", "def http_put(uri:, additional_headers: {}, data: {}, basic_auth: nil, debug: false)\n return nil if uri.blank?\n\n opts = options(additional_headers: additional_headers, debug: debug)\n opts[:body] = data\n opts[:basic_auth] = basic_auth if basic_auth.present?\n HTTParty.put(uri, opts)\n rescue URI::InvalidURIError => e\n handle_uri_failure(method: \"BaseService.http_put #{e.message}\", uri: uri)\n nil\n rescue HTTParty::Error => e\n handle_http_failure(method: \"BaseService.http_put #{e.message}\", http_response: nil)\n nil\n end", "def http_put(url, params, &request_modifier)\n uri = URI.parse url\n req = Net::HTTP::Put.new uri.path\n req.set_form_data(params)\n request_modifier && (request_modifier.call req)\n\n session = (Net::HTTP.new uri.host, uri.port)\n case res = session.start { |http| http.request req }\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n res.error!\n end\n end", "def put(url, data={}, headers={}, http_options={})\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n # handle 302\n when Net::HTTPRedirection then\n if redirect_limit == -1\n HttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n put(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n HttpResponse.new(response)\n elsif gateway_retries == 0\n Kinetic::Platform.logger.info(\"HTTP response: #{response.code} #{response.message}\")\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n Kinetic::Platform.logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n put(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n Kinetic::Platform.logger.info(\"HTTP response code: 0\")\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n HttpResponse.new(e)\n else\n Kinetic::Platform.logger.info(\"HTTP response code: #{response.code}\")\n HttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n Kinetic::Platform.logger.info(\"HTTP bad response: #{e.inspect}\")\n HttpResponse.new(e)\n rescue StandardError => e\n Kinetic::Platform.logger.info(\"HTTP error: #{e.inspect}\")\n HttpResponse.new(e)\n end\n end", "def put(data, opts={})\n self.fd.put(data, opts={})\n end", "def put(data, options={})\n @hal_client.put(href, data, options).tap do\n reset\n end\n end", "def put(url, options = {}, &block)\n run! Request.new(url, :put, options.slice(:headers, :params, :payload), &block)\n end", "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def put_file(path, data)\n raise NotImplemented\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def put(url, payload, headers={})\n RestClient.put url, payload, headers\n end", "def put(url, options = {}, &block)\n request HttpPut, url, options, &block\n end", "def update(data, &block)\n request :put, @data[:id], data, &block\n end", "def write(data=nil,headers={})\n #raise SyntaxException, \"No data was provided for object '#{@name}'\" if (data.nil?)\n # Try to get the content type\n raise SyntaxException, \"No data or header updates supplied\" if (data.nil? and headers.empty?)\n if headers['Content-Type'].nil?\n type = MIME::Types.type_for(self.name).first.to_s\n if type.empty?\n headers['Content-Type'] = \"application/octet-stream\"\n else\n headers['Content-Type'] = type\n end\n end\n response = self.container.connection.cfreq(\"PUT\",@storagehost,\"#{@storagepath}\",headers,data)\n raise InvalidResponseException, \"Invalid content-length header sent\" if (response.code == \"412\")\n raise MisMatchedChecksumException, \"Mismatched etag\" if (response.code == \"422\")\n raise InvalidResponseException, \"Invalid response code #{response.code}\" unless (response.code == \"201\")\n make_path(File.dirname(self.name)) if @make_path == true\n self.populate\n true\n end", "def upload_file(bucket, key, data)\n bucket.put(key, data)\nend", "def fire_put(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.put(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :put, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def put_api subpath, data, category=nil, content_type=nil, &block\n\t\t\t@request_queue.put \"/api/#{api_key}#{subpath}\", data, category, content_type, &block\n\t\tend", "def put(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Put.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def put(data, path, options={})\n self.config.put(data, path, options)\n end", "def upload(key, data_or_path, headers = {})\n if data_or_path.respond_to?(:read) && data_or_path.respond_to?(:size)\n upload_io(key, data_or_path, data_or_path.size, headers)\n elsif !File.file?(data_or_path.to_s)\n raise ArgumentError, \"data_or_path must be an IO with data or filename string\"\n else\n File.open(data_or_path.to_s, \"rb\") do |io|\n upload_io(key, io, io.stat.size, headers)\n end\n end\n end", "def put(resource, **params)\n\n execute(Net::HTTP::Put, 'PUT', resource, **params)\n\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def request_put(file, content_type)\n\turi = URI($amazon_upload_url)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.body_stream = File.open(file)\n\trequest.add_field(\"Content-Type\", content_type)\n\trequest.add_field('Content-Length', File.size(file))\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def put(path, content_type, accept, content = {})\n execute HttpConnect::HttpPut.new(path, content_type, accept, content)\n end", "def put_object(bucket_name, key, data, content_md5, content_length, options, &block)\n if content_length > MAX_PUT_OBJECT_LENGTH\n raise BceClientException.new(\"Object length should be less than #{MAX_PUT_OBJECT_LENGTH}. Use multi-part upload instead.\")\n end\n\n headers = {\n CONTENT_MD5 => content_md5,\n CONTENT_LENGTH => content_length,\n }\n headers.merge! options\n headers[CONTENT_TYPE] = OCTET_STREAM_TYPE if headers[CONTENT_TYPE].nil?\n populate_headers_with_user_metadata(headers) unless headers['user-metadata'].nil?\n send_request(PUT, bucket_name, {}, key, headers, data, &block)\n end", "def update(data, params={})\n send_request @opts[:update_path], params, data\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 put_multipart!(data, boundary, part_index, part_data)\n data << \"\\r\\n--#{boundary}\\r\\n\"\n if part_index > 0\n data << \"Content-Disposition: form-data; name=\\\"file#{part_index}\\\";filename=\\\"file#{part_index}\\\"\\r\\n\"\n data << \"Content-Type: application/octet-stream\\r\\n\"\n elsif\n data << \"Content-Disposition: form-data; name=\\\"data\\\"\\r\\n\"\n data << \"Content-Type: text/json\\r\\n\"\n end\n data << \"Content-Length: #{part_data.length}\\r\\n\"\n data << \"\\r\\n\"\n data << part_data\n end", "def put(*args)\n request :put, *args\n end", "def put(request)\n do_request(request) { |client| client.http_put request.body }\n end", "def load(data)\n begin_connection\n\n logger.info \"Uploading #{data} to #{@username}@#{@host}: #{@remote_path}\"\n sftp_retry { sftp_session.upload! data, @remote_path }\n\n true\n ensure\n end_connection\n end", "def put(*args)\n request(:put, *args)\n end", "def put(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Extract return unit params\n query_params = {}\n query_params[:returnUnit] = data.delete(:returnUnit) if data[:returnUnit]\n query_params[:returnPerUnit] = data.delete(:returnPerUnit) if data[:returnPerUnit]\n # Create PUT request\n put_params = {\n :verbose => DEBUG,\n :method => \"put\",\n :body => form_encode(data)\n }\n put_params[:params] = query_params unless query_params.empty?\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", put_params)\n # Send request\n do_request(put, format)\n end", "def put(key, data, opts = { tag: {} })\n @map[key] = if data.is_a?(Upload)\n UploadAssoc.new(opts[:tag], data)\n else\n data\n end\n end", "def put(path, options={})\n send_request 'put', path, options\n end", "def load(data)\n init_kms(@kms_opt)\n\n @logger.info \"Writing file #{data} to S3 #{@bucket_name} as #{@remote_path}\"\n s3.bucket(@bucket_name).object(@remote_path).upload_file(data, encrypt_args)\n true\n end", "def upload(_data)\n fail NotImplementedError\n end", "def process_put_and_post_requests(request, data)\n content_type = request['Content-Type'] ||= 'application/x-www-form-urlencoded'\n case content_type\n when 'application/x-www-form-urlencoded'; request.form_data = data\n when 'application/json'; request.body = (data.is_a?(Hash) or data.is_a?(Array)) ? JSON.generate(data) : data\n else\n #data = data.to_s unless request.body.is_a?(String)\n request.body = data\n end\n process_request(request)\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def upload_data=(data)\n @upload_data = case data\n when Hash\n self.multipart ? data : Util.build_query_string_from_hash(data, action == :post)\n else\n data\n end\n end", "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end", "def store(key, data, bucket = nil, options = {})\n validate_key!(key)\n # Must build path before infering content type in case bucket is being used for options\n path = path!(bucket, key, options)\n infer_content_type!(key, options)\n \n put(path, options, data) # Don't call .success? on response. We want to get the etag.\n end", "def put(payload = {})\n request! do\n api[url.path].put(to_payload(payload), API_HEADERS)\n end\n end", "def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end", "def putPrivate_object( entity_id, data)\n params = Hash.new\n params['entity_id'] = entity_id\n params['data'] = data\n return doCurl(\"put\",\"/private_object\",params)\n end", "def update_file(uri, data, etag = Box.new)\n node = @tree.node_for_path(uri)\n\n # It is possible for an event handler to modify the content of the\n # body, before it gets written. If this is the case, modified\n # should be set to true.\n #\n # If modified is true, we must not send back an ETag.\n modified = Box.new(false)\n data = Box.new(data)\n\n return false unless emit('beforeWriteContent', [uri, node, data, modified])\n\n etag.value = node.put(data.value)\n etag.value = nil if modified.value\n\n emit('afterWriteContent', [uri, node])\n\n true\n end", "def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end", "def get_pre_singed_url_for_put(data_to_format)\n formatted_data = {\n result_type: 'file_upload_put',\n file_upload_put: data_to_format\n\n }\n formatted_data\n end", "def put(uri, options = T.unsafe(nil)); end", "def commit(upload_href, data, opts = {})\n data, _status_code, _headers = commit_with_http_info(upload_href, data, opts)\n data\n end", "def upload(obj, download) \n obj.put(body: download)\n end", "def put(path, **options)\n execute :put, path, options\n end", "def put(uri, options = {})\n if options[:multipart]\n form_input = build_multipart_data(options)\n build_response(request.put(uri, build_request_options({\"CONTENT_TYPE\" => \"multipart/form-data, boundary=Mack-boundary\", \"CONTENT_LENGTH\" => form_input.size, :input => form_input})))\n else\n build_response(request.put(uri, build_request_options({:input => options.to_params})))\n end\n end" ]
[ "0.77118224", "0.7607027", "0.7374744", "0.7371776", "0.73673177", "0.7344699", "0.73156166", "0.73110235", "0.7270493", "0.72618616", "0.7184285", "0.70555466", "0.7042689", "0.6990701", "0.698433", "0.69083244", "0.6903627", "0.6879228", "0.68719953", "0.68228966", "0.6811323", "0.68083733", "0.6795263", "0.67178744", "0.6657314", "0.66308796", "0.66196454", "0.6595123", "0.6551075", "0.65343606", "0.6532886", "0.6532881", "0.65288436", "0.6491681", "0.64878416", "0.6481151", "0.64313805", "0.63932407", "0.6382248", "0.63621014", "0.6360507", "0.63510287", "0.633675", "0.6331907", "0.6284917", "0.62750083", "0.62435573", "0.62345487", "0.6229967", "0.6229967", "0.62215674", "0.61888963", "0.61862546", "0.6185043", "0.6177044", "0.6170411", "0.6166965", "0.6087934", "0.60840267", "0.6082875", "0.59848994", "0.59756786", "0.5956113", "0.59542423", "0.59534705", "0.59471774", "0.59397393", "0.5930383", "0.5926994", "0.59120435", "0.5910109", "0.58982396", "0.5897547", "0.58857644", "0.58852696", "0.5881407", "0.58183694", "0.58037907", "0.5782112", "0.5779869", "0.57798094", "0.57783675", "0.57479507", "0.5746819", "0.5736895", "0.5733504", "0.5730727", "0.5710465", "0.570121", "0.56897897", "0.568965", "0.5682206", "0.5679405", "0.56659806", "0.5647889", "0.56476575", "0.5647304", "0.5645028", "0.5637669" ]
0.8293644
1
Uploads the contents of a file to the specified +url+ using HTTP PUT.
def put_file(url, filename, headers = {}) request(:put, url, headers, :file => filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def request_put(file, content_type)\n\turi = URI($amazon_upload_url)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.body_stream = File.open(file)\n\trequest.add_field(\"Content-Type\", content_type)\n\trequest.add_field('Content-Length', File.size(file))\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def put(object, url, headers={})\n do_request(\"put\", url, object, headers)\n end", "def put(url, body, headers: {}, params: {}, options: {})\n raise ArgumentError, \"'put' requires a string 'body' argument\" unless body.is_a?(String)\n url = encode_query(url, params)\n\n request = Net::HTTP::Put.new(url, @default_headers.merge(headers))\n request.body = body\n request.content_length = body.bytesize\n\n raise ArgumentError, \"'put' requires a 'content-type' header\" unless request['Content-Type']\n\n execute_streaming(request, options: options)\n end", "def put(url, payload, headers: {}, options: {})\n request_with_payload(:put, url, payload, headers, options)\n end", "def put(url, options = {}, &block)\n run! Request.new(url, :put, options.slice(:headers, :params, :payload), &block)\n end", "def put(url, options = {}, &block)\n request HttpPut, url, options, &block\n end", "def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end", "def put(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n put_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def http_put(url, params, &request_modifier)\n uri = URI.parse url\n req = Net::HTTP::Put.new uri.path\n req.set_form_data(params)\n request_modifier && (request_modifier.call req)\n\n session = (Net::HTTP.new uri.host, uri.port)\n case res = session.start { |http| http.request req }\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n res.error!\n end\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def put(filepath, remote_filepath)\n @request = Net::HTTP::Put.new(::File.join(@uri.path, remote_filepath))\n @request.body_stream = ::File.open(filepath)\n @request.content_type = 'application/kzip'\n @request.content_length = ::File.size(filepath)\n\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n\n @response.body.presence || @response.code.to_i\n end", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def upload_file_to_aws(file_to_upload, content_type)\n\tputs \"Uploading file: \" + file_to_upload + \" to aws\"\n\tresponse = request_put(file_to_upload, content_type)\n\tputs response\nend", "def put(url, payload, headers={})\n RestClient.put url, payload, headers\n end", "def upload_url(url, options = {})\n params = upload_params(options).for_url_upload(url)\n file_upload_response = request_file_upload(params)\n\n handle_response(file_upload_response)\n end", "def put(path, file, options = {})\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n content_md5 = Digest::MD5.file(file).base64digest\n content_type = options[:content_type] || 'image/jpg'\n date = gmtdate\n url = path_to_url(path)\n auth_sign = sign('PUT', bucket_path, content_md5, content_type, date)\n headers = {\n 'Authorization' => auth_sign,\n 'Content-Md5' => content_md5,\n 'Content-Type' => content_type,\n 'Content-Length' => file.size,\n 'Date' => date,\n 'Host' => @aliyun_upload_host,\n 'Expect' => '100-Continue'\n }\n response = RestClient.put(url, file, headers)\n response.code == 200 ? path_to_url(path) : nil\n end", "def put(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:put, url, payload, headers)\n end", "def put(local_file, to_location, overwrite = true, close_file = true)\n local_file = File.open(File.expand_path(local_file), \"rb\") unless local_file.respond_to?(:read) # check if it's a File object\n result = @client.put_file(to_location, local_file, overwrite)\n local_file.close if close_file\n result\n rescue\n puts $! if @@verbose\n nil\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def send_file(url, name, file_info = {})\n client.api.send_content(id, url, name, 'm.file', extra_information: file_info)\n end", "def upload(filename)\n begin\n file = File.open(\"#{filename}\")\n response = @client.put_file(\"/#{filename}\",file,true)\n return true\n rescue\n return false\n end\n end", "def upload(bucket, file); end", "def PUT(uri, data, type, credentials)\n put = Net::HTTP::Put.new(uri.path)\n put.content_type = type\n\n set_upload_body(put, data)\n\n response = submit(put, uri, credentials)\n\n case response\n when Net::HTTPOK, Net::HTTPAccepted\n # We've either set a parameter or started a run so we get 200 or 202\n # back from the server, respectively. Return true to indicate success.\n true\n when Net::HTTPCreated\n # We've uploaded data so we get 201 back from the server. Return the\n # uri of the created resource.\n URI.parse(response['location'])\n when Net::HTTPNoContent\n # We've modified data so we get 204 back from the server. Return the\n # uri of the modified resource.\n uri\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"PUT\", uri.path, response, credentials)\n end\n end", "def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end", "def upload_file(bucket, key, data)\n bucket.put(key, data)\nend", "def upload(remote_path, contents)\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def upload(obj, download) \n obj.put(body: download)\n end", "def put(path, options={})\n send_request 'put', path, options\n end", "def put(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Put.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def upload_remote(url, **opt)\n # @type [Down::ChunkedIO] io\n io = Down.open(url, **DOWN_OPEN_OPTIONS)\n opt[:metadata] = opt[:metadata]&.dup || {}\n opt[:metadata]['filename'] ||= File.basename(url)\n file_attacher.attach(io, **opt)\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n ensure\n # noinspection RubyScope, RubyMismatchedReturnType\n io&.close\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end", "def put(path, content_type, accept, content = {})\n execute HttpConnect::HttpPut.new(path, content_type, accept, content)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put(path, headers = {})\n process :put, path, headers\n end", "def put_filebucket_file(path, body:, environment:)\n headers = add_puppet_headers({\n 'Accept' => 'application/octet-stream',\n 'Content-Type' => 'application/octet-stream'\n })\n\n response = @client.put(\n with_base_url(\"/file_bucket_file/#{path}\"),\n body,\n headers: headers,\n params: {\n environment: environment\n }\n )\n\n process_response(response)\n\n response\n end", "def put_filebucket_file(path, body:, environment:)\n headers = add_puppet_headers({\n 'Accept' => 'application/octet-stream',\n 'Content-Type' => 'application/octet-stream'\n })\n\n response = @client.put(\n with_base_url(\"/file_bucket_file/#{path}\"),\n body,\n headers: headers,\n params: {\n environment: environment\n }\n )\n\n process_response(response)\n\n response\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def put_file(path, file, create_path = false)\n path = File.join('/', path)\n response = self.class.put(path, request_options.merge!(\n body_stream: file,\n headers: {\n 'Content-Length' => file.size.to_s\n }\n ))\n\n if response.code != 201 && response.code != 204\n notify_of_error(response, \"creating(putting) file. File path: #{path}\")\n end\n\n response.code\n end", "def upload_file(bucket_key, file_location, file_name, access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\n end", "def put(path, data, headers = { })\n path = \"/#{path}\" unless path.start_with?('/')\n request = Net::HTTP::Put.new(path, headers)\n process_put_and_post_requests(request, data)\n end", "def simple_put(uri, filename, wait = true, opts = {})\n id = @utils.id_generate\n options = { \"URI\" => uri, \"Identifier\" => id, \"UploadFrom\" => 'disk', \"Filename\" => filename, \"FileHash\" => @utils.filehash_maker(id, filename,identifier), \"Verbosity\" => \"111111111\" }.merge(opts)\n options[\"TargetFilename\"] = filename.split(File::SEPARATOR)[-1] if uri =~ /CHK@/\n send_packet @utils.packet_mangler(options,\"ClientPut\")\n #@com.fcpackets.client_put uri, id, options\n if wait\n wait_for id, /PutFailed|PutSuccessful/\n else\n id\n end\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def make_put_request(url, data)\n headers = {\n \"Content-Type\" => \"application/json\",\n }\n\n response = HTTParty.put(url, body: data.to_json, headers: headers)\n\n if response.success?\n response\n else\n puts \"Request failed with response code: #{response.code}\"\n puts \"Response message: #{response.message}\"\n nil\n end\nend", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def put(path, **options)\n execute :put, path, options\n end", "def put(request)\n do_request(request) { |client| client.http_put request.body }\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)\n \n checksum64 = Base64.encode64([sandbox_file_checksum].pack(\"H*\")).strip\n timestamp = Time.now.utc.iso8601\n file_contents = File.read(sandbox_filename)\n # TODO - 5/28/2010, cw: make signing and sending the request streaming\n sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n :http_method => :put,\n :path => URI.parse(url).path,\n :body => file_contents,\n :timestamp => timestamp,\n :user_id => rest.client_name\n )\n headers = { \n 'content-type' => 'application/x-binary', \n 'content-md5' => checksum64, \n :accept => 'application/json'\n }\n headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))\n\n # Don't set inflated_response as S3 (for the Platform) doesn't return JSON.\n # Only Open Source does.\n self.inflated_response = nil\n self.exception = nil\n self.api_response = RestClient::Request.execute(\n :method => :put, \n :url => url, \n :headers => headers, \n :payload => file_contents\n )\nend", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(query_url,\r\n headers: {},\r\n parameters: {})\r\n HttpRequest.new(HttpMethodEnum::PUT,\r\n query_url,\r\n headers: headers,\r\n parameters: parameters)\r\n end", "def put_file(destination, file)\n href = self.class.get_href(destination)\n @rest_logger.info \"#{__method__.to_s.upcase}\\t#{href}\"\n response = @file_uploader.upload(href, file, @cookies)\n response\n end", "def put(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Put.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\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 put(path, options={})\n request :put, path, options\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def upload_file(remote, local)\n write_file(remote, ::File.read(local))\n end", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def put(path, options={}, format=format)\n request(:put, path, options, format)\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def fire_put(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.put(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :put, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def put(src, uri)\n raise NotImplementedError\n end", "def put(path, options={}, raw=false)\n request(:put, path, options, raw)\n end", "def put(path, options = {}, raw = false)\n request(:put, path, options, raw)\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def upload_media_url(media_url)\n tempfile = Tempfile.open([\"media\", File.extname(media_url)])\n\n open(media_url) do |input| # rubocop:disable Security/Open\n tempfile.write(input.read)\n end\n\n @client.upload_media(tempfile.path)\n ensure\n tempfile.close! if tempfile\n end", "def upload(file_name: nil, file_handle: nil, file_path: nil, sync: true)\n if file_path\n key = key_from_filename(file_path)\n puts \"Uploading #{file_path} to s3 with key #{key}\"\n File.open(file_path, 'rb') do |file|\n s3_client.put_object(key: key, body: file, bucket: bucket )\n end\n else\n key = key_from_filename(file_name)\n s3_client.put_object(key: key, body: file_handle.read, bucket: bucket)\n end\n sync_down if sync\n end", "def put(uri, options = {})\n if options[:multipart]\n form_input = build_multipart_data(options)\n build_response(request.put(uri, build_request_options({\"CONTENT_TYPE\" => \"multipart/form-data, boundary=Mack-boundary\", \"CONTENT_LENGTH\" => form_input.size, :input => form_input})))\n else\n build_response(request.put(uri, build_request_options({:input => options.to_params})))\n end\n end", "def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend", "def put(uri, options = T.unsafe(nil)); end", "def upload(name, destination=nil)\n put File.open(name, \"rb\"), destination || File.basename(name)\n end", "def request_put(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"PUT\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "def store\n result = QcloudCos.upload(path, file.to_file)\n\n if result != nil\n self.url = result\n end\n end", "def download(url, file)\n # First, open the remote file. (FD == 'File Descriptor', a C term)\n #\n # If we first open the remote file, if there are any exceptions in\n # attempting to open it, we won't lose the contents of the local file.\n open(url) do |remoteFD|\n # Open the local file, purging the contents.\n File.open(file, \"w\") do |genericFD|\n remoteFD.each_line do |line|\n # Take each line, stick it in the file.\n genericFD.puts line\n end\n end\n end\n @repo.add(file) # add the file to the list to be committed\nend", "def put(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Put.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n begin\n response = http.start {|http| http.request(request) }\n rescue\n puts url\n end\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def put(*args)\n request :put, *args\n end", "def upload_file(path, format, file)\n delete path\n append_from_file(path, format, file)\n end" ]
[ "0.7282661", "0.7282661", "0.7264141", "0.7235265", "0.7119471", "0.693486", "0.6930544", "0.6883299", "0.6877091", "0.68665636", "0.68636316", "0.68402976", "0.68169767", "0.6750699", "0.66450846", "0.6615274", "0.65965635", "0.6585323", "0.64565015", "0.6437783", "0.64321595", "0.6404756", "0.6339984", "0.62553674", "0.6247995", "0.6240368", "0.62209356", "0.6190697", "0.6180983", "0.6164607", "0.6158222", "0.61567086", "0.61505383", "0.6149908", "0.61421055", "0.6130189", "0.6122741", "0.61112905", "0.60979366", "0.6089167", "0.608272", "0.60804933", "0.60603786", "0.6046826", "0.60376275", "0.6013577", "0.60102826", "0.60102826", "0.59738016", "0.5972788", "0.5966432", "0.59620416", "0.59601647", "0.5948706", "0.5948456", "0.59454596", "0.59327745", "0.5931769", "0.59286964", "0.59221864", "0.5917016", "0.59042776", "0.58985", "0.58861035", "0.588367", "0.588367", "0.5883154", "0.5877743", "0.5876808", "0.5856803", "0.58544415", "0.5849923", "0.5839646", "0.5839646", "0.5832987", "0.5822539", "0.5816431", "0.5805992", "0.580542", "0.5804705", "0.5791144", "0.5787221", "0.5785198", "0.5777133", "0.5777133", "0.5775375", "0.5772971", "0.5732514", "0.57189345", "0.5715329", "0.57044953", "0.56885695", "0.56874895", "0.56874895", "0.568195", "0.5680482", "0.5678042", "0.5668323", "0.5661861" ]
0.8358026
1
Uploads the passed +data+ to the specified +url+ using HTTP POST. +data+ must be a string.
def post(url, data, headers = {}) request(:post, url, headers, :data => data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def post_multipart(url, data, filename, headers = {})\n request(:post, url, headers, {:data => data, :file => filename, :multipart => true})\n end", "def post(url, data, headers = {})\n if data.is_a?(Hash)\n data = data.map {|k,v| urlencode(k.to_s) + '=' + urlencode(v.to_s) }.join('&')\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n end\n request(:post, url, headers, :data => data)\n end", "def send_post(uri, data)\n _send_request('POST', uri, data)\n end", "def post(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"POST #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n post_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def POST(uri, data, type, credentials)\n post = Net::HTTP::Post.new(uri.path)\n post.content_type = type\n\n set_upload_body(post, data)\n\n response = submit(post, uri, credentials)\n\n case response\n when Net::HTTPCreated\n # return the URI of the newly created item\n URI.parse(response['location'])\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"POST\", uri.path, response, credentials)\n end\n end", "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend", "def post_multipart(url, data={}, headers={}, redirect_limit=max_redirects)\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n h[k] = (v.class == File) ? UploadIO.new(v, mimetype(v), File.basename(v)) : v; h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n post_multipart_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def send_request(url, data)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl\t= true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n response = http.post(uri.path, data)\n response.code == '200' ? response.body : response.error!\n end", "def post(url, data, options = {})\n self.new(options).post(url.to_s, data)\n end", "def post(url, post_data, custom_headers = {})\n headers = @default_headers.merge(custom_headers)\n # slow down the request rate! otherwise you will get blocked\n sleep 1\n return @agent.post(url, post_data, headers)\n end", "def POST(data=nil)\n\n if not data.nil? #if request data passed in, use it.\n @data = data\n end\n\n uri = URI(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n if @set_cert_file\n http = set_cert_file(http)\n end\n request = Net::HTTP::Post.new(uri.path)\n request.body = @data\n request.basic_auth(@user_name, @password)\n\n response = http.request(request)\n return response\n end", "def postToolsUpload( filedata)\n params = Hash.new\n params['filedata'] = filedata\n return doCurl(\"post\",\"/tools/upload\",params)\n end", "def post_data(data, url, headers = nil)\n payu_service = Net::HTTP.new(OfficialPaths.domain_url, 443)\n payu_service.use_ssl = true\n payu_service.verify_mode = OpenSSL::SSL::VERIFY_NONE \n\n @response = payu_service.post(url, data.to_s, headers)\n @response.body\n end", "def post(path, data, headers = { })\n path = \"/#{path}\" unless path.start_with?('/')\n request = Net::HTTP::Post.new(path, headers)\n process_put_and_post_requests(request, data)\n end", "def post_multipart(resource_url, params, data={})\n headers = {'Authorization' => authorization('POST', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n uri = URI.parse(url)\n form_data = []\n data.each{|k,v|\n form_data << [k,v]\n }\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.request_uri, headers)\n req.set_form(form_data, 'multipart/form-data')\n res = http.start{|h|\n h.request(req)\n }\n Response.new(res)\n end", "def upload_raw(data)\n data.rstrip!\n response = do_post data\n if response.status == 200\n data = JSON.parse(response.body)\n data['key']\n else\n fail_with \"failure uploading: #{response.body}\"\n end\n rescue JSON::ParserError => e\n fail_with \"failure parsing response: #{e.message}\"\n rescue Errno::ECONNREFUSED => e\n fail_with \"failure connecting: #{e.message}\"\n end", "def http_post(uri, data)\n RestClient.post uri, data\n end", "def send_data_to_external_service(url, data)\n connect = Faraday.new(:url => url)\n connect.post do |request|\n request.headers['Content-Type'] = 'application/json'\n request.body = data.to_json\n end\n end", "def POST(data=nil, headers=nil)\n\n\t\tif not data.nil? #if request data passed in, use it.\n\t\t\t@data = data\n\t\tend\n\n\t\turi = URI(@url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\trequest = Net::HTTP::Post.new(uri.path)\n\t\trequest.body = @data\n\n\t\tif @search_type == 'premium'\n\t\t\trequest['Authorization'] = \"Bearer #{@app_token}\"\n\t\telse\n\t\t\trequest.basic_auth(@app_token, @password)\n\t\tend\n\n\t\tbegin\n\t\t\tresponse = http.request(request)\n\t\trescue\n\t\t\tlogger()\n\t\t\tsleep 5\n\t\t\tresponse = http.request(request) #try again\n\t\tend\n\n\t\treturn response\n\tend", "def post(data = nil, options = nil)\n options ||= {}\n options[:method] = :post\n call data, options\n end", "def post(path, data, params = {}, request_options = {})\n request(:post, path, data, params)\n end", "def post(uri, data)\n uri = URI.parse(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n return http.post(uri.path, data, @headers)\n end", "def upload(_data)\n fail NotImplementedError\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def send_post(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Post.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending POST request to ' + url.to_s\n\n send_request(url, req)\n end", "def post(data = \"\")\n submit :Post, data\n end", "def post(path, data=nil)\n request(:post, path, data)\n end", "def post_multipart(url, data={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n @logger.debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n if v.class == File\n h[k] = UploadIO.new(v, mimetype(v).first, File.basename(v))\n elsif v.class == Array\n h[k] = v.inject([]) do |files, part|\n if part.class == File\n files << UploadIO.new(part, mimetype(part).first, File.basename(part))\n end\n end\n else\n h[k] = v\n end\n h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n post_multipart(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n post_multipart(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def post url, object = nil\n request url, HTTP::Post, object\n end", "def transmit(path, data)\n http_post (host + path),\n {'Content-Type' => 'application/json'},\n [data.to_json]\n end", "def post_request(url, data)\n\n http = Net::HTTP.new(@api_host, API_PORT)\n http.use_ssl = (API_PORT == 443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n begin\n response = http.post(url, data, headers)\n rescue Exception => e\n raise W3i::UnknownError, e.message\n end\n \n json_data = JSON.parse(response.body) if response.content_type == 'application/json'\n \n if response.code.to_i == 200\n return json_data\n else\n message = response.body\n message = \"#{json_data['code']} - #{json_data['message']}\" unless json_data.nil?\n raise W3i::ApiError, message: message\n end\n\n false\n end", "def post(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Post.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def post(resource_url, params, data=nil)\n headers = {'Authorization' => authorization('POST', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request_post(url, data, headers)\n Response.new(res)\n end", "def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end", "def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end", "def http(data, url, opts = {})\n method = opts[:method] || :post\n opts[:data] = data\n response = HTTParty.send(method, url, opts)\n unless (200..299).include?(response.code)\n raise HttpError.new(\"Bad response: #{response.code} #{response.body}\", response)\n end\n end", "def post_request(url, data:, headers: { \"Content-Type\" => \"application/x-www-form-urlencoded\" })\n if driver_type == :mechanize\n begin\n set_delay(delay) if delay\n check_request_options\n\n self.class.stats[:requests] += 1\n stats[:requests] += 1\n logger.info \"Session: started post request to: #{visit_uri}\"\n\n driver.browser.agent.post(url, data, headers)\n\n self.class.stats[:responses] += 1\n stats[:responses] += 1\n logger.info \"Session: finished post request to: #{visit_uri}\"\n rescue => e\n raise e\n ensure\n print_stats\n end\n else\n raise \"Not implemented in this driver\"\n end\n end", "def upload_data=(data)\n @upload_data = case data\n when Hash\n self.multipart ? data : Util.build_query_string_from_hash(data, action == :post)\n else\n data\n end\n end", "def send_data(data, url)\n content_type = :xml\n response = Requester.request(url, data, content_type)\n response.body\n end", "def set_up_post_request(uri, data, headers, binary_key = nil)\n if !binary_key.nil?\n binary_data = data[binary_key]\n\n if binary_data.is_a?(StringIO)\n data[binary_key] = UploadIO.new(\n binary_data, \"text/plain\", \"local.path\"\n )\n else\n data[binary_key] = UploadIO.new(\n File.open(binary_data), \"text/plain\"\n )\n end\n\n req = Net::HTTP::Post::Multipart.new(uri.path, data)\n else\n req = Net::HTTP::Post.new(uri.path, headers)\n req.body = data.to_json\n end\n req\n end", "def submit_data_to_cas(uri, data)\n uri = URI.parse(uri) unless uri.kind_of? URI\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(data, ';')\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = (uri.scheme == 'https')\n https.verify_mode = (@force_ssl_verification ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE)\n https.start {|conn| conn.request(req) }\n end", "def post(path, data, headers = {})\n request(:post, path, data, headers).body\n end", "def post(resource:, data:, version: :v1)\n if data.is_a? String\n begin\n MultiJson.load data\n rescue MultiJson::ParseError => e\n raise BayPhoto::Exceptions::BadJSON, \"Invalid JSON string: #{e.message}\"\n end\n else\n data = MultiJson.dump data\n end\n\n handle = http_handle(version: version)\n\n req = Net::HTTP::Post.new(uri_path_for(resource: resource, version: version))\n req[\"Content-Type\"] = \"application/json\"\n SET_REQUEST_AUTH_TOKEN.call(req)\n req.body = data\n\n handle_response(handle.request(req))\n end", "def http_request(data)\n\t\t\tunless @connection\n\t\t\t\t@connection = Net::HTTP.new(@host, @port)\n\t\t\t\t@connection.use_ssl = @ssl\n\t\t\tend\n\n\t\t\treq = Net::HTTP::Post.new('/')\n\t\t\treq.basic_auth(@user, @password)\n\t\t\treq.content_type = 'multipart/form_data'\n\t\t\treq.body = data\n\n\t\t\tresp = @connection.request(req)\n\t\t\tif Net::HTTPUnauthorized === resp\n\t\t\t\traise AuthenticationError.new(self)\n\t\t\tend\n\n\t\t\tresp.body()\n\t\tend", "def send_webhook_data(url, data)\n Rails.logger.debug(\"Webhook URL: #{url}\")\n Rails.logger.debug(\"Webhook Data: #{data.to_json}\")\n\n ## Send data\n begin\n https_proxy = ENV['https_proxy'] || ENV['HTTPS_PROXY']\n client = HTTPClient.new(https_proxy)\n client.ssl_config.cert_store.set_default_paths\n client.ssl_config.ssl_version = :auto\n # client.protocol_retry_count = 10\n # client.debug_dev = Rails.logger\n client.post_async url, {:body => data.to_json, :header => {'Content-Type' => 'application/json'}}\n rescue Exception => e\n Rails.logger.warn(\"cannot connect to #{url}\")\n Rails.logger.warn(e)\n end\n end", "def post data\n commit data\n end", "def upload(file_data)\n\t\t\tkparams = {}\n\t\t\t# The file data\n\t\t\tclient.add_param(kparams, 'fileData', file_data);\n\t\t\tclient.queue_service_action_call('baseentry', 'upload', 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 http_post(path, data, headers = {})\n clear_response\n path = process_path(path)\n @success_code = 201\n @response = http.post(path, data, headers)\n parse_response? ? parsed_response : response.body\n end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end", "def post(object, url, headers={})\n do_request(\"post\", url, object, headers)\n end", "def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end", "def put(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n put_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def update(data)\n options = {\n \"url\" => @location,\n \"data\" => data\n }\n\n @connector.apply(:post, self, options)\n end", "def upload(id, path)\n path = Pathname.new(path) unless path.kind_of? Pathname\n\n mime = MIME::Types.type_for(path.to_s)[0] || MIME::Types[\"application/octet-stream\"][0]\n uri = endPoint(\"/#{id}\")\n request = Net::HTTP::Post.new(uri)\n ret = nil\n\n path.open do |io|\n request.body_stream = io\n set_def_headers(request)\n request.content_length = path.size\n request.content_type = mime.simplified\n ret = workit(request)\n end\n ret\n end", "def post(data)\n uri = URI(@host)\n res = Net::HTTP.post_form(uri, {shell: data})\n # puts res.body\nend", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def post(path, query_string, data)\n # ...and delegate to the Faraday connection we created on initilization\n @conn.post \"#{path}?#{query_string}\", data\n end", "def post(data = {})\n call data, method: :post\n end", "def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end", "def post(resource, data)\n proxy(method: :post, url: url_for(resource), data: data)\n end", "def load(data)\n begin_connection\n\n logger.info \"Uploading #{data} to #{@username}@#{@host}: #{@remote_path}\"\n sftp_retry { sftp_session.upload! data, @remote_path }\n\n true\n ensure\n end_connection\n end", "def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end", "def upload(file_data)\n\t\t\tkparams = {}\n\t\t\t# The file data\n\t\t\tclient.add_param(kparams, 'fileData', file_data);\n\t\t\tclient.queue_service_action_call('media', 'upload', 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 post(url, body, headers: {}, params: {}, options: {}, &block)\n raise ArgumentError, \"'post' requires a string 'body' argument\" unless body.is_a?(String)\n url = encode_query(url, params)\n\n request = Net::HTTP::Post.new(url, @default_headers.merge(headers))\n request.body = body\n request.content_length = body.bytesize\n\n raise ArgumentError, \"'post' requires a 'content-type' header\" unless request['Content-Type']\n\n execute_streaming(request, options: options, &block)\n end", "def send_data(data)\n @lock.synchronize do\n\n @send_buffer += data\n limited_by_polling = (@last_send + @http_polling >= Time.now)\n limited_by_requests = (@pending_requests + 1 > @http_requests)\n\n # Can we send?\n if !limited_by_polling and !limited_by_requests\n data = @send_buffer\n @send_buffer = ''\n\n Thread.new do\n Thread.current.abort_on_exception = true\n post_data(data)\n end\n\n elsif !limited_by_requests\n Thread.new do\n Thread.current.abort_on_exception = true\n # Defer until @http_polling has expired\n wait = @last_send + @http_polling - Time.now\n sleep(wait) if wait > 0\n # Ignore locking, it's already threaded ;-)\n send_data('')\n end\n end\n\n end\n end", "def pbPostData(url, postdata, filename=nil, depth=0)\r\n userAgent=\"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14\"\r\n if url[/^http:\\/\\/([^\\/]+)(.*)$/]\r\n host=$1\r\n path=$2\r\n path=\"/\" if path.length==0\r\n body = postdata.map {|key, value|\r\n keyString=key.to_s\r\n valueString=value.to_s\r\n keyString.gsub!(/[^a-zA-Z0-9_\\.\\-]/n) {|s| sprintf('%%%02x', s[0]) }\r\n valueString.gsub!(/[^a-zA-Z0-9_\\.\\-]/n) {|s| sprintf('%%%02x', s[0]) }\r\n next \"#{keyString}=#{valueString}\"\r\n }.join('&')\r\n request=\"POST #{path} HTTP/1.1\\nUser-Agent: #{userAgent}\\nPragma: no-cache\\nHost: #{host}\\nProxy-Connection: Close\\n\"\r\n request+=\"Content-Type: application/x-www-form-urlencoded\\n\"\r\n request+=\"Content-Length: #{body.length}\\n\"\r\n request+=\"\\n\"\r\n request+=body\r\n return pbHttpRequest(host, request, filename, depth)\r\n end\r\n return \"\"\r\nend", "def do_post_request(data)\n\t\tresponse = Net::HTTP.post_form(URI(@url),data)\n if response.message == \"OK\"\n\t\t\tresult = {}\n\t\t\tresponse.body.split('&').each do |res|\n\t\t\t\tif res != ''\n\t\t\t\t\ttemp = res.split('=')\n\t\t\t\t\tif temp.size > 1\n\t\t\t\t\t\tresult[temp[0]] = temp[1]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n else\n result = \"Error in the HTTP request\"\n end\n return result\n\tend", "def upload(key, data_or_path, headers = {})\n if data_or_path.respond_to?(:read) && data_or_path.respond_to?(:size)\n upload_io(key, data_or_path, data_or_path.size, headers)\n elsif !File.file?(data_or_path.to_s)\n raise ArgumentError, \"data_or_path must be an IO with data or filename string\"\n else\n File.open(data_or_path.to_s, \"rb\") do |io|\n upload_io(key, io, io.stat.size, headers)\n end\n end\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def post_file(url, filename, headers = {})\n request(:post, url, headers, :file => filename)\n end", "def http_post(curl, data, url)\n\n # Define the post data\n data2 = ''\n\n # Loop through the data[\"post_data\"] passed in to build up the post data string\n data[\"post_data\"].each do |key, value|\n if (data2 != '') then\n data2 = data2 + '&'\n end\n # If the value is null we don't just want it to look like: item=\n if (value.nil?) then\n data2 = data2 + CGI::escape(key.to_s) + '='\n else\n data2 = data2 + CGI::escape(key.to_s) + '=' + CGI::escape(value.to_s)\n end\n end\n\n # Define the url we want to hit\n curl.url = url\n # Specify the headers we want to hit\n curl.headers = data['header']\n\n # perform the call\n curl.post(data2)\n\n curl.headers = nil\n\n # Set headers to nil so none get reused elsewhere\n curl.headers = nil\n\n # return the curl object\n return curl\n\nend", "def post(path, data = {})\n self.class.post path, :body => data.merge(:u => access_token)\n end", "def post(path, *data, &block)\n map(path, R3::POST, *data, &block)\n end", "def forward(data)\n timestamp = Time.now\n http = Net::HTTP.new(url.host, url.port)\n \n http.read_timeout = http_read_timeout\n http.open_timeout = http_open_timeout\n \n \n request = Net::HTTP::Post.new(url.request_uri)\n request['Authorization'] = Authorization.new(data, timestamp).header\n request['Content-Type'] = 'application/octet-stream'\n request.body = data\n \n if secure\n http.use_ssl = true\n http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n http.use_ssl = false\n end\n \n response = nil\n \n begin\n response = http.request(request)\n rescue Exception => e\n puts \"Timeout while connecting to the Sentry server\"\n end\n end", "def dcs_request(uri, data)\r\n boundary = Array::new(16) { \"%2.2d\" % rand(99) }.join()\r\n extheader = {\r\n \"content-type\" => \"multipart/form-data; boundary=___#{ boundary }___\"\r\n }\r\n\r\n client = HTTPClient.new\r\n response = client.post_content(uri, data, extheader)\r\n end", "def store(data, headers = {})\n r = conn.put(escaped_path, data) do |req|\n req.headers = headers\n token = CarrierWave::UCloud::Digest.authorization(@uploader, req)\n req.headers['Authorization'] = token\n end\n r\n end", "def put_multipart!(data, boundary, part_index, part_data)\n data << \"\\r\\n--#{boundary}\\r\\n\"\n if part_index > 0\n data << \"Content-Disposition: form-data; name=\\\"file#{part_index}\\\";filename=\\\"file#{part_index}\\\"\\r\\n\"\n data << \"Content-Type: application/octet-stream\\r\\n\"\n elsif\n data << \"Content-Disposition: form-data; name=\\\"data\\\"\\r\\n\"\n data << \"Content-Type: text/json\\r\\n\"\n end\n data << \"Content-Length: #{part_data.length}\\r\\n\"\n data << \"\\r\\n\"\n data << part_data\n end", "def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end", "def submit(verb, data)\n start do |connection|\n request = http verb\n request.body = data\n connection.request request\n end\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def send_upload(apikey, external_url = nil, security = nil, options = nil)\n base = \"#{FilestackConfig::CDN_URL}/#{apikey}/#{build_store_task(options)}\"\n\n if security\n policy = security.policy\n signature = security.signature\n base = \"#{base}/security=s:#{signature},p:#{policy}\"\n end\n\n response = Typhoeus.post(\"#{base}/#{external_url}\", headers: FilestackConfig::HEADERS)\n\n if response.code == 200\n begin\n response_body = JSON.parse(response.body)\n return response_body\n rescue\n raise response.body\n end\n end\n raise response.body\n end", "def post_request(url_params, data_params)\n # URL to POST to\n url = format_url(url_params)\n \n # Data to include\n data = format_arguments(data_params)\n \n response = self.class.post(url, :body => data)\n if response.code != 200\n raise AssignmentManager::ResponseError, \"Post request was met with error #{response.code}\"\n end\n return response\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def post(url, headers, body)\n request(:post, url, headers, body)\n end", "def post_upload(original_params,\n original_payload)\n\n call_tapi('POST',\n '/',\n original_params,\n original_payload,\n do_upload: true)\n end", "def send_data( data )\n @connection.register_data_request( self, data )\n end", "def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end", "def send_request(url, data=nil)\n begin\n puts \"BigBlueButtonAPI: URL request = #{url}\" if @debug\n url_parsed = URI.parse(url)\n http = Net::HTTP.new(url_parsed.host, url_parsed.port)\n http.open_timeout = @timeout\n http.read_timeout = @timeout\n if data.nil?\n response = http.get(url_parsed.request_uri, @request_headers)\n else\n puts \"BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}\" if @debug\n opts = { 'Content-Type' => 'text/xml' }.merge @request_headers\n response = http.post(url_parsed.request_uri, data, opts)\n end\n puts \"BigBlueButtonAPI: URL response = #{response.body}\" if @debug\n\n rescue TimeoutError => error\n raise BigBlueButtonException.new(\"Timeout error. Your server is probably down: \\\"#{@url}\\\". Error: #{error}\")\n\n rescue Exception => error\n raise BigBlueButtonException.new(\"Connection error. Your URL is probably incorrect: \\\"#{@url}\\\". Error: #{error}\")\n end\n\n response\n end", "def request_post(path, data)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"POST\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Post.new(uri)\n\trequest.add_field(\"Content-Type\", \"application/json\")\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\trequest.body = data\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def post(content)\n remote_post_to(@uri, content)\n end", "def post(url, data={}, headers={}, http_options={})\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n # handle 302\n when Net::HTTPRedirection then\n if redirect_limit == -1\n HttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n post(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n HttpResponse.new(response)\n elsif gateway_retries == 0\n Kinetic::Platform.logger.info(\"HTTP response: #{response.code} #{response.message}\")\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n Kinetic::Platform.logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n post(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n Kinetic::Platform.logger.info(\"HTTP response code: 0\")\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n HttpResponse.new(e)\n else\n Kinetic::Platform.logger.info(\"HTTP response code: #{response.code}\")\n HttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n Kinetic::Platform.logger.info(\"HTTP bad response: #{e.inspect}\")\n HttpResponse.new(e)\n rescue StandardError => e\n Kinetic::Platform.logger.info(\"HTTP error: #{e.inspect}\")\n HttpResponse.new(e)\n end\n end", "def post(url, payload, headers: {}, options: {})\n request_with_payload(:post, url, payload, headers, options)\n end", "def post(payload)\n post_like payload, Net::HTTP::Post.new(@uri.path)\n end", "def postAssociation( association_id, association_name, association_url, filedata)\n params = Hash.new\n params['association_id'] = association_id\n params['association_name'] = association_name\n params['association_url'] = association_url\n params['filedata'] = filedata\n return doCurl(\"post\",\"/association\",params)\n end", "def post(path, data = {}, params = {})\n body = data.to_json\n path = File.join(@prefix, path)\n\n response = @conn.post(path, body) do |req|\n req.params = params\n req.headers['Content-Type'] = 'application/json'\n end\n\n JSON.parse response.body\n end" ]
[ "0.73014164", "0.710283", "0.6953084", "0.6922987", "0.681095", "0.6749596", "0.67080754", "0.66812557", "0.66390383", "0.6630966", "0.6600273", "0.65825564", "0.6553531", "0.65181434", "0.64601964", "0.644824", "0.64291996", "0.6427009", "0.6342407", "0.6341938", "0.6328047", "0.6326644", "0.63234836", "0.62739176", "0.62661535", "0.6263529", "0.62592393", "0.6254336", "0.62531704", "0.62461704", "0.62160766", "0.6211612", "0.61498225", "0.6149328", "0.6118025", "0.6117478", "0.60975194", "0.6088167", "0.6085146", "0.6023522", "0.60206795", "0.6005372", "0.6001686", "0.5989236", "0.59800595", "0.5979896", "0.5972762", "0.59630924", "0.59567523", "0.59486634", "0.59452647", "0.59348685", "0.59308153", "0.59250784", "0.5924873", "0.5924605", "0.5911471", "0.58987075", "0.58957577", "0.5894841", "0.5894841", "0.5892267", "0.5892084", "0.5890246", "0.587689", "0.58624357", "0.5858388", "0.5857661", "0.5856814", "0.5855436", "0.5845195", "0.5838582", "0.5838571", "0.583752", "0.583752", "0.5834347", "0.5826511", "0.58196026", "0.58086354", "0.57979935", "0.5790509", "0.57761717", "0.57701534", "0.57634985", "0.5757797", "0.5735785", "0.5727909", "0.57253057", "0.5719801", "0.5717929", "0.57122386", "0.5699886", "0.56939197", "0.5668726", "0.56674486", "0.56612337", "0.5654402", "0.56539553", "0.56452626", "0.5642882" ]
0.71998215
1
Uploads the contents of a file to the specified +url+ using HTTP POST.
def post_file(url, filename, headers = {}) request(:post, url, headers, :file => filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end", "def upload_url(url, options = {})\n params = upload_params(options).for_url_upload(url)\n file_upload_response = request_file_upload(params)\n\n handle_response(file_upload_response)\n end", "def post_multipart(url, data, filename, headers = {})\n request(:post, url, headers, {:data => data, :file => filename, :multipart => true})\n end", "def post_image(url, filename)\n post(url) do |req|\n req.body = open(filename).read\n end\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def upload(remote_path, contents)\n end", "def upload_media_url(media_url)\n tempfile = Tempfile.open([\"media\", File.extname(media_url)])\n\n open(media_url) do |input| # rubocop:disable Security/Open\n tempfile.write(input.read)\n end\n\n @client.upload_media(tempfile.path)\n ensure\n tempfile.close! if tempfile\n end", "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def post_file(file_path, deposit_url, headers={})\n\n # Make sure file exists\n raise SwordException, \"Could not find file at \" + file_path if(!File.exists?(file_path))\n\n # Make sure we have a deposit URL\n raise SwordException.new, \"File '#{file_path}' could not be posted via SWORD as no deposit URL was specified!\" if !deposit_url or deposit_url.empty?\n\n # Map our passed in headers to valid HTTP POST headers\n post_headers = http_post_headers(headers)\n puts \"*\"*60\n puts \"Object headers in Connection#post_file are \", post_headers.inspect\n puts \"*\"*60\n\n # POST our file to deposit_url\n post(file_path, deposit_url, post_headers)\n end", "def send_file(url, name, file_info = {})\n client.api.send_content(id, url, name, 'm.file', extra_information: file_info)\n end", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def upload_remote(url, **opt)\n # @type [Down::ChunkedIO] io\n io = Down.open(url, **DOWN_OPEN_OPTIONS)\n opt[:metadata] = opt[:metadata]&.dup || {}\n opt[:metadata]['filename'] ||= File.basename(url)\n file_attacher.attach(io, **opt)\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n ensure\n # noinspection RubyScope, RubyMismatchedReturnType\n io&.close\n end", "def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end", "def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend", "def upload(file)\n file = File.expand_path(file)\n\n abort \"#{file} does not exist!\" unless File.exist?(file)\n\n dest = dropbox_resolve_file(File.join(destination_directory, File.basename(file)))\n\n if remote_file = dropbox_upload_file(file, dest)\n url(remote_file, method: :create, retries: 0)\n else\n abort \"Couldn't upload file #{file}\"\n end\n rescue APIError => e\n abort e.message\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end", "def upload_file(file_path, itunes_location)\n # url = URI.parse(self.upload_url_for_location(itunes_location))\n # req = Net::HTTP::Post::Multipart.new(url.path, {\"file\" => UploadIO.new(file_path, \"image/jpeg\")})\n # res = Net::HTTP.start(url.host, url.port) do |http|\n # http.request(req)\n # end\n \n IO::popen('-') do |c|\n exec \"curl -q -F 'file=@#{file.path}' '#{upload_url_for_location(itunes_location)}'\"\n end\n end", "def post_multipart(url, data={}, headers={}, redirect_limit=max_redirects)\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n h[k] = (v.class == File) ? UploadIO.new(v, mimetype(v), File.basename(v)) : v; h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n post_multipart_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def upload(filename)\n begin\n file = File.open(\"#{filename}\")\n response = @client.put_file(\"/#{filename}\",file,true)\n return true\n rescue\n return false\n end\n end", "def upload(id, path)\n path = Pathname.new(path) unless path.kind_of? Pathname\n\n mime = MIME::Types.type_for(path.to_s)[0] || MIME::Types[\"application/octet-stream\"][0]\n uri = endPoint(\"/#{id}\")\n request = Net::HTTP::Post.new(uri)\n ret = nil\n\n path.open do |io|\n request.body_stream = io\n set_def_headers(request)\n request.content_length = path.size\n request.content_type = mime.simplified\n ret = workit(request)\n end\n ret\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end", "def upload_file\n #TODO\n end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def upload_file(uploadURL, uploadFile, progressUrl, config={})\n raise ::IOError, \"#{uploadFile} not found.\" unless File.exists?(uploadFile)\n\n # Set chunksize to 10M if not specified otherwise\n chunkSize = (config[:chunksize] || 10485760)\n\n # Set progress bar to default format if not specified otherwise\n progressBarFormat = (config[:progressbar_format] || \"%e <%B> %p%% %t\")\n\n # Set progress bar length to 120 if not specified otherwise\n progressBarLength = (config[:progressbar_length] || 120)\n\n # Open our file for upload\n uploadFileHandle = File.new(uploadFile, \"rb\" )\n fileName = File.basename(uploadFileHandle)\n\n progressBarTitle = \"Uploading: \" + uploadFile.to_s\n\n # Create a progressbar object if progress bar is enabled\n if config[:progressbar_enable] == true && uploadFileHandle.size.to_i > chunkSize\n progressbar = ProgressBar.create(\n :title => progressBarTitle,\n :starting_at => 0,\n :total => uploadFileHandle.size.to_i,\n :length => progressBarLength,\n :format => progressBarFormat\n )\n else\n @logger.info progressBarTitle\n end\n # Create a new HTTP client\n clnt = HTTPClient.new\n\n # Disable SSL cert verification\n clnt.ssl_config.verify_mode=(OpenSSL::SSL::VERIFY_NONE)\n\n # Suppress SSL depth message\n clnt.ssl_config.verify_callback=proc{ |ok, ctx|; true };\n\n # Perform ranged upload until the file reaches its end\n until uploadFileHandle.eof?\n\n # Create ranges for this chunk upload\n rangeStart = uploadFileHandle.pos\n rangeStop = uploadFileHandle.pos.to_i + chunkSize\n\n # Read current chunk\n fileContent = uploadFileHandle.read(chunkSize)\n\n # If statement to handle last chunk transfer if is > than filesize\n if rangeStop.to_i > uploadFileHandle.size.to_i\n contentRange = \"bytes #{rangeStart.to_s}-#{uploadFileHandle.size.to_s}/#{uploadFileHandle.size.to_s}\"\n rangeLen = uploadFileHandle.size.to_i - rangeStart.to_i\n else\n contentRange = \"bytes #{rangeStart.to_s}-#{rangeStop.to_s}/#{uploadFileHandle.size.to_s}\"\n rangeLen = rangeStop.to_i - rangeStart.to_i\n end\n\n # Build headers\n extheader = {\n 'x-vcloud-authorization' => @auth_key,\n 'Content-Range' => contentRange,\n 'Content-Length' => rangeLen.to_s\n }\n\n begin\n uploadRequest = \"#{@host_url}#{uploadURL}\"\n connection = clnt.request('PUT', uploadRequest, nil, fileContent, extheader)\n\n if config[:progressbar_enable] == true && uploadFileHandle.size.to_i > chunkSize\n params = {\n 'method' => :get,\n 'command' => progressUrl\n }\n response, headers = send_request(params)\n\n response.css(\"Files File [name='#{fileName}']\").each do |file|\n progressbar.progress=file[:bytesTransferred].to_i\n end\n end\n rescue\n retryTime = (config[:retry_time] || 5)\n @logger.warn \"Range #{contentRange} failed to upload, retrying the chunk in #{retryTime.to_s} seconds, to stop the action press CTRL+C.\"\n sleep retryTime.to_i\n retry\n end\n end\n uploadFileHandle.close\n end", "def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end", "def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end", "def upload(ticket, file_path, response_url='www.divshare.com/upload_result') \n location = nil\n File.open(file_path, 'r') { |file|\n uri = URI.parse(UPLOAD_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n # API methods can be SLOW. Timeout interval should be long.\n http.read_timeout = 15*60\n request = Net::HTTP::Post.new(UPLOAD_PATH)\n fields = Hash.new\n fields['upload_ticket'] = ticket\n # API doesn't allow blank response_url. This is just filler.\n fields['response_url'] = response_url\n\n fields['file1'] = file\n request.multipart_params = fields\n # Until DivShare supports direct upload API, we deal with its response location field\n location = http.request(request)['location']\n }\n \n # if error, throw, otherwise return file ID for caller to do whatever they like\n resp = {}\n location.split('?')[1].split('&').each { |param| \n k, v = param.split('=', 2) # some params could contain two '=' for some reason\n resp[k]=CGI.unescape(v)\n }\n if resp['error']\n raise Divshare::APIError, resp['description']\n else\n resp['file1'] # return the file ID\n end\n end", "def request_put(file, content_type)\n\turi = URI($amazon_upload_url)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.body_stream = File.open(file)\n\trequest.add_field(\"Content-Type\", content_type)\n\trequest.add_field('Content-Length', File.size(file))\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def upload(name, url, digest = nil)\n \n r = request('UploadTemplate', { :name => name, :url => url, :digest => digest})\n \n { :status => r['status'] == ' ok ', :blocks => r['blocks'] }\n end", "def send_upload(apikey, external_url = nil, security = nil, options = nil)\n base = \"#{FilestackConfig::CDN_URL}/#{apikey}/#{build_store_task(options)}\"\n\n if security\n policy = security.policy\n signature = security.signature\n base = \"#{base}/security=s:#{signature},p:#{policy}\"\n end\n\n response = Typhoeus.post(\"#{base}/#{external_url}\", headers: FilestackConfig::HEADERS)\n\n if response.code == 200\n begin\n response_body = JSON.parse(response.body)\n return response_body\n rescue\n raise response.body\n end\n end\n raise response.body\n end", "def post_multipart(url, params = {})\n post_auth_hash = {\n \"oauth_consumer_key\" => \"#{@consumer_key}\",\n \"oauth_token\" => \"#{@access_token[\"oauth_token\"]}\",\n \"oauth_signature_method\" => \"HMAC-SHA1\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => \"1.0\",\n }\n\n # set signature\n # (when sending multipart/form-data, \n # it doesn't need post params for signature base string)\n post_auth_hash[\"oauth_signature\"] = generate_access_signature(generate_signature_base_string(\"POST\", url, post_auth_hash))\n\n # post with auth header\n return MyHttp.post_multipart(url, params, {\n \"Authorization\" => \"OAuth #{generate_auth_header(post_auth_hash)}\",\n })\n end", "def upload(file_path, file_type = 'text/plain', encrypted = 0)\n response = @client.post('file/upload',\n file: Hurley::UploadIO.new(file_path, file_type),\n no_enc: encrypted)\n verify response,\n internal_server_error: 'File failed to upload'\n end", "def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end", "def upload_file(remote, local)\n write_file(remote, ::File.read(local))\n end", "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def upload(type, path)\n File.open(path, 'r') do |file|\n make_request(\n :post, '/upload',\n headers: {\n 'Content-Type' => type, 'Content-Length' => file.size.to_s,\n 'Transfer-Encoding' => 'chunked'\n },\n content: file, base: @media_uri\n )['content_uri']\n end\n end", "def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end", "def post(url, headers, body)\n request(:post, url, headers, body)\n end", "def upload(bucket, file); end", "def upload_file_to_aws(file_to_upload, content_type)\n\tputs \"Uploading file: \" + file_to_upload + \" to aws\"\n\tresponse = request_put(file_to_upload, content_type)\n\tputs response\nend", "def upload(path, options={})\n if options[:description]\n options['text'] = options[:description]\n options.delete(:description)\n end\n\n if options[:target]\n options['filename'] = options[:target]\n options.delete(:target)\n end\n\n if options[:summary]\n options['text'] ||= options[:summary]\n options['comment'] = options[:summary]\n options.delete(:summary)\n end\n\n options['comment'] ||= \"Uploaded by MediaWiki::Gateway\"\n options['file'] = File.new(path) if path\n full_name = path || options['url']\n options['filename'] ||= File.basename(full_name) if full_name\n\n raise ArgumentError.new(\n \"One of the 'file', 'url' or 'sessionkey' options must be specified!\"\n ) unless options['file'] || options['url'] || options['sessionkey']\n\n form_data = options.merge(\n 'action' => 'upload',\n 'token' => get_token('edit', options['filename'])\n )\n\n make_api_request(form_data)\n end", "def upload(project, token)\n\n uri = URI.parse(\"https://pkghub.io/api/v1/upload\")\n n = Net::HTTP.new(uri.host, uri.port)\n n.use_ssl = true\n\n File.open(@path) do |package_file|\n req = Net::HTTP::Post::Multipart.new uri.path,\n \"token\" => token,\n \"project\" => project,\n \"distro\" => @distro,\n \"file\" => UploadIO.new(package_file, \"application/x-deb\", File.basename(@path))\n\n res = n.start do |http|\n http.request(req) \n end\n\n if res.code == \"200\"\n puts \"Success\"\n else\n raise \"Error uploading to pkghub.io API, code: #{res.code} body: #{res.body}\"\n end\n end\n\n end", "def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end", "def post(url, options)\n headers = options[:headers] || {}\n params = options[:params] || {}\n req = Net::HTTP::Post.new(url)\n req = request_with_headers(req, headers)\n request_with_params(req, params)\n end", "def post(url, data, headers = {})\n request(:post, url, headers, :data => data)\n end", "def upload(path)\n name = ::File.basename(path)\n data = ::File.read(path)\n _post_with_file(\"/files\", file: data, filename: name) { |json| json }\n end", "def post(url, body, headers: {}, params: {}, options: {}, &block)\n raise ArgumentError, \"'post' requires a string 'body' argument\" unless body.is_a?(String)\n url = encode_query(url, params)\n\n request = Net::HTTP::Post.new(url, @default_headers.merge(headers))\n request.body = body\n request.content_length = body.bytesize\n\n raise ArgumentError, \"'post' requires a 'content-type' header\" unless request['Content-Type']\n\n execute_streaming(request, options: options, &block)\n end", "def upload(file, someone)\n end", "def execute(msg, url, filename)\n begin\n upload = wiki.upload(url, filename)\n rescue MediaWiki::Butt::UploadInvalidFileExtError => e\n msg.reply('Invalid file extension. Failed to upload!')\n rescue MediaWiki::Butt::EditError => e\n msg.reply(\"General error: #{e.message}\")\n end\n\n if upload\n msg.reply('Uploaded the file to the wiki!'.freeze)\n else\n msg.reply('Failed to upload!')\n end\n end", "def upload_file\n filename = request.headers['X-Filename']\n if filename.blank?\n render plain: \"X-Filename header not provided\",\n status: :bad_request and return\n end\n input = request.env['rack.input']\n input.rewind\n input.set_encoding(Encoding::UTF_8)\n @import.save_file(file: input, filename: filename)\n head :no_content\n end", "def fetch_and_upload_file(file, **opt)\n meth = opt.delete(:meth) || __method__\n remote = file.match?(/^https?:/)\n result = remote ? upload_remote(file, **opt) : upload_local(file, **opt)\n Log.info do\n name = result&.original_filename.inspect\n size = result&.size || 0\n type = result&.mime_type || 'unknown MIME type'\n \"#{meth}: #{name} (#{size} bytes) #{type}\"\n end\n result\n end", "def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend", "def send_request(url, data)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl\t= true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n response = http.post(uri.path, data)\n response.code == '200' ? response.body : response.error!\n end", "def upload(opts, files)\n request(\n :post,\n \"#{opts['a']}#{UPLOAD_URL}?key=#{opts['t']}\",\n 'files'.to_sym => files\n )\n end", "def create_file_from_url(url, file_name)\n ::GenericFile.new(import_url: url, label: file_name).tap do |gf|\n actor = Sufia::GenericFile::Actor.new(gf, current_user)\n actor.create_metadata(params[:batch_id])\n gf.save!\n Sufia.queue.push(ImportUrlJob.new(gf.id))\n end\n end", "def upload(resource, bytes)\n headers = {\n 'x-ton-expires' => DEFAULT_EXPIRE,\n 'content-length' => @file_size,\n 'content-type' => content_type\n }\n TwitterAds::Request.new(\n @client, :post, resource, domain: DEFAULT_DOMAIN, headers: headers, body: bytes).perform\n end", "def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end", "def request(action, url, headers, options = {})\n # If the Expect header isn't set uploads are really slow\n headers['Expect'] ||= ''\n\n req = Request.new\n req.action = action\n req.timeout = self.timeout\n req.connect_timeout = self.connect_timeout\n req.max_redirects = self.max_redirects\n req.headers = self.headers.merge(headers)\n req.username = self.username\n req.password = self.password\n req.upload_data = options[:data]\n req.file_name = options[:file]\n req.proxy = proxy\n req.auth_type = auth_type\n req.insecure = insecure\n\n req.url = self.base_url.to_s + url.to_s\n raise ArgumentError, \"Empty URL\" if req.url.empty?\n\n handle_request(req)\n end", "def httppostfile(url, corpNum, form, files, userID, isBinary = false)\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Content-Type\" => \"multipart/form-data;boundary=\" + BaseService::BOUNDARY,\n \"Accept-Encoding\" => \"gzip,deflate\",\n \"Connection\" => \"Keep-Alive\"\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n post_body = []\n\n if form.to_s != ''\n post_body << \"--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"form\\\"\\r\\n\"\n post_body << \"Content-Type: Application/json;\\r\\n\\r\\n\"\n post_body << form.to_json + \"\\r\\n\"\n end\n if isBinary\n files.each do |fileData|\n fileName = fileData[\"fileName\"]\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << fileData[\"fileData\"].force_encoding(\"UTF-8\")\n end\n else\n files.each do |filePath|\n begin\n fileName = File.basename(filePath)\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << File.read(filePath)\n rescue\n raise PopbillException.new(-99999999, \"Failed to reading filedata from filepath\")\n end\n end\n end\n\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}--\\r\\n\"\n # Add the file Data\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, post_body.join.encode(\"UTF-8\"), headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n\n end", "def post_multipart(url, data={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n @logger.debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n if v.class == File\n h[k] = UploadIO.new(v, mimetype(v).first, File.basename(v))\n elsif v.class == Array\n h[k] = v.inject([]) do |files, part|\n if part.class == File\n files << UploadIO.new(part, mimetype(part).first, File.basename(part))\n end\n end\n else\n h[k] = v\n end\n h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n post_multipart(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n post_multipart(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end", "def upload\r\n \r\n end", "def upload_image(filename)\n\n # Create URI::HTTP\n uri = URI.parse(K_Google_Sbi)\n\n response = Net::HTTP.start(uri.host, uri.port){|http|\n\n # -----\n # request instance\n request = Net::HTTP::Post.new(uri.path)\n request[\"user-agent\"] = K_User_Agent\n request[\"content-type\"] = \"multipart/form-data; boundary=myboundary\"\n \n # -----\n # request body\n # (see also multipart/form-data spec)\n body = \"\"\n body.concat(\"--myboundary\\r\\n\")\n body.concat(\"content-disposition: form-data; name=\\\"#{K_Field_Name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\")\n body.concat(\"\\r\\n\")\n File::open(filename){|f| body.concat(f.read + \"\\r\\n\") }\n \n body.concat(\"--myboundary--\\r\\n\")\n request.body = body\n \n # send request!\n http.request(request)\n }\n \n return response\nend", "def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath: #{file_path}\"\n upload_io(io, size, filename).tap do\n io.close\n end\n end", "def upload(obj, download) \n obj.put(body: download)\n end", "def upload(filename)\r\n select(nil, nil, nil, 1)\r\n\r\n peer = \"#{rhost}:#{rport}\"\r\n print_status(\"#{peer} - Trying to upload #{::File.basename(filename)}\")\r\n conn = connect(false, datastore['VERBOSE'])\r\n if not conn\r\n fail_with(Exploit::Failure::Unreachable, \"#{@peer} - Connection failed\")\r\n end\r\n\r\n # Switch to binary mode\r\n print_status(\"#{peer} - Set binary mode\")\r\n send_cmd(['TYPE', 'I'], true, conn)\r\n\r\n # Prepare active mode: Get attacker's IP and source port\r\n src_ip = datastore['SRVHOST'] == '0.0.0.0' ? Rex::Socket.source_address : datastore['SRVHOST']\r\n src_port = datastore['SRVPORT'].to_i\r\n\r\n # Prepare active mode: Convert the IP and port for active mode\r\n src_ip = src_ip.gsub(/\\./, ',')\r\n src_port = \"#{src_port/256},#{src_port.remainder(256)}\"\r\n\r\n # Set to active mode\r\n print_status(\"#{peer} - Set active mode \\\"#{src_ip},#{src_port}\\\"\")\r\n send_cmd(['PORT', \"#{src_ip},#{src_port}\"], true, conn)\r\n\r\n # Tell the FTP server to download our file\r\n send_cmd(['STOR', filename], false, conn)\r\n\r\n print_good(\"#{peer} - Upload successful\")\r\n disconnect(conn)\r\n end", "def post_page file, token, key, tags, title\n server = Configuration.SERVER\n addr = Configuration.CLIOWL_ADDRESS\n\n # Builds the multipart data\n data = MultipartData.new\n data.add_field 'token', token\n data.add_field 'key', key\n data.add_field 'tags', tags\n data.add_field 'title', title\n \n file_content = File.read(file)\n data.add_file 'file', file, 'text/plain', file_content\n \n HttpHelper.post_multipart \"http://#{server}#{addr}/page\", data\n end", "def post_file(path, file_path, options = {})\n request = Net::HTTP::Post.new(request_uri(path))\n options[:partial_scan] ||= CopyleaksApi::Config.allow_partial_scan\n boundary = \"copyleaks_sdk_#{SecureRandom.hex(4)}\"\n request.body = file_body(file_path, boundary)\n make_request(request, options.merge(boundary: boundary))\n end", "def post_request(url, boundary=nil)\n request = Net::HTTP::Post.new(url) # , header\n content_type_str = \"multipart/form-data\"\n request['accept'] = '*/*'\n\n if boundary != nil\n content_type_str << \", boundary=#{boundary}\"\n end\n request['content-type'] = content_type_str\n\n return request\nend", "def upload(name, destination=nil)\n put File.open(name, \"rb\"), destination || File.basename(name)\n end", "def post(url, payload, headers: {}, options: {})\n request_with_payload(:post, url, payload, headers, options)\n end", "def upload_file(deployment_id, id, local_file, destination, params={})\n if destination.empty? || destination == \"/\" || destination == \".\" || destination.include?(\"../\")\n raise \"#{self.class}.upload_file() passed a bad destination: '#{destination}'\"\n end\n # url = \"#{@base_url}/#{base_path}/#{deployment_id}/versions/#{id}/files\"\n url = \"#{base_path}/#{deployment_id}/versions/#{id}/files\"\n if !destination.to_s.empty?\n url += \"/#{destination}\"\n end\n # use URI to escape path\n uri = URI.parse(url)\n url = uri.path\n # params[:filename] = File.basename(destination)\n if !local_file.kind_of?(File)\n local_file = File.new(local_file, 'rb')\n end\n payload = local_file\n headers = {'Content-Type' => 'application/octet-stream'}\n headers['Content-Length'] = local_file.size # File.size(local_file)\n execute(method: :post, url: url, headers: headers, payload: payload, params: params, timeout: 172800)\n end", "def post(url, options = {}, &block)\n request HttpPost, url, options, &block\n end", "def send_post_request(url, payload, content_type = 'application/json')\n # set the uri\n url = URI(url)\n\n # set http settings\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # set request\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = content_type\n request[\"cache-control\"] = 'no-cache'\n\n # set the payload\n request.body = payload\n\n # send the request and get whatever is the response\n response = http.request(request)\n\n # return the response by reading the body\n return response.read_body\n end", "def rest_post_upload(uri,filepath)\n response = RestClient::Request.execute(method: :post, \n url: uri,\n user: @rest_user, \n password: @rest_passwd,\n payload: {:multipart => true, :file => File.new(filepath)}, \n headers: {content_type: @rest_cont_type, accept: @rest_accept_type}\n )\n @resp_headers=response.headers\n @resp_code=response.code\n @resp_body=response.body \n return response\n end", "def upload(file)\n raise \"File does not exist\" unless File.exist?(file)\n\n #result = `curl --basic -u #{@auth[:username]}:#{@auth[:password]} -F file=@#{file} -F description=\"testing the API\" -F tags=\"api\" http://www.pcapr.net/api/upload`\n result = @res[\"/upload\"].post, { :file => File.read(file), :description => \"Testing the API\", :tags => \"api\" }\n return nil if result.nil?\n return result.to_json\n rescue\n puts $!\n return {:okay => false}.to_json\n end", "def upload\n end", "def upload\n end", "def upload\n uploaded_io = params[:address][:file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.read)\n end\nend", "def post(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"POST #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n post_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def upload(src, dst)\n\t# src: the file to be transferred \n\t# dst: the location to transfer the file to \n\t# function that will upload a file to a dropbox location\n\t# returns a boolean indicating if it succeeded\n\n\t# A single request should not upload more than 150 MB. \n\t# The maximum size of a file one can upload to an upload session is 350 GB.\n\n\t# check if src is greater than or equal to 350 GB\n\tif File.size(src) >= 350000000000\n\t\tputs \"error: local file is too large to upload\"\n\t\treturn false\n\tend\n\n\t# start an upload session\n\tbase_url = \"https://content.dropboxapi.com/2/files/upload_session/\"\n\tstart_endpoint = \"start\"\n\tstart_uri = URI(base_url+start_endpoint)\n\tresponse = Net::HTTP.get_response(start_uri)\n\tsession_id = nil\n\t# upload file\n\tupload_endpoint = \"append_v2\"\n\tclose = false\n\tfd = IO.sysopen(src)\n\tio_reader = IO.new(fd)\n\twhile !close do \n\t\tbegin\n\t\t\tfile_content_chunk = io_reader.sysread(140000000) # read in 140 MB at a time since 150 is the cut off\n\t\t\tputs file_content_chunk\n\t\trescue EOFError\n\t\t\t# there is no more data to read \n\t\t\tclose = true\n\t\tend\n\t\tif file_content_chunk.length < 140000000\n\t\t\t# there was less than our maximum chunk size of data\n\t\t\tclose = true\n\t\tend\n\t\t# send data here\n\t\tupload_uri = URI(base_url+upload_endpoint)\n\t\tupload_uri.query = URI.encode_www_form({ \"content\" => file_content_chunk, \"close\" => close })\n\t\tresponse = Net::HTTP.get_response(upload_uri)\n\tend\n\tio_reader.close\n\treturn true\nend", "def post_multipart(resource_url, params, data={})\n headers = {'Authorization' => authorization('POST', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n uri = URI.parse(url)\n form_data = []\n data.each{|k,v|\n form_data << [k,v]\n }\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.request_uri, headers)\n req.set_form(form_data, 'multipart/form-data')\n res = http.start{|h|\n h.request(req)\n }\n Response.new(res)\n end", "def post(path = '/files/', params = {})\n request :post, path, params\n end", "def upload_file(source, destination, targets)\n future = executor.future&.fetch('file_paths', false)\n source = find_file(source, future)\n targets = inventory.get_targets(targets)\n\n Bolt::Util.validate_file('source file', source, true)\n\n with_benchmark do\n executor.upload_file(targets, source, destination)\n end\n end", "def store\n result = QcloudCos.upload(path, file.to_file)\n\n if result != nil\n self.url = result\n end\n end", "def upload(file)\n Item.create(:upload, :file => file)\n end", "def upload_client(target_uri, file_size, method)\n return {} if target_uri.nil? || method.nil?\n\n uri = URI.parse(target_uri)\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n\n begin\n req = Net::HTTP::Post.new(uri.request_uri)\n req[\"Content-Type\"] = \"image/jpeg\"\n req[\"Content-Length\"] = file_size\n\n response = https.request(req)\n\n puts \"code -> #{response.code}\"\n puts \"body -> #{response.body}\"\n rescue => e\n logger.error [uri.to_s, e.class, e].join(\" : \")\n return nil\n end\n\n end", "def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend", "def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end", "def upload(relative_uri, file, headers={}, &block)\n request = RedHatSupportLib::Network::HttpRequest.new(\n :headers => headers,\n :method => :post,\n :url => \"#{@config.base_uri}#{relative_uri}\",\n :user => @config.username,\n :password => @config.password,\n :payload => {\n :multipart => true,\n :file => file\n },\n :proxy => config.proxy\n )\n\n result = request.execute\n if block\n yield result.code, result.headers\n end\n end", "def upload(file, options = {})\n dir = options[:directory] || ''\n staging_uri = options[:staging_url].to_s\n url = dir.empty? ? staging_uri : URI.join(staging_uri, \"#{dir}/\").to_s\n\n # Make a directory, if needed\n unless dir.empty?\n method = :get\n GoodData.logger.debug \"#{method}: #{url}\"\n begin\n # first check if it does exits\n raw = {\n :method => method,\n :url => url,\n # :timeout => @options[:timeout],\n :headers => @headers\n }.merge(cookies)\n RestClient::Request.execute(raw)\n rescue RestClient::Exception => e\n if e.http_code == 404\n method = :mkcol\n GoodData.logger.debug \"#{method}: #{url}\"\n raw = {\n :method => method,\n :url => url,\n # :timeout => @options[:timeout],\n :headers => @headers\n }.merge(cookies)\n RestClient::Request.execute(raw)\n end\n end\n end\n\n payload = options[:stream] ? 'file' : File.read(file)\n filename = options[:filename] || options[:stream] ? 'randome-filename.txt' : File.basename(file)\n\n # Upload the file\n # puts \"uploading the file #{URI.join(url, filename).to_s}\"\n raw = {\n :method => :put,\n :url => URI.join(url, filename).to_s,\n # :timeout => @options[:timeout],\n :headers => {\n :user_agent => GoodData.gem_version_string\n },\n :payload => payload,\n :raw_response => true,\n # :user => @username,\n # :password => @password\n }.merge(cookies)\n RestClient::Request.execute(raw)\n true\n end", "def post url, object = nil\n request url, HTTP::Post, object\n end", "def upload_photo(file, params)\n url_str = BASE_URL + PHOTO_UPLOAD_ENDPOINT + \"?\"\n # build out url based on params of photo\n url_str = url_str + \"name=#{params['name']}&description=#{params['description']}&category=0&privacy=0\"\n\n url = URI.parse(url_str)\n File.open(file) do |jpg|\n req = Net::HTTP::Post::Multipart.new url.path, \"file\" => UploadIO.new(jpg, \"image/jpeg\", \"#{params['file_name']}.jpg\")\n add_oauth(req)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start do |https|\n res = https.request(req)\n # puts res.body\n return res.body\n end\n end\nend" ]
[ "0.72392786", "0.72392786", "0.7205245", "0.7163972", "0.68863684", "0.6812116", "0.67100185", "0.67100185", "0.6650342", "0.6631915", "0.66068155", "0.65517277", "0.6490836", "0.64717126", "0.6429676", "0.6407607", "0.63749534", "0.63616776", "0.6282497", "0.6279639", "0.6270757", "0.6268955", "0.626728", "0.6233211", "0.6217134", "0.61619836", "0.6136327", "0.6101408", "0.6100848", "0.60897183", "0.60845464", "0.6077207", "0.60741365", "0.6067429", "0.6065425", "0.6060262", "0.60566145", "0.6011129", "0.60027874", "0.60011965", "0.5987792", "0.5981397", "0.5972785", "0.5966889", "0.5956523", "0.59553444", "0.5929961", "0.5928806", "0.59117347", "0.5899407", "0.5884081", "0.58780473", "0.58501226", "0.5807425", "0.58062273", "0.58048666", "0.5796854", "0.57890093", "0.5788117", "0.5785681", "0.5763354", "0.5748628", "0.57435924", "0.57435715", "0.57373637", "0.57130677", "0.57123536", "0.57102585", "0.5706373", "0.5704339", "0.5697795", "0.5689937", "0.56889176", "0.56884503", "0.56858945", "0.56804883", "0.56772184", "0.56744725", "0.5658411", "0.5651726", "0.56472635", "0.56413007", "0.5633757", "0.5633757", "0.562456", "0.560977", "0.5593524", "0.5587692", "0.5571832", "0.5571651", "0.5570499", "0.55703986", "0.5567963", "0.55654967", "0.5553671", "0.5550945", "0.5547173", "0.55466634", "0.5544666" ]
0.78589755
1
WebDAV methods Sends a WebDAV COPY request to the specified +url+.
def copy(url, dest, headers = {}) headers['Destination'] = dest request(:copy, url, headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_copy(src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/fileops/copy/\",data).body_str\n end", "def http_copy(request, response)\n path = request.path\n\n copy_info = @server.copy_and_move_info(request)\n\n return false unless @server.emit('beforeBind', [copy_info['destination']])\n if copy_info['destinationExists']\n return false unless @server.emit('beforeUnbind', [copy_info['destination']])\n @server.tree.delete(copy_info['destination'])\n end\n\n @server.tree.copy(path, copy_info['destination'])\n\n @server.emit('afterBind', [copy_info['destination']])\n\n # If a resource was overwritten we should send a 204, otherwise a 201\n response.update_header('Content-Length', '0')\n response.status = copy_info['destinationExists'] ? 204 : 201\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def copy(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:copy, access_token)\n res = connexion.post do |req|\n req.url \"fileops/copy\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end", "def file_copy(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/copy\", params)\n parse_response(response)\n end", "def copy(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/copy\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def copy_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n response = {}\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.copy_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n response[:error] = \"Copy failed\" \n render json: response, status: 422\n end\n end", "def test_copy_file\n remote_file_name = 'TestCopyFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = CopyFileRequest.new(dest_path: remote_data_folder + '/TestCopyFileDest.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.copy_file(request)\n end", "def copy(uri, destination, options = {})\n opts = options.nil? ? {} : options.dup\n # also copy headers!\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute(uri, :copy, opts)\n end", "def copy(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.copy(src, dest)\n end", "def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def get(url)\n p = URI.parse url\n case p.scheme\n when /https?/\n http_get p, @resource[:path]\n when \"file\"\n FileUtils.copy p.path, @resource[:path]\n end\n end", "def google_copy_file(client)\n notify \"Command : Google copy file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.copy_files(src_files,dest_path)\n end", "def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.copy_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def copy_file(client, origin_file_id, copy_title)\n\n drive = client.discovered_api('drive', 'v2')\n copied_file = drive.files.copy.request_schema.new({\n 'title' => copy_title\n })\n result = client.execute(\n :api_method => drive.files.copy,\n :body_object => copied_file,\n :parameters => { 'fileId' => origin_file_id })\n if result.status == 200\n return result.data\n else\n flash[:error]=\"An error occurred: #{result.data['error']['message']}\"\n end\nend", "def cp(from_location, to_location)\n @client.file_copy(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def test_put_copy\n\n path = 'folder1/FileTest.pdf'\n newdest = 'folder2/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PutCopyRequest.new(path, newdest, versionId, storage, destStorage)\n\n result = @storage_api.put_copy(request)\n assert result.code == 200,'Error while copying document'\n\n end", "def copy(dest, overwrite = false)\n# if(dest.path == path)\n# Conflict\n# elsif(stat.directory?)\n# dest.make_collection\n# FileUtils.cp_r(\"#{file_path}/.\", \"#{dest.send(:file_path)}/\")\n# OK\n# else\n# exists = File.exists?(file_path)\n# if(exists && !overwrite)\n# PreconditionFailed\n# else\n# open(file_path, \"rb\") do |file|\n# dest.write(file)\n# end\n# exists ? NoContent : Created\n# end\n# end\n\n # ディレクトリなら末尾に「/」をつける。\n # (dstにもともと「/」が付いているかどうか、クライアントに依存している)\n # CarotDAV : 「/」が付いていない\n # TeamFile : 「/」が付いている\n dest.collection! if collection?\n\n src = @bson['filename']\n dst = dest.file_path\n exists = nil\n\n @collection.find({:filename => /^#{Regexp.escape(src)}/}).each do |bson|\n src_name = bson['filename']\n dst_name = dst + src_name.slice(src.length, src_name.length)\n\n exists = @collection.find_one({:filename => dst_name}) rescue nil\n\n return PreconditionFailed if (exists && !overwrite && !collection?)\n\n @filesystem.open(src_name, \"r\") do |src|\n @filesystem.open(dst_name, \"w\") do |dst|\n dst.write(src) if src.file_length > 0\n end\n end\n\n @collection.remove(exists) if exists\n end\n\n collection? ? Created : (exists ? NoContent : Created)\n end", "def push_file(user, host, copy_path, paste_path, sudo = false)\n ping(user, host) do\n begin\n file = open(copy_path)\n write_body(user, host, file.read(File.size(copy_path)), paste_path)\n file.close if file\n rescue\n \"No such file.\"\n end\n end\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, 'copy-destination': copy_destination)\n end", "def copy_file(path:, copy_destination:)\n BrickFTP::API::FileOperation::Copy.create(path: path, :'copy-destination' => copy_destination)\n end", "def download(url, file)\n # First, open the remote file. (FD == 'File Descriptor', a C term)\n #\n # If we first open the remote file, if there are any exceptions in\n # attempting to open it, we won't lose the contents of the local file.\n open(url) do |remoteFD|\n # Open the local file, purging the contents.\n File.open(file, \"w\") do |genericFD|\n remoteFD.each_line do |line|\n # Take each line, stick it in the file.\n genericFD.puts line\n end\n end\n end\n @repo.add(file) # add the file to the list to be committed\nend", "def http_pull(dest_url)\n res = Net::HTTP.get_response(URI.parse(dest_url))\n self.fetched = res.body\n end", "def download_resource(src_url,dest_path,content_type)\n begin \n content = open(src_url).read\n basename = Pathname.new(src_url).basename.to_s.gsub(/\\..*/,'')\n vortex_url = dest_path + basename + \".\" + content_type\n vortex_url = vortex_url.downcase\n begin\n @vortex.put_string(vortex_url, content)\n puts \"Copying resource: \" + src_url + \" => \" + vortex_url\n @log = @log + \"Copying resource: \" + src_url + \" => \" + vortex_url + \"<br>\\n\"\n rescue Exception => e\n puts e.message\n pp e.backtrace.inspect\n puts \"vortex_url: \" + vortex_url\n exit\n end\n return vortex_url\n rescue\n puts \"WARNING could not open file \" + src_url\n @log = @log + \"WARNING could not open file \" + src_url + \"<br>\\n\"\n return nil\n end\nend", "def copy_to_remote_file_copy_to_remote_file_with_http_info(file_name, copy_to_remote_file_properties, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.copy_to_remote_file_copy_to_remote_file ...\"\n end\n # verify the required parameter 'file_name' is set\n if @api_client.config.client_side_validation && file_name.nil?\n fail ArgumentError, \"Missing the required parameter 'file_name' when calling NsxComponentAdministrationApi.copy_to_remote_file_copy_to_remote_file\"\n end\n # verify the required parameter 'copy_to_remote_file_properties' is set\n if @api_client.config.client_side_validation && copy_to_remote_file_properties.nil?\n fail ArgumentError, \"Missing the required parameter 'copy_to_remote_file_properties' when calling NsxComponentAdministrationApi.copy_to_remote_file_copy_to_remote_file\"\n end\n # resource path\n local_var_path = \"/node/file-store/{file-name}?action=copy_to_remote_file\".sub('{' + 'file-name' + '}', file_name.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 = @api_client.object_to_http_body(copy_to_remote_file_properties)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#copy_to_remote_file_copy_to_remote_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def copy(source, destination, **options); end", "def copy_file\n bucket = get_bucket(@source_bucket)\n object = bucket.object(@file_name)\n destination_bucket = @destination.split('/').first\n destination_file = @destination.gsub(\"#{destination_bucket}/\",'')\n dest_file_already_there = check_file(destination_bucket,destination_file)\n if check_file(@source_bucket, @file_name)\n if dest_file_already_there\n [200,{ message: \"#{@file_name} exists.\" }.to_json]\n else\n object.copy_to(@destination)\n # if object copies, return a 201\n [201,{ message: \"#{@file_name} copied.\" }.to_json]\n # if object does not copy, return appropriate error\n end\n else\n [404,{ message: \"#{@file_name} not found.\" }.to_json]\n end\n end", "def upload_remote(url, **opt)\n # @type [Down::ChunkedIO] io\n io = Down.open(url, **DOWN_OPEN_OPTIONS)\n opt[:metadata] = opt[:metadata]&.dup || {}\n opt[:metadata]['filename'] ||= File.basename(url)\n file_attacher.attach(io, **opt)\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n ensure\n # noinspection RubyScope, RubyMismatchedReturnType\n io&.close\n end", "def copy(destination)\r\n self.class.service_instance.copy_blob(self.path, destination)\r\n properties = self.class.service_instance.get_blob_properties(destination)\r\n return BlobObject.new(:name => destination, \r\n :url => self.class.service_instance.generate_request_uri(destination),\r\n :content_type => properties[:content_type])\r\n end", "def download!(source_url, destination_file); end", "def copy(from, to)\n @ctx.cp(@path + from, @path + to)\n end", "def copy\n self.public_send('|', 'pbcopy')\n self\n end", "def put_copy(request)\n data, _status_code, _headers = put_copy_with_http_info(request)\n data\n end", "def fetch(base_url, file_name, dst_dir)\n FileUtils.makedirs(dst_dir)\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if File.exists?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n end\n return dst\n end", "def upload(src, dst)\n\t# src: the file to be transferred \n\t# dst: the location to transfer the file to \n\t# function that will upload a file to a dropbox location\n\t# returns a boolean indicating if it succeeded\n\n\t# A single request should not upload more than 150 MB. \n\t# The maximum size of a file one can upload to an upload session is 350 GB.\n\n\t# check if src is greater than or equal to 350 GB\n\tif File.size(src) >= 350000000000\n\t\tputs \"error: local file is too large to upload\"\n\t\treturn false\n\tend\n\n\t# start an upload session\n\tbase_url = \"https://content.dropboxapi.com/2/files/upload_session/\"\n\tstart_endpoint = \"start\"\n\tstart_uri = URI(base_url+start_endpoint)\n\tresponse = Net::HTTP.get_response(start_uri)\n\tsession_id = nil\n\t# upload file\n\tupload_endpoint = \"append_v2\"\n\tclose = false\n\tfd = IO.sysopen(src)\n\tio_reader = IO.new(fd)\n\twhile !close do \n\t\tbegin\n\t\t\tfile_content_chunk = io_reader.sysread(140000000) # read in 140 MB at a time since 150 is the cut off\n\t\t\tputs file_content_chunk\n\t\trescue EOFError\n\t\t\t# there is no more data to read \n\t\t\tclose = true\n\t\tend\n\t\tif file_content_chunk.length < 140000000\n\t\t\t# there was less than our maximum chunk size of data\n\t\t\tclose = true\n\t\tend\n\t\t# send data here\n\t\tupload_uri = URI(base_url+upload_endpoint)\n\t\tupload_uri.query = URI.encode_www_form({ \"content\" => file_content_chunk, \"close\" => close })\n\t\tresponse = Net::HTTP.get_response(upload_uri)\n\tend\n\tio_reader.close\n\treturn true\nend", "def local_to_remote!\n if not @remote_io or not @local_io\n raise Exception::new(\"Copy request from local to remote stream, but no local and/or remote stream have been assigned.\")\n end\n\n @local_io.acquire do |lio|\n lio.seek(@local_position)\n @remote_io.acquire :write do |rio|\n #p rio\n rio.write(self.to_s)\n File.copy_stream(lio, rio, @local_size)\n end\n end\n\n end", "def upload(remote_path, contents)\n end", "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def copy_part(part)\n response = client.upload_part_copy(part)\n\n { \"part_number\" => part[:part_number], \"etag\" => response.copy_part_result.etag }\n end", "def copy_from_remote_file_copy_from_remote_file_with_http_info(file_name, copy_from_remote_file_properties, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.copy_from_remote_file_copy_from_remote_file ...\"\n end\n # verify the required parameter 'file_name' is set\n if @api_client.config.client_side_validation && file_name.nil?\n fail ArgumentError, \"Missing the required parameter 'file_name' when calling NsxComponentAdministrationApi.copy_from_remote_file_copy_from_remote_file\"\n end\n # verify the required parameter 'copy_from_remote_file_properties' is set\n if @api_client.config.client_side_validation && copy_from_remote_file_properties.nil?\n fail ArgumentError, \"Missing the required parameter 'copy_from_remote_file_properties' when calling NsxComponentAdministrationApi.copy_from_remote_file_copy_from_remote_file\"\n end\n # resource path\n local_var_path = \"/node/file-store/{file-name}?action=copy_from_remote_file\".sub('{' + 'file-name' + '}', file_name.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 = @api_client.object_to_http_body(copy_from_remote_file_properties)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FileProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#copy_from_remote_file_copy_from_remote_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_file(url, name, file_info = {})\n client.api.send_content(id, url, name, 'm.file', extra_information: file_info)\n end", "def copy\n new_attributes = self.attributes\n new_attributes.delete(:id)\n file = WSFile.create(new_attributes)\n owner = self.permissions(level: 'owner').user.first\n Permission.create(user: owner, file: file, level: \"owner\")\n self.assets.each do |asset|\n file.assets.push asset\n end\n self.children.each do |child|\n file.children.push child.copy\n end\n file.save\n file.data = self.data\n file\n end", "def copia_correo(correo, mbdestino)\n RestClient.put(@xolo_url+mbdestino, correo.to_s)\n end", "def copy(io, context)\n storage.upload(io, context[:location], context[:metadata])\n ensure\n io.close rescue nil\n end", "def upload_part_copy(target_bucket_name, target_object_name, upload_id, part_number, options = {})\n headers = options\n request({\n :expects => 200,\n :idempotent => true,\n :headers => headers,\n :bucket_name => target_bucket_name,\n :object_name => target_object_name,\n :method => 'PUT',\n :query => {'uploadId' => upload_id, 'partNumber' => part_number},\n :parser => Fog::Parsers::AWS::Storage::UploadPartCopyObject.new,\n })\n end", "def copy(path, destination, options = {})\n opts = options.nil? ? {} : options.dup\n opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup\n opts[:headers]['Destination'] = destination\n execute('COPY', path, opts)\n end", "def copy\n if args.dest.instance_of?(Pathname)\n n = args.dest.to_s.delete_prefix(project.write_path(:services).to_s).delete_prefix('/')\n w = project.write_path(:services).join(service.name)\n w.join(Pathname.new(n).split.first).mkpath\n @args = args.merge('dest' => w.join(n).to_s)\n end\n cmd = service.copy(args.src, args.dest)\n Cnfs.logger.info cmd.join(\"\\n\")\n result = command.run!(*cmd)\n raise Cnfs::Error, result.err if result.failure?\n\n # Signal.trap('INT') do\n # warn(\"\\n#{caller.join(\"\\n\")}: interrupted\")\n # # exit 1\n # end\n end", "def remote_copy(from, to, sudo: false, owner: nil, group: nil)\n extra_opts = {}\n extra_opts[:sudo] = sudo if sudo\n extra_opts[:owner] = owner if owner\n extra_opts[:group] = group if group\n @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])\n @remote_copy_code&.call(@stdout_io, @stderr_io, self)\n end", "def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end", "def add_file_from_url(url, description = nil, convert_to = nil, pingback_url = nil)\n Dropio::Resource.client.add_file_from_url(self,url,description, convert_to, pingback_url)\n end", "def modify_web_p(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def cp!( from_file, to_file, opts = {} )\r\n args = { :source => from_file, :destination => to_file }\r\n args[:source_address] = opts[:source_address] if opts[:source_address]\r\n \r\n begin\r\n got = @ndev.rpc.file_copy( args )\r\n rescue => e\r\n raise IOError, e.rsp.xpath('rpc-error/error-message').text.strip\r\n else\r\n return true\r\n end\r\n end", "def cp(*args, **kwargs)\n queue CopyCommand, args, kwargs\n end", "def FileCopy(src, dst)\n success?(parse(cmd(with_args(src, dst))))\n end", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def copy(dest, overwrite=false)\n @resource.copy(dest, overwrite)\n end", "def upload_test(path)\n puts \"curl -F 'file=@#{path}' -F 'uKey=fc462b86df69a3373a1c657c68fa78ca' -F '_api_key=3a9cf2ef36199832fc96d03c4d870c42' https://www.pgyer.com/apiv1/app/upload\"\n puts \"uploading #{path}........\"\n puts `curl -F \"file=@#{path}\" -F \"uKey=fc462b86df69a3373a1c657c68fa78ca\" -F \"_api_key=3a9cf2ef36199832fc96d03c4d870c42\" https://www.pgyer.com/apiv1/app/upload`\n puts \"finish uploading #{path}........\"\nend", "def file_upload(*paths); net_scp_transfer!(:upload, false, *paths); end", "def move(*args)\n unless(resource.exist?)\n NotFound\n else\n resource.lock_check if resource.supports_locking? && !args.include?(:copy)\n destination = url_unescape(env['HTTP_DESTINATION'].sub(%r{https?://([^/]+)}, ''))\n dest_host = $1\n if(dest_host && dest_host.gsub(/:\\d{2,5}$/, '') != request.host)\n BadGateway\n elsif(destination == resource.public_path)\n Forbidden\n else\n dest = resource_class.new(destination, clean_path(destination), @request, @response, @options.merge(:user => resource.user))\n status = nil\n if(args.include?(:copy))\n status = resource.copy(dest, overwrite)\n else\n return Conflict unless depth.is_a?(Symbol) || depth > 1\n status = resource.move(dest, overwrite)\n end\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(dest)}\" if status == Created\n # RFC 2518\n return_status(dest,status)\n end\n end\n end", "def rsync(src,uri)\n log \"Publishing #{src} to #{uri}...\"\n params = params(uri)\n\n rsync_args = \"-a\"\n rsync_args << ' ' << params[:rsync_args].join(' ') if params[:rsync_args]\n\n if uri.host\n dest = \"#{uri.host}::#{uri.path.sub(/^\\//,'')}\" # destination without leading /\n else\n dest = uri.path\n end\n\n log \"Copying...\"\n Rsync.run(src+'/.',dest, rsync_args) { |r| abort(r.error) unless r.success? }\n log \"Done\"\n end", "def copy(src, dst)\n\t\t# TODO: make cp able to handle strings, where it will create an entry based\n\t\t# on the box it's run from.\n\t\t\n\t\tif !(src.kind_of?(Rush::Entry) && dst.kind_of?(Rush::Entry))\n\t\t\traise ArgumentError, \"must operate on Rush::Dir or Rush::File objects\"\n\t\tend\n\t\t\n\t\t# 5 cases:\n\t\t# 1. local-local\n\t\t# 2. local-remote (uploading)\n\t\t# 3. remote-local (downloading)\n\t\t# 4. remote-remote, same server\n\t\t# 5. remote-remote, cross-server\n\t\tif src.box == dst.box # case 1 or 4\n\t\t\tif src.box.remote? # case 4\n\t\t\t\tsrc.box.ssh.exec!(\"cp -r #{src.full_path} #{dst.full_path}\") do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # case 1\n\t\t\t\tFileUtils.cp_r(src.full_path, dst.full_path)\n\t\t\tend\n\t\telse # case 2, 3, or 5\n\t\t\tif src.local? && !dst.local? # case 2\n\t\t\t\t# We use the connection on the remote machine to do the upload\n\t\t\t\tdst.box.ssh.scp.upload!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telsif !src.local? && dst.local? # case 3\n\t\t\t\t# We use the connection on the remote machine to do the download\n\t\t\t\tsrc.box.ssh.scp.download!(src.full_path, dst.full_path, :recursive => true)\n\t\t\telse # src and dst not local, case 5\n\t\t\t\tremote_command = \"scp #{src.full_path} #{dst.box.user}@#{dst.box.host}:#{dst.full_path}\"\n\t\t\t\t# doesn't matter whose connection we use\n\t\t\t\tsrc.box.ssh.exec!(remote_command) do |ch, stream, data|\n\t\t\t\t\tif stream == :stderr\n\t\t\t\t\t\traise Rush::DoesNotExist, stream\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# TODO: use tar for cross-server transfers.\n\t\t# something like this?:\n\t\t# archive = from.box.read_archive(src)\n\t\t# dst.box.write_archive(archive, dst)\n\n\t\tnew_full_path = dst.dir? ? \"#{dst.full_path}#{src.name}\" : dst.full_path\n\t\tsrc.class.new(new_full_path, dst.box)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, File.dirname(to)\n\trescue RuntimeError\n\t\traise Rush::DoesNotExist, from\n\tend", "def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end", "def copy_s3_to_server(filename, config)\n puts \"Copying #{filename} from S3 to server...\"\n\n s3 = Aws::S3::Client.new\n signer = Aws::S3::Presigner.new(client: s3)\n url = signer.presigned_url(:get_object,\n { expires_in: 3600,\n bucket: config['s3_bucket'],\n key: filename,\n secure: true\n }\n )\n\n remote_directory = \"#{config['remote_directory']}/audio\"\n remote_path = \"#{remote_directory}/#{filename}\"\n `ssh #{config['server']} \"mkdir -p #{remote_directory} && curl '#{url}' > #{remote_path}\"`\nend", "def copy(*args)\n !!client.bucket_multipart_copy_upload(*args.unshift(upload_id, key))\n end", "def copy(from, to)\n \n end", "def copy\n \n end", "def remote_to_local!\n if not @remote_io or not @local_io\n raise Exception::new(\"Copy request from remote to local stream, but no local and/or remote stream have been assigned.\")\n end\n \n @local_io.acquire do |lio|\n lio.seek(@local_position)\n lio.write(@content)\n end\n end", "def copy_to(new_path)\n res = conn.put(new_path) do |req|\n req.headers = {\n \"X-Upyun-Copy-Source\" => \"/#{@uploader.upyun_bucket}/#{path}\",\n \"Content-Length\" => 0,\n \"Mkdir\" => \"true\"\n }\n end\n\n check_put_response!(res)\n\n File.new(@uploader, @base, new_path)\n rescue ConcurrentUploadError\n retry\n end", "def curl(server, url, args:{}, file:\"\", post:false, json:false, getfile:nil)\n cmd = \"\"\n # Getfile needs json to remove html, but don't parse as json\n cmd << if getfile.nil? then '-i ' else '-H \"Accept: application/json\" ' end\n cmd << '-X POST ' if post\n cmd << '-H \"Accept: application/json\" ' if json\n cmd << \"-F \\'file=@#{file}\\' \" if file != \"\"\n args.each_pair { |k,v| cmd << \"-F \\'#{k}=#{v}\\' \" }\n\n pipe = getfile.nil? ? '' : '-o ' + File.join($workdir, getfile)\n url2 = !getfile.nil? ? url + getfile + \"/\" : url\n\n res = run(\"curl http://#{server}#{url2} #{cmd}#{pipe}\")\n # clean up json output\n if json\n i = res =~ /{/\n res = res[i..-1] if i\n res = JSON::parse(res)\n end\nend", "def create_modified_web_p(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def write!(content)\n raise WebDavErrors::ForbiddenError\n end", "def copy(donor, recipient)\n input = File.open(donor, 'r') {|f| f.read() }\n output = File.open(recipient, 'w') {|f| f.write(input) }\nend", "def copy_file\n `cp pages/#{self.page.name}/#{self.filename} public/pages/#{self.page.name}/#{self.filename}`\n end", "def curl(name, url)\n sh \"curl -L --fail --retry 3 --retry-delay 1 #{url} -s -o - | tar zxf -\"\n\n Dir[\"#{name}-*\"].each { |path| mv path, \"#{@dir}/#{name}\" }\n end", "def test_copy_folder\n folder_to_copy = remote_data_folder + '/TestCopyFolder'\n\n upload_file File.join(local_test_folder, local_file), folder_to_copy + 'Src/TestCopyFolderSrc.docx'\n\n request = CopyFolderRequest.new(dest_path: folder_to_copy + 'Dest', src_path: folder_to_copy + 'Src')\n\n @words_api.copy_folder(request)\n end", "def copy(title)\n copied_file = @session.drive.files.copy.request_schema.new({\n \"title\" => title,\n })\n api_result = @session.execute!(\n :api_method => @session.drive.files.copy,\n :body_object => copied_file,\n :parameters => {\"fileId\" => self.id})\n return @session.wrap_api_file(api_result.data)\n end", "def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend", "def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend", "def local_copy_file(source, options = {})\n Uploadcare::File.local_copy(source, options)\n end", "def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end", "def copy_to_local srcpath, dstpath\n src_bucket,src_key_path = split_path(srcpath)\n dstfile = File.new(dstpath, 'w')\n @s3.interface.get(src_bucket, src_key_path) do |chunk|\n dstfile.write(chunk)\n end\n dstfile.close\n end", "def http_get(uri, download_path)\n\n # We'll save to a tempfile in case something goes wrong in the download\n # process. This avoids accidentally overwriting an old version, or\n # leaving a partially downloaded file in place\n begin\n tempfile = Tempfile.new('remote_file')\n tempfile.binmode\n response = http(uri) do |resp|\n resp.read_body do |chunk|\n tempfile.write(chunk)\n end\n end\n\n # If download was successful, copy the tempfile over to the resource path.\n if response.kind_of?(Net::HTTPSuccess)\n tempfile.flush\n\n # Try to move the file from the temp location to the final destination.\n # If the move operation fails due to permission denied, try a copy\n # before giving up. On some platforms (Windows) file locking or weird\n # permissions may cause the mv operation to fail but will still allow\n # the copy operation to succeed.\n begin\n FileUtils.mv(tempfile.path, download_path)\n rescue Errno::EACCES\n FileUtils.cp(tempfile.path, download_path)\n end\n\n # If the fileserver supports the last-modified header, make sure the\n # file saved has a matching timestamp. This may be used later to do a\n # very rough ensure=latest kind of check.\n if response.header['last-modified']\n time = Time.parse(response.header['last-modified'])\n File.utime(time, time, download_path)\n end\n end\n ensure\n tempfile.close\n tempfile.unlink\n response\n end\n end", "def cp srcpath, dstpath\n end", "def file_download(*paths); net_scp_transfer!(:download, false, *paths); end", "def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end", "def save_as( url, dest )\n\t\tself.out \"save_as\"\n\t\tto = @code + dest\n\t\tself.out \" :#{to}\"\n\t\t#if !@isTest\n\t\t\t# If file exists - for saving resource of HD\n\t\t\t# we delete it - we don't need copies \n\t\t\tif File.exist? to\n\t\t\t\tFile.delete to\n\t\t\tend\n\t\t\t# Save as - use HTTP.GET\n\t\t\t@agent.get( url ).save_as to\n\t\t#end\n\t\tself.out \" #{url} to #{dest}\"\n\tend", "def copy(data)\n File.popen('pbcopy', 'w') { |p| p << data.to_s }\n $?.success?\nend", "def download from_path, to_path, options={}, &block\n from_path = \"#{@host}:#{from_path}\"\n Sunshine.logger.info @host, \"Downloading #{from_path} -> #{to_path}\" do\n execute rsync_cmd(from_path, to_path, options), &block\n end\n end", "def copy_file(source_file, dest_file, settings)\n\tFileUtils.cp_r(source_file, dest_file)\nend", "def copy_content(industry)\n\n puts \"copying content...\"\n client = user_client\n threads = []\n\n # get \"My Files\" and \"Shared Files\" folder objects\n myFolder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder\", :expires_in => 10.minutes) do\n client.folder_from_path('My Files')\n end\n myFolderContents = client.folder_items(myFolder, fields: [:id, :type])\n\n sharedFolder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/shared_folder\", :expires_in => 10.minutes) do\n client.folder_from_path(\"#{session[:userinfo]['info']['name']} - Shared Files\")\n end\n sharedFolderContents = client.folder_items(sharedFolder, fields: [:id]).files\n\n # delete vault folder contents\n myFolderContents.each do |f|\n if (f.type == \"folder\")\n client.delete_folder(f, recursive: true)\n else\n client.delete_file(f)\n end\n end\n\n sharedFolderContents.each do |f|\n threads << Thread.new do\n client.delete_file(f)\n end\n end\n\n threads.each { |thr| thr.join }\n\n # fetch industry folder items\n case industry\n when \"finserv\"\n industryParentItems = client.folder_items(ENV['FINSERV_VAULT_CONTENT'], fields: [:id, :type])\n when \"healthcare\"\n industryParentItems = client.folder_items(ENV['HEALTHCARE_VAULT_CONTENT'], fields: [:id, :type])\n when \"insurance\"\n industryParentItems = client.folder_items(ENV['INSURANCE_VAULT_CONTENT'], fields: [:id, :type])\n when \"nonprofit\"\n industryParentItems = client.folder_items(ENV['NONPROFIT_VAULT_CONTENT'], fields: [:id, :type])\n else\n end\n\n # copy industry folder items over\n industryParentItems.each do |f|\n threads << Thread.new do\n if f.type == \"folder\"\n client.copy_folder(f, myFolder)\n else\n client.copy_file(f, myFolder)\n end\n end\n end\n\n threads.each { |thr| thr.join }\n\n end", "def copy(copy_name, options = {})\n self.class.copy(key, copy_name, bucket.name, options)\n end", "def transfer(item)\n base = File.basename(item.to_s.chomp)\n cmd = \"#{@rsync_cmd} #{@origin}/#{base} #{@dst}\"\n SingleLogger.instance.info cmd\n `#{cmd}`\n end", "def download(url)\n response = client.send(:get, url, {}, 'Content-Type': 'text/html')\n raise ::Errors::BadRequest unless response.success?\n\n response.body\n end", "def copy_to(relpath, abspath)\n end", "def test_copy_using_cp\n @rogerfile.release(blank: true, cleanup_build: false)\n @project.construct.file \"html/test.txt\"\n @project.release.run!\n\n build_path = @project.release.build_path\n\n assert build_path.exist?\n assert_equal 1, build_path.children.size\n assert_equal build_path + \"test.txt\", build_path.children.first\n end", "def copy(text)\n IO.popen('pbcopy', 'w') {|f| f << text}\nend", "def copy_to_local srcpath, dstpath\n src_bucket = bucket(srcpath)\n src_key_path = key_path(srcpath)\n dstfile = File.new(dstpath, 'w')\n @s3.interface.get(src_bucket, src_key_path) do |chunk|\n dstfile.write(chunk)\n end\n dstfile.close\n end", "def copy(dest_path, overwrite, depth = nil)\n\n is_new = true\n\n dest = new_for_path dest_path\n unless dest.parent.exist? and dest.parent.collection?\n return Conflict\n end\n\n if dest.exist?\n if overwrite\n FileUtils.rm_r dest.file_path, secure: true\n else\n return PreconditionFailed\n end\n is_new = false\n end\n\n if collection?\n\n if request.depth == 0\n Dir.mkdir dest.file_path\n else\n FileUtils.cp_r(file_path, dest.file_path)\n end\n\n else\n\n FileUtils.cp(file_path, dest.file_path.sub(/\\/$/, ''))\n FileUtils.cp(prop_path, dest.prop_path) if ::File.exist? prop_path\n\n end\n\n is_new ? Created : NoContent\n end", "def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend" ]
[ "0.632978", "0.6106217", "0.5981723", "0.5804542", "0.5715317", "0.5651573", "0.5603437", "0.55654824", "0.55093294", "0.5505272", "0.54435843", "0.5443364", "0.54273534", "0.5416223", "0.5378505", "0.53065944", "0.5273033", "0.5161088", "0.5085909", "0.5072235", "0.50692123", "0.5048715", "0.5044332", "0.50350577", "0.502039", "0.50193286", "0.50156647", "0.50129104", "0.5011844", "0.49984857", "0.499397", "0.49845928", "0.49582285", "0.49430308", "0.49292633", "0.49191514", "0.49038452", "0.49031675", "0.48851275", "0.48803204", "0.4877317", "0.48568785", "0.4853534", "0.48509753", "0.48483893", "0.4843643", "0.48419738", "0.48392442", "0.48349744", "0.48268944", "0.4825802", "0.4819504", "0.48035765", "0.47857282", "0.4777552", "0.47718614", "0.47496194", "0.4744322", "0.47338736", "0.47304034", "0.47227022", "0.47174346", "0.4709264", "0.47000745", "0.46920896", "0.46897048", "0.46872962", "0.46850118", "0.46824932", "0.46773785", "0.4677009", "0.46745792", "0.46724468", "0.46678007", "0.46656072", "0.46627694", "0.4655292", "0.46549493", "0.46420577", "0.4635192", "0.46331128", "0.46313545", "0.4626323", "0.4614876", "0.4597898", "0.459118", "0.45878097", "0.45874587", "0.45792174", "0.45682436", "0.45653307", "0.4543759", "0.45423663", "0.45421964", "0.4541361", "0.45410264", "0.45400253", "0.4539071", "0.45370167", "0.45247877" ]
0.66529083
0
Basic API methods Send an HTTP request to the specified +url+.
def request(action, url, headers, options = {}) # If the Expect header isn't set uploads are really slow headers['Expect'] ||= '' req = Request.new req.action = action req.timeout = self.timeout req.connect_timeout = self.connect_timeout req.max_redirects = self.max_redirects req.headers = self.headers.merge(headers) req.username = self.username req.password = self.password req.upload_data = options[:data] req.file_name = options[:file] req.proxy = proxy req.auth_type = auth_type req.insecure = insecure req.url = self.base_url.to_s + url.to_s raise ArgumentError, "Empty URL" if req.url.empty? handle_request(req) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_request(url)\n verify_credentials!\n\n api_response = nil\n\n complete_url = Applitrack.api_base + url\n uri = URI(complete_url)\n\n Net::HTTP.start(uri.host, uri.port,\n use_ssl: uri.scheme == 'https') do |http|\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(Applitrack.username, Applitrack.password)\n\n api_response = http.request(request)\n if api_response.code != \"200\"\n raise api_error(api_response)\n end\n end\n\n api_response\n end", "def send_request(url, data)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl\t= true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n response = http.post(uri.path, data)\n response.code == '200' ? response.body : response.error!\n end", "def make_api_request(request_url)\n url = URI.parse(request_url)\n request = Net::HTTP::Get.new(url.path)\n connection = Net::HTTP.new(url.host, url.port)\n connection.use_ssl = true\n connection.request(request)\n end", "def httpRequest (url)\n\turi = URI.parse(url)\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\tresponse = http.request(Net::HTTP::Get.new(uri.request_uri))\nend", "def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end", "def request(url, type)\n url = URI(URI.encode(url))\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end", "def makeRequest(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n\n r = http.request(request)\n return r\nend", "def send_request(url, req)\n begin\n Net::HTTP.start(url.host, url.port, :read_timeout => 180) {|http| http.request(req)}\n rescue Errno::ECONNREFUSED, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts e.to_s\n nil\n end\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def send_request(url, data=nil)\n begin\n puts \"BigBlueButtonAPI: URL request = #{url}\" if @debug\n url_parsed = URI.parse(url)\n http = Net::HTTP.new(url_parsed.host, url_parsed.port)\n http.open_timeout = @timeout\n http.read_timeout = @timeout\n if data.nil?\n response = http.get(url_parsed.request_uri, @request_headers)\n else\n puts \"BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}\" if @debug\n opts = { 'Content-Type' => 'text/xml' }.merge @request_headers\n response = http.post(url_parsed.request_uri, data, opts)\n end\n puts \"BigBlueButtonAPI: URL response = #{response.body}\" if @debug\n\n rescue TimeoutError => error\n raise BigBlueButtonException.new(\"Timeout error. Your server is probably down: \\\"#{@url}\\\". Error: #{error}\")\n\n rescue Exception => error\n raise BigBlueButtonException.new(\"Connection error. Your URL is probably incorrect: \\\"#{@url}\\\". Error: #{error}\")\n end\n\n response\n end", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def http(url, opts = {})\n method = opts[:method] || :get\n response = HTTParty.send(method, url, opts)\n if (200..299).include?(response.code)\n response.body\n else\n raise HttpError.new(\"Bad response: #{response.code} #{response.body}\", response)\n end\n end", "def perform_request url\n response = self.class.get(url)\n raise NotFound.new(\"404 Not Found\") if response.respond_to?(:code) && response.not_found?\n raise InvalidAPIResponse.new(response[\"status\"][\"message\"]) if response.is_a?(Hash) && response[\"status\"]\n\n response\n end", "def http_request(url)\n uri = URI.parse(url)\n begin\n http = uri.read(read_timeout: 4)\n rescue OpenURI::HTTPError => e\n raise RequestError, YAML::dump(e)\n end\n end", "def _request(url, type, key)\n url = URI(url)\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n req.add_field('X-Vermillion-Key', key)\n req.add_field('Accept', 'application/json')\n req.add_field('Cache-Control', 'no-cache')\n req.add_field('From', @config.get(:user))\n req.add_field('User-Agent', 'Vermillion Client 1.0')\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end", "def request(url)\n raise TypeError, 'url must be a String or respond_to #to_s' unless url.is_a?(String) || url.respond_to?(:to_s)\n @parameters['url'] = url.to_s # The URL must contain the entire URL with the _escaped_fragment_ parsed out\n \n content_from_response(send_request)\n end", "def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end", "def make_request(url)\n res = Typhoeus::Request.new(\n url,\n method: :get,\n headers: {\n \"Accept-Charset\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n \"Accept-Language\" => \"en-US,en;q=0.9,pt;q=0.8\",\n \"X-Riot-Token\" => @api_key.to_s,\n \"User-Agent\": \"https://github.com/drish/rioter\"\n }\n ).run\n parse!(res)\n end", "def get(url='/', vars={})\n send_request url, vars, 'GET'\n end", "def http_get(url)\n # set HTTP version to 1.2\n Net::HTTP::version_1_2\n\n urls = %w{api proxy}.inject({}) do |ret, key|\n if url_val = @opt[\"#{key}_url\"] \n uri = parse_url(url_val, \"#{key} URL\")\n [:host, :port].each { |m| ret[\"#{key}_#{m}\"] = uri.send(m) }\n end\n\n ret\n end\n\n # connect to technorati\n http = Net::HTTP.Proxy(urls['proxy_host'], urls['proxy_port']).new(urls['api_host'], urls['api_port'])\n http.start\n\n # $stderr.puts \"DEBUG URL: #{url}\"\n\n # create HTTP headers hash\n http_headers = {\n 'User-Agent' => @opt['user_agent']\n }\n\n # get URL, check for error\n resp = http.get(url, http_headers)\n raise Technorati::HTTPError, \"HTTP #{resp.code}: #{resp.message}\" unless resp.code =~ /2\\d{2}/\n\n # close HTTP connection, return response\n http.finish\n resp.body\n end", "def get(url)\n call(url: url)\n end", "def get(url)\n request(:get, url, {}, nil)\n end", "def make_request(url, params)\n response = connection.get do |req|\n req.url url\n params.each do |k, v|\n req.params[k] = v\n end\n end\n response\n end", "def send_get(url)\r\n result = @client.get(self.target_uri(url))\r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200')\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end", "def run_request(method, url, body, headers); end", "def call(url, **options)\n self.class.get url, options\n end", "def consume(url, options = {}, with_status = false)\n base_uri, path = extract_base_uri_and_path(url)\n\n method = (options[:method] || 'GET').to_s.downcase\n\n _options = build_httpparty_options(options, method)\n _options[:base_uri] = base_uri\n\n if with_status\n verbose_perform_request_to(method, path, _options)\n else\n perform_request_to(method, path, _options)\n end\n end", "def http_request(url, options = {})\n\t\t\treq = Net::HTTP::Get.new(url)\n\t\t\treq[\"user-agent\"] = \"Mozilla/5.0 Gecko/20070219 Firefox/2.0.0.2\" # ensure returns XML\n\t\t\treq[\"cookie\"] = \"cookieMenu=all; cookieLangId=\" + options[:lang] + \"; cookies=true;\"\n\t\t\t\n\t\t\treq[\"cookie\"] += options[:cookie] if options[:cookie]\n\t\t\t\n\t\t\turi = URI.parse(url)\n\t\t\t\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\n\t\t\tif (options[:secure])\n\t\t\t\tputs \"Secure authentication\" if options[:debug]\n\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\thttp.use_ssl = true\n\t\t\tend\n\t\t \n\t\t\t\n\t\t\tbegin\n\t\t\t http.start do\n\t\t\t res = http.request req\n\t\t\t\t\t# response = res.body\n\t\t\t\t\t\n\t\t\t\t\ttries = 0\n\t\t\t\t\tresponse = case res\n\t\t\t\t\t\twhen Net::HTTPSuccess, Net::HTTPRedirection\n\t\t\t\t\t\t\tres.body\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttries += 1\n\t\t\t\t\t\t\tif tries > @@max_connection_tries\n\t\t\t\t\t\t\t\traise Wowr::Exceptions::NetworkTimeout.new('Timed out')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tretry\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t end\n\t\t\trescue \n\t\t\t\traise Wowr::Exceptions::ServerDoesNotExist.new('Specified server at ' + url + ' does not exist.');\n\t\t\tend\n\t\tend", "def api_call(url_string)\n uri = URI.parse(url_string)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n http.read_timeout = get_param(:timeout)\n #todo use JSON calls where available vs xml\n if get_param(:action_name)=='ADMIN'\n xstring = Nokogiri::XML(open(url_string))\n else\n response = http.request(request)\n puts \"Response: #{response.code} #{response.message} #{response.class.name}\"\n puts \"#{request}\"\n end\n end", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def get url\n url = URI url\n request = HTTP::Get.new url.path\n\n dispatch request, to: url\n end", "def getHTTP(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n request = Net::HTTP::Get.new(uri.request_uri)\n http.request(request)\nend", "def http_get(url)\n # get proxy info\n proxy_host, proxy_port = find_http_proxy\n # $stderr.puts \"DEBUG: proxy: host = #{proxy_host}, port = #{proxy_port}\"\n\n # get host, port, and base URI for API queries\n uri = URI.parse(@base_uri)\n base = uri.request_uri\n\n # prepend base to url\n url = \"#{base}/#{url}\"\n\n # connect to delicious\n http = Net::HTTP.Proxy(proxy_host, proxy_port).new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n # check to make sure we have SSL support\n raise NoSSLError, \"Unsupported URI scheme 'https'\" unless HAVE_SSL\n init_http_ssl(http)\n end\n\n # start HTTP connection\n http = http.start\n\n # get URL, check for error\n resp = http.get(url, @headers)\n raise HTTPError, \"HTTP #{resp.code}: #{resp.message}\" unless resp.code =~ /2\\d{2}/\n\n # close HTTP connection, return response\n http.finish\n resp.body\n end", "def restRequest(url)\n printDebugMessage('restRequest', 'Begin', 11)\n printDebugMessage('restRequest', 'url: ' + url, 12)\n # Split URL into components\n uri = URI.parse(url)\n # Create a HTTP connection\n httpConn = Net::HTTP.new(uri.host, uri.port)\n # Get the resource\n if uri.query\n path = \"#{uri.path}?#{uri.query}\"\n else\n path = uri.path\n end\n resp, data = httpConn.get(path, {'User-agent' => getUserAgent()})\n case resp\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n $stderr.puts data\n resp.error!\n end\n printDebugMessage('restRequest', 'data: ' + data, 21)\n printDebugMessage('restRequest', 'End', 11)\n return data\n end", "def make_get_request url, headers = []\n make_request url, headers: headers\n end", "def get(url); end", "def make_request(call, url)\n request = Net::HTTP.new(url.host, url.port)\n request.read_timeout = 30\n request.use_ssl = true\n\n response = request.start { |http| http.request(call) }\n JSON.parse(response.body)\n end", "def fetch(url)\n url = URI.parse url\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = (url.scheme == \"https\")\n http.request_get url.request_uri\n end", "def http_get(url)\n # connect to delicious\n http = Net::HTTP.new('del.icio.us', 80)\n http.start\n\n # get URL, check for error\n resp = http.get(url, @headers);\n raise \"HTTP #{resp.code}: #{resp.message}\" unless resp.code =~ /2\\d{2}/\n\n # close HTTP connection, return response\n http.finish\n resp.body\n end", "def request(url, options = {})\n set_x_request_id!(options)\n Request.new(@logger, url, @curl_options.merge(options))\n end", "def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end", "def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend", "def http_get(url)\n opts = {\n followlocation: false,\n timeout: @time_out,\n accept_encoding: 'gzip',\n headers: {\n 'User-Agent' => \"wgit/#{Wgit::VERSION}\",\n 'Accept' => 'text/html'\n }\n }\n\n # See https://rubydoc.info/gems/typhoeus for more info.\n Typhoeus.get(url, opts)\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def make_request(method, url, params = {})\n path = \"#{EbanqApi.base_url}/#{url}\"\n response = case method\n when :get then get(path, headers, params)\n when :post then post(path, headers, params)\n when :put then put(path, headers, params)\n when :delete then delete(path, headers)\n else raise 'Error'\n end\n process_raw_response(response)\n rescue RestClient::ResourceNotFound, SocketError, Errno::ECONNREFUSED => e\n raise e\n end", "def request(type, url, params = {})\n request = Request.new(type, url, params)\n make_request(request)\n\n update_history(request)\n end", "def _http_request(method, url, *args)\n request_args = get_hash_args(*args)\n url = get_url url unless url.to_s.start_with?('http://')\n request_args[:header] = @head\n request_args[:body] = \\\n JSON.dump(request_args[:body]) if request_args[:body]\n\n res = @http_session.request(method, url, request_args)\n status = res.status\n raise HTTPError, 'HTTPError: %s %s'\\\n % [status, (JSON.load(res.content)['message'] rescue res.reason)]\\\n if status >= 400 && status < 600\n res\n end", "def submit\n http = Net::HTTP.new(URL.host, URL.port)\n http.use_ssl = true\n http.start { |send| send.request(self) }.body\n end", "def http_get(url)\n response = client.get(url, follow_redirect: true)\n\n raise HTTPClient::BadResponseError, response.reason unless HTTP::Status.successful?(response.status)\n\n response\n end", "def request(url)\n # Allow the user to specify the full URL.\n remainder = url[0, base.length] == base ? url.sub(base, '') : url\n\n request = nil\n delim = remainder.include?('?') ? '&' : '?'\n @limiter.times 1 do\n request = NYTResponse.new(\"#{base}#{remainder}#{delim}api-key=#{key}\")\n end\n request\n end", "def http(data, url, opts = {})\n method = opts[:method] || :post\n opts[:data] = data\n response = HTTParty.send(method, url, opts)\n unless (200..299).include?(response.code)\n raise HttpError.new(\"Bad response: #{response.code} #{response.body}\", response)\n end\n end", "def request(url)\n\n # For catch 4xx and 5xx HTTP errors\n has_errors = false\n\n # Send request to vendor API\n http = Curl.get(url) do |http|\n\n # On 4xx errors\n http.on_missing do\n has_errors = true\n end\n\n # On 5xx errors\n http.on_failure do\n has_errors = true\n end\n\n end\n\n raise \"Error from TRADO API - #{http.body_str}\" if has_errors\n\n JSON.parse(http.body_str)['data']\n\n end", "def http(method, url, options = {}, &block)\n case method.to_s.downcase\n when *%w(get put head post delete options patch)\n send method, url, options, &block\n else\n raise \"Invalid method: #{method}\"\n end\n end", "def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end", "def request\n EventMachine::HttpRequest.new(url)\n end", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def get_request(url)\n\n request = Net::HTTP::Get.new(url)\n request['content-type'] = 'application/x-www-form-urlencoded'\n request['accept'] = '*/*'\n return request\nend", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend", "def make_http_request( url, options, auth_info = {} )\n try_count = 0\n \n begin\n request = Net::HTTP::Post.new(url.path)\n request.basic_auth auth_info[:hapi_username], auth_info[:hapi_password] unless auth_info.empty?\n request.set_form_data(options)\n request.add_field('User-Agent', USER_AGENT)\n \n http = Net_HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.request(request)\n rescue Errno::ECONNREFUSED\n if try_count < 2\n try_count += 1\n sleep 1\n retry\n else\n raise Backend, \"Connection refused trying to contact hAPI at #{@hapi_hostname}\"\n end\n end\n end", "def http( *args )\n p http_get( *args )\n end", "def make_request url, method: ::Rack::GET, body: nil, headers: []\n env = Testing.build_standard_env URI(url), headers\n env[::Rack::REQUEST_METHOD] = method\n env[::Rack::RACK_INPUT] = ::StringIO.new body if body\n ::Rack::Request.new env\n end", "def make_request(url,headers,query)\n c = HTTPClient.new\n c.get_content(url,query,headers)\nend", "def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end", "def send\n uri = URI(@api_url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end\n http.read_timeout = GlobalConstant::CompanyApi.read_timeout\n http.open_timeout = GlobalConstant::CompanyApi.open_timeout\n req_obj = get_request_obj(uri.request_uri)\n\n http_response, e = nil, nil\n begin\n http_response = http.request(req_obj)\n set_api_response_cookie(http_response)\n parse_api_response(http_response)\n rescue Net::ReadTimeout, Net::OpenTimeout => e\n # Timeouts\n exception_with_internal_code(\n e,\n 'company_api_timeout',\n 'company api timeout',\n GlobalConstant::ErrorCode.internal_server_error,\n debug_data\n )\n rescue Exception => e\n # Exceptions\n exception_with_internal_code(e, 'company_api_exception', 'company api exception', GlobalConstant::ErrorCode.internal_server_error, debug_data)\n end\n\n end", "def http_get(url)\n require \"open-uri\"\n URI.parse(url).read\n end", "def http_fetch(url)\n uri = URI.parse url\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Unfortunately the net/http(s) API can't seem to do this for us,\n # even if we require net/https from the beginning (ruby 1.8)\n if uri.scheme == \"https\"\n require 'net/https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n res = http.start { |http|\n req = Net::HTTP::Get.new uri.request_uri\n cred = netrc_credentials uri.host\n req.basic_auth *cred if cred\n http.request req\n }\n end", "def get(url)\n # slow down the request rate! otherwise you will get blocked\n sleep 1\n return @agent.get(url)\n end", "def request(url,token = nil)\n url = URI(\"#{url}&api_key=#{token}\") # se quita uri y parentesis\n #puts url_string\n \n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n response = https.request(request)\n data = JSON.parse(response.read_body)\n #puts data\nend", "def fetch(url)\n # TODO: support HTTPS too\n @open_params ||= begin\n u = URL(@root_url)\n [u.host, u.port]\n end\n Net::HTTP.start(*@open_params) do |http|\n request = Net::HTTP::Get.new(URL(url).full_path.gsub(/ /, \"%20\"))\n with_sts_auth_retry do\n authenticate(request, {:is_request => true})\n http.request(request)\n end\n end\n end", "def http_get(url)\n FaviconParty::HTTPClient.get(url)\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def http_request(url, options = {})\n\t\t\treq = Net::HTTP::Get.new(url)\n\t\t\treq[\"user-agent\"] = @@user_agent # ensure returns XML\n\t\t\treq[\"cookie\"] = \"cookieMenu=all; cookieLangId=\" + options[:lang] + \"; cookies=true;\"\n\t\t\t\n\t\t\treq[\"cookie\"] += options[:cookie] if options[:cookie]\n\n\t\t\turi = URI.parse(URI.escape(url))\n\t\t\t\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\n\t\t\tif (options[:secure])\n\t\t\t\tputs \"Secure authentication\" if options[:debug]\n\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\thttp.use_ssl = true\n\t\t\tend\n\t\t \n\t\t\t\n\t\t\tbegin\n\t\t\t\ttries = 0\n\t\t\t http.start do\n\t\t\t\t puts \"Get URL \"+ url if options[:debug]\n\t\t\t res = http.request req\n\t\t\t\t\t# response = res.body\n\t\t\t\t\t\n\t\t\t\t\t# FIXME WoW Armory rate limiter. Simple version\n\t\t\t\t\t# Needs to work across instances and not sleep for 1.5 if the\n\t\t\t\t\t# request took more than 1.5\n\t\t\t\t\t# just need a 1.5 second wait until the start of the next request\n \n if options[:rate_limit]\n\t\t\t\t\t puts \"Sleeping for 1.5 seconds\" if options[:debug]\n \t\t\t\t\tsleep 1.5\n\t\t\t\t\tend\n\n\t\t\t\t\tresponse = case res\n\t\t\t\t\t\twhen Net::HTTPSuccess, Net::HTTPRedirection\n\t\t\t\t\t\t\tres.body\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttries += 1\n\t\t\t\t\t\t\tif tries > @@max_connection_tries\n\t\t\t\t\t\t\t\traise Wowr::Exceptions::NetworkTimeout.new('Timed out')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tredo\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t end\n\t\t\trescue Timeout::Error => e\n raise Wowr::Exceptions::NetworkTimeout.new('Timed out - Timeout::Error Exception')\n\t\t\trescue SocketError, Net::HTTPExceptions => e\n\t\t\t\traise Wowr::Exceptions::ServerDoesNotExist.new('Specified server at ' + url + ' does not exist.')\n\t\t\tend\n\t\tend", "def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end", "def request(url, token)\n headers = { \"Authorization\" => \"Splunk #{token}\" }\n Net::HTTP::Get.new(url, headers)\n end", "def webRequest (url)\n\tif url =~ /(https)/\n\t\treturn httpsRequest(url)\n\telse\n\t\treturn httpRequest(url)\n\tend\nend", "def request\n self.http_response = http_client.get(url, request_options)\n self\n end", "def makeRequest(url,input)\n #GET\n if input.class == String\n begin\n rawData = Net::HTTP.get_response(URI.parse(url+input))\n if rawData.code == \"404\"\n data = nil\n else\n data = rawData.body\n end\n rescue\n puts \"Error: #{$!}\"\n end\n #POST\n else\n uri = URI.parse(url+\"/\")\n begin\n data = Net::HTTP.new(uri.host).post(uri.path,input.join(\",\")).body\n rescue\n puts \"Error: #{$!}\"\n end\n end\n return data\n end", "def get(url, args = {})\r\n make_request(:get, url, args)\r\n end", "def request(url)\n\t\tTyphoeus::Request.new( url, \n\t\t\tfollowlocation: true, \n\t\t\theaders: {\"User-Agent\" => BrowserHeader.random}, \n\t\t\tcookiefile: config[:cookie][:file],\n\t\t\tcookiejar: config[:cookie][:file]\n\t\t)\n\tend", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def get(url)\n uri = normalize_url(url)\n\n # Ensure the parsed URL is an HTTP one\n raise HTTPError::ClientError.new(\"Invalid URL #{url}\") unless uri.is_a?(URI::HTTP)\n\n req = Net::HTTP::Get.new(uri.request_uri)\n handle_request(uri, req)\n end", "def call_gnews_url(url)\n result = \n HTTP.headers(\n 'Accept' => 'application/json',\n 'x-api-key' => \"#{@gnews_token}\" ).get(url)\n Response.new(result).response_or_error\n end", "def send_url(url)\n # debug - puts \"trying #{url}\"\n result = JSON.parse(URI.parse(url).read)\n puts \"#{result['status']} #{result['message']}\" if result['status'] == 'ERROR'\nend", "def send_request(type,params)\n request_url = prepare_url(type,params)\n log \"Request URL: #{request_url}\"\n res = nil\n RemoteUtil.do_with_retry(exceptions: [TimeoutError, InternalServerError]) do |except|\n begin\n if not except.nil?\n puts \"Error calling BestBuy API, will retry: \" + except.to_s\n end\n res = Net::HTTP.get_response(URI::parse(request_url))\n rescue Timeout::Error\n raise BestBuyApi::TimeoutError, \"Timeout calling #{request_url}\"\n end\n if res.kind_of? Net::HTTPSuccess\n # Successful HTTP result.\n elsif res.kind_of? Net::HTTPInternalServerError\n raise BestBuyApi::InternalServerError, \"HTTP Response: #{res.code} #{res.message} for #{request_url}\"\n else\n raise BestBuyApi::RequestError, \"HTTP Response: #{res.code} #{res.message} for #{request_url}\"\n end\n end\n begin\n JSON.parse(res.body)\n rescue JSON::ParserError\n raise BestBuyApi::RequestError, \"Bad Response: JSON Parser Error for #{request_url}\"\n end\n \n end", "def perform_http_request\n request_opts = { followlocation: true, ssl_verifypeer: false, timeout: 30 }\n @response = Typhoeus.get(@webpage_request.url, request_opts)\n @response && process_response_data\n @response\n end", "def request(verb, url, params={}, headers={})\n if (verb == :get) || (verb == :delete)\n resp = connection.run_request(verb, url, nil, headers) do |req|\n req.params.update(params)\n end\n else\n resp = connection.run_request(verb, url, params, headers)\n end\n\n case resp.status\n when 200...299\n Response.new(resp)\n when 302\n request(verb, resp.headers['location'], params, headers)\n when 400...599\n response = Response.new(resp)\n e = Error.new(response)\n raise e if options[:raise_errors]\n response.error = e\n response\n else\n raise Error.new(Response.new(resp)), \"Unhandled status code value of #{resp.status}\"\n end\n end", "def fetch(url, params, method=nil)\n if method && method == 'GET'\n url = build_get_uri(url, params)\n end\n uri = URI.parse(url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n #http.use_ssl = true\n\n if method && method == 'GET'\n req = Net::HTTP::Get.new(uri.request_uri)\n elsif method && method == 'DELETE'\n req = Net::HTTP::Delete.new(uri.request_uri)\n elsif method && method == 'PUT'\n req = Net::HTTP::Put.new(uri.request_uri)\n req.set_form_data(params)\n else\n req = Net::HTTP::Post.new(uri.request_uri)\n req.set_form_data(params)\n end\n req.basic_auth(@id, @token)\n\n return http.request(req)\n end", "def call_poke_url(url)\n JSON.parse(\n HTTP\n .get(URI(url))\n )\nend", "def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end", "def httpget(url, corpNum, userID = '')\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Accept-Encoding\" => \"gzip,deflate\",\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n uri = URI(getServiceURL() + url)\n\n request = Net::HTTP.new(uri.host, 443)\n request.use_ssl = true\n\n Net::HTTP::Get.new(uri)\n\n res = request.get(uri.request_uri, headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n end", "def request(kind, url, data, options)\n # options passed as optional parameter show up as an array\n options = options.first if options.kind_of? Array\n query_options = self.class.package_query_params(options)\n full_url = URI.parse(\"#{self.url}#{url}#{query_options}\")\n \n # create an object of the class required to process this method\n klass = Object.module_eval(\"::Net::HTTP::#{kind.to_s.capitalize}\", __FILE__, __LINE__)\n request = klass.new([full_url.path, full_url.query].compact.join('?'))\n request = apply_headers(request)\n # take passed data and encode it\n request.body = self.class.body_encoder(data) if data\n \n http = Net::HTTP.new(full_url.host, full_url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 500\n response = http.start do |web|\n web.request(request)\n end\n return self.class.parse_response(response.code, response.body)\n end", "def request(url, body)\n #res = HTTParty.post(url, body: body, headers: {'Content-Type' => 'application/soap+xml; charset=\"utf-8\"'}, :verify => false)\n res = HTTParty.post(url, body: body, headers: {'Content-Type' => 'application/soap+xml; charset=\"utf-8\"'}, :verify => false)\n p \"response is: #{res}. response body is: #{res.body} for url: #{url}\"\n content = JSON.parse(res.body)\n end", "def background_visit(url, opts = {})\r\n require 'httpclient'\r\n begin\r\n client = HTTPClient.new\r\n if url && url =~ /^http/\r\n http_response = client.get(url).body\r\n else\r\n base_url = $TESTWISE_PROJECT_BASE_URL || $TESTWISE_PROJECT_BASE_URL || $BASE_URL\r\n http_response = client.get(\"#{base_url}#{url}\").body\r\n end\r\n\t\t\t\t\r\n\t\t\t\thttp_response = http_response.content if http_response.respond_to?(\"content\")\r\n rescue => e\r\n raise e\r\n end\r\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend", "def make_request\n response = @http.request(@request)\n end", "def httpsRequest (url)\n\turi = URI.parse(url)\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\trequest = Net::HTTP::Get.new(uri.request_uri)\n\tresponse = http.request(request)\n\treturn response\nend", "def get(url, headers: {}, params: {}, options: {}, &block)\n url = encode_query(url, params)\n\n request = Net::HTTP::Get.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options, &block)\n end", "def request(verb, uri, options = {})\n client = HTTP::Client.new(headers: headers)\n client = client.via(*proxy) if proxy\n handle_response(client.request(verb, uri, options))\n end" ]
[ "0.79592663", "0.7614962", "0.7466754", "0.7462733", "0.7396056", "0.73940516", "0.72606236", "0.721372", "0.7203003", "0.71396554", "0.7120782", "0.7119559", "0.7089201", "0.7065934", "0.7027009", "0.70258313", "0.70136625", "0.70115995", "0.698858", "0.69823205", "0.69591457", "0.69589293", "0.69534206", "0.69321287", "0.69290274", "0.6925722", "0.69248164", "0.69119424", "0.6907812", "0.68951213", "0.68874335", "0.68819463", "0.6875181", "0.6874445", "0.68707573", "0.68678766", "0.6857181", "0.6845173", "0.6838774", "0.6813214", "0.68077093", "0.68054724", "0.67832", "0.6774415", "0.6754936", "0.6730982", "0.67247283", "0.6717219", "0.671701", "0.66987073", "0.669369", "0.6672411", "0.66694635", "0.66579366", "0.66527355", "0.6647512", "0.66469127", "0.6634455", "0.6634455", "0.66225755", "0.6619908", "0.661964", "0.66107875", "0.6605091", "0.6604758", "0.6599561", "0.65818375", "0.6580128", "0.65796", "0.65554184", "0.6551298", "0.6550156", "0.65472883", "0.65459704", "0.6542325", "0.65374476", "0.6529328", "0.65175074", "0.65009385", "0.64943063", "0.6493839", "0.64899313", "0.6487044", "0.64790577", "0.6471175", "0.6466584", "0.6465323", "0.6459117", "0.6458723", "0.6458085", "0.64383876", "0.6422821", "0.6422656", "0.64195955", "0.6414183", "0.63978255", "0.6394408", "0.6390348", "0.63845235", "0.6383247", "0.6378643" ]
0.0
-1
Look for relevent nodes only
def parse_for_relevant_nodes @relevant_nodes = Array.new reduce(params[:api_response].to_hash)['data'].each do | node | if node[1]['from']['id'] == params[:friend_id] @relevant_nodes << node[1] elsif node[1]['tags'] node[1]['tags']['data'].each do |tagged_person| if tagged_person['id'] == params[:friend_id] @relevant_nodes << node[1] end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scanned_node?(node); end", "def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end", "def restrict_when_referenced\n return false if nodes.count > 0\n end", "def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end", "def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end", "def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end", "def matches?(node); end", "def fakesearch_all_nodes(options = {})\n fakesearch_nodes(nil, options)\nend", "def check_nodes(node)\n nodes = []\n all_nodes = get_consul_members\n if (node.downcase != \"all\")\n nodes << node if all_nodes.include? node\n else\n nodes = all_nodes\n end\n return nodes\n end", "def free_nodes\n nodes.select(&:is_free?)\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end", "def process_node_bookmark(xn)\n pull_node(xn)\n flag_match_found\n end", "def node?\n any?(&:node?)\n end", "def process_child_nodes(node); end", "def search(node = @root)\n if node.position == @target\n @target_node = node\n return\n else\n node.connected_knights.each { |knight| search(knight) }\n end\n end", "def nodelist; end", "def nodelist; end", "def ignore_node(xn)\n @xn_context.process_children = false\n end", "def check(node); end", "def nodes()\n return SearchNodes.new(:node => self, :return_many => true)\n end", "def allowed_nodes\n if is_root?\n Node.with_root_fund_items_for( fund_grant ).under_limit\n else\n Node.with_child_fund_items_for( parent ).under_limit\n end\n end", "def watch_appropriate_nodes\n remaining_paths.last( threshold + 1 ).reverse_each do |path|\n next if watched_paths.include? path\n watched_paths << path\n finish_node(path) unless zk.exists?(path, :watch => true)\n end\n end", "def search keyword\n result = Set.new\n matched = Array.new\n @frame_tree_root_node.each{|node|\n if node.content =~ /#{keyword}/i\n matched << node.name\n end\n } \n @frame_tree_root_node.each{|node|\n if node.is_root?\n result << node.name\n elsif matched.include? node.name\n result << node.name #add id\n node.parentage.each{|item|\n result << item.name\n }\n end\n }\n @frame_tree_root_node.print_tree\n result\n end", "def find_all_nodes(*args)\n raise NotImplementedError\n nodes = @database.all_nodes\n # TODO: design node finder syntax\n nodes\n end", "def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end", "def on_test(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |xml_node|\n nodes << xml_node if node_matches?(xml_node, ast_node)\n end\n\n return nodes\n end", "def don_bobfather\n #traversal = self.outgoing(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| (path.end_node[:fbid] == user[:fbid]) ? :include_and_continue : :exclude_and_continue }\n traversal = self.outgoing(:bobfather).depth(:all).to_a.last #. #filter{|path| path.end_node.has_bobfather?}.\n # each{|node| puts node[:name]}\n end", "def search_for_a_node( nokogiri_nodeset, text_key_word )\n matches_found = 0\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n# DEBUG\n# puts line\n matches_found += 1 if !( line =~ /#{ text_key_word }/ui ).nil?\n end\n matches_found\n end", "def nodes_satisfying(dependency)\r\n @nodes.find_all { |n| n.satisfies?(dependency) }\r\n end", "def excluded_node_list\n config[\"nodes\"] ? config[\"nodes\"][\"exclude\"] : []\n end", "def process_node node, filter\n \n # collect toplevel creators\n\n if node.kind == :dir && node.action == :add\n # find toplevel dir creators\n case node.path\n when @@regexp_branches_top, @@regexp_tags_top\n # continue\n when \"trunk\", @@regexp_trunk_dir, @@regexp_trunk_file, \n\t\"branches\", @@regexp_branches_dir, @@regexp_branches_file,\n\t\"tags\", @@regexp_tags_dir\n\tself.make_relevant!\n\t# continue\n else\n\textra_rev = $extra_pathes[node.path]\n\tif extra_rev && @num <= extra_rev\n\t self.make_relevant!\n\telse\n\t return\n\tend\n end\n\n @@last_relevant_for[node.path] ||= []\n @@last_relevant_for[node.path] << self\n \n else\n\n case node.path\n when @@regexp_trunk_file, @@regexp_branches_file\n\tself.make_relevant!\n\t# continue\n else\n\textra_rev = $extra_pathes[node.path]\n\tif extra_rev && @num <= extra_rev\n\t self.make_relevant!\n\telse\n\t return\n\tend\n end\n\n end\n \n STDOUT.puts \"# #{@num} is relevant for '#{node.path}'\" if $debug\n \n # check if this is a move from another module\n path = node['Node-copyfrom-path']\n unless $extra_pathes[path]\n case path\n when /trunk\\/([^\\/]+)\\/(.*)/\n\tfrom_module = $1\n\tSTDERR.puts \"#{@num} #{path}\" if from_module != filter\n when /branches\\/([^\\/]+)\\/([^\\/]+)\\/(.*)/, /tags\\/([^\\/]+)\\/([^\\/]+)\\/(.*)/\n\tfrom_module = $2\n\tSTDERR.puts \"#{@num} #{path}\" if from_module != filter\n when nil\n # skip\n else\n # STDERR.puts \"Unhandled #{path}\"\n end\n end\n @nodes << node\n\n end", "def ignore *node\n end", "def descendants_affected\n descendants\n end", "def node_within_block_or_conditional?(node, stop_search_node); end", "def query_body_nodes\n body_node = query_body_node\n query_body_node && query_body_node.elements\n end", "def for_node(*nodeargs)\n xpath, depth, ntype = *nodeargs\n\n return unless xpath\n\n offset = depth ? depth - @depth : 0 \n xpath_regex = ASpaceImport::Crosswalk::regexify_xpath(xpath, offset) \n\n @receivers.each do |p, r| \n yield r if r.receives_node? xpath_regex\n end \n end", "def search_children(node, attribute, search_term)\n matches = []\n end", "def nodes_near_me\n if @node['location'] && @node['location']['name']\n nodes_like_me['location.name' => @node.location.name]\n else\n nodes_like_me['location' => nil]\n end\n end", "def getNodes(root, xp=\"//xmlns:offer\", debug=true)\r\n\tnodes = root.xpath(xp)\r\n\tif debug\r\n\t\tputs nodes.count().to_s + \" nodes found\" \r\n\tend\r\n\treturn nodes\r\nend", "def visit_nodes(node)\n return if node.blank?\n if node.respond_to?(:each) # e.g. a list of nodes from a has_many association\n node.each { |n| visit_nodes(n) }\n else\n class_name = node.class.name\n @hash[class_name] ||= Set.new\n @hash[class_name] << visit(node)\n get_associations(node).each do |assoc|\n @logger.debug(\"Visiting #{assoc.name}\")\n new_nodes = node.send(assoc.name)\n next if new_nodes.blank?\n\n if new_nodes.respond_to?(:find_each)\n new_nodes.find_each { |n| visit_nodes(n) }\n else\n visit_nodes(new_nodes)\n end\n end\n\n end\n end", "def receives_node?(xpath_regex)\n return false unless self.class.xdef['xpath']\n \n unless @cache.has_key?(xpath_regex)\n @cache[xpath_regex] = self.class.xdef['xpath'].find { |xp| xp.match(xpath_regex) } ? true : false\n end\n \n @cache[xpath_regex]\n end", "def update( search_nodes )\n if has_target_predicate? then\n search_nodes.each do |node|\n if node.slot_filled?(@slot_name) then\n unless @target_predicate.apply(node[@slot_name].to_a).empty?\n yield( node )\n end \n end\n end\n else\n search_nodes.each do |node|\n yield( node )\n end\n end\n end", "def checkNode()\n source_set = []\n neighbor_set = []\n $networks.each do |s, nb|\n source_set << s\n nb[\"neighbors\"].each do |s_, dist|\n neighbor_set << s_\n end\n end\n source_set.sort!\n source_set.uniq!\n neighbor_set.sort!\n neighbor_set.uniq!\n return source_set == neighbor_set\nend", "def get_registered_nodes\n update_nodes\n @registered_nodes\n end", "def contains(node)\n return !(@nodes[node] == nil)\n end", "def on_axis_following(ast_node, context)\n nodes = XML::NodeSet.new\n root = root_node(@document)\n\n context.each do |context_node|\n check = false\n\n root.each_node do |doc_node|\n # Skip child nodes of the current context node, compare all\n # following nodes.\n if doc_node == context_node\n check = true\n throw :skip_children\n end\n\n next unless check\n\n nodes << doc_node if node_matches?(doc_node, ast_node)\n end\n end\n\n return nodes\n end", "def skipped_nodes\n select do |node|\n node.skipped?\n end\n end", "def filter!(filters)\n node_list = filter(filters)\n Util::assert! node_list.any?, \"Could not match any nodes from '#{filters}'\"\n return node_list\n end", "def node(node)\n true\n end", "def matches?(node) # rubocop:disable Lint/UnusedMethodArgument\n raise NotImplementedError\n end", "def get_others(nodes, metadata)\n record_call(:get_others, nodes, metadata)\n nodes.map do |node|\n [\n node,\n {\n downcase: \"_#{node}_\",\n last_3: node[-3..],\n nothing: \"#{node} has another nothing\"\n }\n ]\n end.to_h\n end", "def find_nodes(target_types, ignoring = [])\n result = []\n look_for_types(target_types, ignoring) { |exp| result << exp }\n result\n end", "def scanned_node?(node)\n scanned_nodes.any? do |scanned_node|\n scanned_node.equal?(node)\n end\n end", "def ret_matching_nodes(parent_idh)\n if parent_idh[:model_name] == :node\n return [parent_idh]\n end\n filter = [:eq, :assembly_id, parent_idh.get_id()]\n if node_filter = ret_filter(pattern, :node)\n filter = [:and, filter, node_filter]\n end\n sp_hash = {\n cols: [:id, :group_id, :display_name],\n filter: filter\n }\n Model.get_objs(parent_idh.createMH(:node), sp_hash)\n end", "def nodes\n []\n end", "def show\n @node = Node.find(params[:id])\n unless @node.status == '2'\n @matched_build_objects = BuildObject.actual.where(\"user_id != ?\", current_user)\n @matched_nodes = Node.includes{ [sell] }.where { (sell.user_id != my {current_user}) & ( status != 2 ) }.matched_by_node @node #(\"build_objects.user_id != ? AND status != 2\", current_user).matched_by_node @node\n @matched_build_objects = BuildObject.match(@node)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @node }\n end\n end", "def visit_e(node)\n ignore_node(node)\n end", "def not_visited(node, visited, unvisited)\n visited.each do |x,i|\n return false if x == node\n end\n \n unvisited.each do |x,i|\n return false if x == node\n end\n true\nend", "def nodes\n @nodes ||= {}\n end", "def nodes\n @nodes ||= {}\n end", "def listed(node)\n icons=[]\n node.each_element(\"icon\") do |nn|\n icons << nn.attributes[\"BUILTIN\"]\n end\n return !icons.include?(\"closed\")\n## icon= node.elements[\"icon\"]\n# return icon ? node.elements[\"icon\"].attributes[\"BUILTIN\"] != \"closed\" : true\n end", "def hemogenous?\n return true if empty?\n\n klass = nodes_by_id[selected_node_ids.first].class\n selected_nodes.all? { |n| n.class == klass }\n end", "def is_node?(); @type == GRT_NODE; end", "def search_missing_node_of(other_state)\n results = []\n\n other_state.job_names.each do |other_job_name|\n other_state.job_nodes(other_job_name).size.times do |i|\n other_node = other_state.job_nodes(other_job_name)[i]\n found_node = job_nodes(other_job_name)[i] || job_extra_node(other_job_name, i)\n # found in other state or this state doens't has it either\n if (other_node && other_node.existing?) || found_node.nil?\n results.push(other_node)\n else\n results.push(found_node)\n end\n end\n end\n\n other_state.resource_pool_names.each do |other_resource_pool_name|\n my_exisiting_nodes = (\n idle_nodes(other_resource_pool_name) +\n idle_extra_nodes(other_resource_pool_name)\n ).select(&:existing?)\n\n other_exisiting_nodes = other_state\n .idle_nodes(other_resource_pool_name)\n .select(&:existing?)\n\n my_exclusive_nodes = my_exisiting_nodes.select do |my_node|\n other_exisiting_nodes.find do |other_node|\n my_node.id == other_node.id\n end.nil?\n end\n\n other_state.idle_nodes(other_resource_pool_name).size.times do |i|\n other_node = other_state.idle_nodes(other_resource_pool_name)[i]\n if other_node && other_node.existing?\n results.push(other_node)\n else\n my_node = my_exclusive_nodes.pop\n if my_node\n results.push(my_node)\n else\n results.push(other_node)\n end\n end\n end\n end\n\n results\n end", "def remove_nonsense_nodes\n _clear_cache\n hash = {}\n self.each_node do |node|\n hash[node] = true if @pathway.graph[node].size == 2\n end\n hash.each_key do |node|\n adjs = @pathway.graph[node].keys\n edges = @pathway.graph[node].values\n new_edge = get_edge_merged(edges[0], edges[1])\n @pathway.graph[adjs[0]].delete(node)\n @pathway.graph[adjs[1]].delete(node)\n @pathway.graph.delete(node)\n @pathway.append(Bio::Relation.new(adjs[0], adjs[1], new_edge))\n end\n #@pathway.to_relations\n @pathway.relations.reject! do |rel|\n hash[rel.node[0]] or hash[rel.node[1]]\n end\n return hash.keys\n end", "def nodes_match?(other_nodes, self_nodes=nil)\n self_nodes = query_nodes.body if self_nodes.nil?\n return false unless other_nodes.size == self_nodes.size\n other_nodes.each_index { |index| return false unless node_match? other_nodes[index], self_nodes[index] }\n true\n end", "def nodes\n TestLab::Node.all\n end", "def remote_nodes\n nodes.select { |node| node.namespace != local_namespace }\n end", "def search_node_in_roles( roles )\n roles.each do |r|\n Chef::Log.info \"Searching for '#{self[:fqdn]}' in the '#{r}' role.\"\n if self.role?(r)\n # return true for the first match\n Chef::Log.info \"Whitelisting: Found node '#{self[:fqdn]}' via role '#{r}'.\"\n return true\n end\n end\n\n return false\n\n end", "def registered_node_types\n [Nodes::String, Nodes::Excludes, Nodes::MustInclude, Nodes::Text]\n end", "def nodes_like_me\n nodes[:environment => @node.environment]\n end", "def find_deepest_node(taxonomy_doc)\n xpath = [\"taxonomies\",\"taxonomy\",\"node\"]\n nodecount = taxonomy_doc.xpath(\"/\" + xpath.join(\"/\")).count\n while(nodecount > 0)\n xpath << \"node\"\n nodecount = taxonomy_doc.xpath(\"/\" + xpath.join(\"/\")).count\n end\n\n #pop off node that did not have any count and then we have the deeped node\n\n xpath.pop\n return xpath\n end", "def nested?\n @nodes.any?\n end", "def cleanup_node_lists(options)\n @disabled_nodes = Config::ObjectList.new\n @nodes.each do |name, node|\n if node.enabled || options[:include_disabled]\n if node['services']\n node['services'].to_a.each do |node_service|\n env(node.environment).services[node_service].node_list.add(node.name, node)\n env('_all_').services[node_service].node_list.add(node.name, node)\n end\n end\n if node['tags']\n node['tags'].to_a.each do |node_tag|\n env(node.environment).tags[node_tag].node_list.add(node.name, node)\n env('_all_').tags[node_tag].node_list.add(node.name, node)\n end\n end\n elsif !options[:include_disabled]\n log 2, :skipping, \"disabled node #{name}.\"\n @nodes.delete(name)\n @disabled_nodes[name] = node\n end\n end\n end", "def process_all_nodes\n debug 'Start processing all nodes'\n hook 'pre_all'\n each_node do |node|\n process_node node\n end\n hook 'post_all'\n end", "def node_ids() ; ext_info[:nodes] ; end", "def match_node(node, *args)\n match_nodes([node], *args)\n end", "def nodes_within?(src, chk)\n s = (src.is_a?(Array) ? src : [src]).map{|x|x.is_a?(ActiveRecord::Base) ? eval(\"x.#{configuration[:primary_key]}\") : x.to_s}\n c = (chk.is_a?(Array) ? chk : [chk]).map{|x|x.is_a?(ActiveRecord::Base) ? eval(\"x.#{configuration[:primary_key]}\") : x.to_s}\n if(s.empty? || c.empty?)\n false\n else\n q = configuration[:class].connection.select_all(\n \"WITH RECURSIVE crumbs AS (\n SELECT #{configuration[:class].table_name}.*, 0 AS level FROM #{configuration[:class].table_name} WHERE #{configuration[:primary_key]} IN (#{s.join(', ')})\n UNION ALL\n SELECT alias1.*, crumbs.level + 1 FROM crumbs JOIN #{configuration[:class].table_name} alias1 on alias1.#{configuration[:foreign_key]} = crumbs.#{configuration[:primary_key]}\n ) SELECT count(*) as count FROM crumbs WHERE #{configuration[:primary_key]} IN (#{c.join(', ')})\"\n )\n q.first['count'].to_i > 0\n end\n end", "def get_nothing(nodes, metadata)\n record_call(:get_nothing, nodes, metadata)\n # Here we return something to test that if the first one fails we have the second CMDB\n nodes.map { |node| [node, \"#{node} has nothing\"] }.to_h\n end", "def nodes_for_event(some_event)\n @subscribe_event_nodes_hash ||={}\n unless @subscribe_event_nodes_hash.key? some_event.event_name\n nodes = self.root.self_and_descendants.select{|layout| layout.section.global_event_array.include? some_event.event_name}\n @subscribe_event_nodes_hash[some_event.event_name] = nodes\n end\n @subscribe_event_nodes_hash[some_event.event_name]\n end", "def registered_node_types\n [Nodes::String, Nodes::MustExclude, Nodes::MustInclude, Nodes::Text]\n end", "def node_type; end", "def node_type; end", "def nodes()\n self.root.nodes()\n end", "def r_nodes\n support[:map].select do |key, node|\n node[:types].any? { |type| type.fetch(:only, {})[:language] == ['r'] }\n end\n end", "def node?\n node.present?\n end", "def blank_nodes\n bindings.values.select {|v| v.is_a?(RDF::Node)}.uniq\n end", "def extract_all_nodes(xpath, node = xml, namespaces = DEFAULT_NAMESPACES)\n _extract_nodes(:match, xpath, node, namespaces)\n end", "def shiny_gold_reachable_nodes\n # Init\n unvisited_nodes = @nodes_by_color.values\n # Nodes that can reach shiny gold node\n gold_reachable_nodes = Set.new\n\n until unvisited_nodes.empty?\n next_node = unvisited_nodes.pop\n\n # Can we find shiny gold?\n path = shiny_gold_path(next_node)\n\n # Cannot reach or at shiny gold. Try next node\n next if path.empty?\n\n # We can reach gold! Mark nodes in path as shiny gold reachable\n path.each do |node|\n # Shiny gold bag cannot contain itself\n next if is_shiny_gold_node?(node)\n\n gold_reachable_nodes << node\n\n # Mark as visited\n unvisited_nodes.delete(node)\n end\n end\n\n gold_reachable_nodes\n end", "def on_match_pattern(node); end", "def on_axis_preceding(ast_node, context)\n nodes = XML::NodeSet.new\n root = root_node(@document)\n\n context.each do |context_node|\n check = true\n\n root.each_node do |doc_node|\n # Test everything *until* we hit the current context node.\n if doc_node == context_node\n break\n elsif node_matches?(doc_node, ast_node)\n nodes << doc_node\n end\n end\n end\n\n return nodes\n end", "def select_nodes(&block)\n each_node.select &block\n end", "def starting_nodes(graph)\n graph.nodes.select { |node| node.incoming_edges.empty? }\n end", "def returns_from(node); end", "def returns_from(node); end", "def available_node_list\n all_nodes = Node.by_name\n return all_nodes.select {|node| node.status == \"RUNNING\"}\n end", "def deadend_nodes\n return enum_for(:deadend_nodes) if not block_given?\n @nodes.each { |n| yield n if n.out.empty? }\n end" ]
[ "0.67313445", "0.6549524", "0.6465936", "0.63065237", "0.6198803", "0.61699826", "0.60993725", "0.6084471", "0.5930449", "0.5846096", "0.58442694", "0.58442694", "0.58442694", "0.5839834", "0.58339185", "0.57709146", "0.5754333", "0.571414", "0.57138354", "0.57138354", "0.568086", "0.56565416", "0.56477886", "0.5638128", "0.56333715", "0.5619309", "0.5615988", "0.5608139", "0.56060463", "0.55822885", "0.555534", "0.5553166", "0.5551178", "0.55182815", "0.55173624", "0.5516864", "0.5505085", "0.5504276", "0.54789543", "0.54762787", "0.546614", "0.5465453", "0.54517365", "0.54505235", "0.5439646", "0.54240584", "0.54172564", "0.5416329", "0.5407795", "0.54063845", "0.5405843", "0.539931", "0.538783", "0.5377893", "0.5358063", "0.5352159", "0.5351817", "0.53507394", "0.5339777", "0.5339098", "0.5334758", "0.532524", "0.532524", "0.5315585", "0.5315275", "0.5313377", "0.5313022", "0.5306636", "0.5304363", "0.5301676", "0.5297685", "0.5279198", "0.5277391", "0.5274843", "0.52745134", "0.52700114", "0.5267007", "0.52657026", "0.5258422", "0.5258178", "0.52407324", "0.52343655", "0.520755", "0.52011377", "0.52009064", "0.52009064", "0.51970845", "0.5196585", "0.5190181", "0.5190112", "0.51859444", "0.5184084", "0.51840574", "0.5181987", "0.5181922", "0.51795685", "0.5178519", "0.5178519", "0.51746726", "0.516548" ]
0.5916563
9
For some reason Facebook's JavaScript SDK behaves differently when making API calls to OpenGraph This does a depth first traversal on the API response, look for the data key, and raises its contents by one depth
def reduce(nodes) for node in nodes if node.class==ActiveSupport::HashWithIndifferentAccess && node['data'] data_array = Array.new node['data'].map{|element| data_array << element[1]} node['data'] = data_array end if node.class==Array || node.class == ActiveSupport::HashWithIndifferentAccess reduce (node) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_data_about(item, keys = {})\n begin\n res = JSON.parse(token_get(item) || \"{}\") \n keys[:as] ? res[keys[:as]] : res\n rescue SocketError, Errno::ECONNRESET, OAuth2::HTTPError, EOFError => e\n # TODO :: hoptoad\n nil\n end\n end", "def test_relationship_influenced_by_single\r\n response = @rk.relationship_influenced_by(@user_single)\r\n assert_instance_of Hash, response\r\n assert_equal response[\"status\"], 200\r\n end", "def dummy_api_hit\n # barchart daily data api hit return\n {\"status\":{\"code\":200,\"message\":\"Success.\"},\"results\":\n [{\"symbol\":\"AAPL\",\"exchange\":\"BATS\",\"name\":\"Apple Inc\",\"dayCode\":\"R\",\n \"serverTimestamp\":\"2018-12-28T13:32:27-06:00\",\"mode\":\"i\",\"lastPrice\":157.51,\n \"tradeTimestamp\":\"2018-12-28T14:17:24-06:00\",\"netChange\":1.36,\n \"percentChange\":0.87,\"unitCode\":\"2\",\"open\":157.3,\"high\":157.65,\n \"low\":154.55,\"close\":0,\"flag\":\"\",\"volume\":1949701\n }]\n }\n end", "def example_result\n {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"user\",\n \"attributes\": {\n \"first_name\": \"test\",\n \"last_name\": \"jones\"\n },\n \"relationships\": {\n \"blogs\": {\n \"data\": [\n {\n \"id\": \"1\",\n \"type\": \"blog\"\n },\n {\n \"id\": \"3\",\n \"type\": \"blog\"\n }\n ]\n }\n }\n },\n \"included\": [\n {\n \"id\": \"1\",\n \"type\": \"blog\",\n \"attributes\": {\n \"title\": \"Blog 1\"\n },\n \"relationships\": {\n \"images\": {\n \"data\": [\n {\n \"id\": \"4\",\n \"type\": \"image\"\n },\n {\n \"id\": \"3\",\n \"type\": \"image\"\n }\n ]\n }\n }\n },\n {\n \"id\": \"3\",\n \"type\": \"blog\",\n \"attributes\": {\n \"title\": \"another blog 1\"\n },\n \"relationships\": {\n \"images\": {\n \"data\": [\n {\n \"id\": \"5\",\n \"type\": \"image\"\n }\n ]\n }\n }\n },\n {\n \"id\": \"4\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"ghg\"\n }\n },\n {\n \"id\": \"3\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"ii\"\n }\n },\n {\n \"id\": \"5\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"rty\"\n }\n }\n ]\n }\n end", "def process_response(response)\n instagram_hash = JSON.parse(response.body)\n next_url = instagram_hash.dig('pagination', 'next_url')\n data = instagram_hash.dig('data')\n [next_url, data]\nend", "def parse_nested_object(results, key, properties)\n links = results.collect do |result|\n link_uri = result[key]\n if link_uri\n linked_document, pipeline = fetch_document_to_index uri: link_uri, properties: properties, allowed_groups: allowed_groups\n linked_document\n else\n nil\n end\n end\n\n [key, denumerate(links)]\nend", "def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend", "def parse_for_relevant_nodes\n @relevant_nodes = Array.new\n\n reduce(params[:api_response].to_hash)['data'].each do | node |\n if node[1]['from']['id'] == params[:friend_id]\n @relevant_nodes << node[1]\n elsif node[1]['tags']\n node[1]['tags']['data'].each do |tagged_person|\n if tagged_person['id'] == params[:friend_id]\n @relevant_nodes << node[1]\n end\n end\n end\n end\n end", "def get_digg\n\nresponse = JSON.parse(RestClient.get 'http://digg.com/api/news/popular.json')\n# puts response['data']['feed'][0]['content']['title']\n\nstories = []\n\nresponse['data']['feed'].each do |story|\n\tstory_hash = {}\n\tstory_hash[:title] = story['content']['title']\n\tstory_hash[:category] = story['content']['tags'][0]['display']\n\tcalculate_upvotes(story_hash)\n\tstories.push(story_hash)\n\tend\n\tshow_all_stories(stories)\nend", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\nrescue Koala::Facebook::APIError => e\n logger.info e.to_s\n nil\nend", "def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end", "def parse_data_for_parser(doc, original_url, _jsonld_array)\n\n handle_exceptions(StandardError) do\n grabber = IdsGrabber.new(doc, url, original_url)\n set_data_field('user_uuid', grabber.user_id)\n set_data_field('object_id', grabber.post_id)\n set_data_field('uuid', grabber.uuid)\n set_data_field('external_id', grabber.uuid)\n\n @parsed_data['raw']['crowdtangle'] = get_crowdtangle_data(parsed_data['uuid']) || {}\n if has_valid_crowdtangle_data?\n crowdtangle_data = format_crowdtangle_result(parsed_data['raw']['crowdtangle'])\n updated_url = parsed_data.dig('raw', 'crowdtangle', 'posts', 0, 'postUrl')\n @url = updated_url if updated_url && updated_url != url\n @parsed_data.merge!(crowdtangle_data)\n else\n og_metadata = get_opengraph_metadata.reject{|k,v| v.nil?}\n\n if should_use_markup_title?\n set_data_field('title', get_unique_facebook_page_title(doc))\n else\n set_data_field('title', og_metadata['description']) unless NONUNIQUE_TITLES.include?(og_metadata['description']&.downcase)\n end\n set_data_field('description', og_metadata['description'])\n set_data_field('picture', og_metadata['picture'])\n end\n\n strip_facebook_from_title!\n\n @parsed_data['html'] = html_for_facebook_post(parsed_data.dig('username'), doc, url) || ''\n \n ['log in or sign up to view', 'log into facebook', 'log in to facebook'].each do |login|\n if @parsed_data[:title] && (@parsed_data[:title].downcase).include?(login)\n @parsed_data.merge!(\n title: url,\n description: '',\n )\n end\n end\n\n end\n \n parsed_data\n end", "def api_data\n expect(api_result).to match(\n {\n meta: an_instance_of(Hash),\n data: an_instance_of(Hash).or(an_instance_of(Array)).and(have_at_least(1).items)\n }\n )\n\n api_result[:data]\n end", "def fbCall(path,params = {})\n params['access_token'] = self.token ? self.token['access_token'] : self.originalFriend.token['access_token']\n getJSON(\"https://graph.facebook.com#{path}\", params)\n end", "def lookup\n # gets a page (Hash) or a FB error\n page = @key_master.get_page(params[:name])\n respond_to do |format|\n format.json do\n render json: page, status: (page.is_a?(Hash) ? :ok : :not_found)\n end\n end\n end", "def get_from_reddit\n response = JSON.load( RestClient.get('xhttp://www.reddit.com/r/bitcoin/.json') )\n\n response['data']['children'].map do |child|\n story = {\n title: child['data']['title'].first\n }\n end\nend", "def userinfo(access_token) \n querystr = \"https://graph.facebook.com/me?access_token=\"+access_token\n\n uri = URI.parse(URI.encode(querystr))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n result = JSON.parse(response.body)\n myinfo = {}\n if result['name']\n myinfo['name']=result['name']\n myinfo['fbid']=result['id']\n end\n return myinfo\n end", "def get_from_digg\n raw_response = RestClient.get('http://digg.com/api/news/popular.json')\n response = JSON.load(raw_response)\n\n response[\"data\"][\"feed\"].map do |story|\n story_hash = {\n title: story[\"content\"][\"title_alt\"],\n author: story[\"content\"][\"author\"],\n score: story[\"digg_score\"],\n category: story[\"content\"][\"tags\"].map {|tag| tag[\"display\"]}\n }\n end\n\n\nend", "def get_api_values(query) \n retval = perform_api_request(query) \n if retval[\"Status\"] != \"OK\" \n puts response.body \n raise \"Expected status OK, but was #{retval[\"Status\"]}\" \n end \n return retval[\"Value\"] \nend", "def get_other_friends(fbid)\n graph_url = \"https://graph.facebook.com/#{fbid}/friends?access_token=TOKEN\"\n parsed_resp = query_graph(graph_url)\n friends = parsed_resp[\"data\"]\n return friends\nend", "def load_daily_fb_stats_from_sm_directory(datekey_req)\n # get get a fb token ...\n # https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=client_credentials\n # returns access_token=xxxxxxxx|xxxxxxxxxx\n save_cnt = 0\n fb_graph_url_base = \"https://graph.facebook.com/\"\n\n fb_token_action = 'oauth/access_token'\n fb_token_url = fb_graph_url_base + fb_token_action\n conn = Faraday.new(url: fb_token_url, ssl: { verify: false }) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n response = conn.get do |req|\n req.headers['Content-Type'] = 'application/json'\n req.params['client_id'] = ENV['FB_APP_ID']\n req.params['client_secret'] = ENV['FB_APP_SECRET']\n req.params['grant_type'] = 'client_credentials'\n end\n\n fb_token = response.body.partition('access_token=').last if response.body.present?\n\n if response.status == 200 && fb_token.present?\n # https://graph.facebook.com/RevenantMovie?fields=likes,talking_about_count&access_token=<access_token>\n # returns\n # {\n # likes: 122615,\n # talking_about_count: 22026,\n # id: \"568876783246225\"\n # }\n SmDirectory.all.each do |sm_dir_record|\n if sm_dir_record.fb_id && sm_dir_record.tmdb_id\n sleep(0.5)\n puts \"Handling page name: #{sm_dir_record.fb_page_name}\"\n fb_url_w_alias = fb_graph_url_base + sm_dir_record.fb_id\n conn = Faraday.new(url: fb_url_w_alias, ssl: { verify: false }) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n\n response = conn.get do |req|\n req.headers['Content-Type'] = 'application/json'\n req.params['fields'] = 'likes,talking_about_count'\n req.params['access_token'] = fb_token\n end\n\n if response.status == 200\n # curr_sm_data = SmData.find_or_create_by(tmdb_id: curr_tmdb_id)\n curr_sm_data = SmData.where(:tmdb_id => sm_dir_record.tmdb_id, :date_key => datekey_req).first_or_create\n\n curr_sm_data.date_key = datekey_req unless curr_sm_data.date_key\n\n json_resp = JSON.parse(response.body)\n\n curr_fb_likes = json_resp['likes'].to_i\n curr_fb_talk_about = json_resp['talking_about_count'].to_i\n curr_fb_id = sm_dir_record.fb_id #json_resp['id']\n\n curr_sm_data.fb_id = curr_fb_id\n curr_sm_data.fb_likes = curr_fb_likes\n curr_sm_data.fb_talk_about = curr_fb_talk_about\n curr_sm_data.tmdb_id = sm_dir_record.tmdb_id\n curr_sm_data.fb_page_name = sm_dir_record.fb_page_name\n curr_sm_data.save\n\n puts \"Likes: #{curr_fb_likes.to_s}\"\n puts \"Talk about count: #{curr_fb_talk_about.to_s}\"\n puts \"FB id: #{curr_fb_id.to_s}\"\n puts \"Tmdb id: #{sm_dir_record.tmdb_id.to_s}\"\n puts \"FB page name: #{sm_dir_record.fb_page_name.to_s}\"\n\n save_cnt += 1\n end\n end\n end\n end\n puts \"FB stats update completed. Added/updated #{save_cnt.to_s} records.\"\nend", "def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end", "def make_recursive_call\n offset = 0\n p_args = set_pagination(offset, page_size, args)\n api_caller.verbosity(conn, method, *p_args)\n\n return if api_caller.opts[:noop]\n\n ret = api_caller.respond(conn.public_send(method, *p_args))\n\n return ret unless ret.more_items?\n\n loop do\n offset += page_size\n p_args = set_pagination(offset, page_size, p_args)\n api_caller.verbosity(conn, method, *p_args)\n resp = api_caller.respond(conn.public_send(method, *p_args))\n raise StopIteration unless resp.ok?\n\n ret.response.items += resp.response.items\n return finalize_response(ret) unless resp.more_items?\n end\n end", "def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end", "def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number of followees'\r\n assert follows[0]['id'] == 7\r\n assert follows[0]['follower_id'] == 9\r\n assert follows[1]['id'] == 8\r\n assert follows[1]['follower_id'] == 10\r\n assert follows[2]['id'] == 9\r\n assert follows[2]['follower_id'] == 11\r\n end", "def get_groups_in_group_set(group_set_id)\n group_set_data = Array.new\n\n @url = \"http://#{$canvas_host}/api/v1/group_categories/#{group_set_id}/groups\"\n puts \"@url is #{@url}\"\n \n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get groups in group set has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n group_set_data.append(@getResponse.parsed_response)\n\n while $link_parser.parse(@getResponse).by_rel('next')\n @url = $link_parser.parse(@getResponse).by_rel('next').target\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get groups in group set has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n group_set_data.append(@getResponse.parsed_response)\n end\n\n if @getResponse.empty?\n puts \"WARNING: No groups found in group set, program may not function correctly!\"\n end\n\n return group_set_data\nend", "def get_books(response)\n response[\"items\"]\nend", "def test_headlines_nested\n\n # load page\n page = Wiki::Api::Page.new name: \"program\"\n assert page.is_a?(Wiki::Api::Page), \"expected Page object\"\n headline = page.root_headline\n assert headline.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n assert headline.name == \"program\", \"expected developer headline\"\n\n # search nested headline: english\n english = headline.headline(\"english\").first\n assert english.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n\n # search nested headline: noun\n noun = english.headline(\"noun\").first\n assert noun.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n\n # get block\n block = noun.block\n assert block.is_a?(Wiki::Api::PageBlock), \"expected PageBlock object\"\n\n # list items\n block.list_items.each do |list_item|\n assert list_item.is_a?(Wiki::Api::PageListItem), \"expected PageListItem object\"\n # links\n list_item.links.each do |link|\n assert link.is_a?(Wiki::Api::PageLink), \"expected PageListItem object\"\n end\n end\n\n # links\n block.links.each do |link|\n assert link.is_a?(Wiki::Api::PageLink), \"expected PageListItem object\"\n end\n end", "def get_a_page_of_friends(req, opts)\n\tfriends_got = JSON.parse(Net::HTTP.get(URI(\"#{req}&access_token=#{opts[:token]}\")))\n\tunless friends_got[\"error\"].nil?\n\t\thandle_error friends_got[\"error\"]\n\tend\n\tif opts[:verbose]\n\t\tfriends_got[\"data\"].each do |f|\n\t\t\tprint \"#{f[\"display_name\"]}, \"\n\t\tend\n\tend\n\tfriends_got\nend", "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/') # web request\n character_hash = JSON.parse(all_characters)\n\n arr = nil\n character_hash[\"results\"].each do |key|\n if key[\"name\"] == character\n arr = key[\"films\"]\n end\n end\narr\nend", "def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend", "def root_of(input_hash)\n input_hash[\"Entities\"][\"Entity\"] rescue []\n end", "def index\n @graph = Koala::Facebook::API.new(session[:fb_access_token])\n profile = @graph.get_object(\"me\")\n puts profile\n end", "def get_character_movies_from_api(character)\n #make the web request\n page = 1\n # iterate over the character hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls,\n until page == 10\n all_characters = RestClient.get(\"https://swapi.co/api/people/?page=#{page}\")\n character_hash = JSON.parse(all_characters)\n\n character_hash[\"results\"].each do |value|\n if value[\"name\"] == character\n films_hash = value[\"films\"]\n end\n end\n page +=1\n end\n\nend", "def get_full_data(data)\n case @client.api_version\n when \"1.2\"\n # in this version returned id=>{...}\n result = @client.api_request(:method => \"template.get\", :params => {:filter => data, :output => \"extend\"})\n result.empty? ? [] : result.values \n else\n @client.api_request(:method => \"template.get\", :params => {:filter => data, :output => \"extend\"})\n end\n end", "def get_character_movies_from_api(character)\n #make the web request\n link = \"http://www.swapi.co/api/people/\"\n character_hash = parse_json(link)\n link = character_hash[\"next\"]\n\n while link != nil\n character_hash[\"results\"] = character_hash[\"results\"].replace(parse_json(link)[\"results\"])\n break if check_for_character(character_hash[\"results\"], character)\n link = parse_json(link)[\"next\"]\n end\n\n char = get_character_info(character_hash, character)\n\nend", "def find_wikidata_item_by_steam_app_id(app_id)\n endpoint = \"https://query.wikidata.org/sparql\"\n \n client = SPARQL::Client.new(\n \"https://query.wikidata.org/sparql\",\n method: :get,\n headers: { 'User-Agent': \"Connor's Random Ruby Scripts Data Fetcher/1.0 (connor.james.shea@gmail.com) Ruby 2.6\" }\n )\n sparql = query(app_id)\n begin\n rows = client.query(sparql)\n rescue SocketError => e\n puts e\n sleep 5\n return nil\n end\n\n # If there are 0 rows (no data returned) or more than one row, just skip it.\n if rows.size != 1\n print '.'\n return nil\n end\n return_row = {}\n rows.each do |row|\n return_row = { url: row.to_h[:item].to_s, title: row.to_h[:itemLabel].to_s }\n end\n\n return return_row\nend", "def check_response_hash(body)\n body.keys.include?('offers') && ### Check if offers key exists\n body[:offers].is_a?(Array) && ### Check if offers is an Array\n (body[:offers].first.nil? || ### Check if first elem of offers is nil or\n (body[:offers].first.keys.include?('title') && ### If the first elem exists check if first elem contains the key title\n body[:offers].first.keys.include?('payout') && ### check if first elem contains the key payout\n body[:offers].first.keys.include?('thumbnail') && ### check if first elem contains the key thumbnail\n body[:offers].first[:thumbnail].is_a?(Hash) && ### check if value corresponding to the key thumbnail is a Hash\n body[:offers].first[:thumbnail].keys.include?('lowres'))) ### check if value corresponding to the key thumbnail contains the key lowres\n end", "def parse_response(data)\n doc = REXML::Document.new(data)\n\n values = {}\n\n elements = doc.elements[\"/OPS_envelope/body/data_block/dt_assoc\"].select { |item|\n item.is_a? REXML::Element\n }\n\n build_xml_hash(elements)\n end", "def fetch_parsed_response(query, reverse = false)\n if doc = fetch_raw_response(query, reverse)\n ActiveSupport::JSON.decode(doc)\n end\n end", "def checkLode()\r\n print \"Retrieving FC members from xivapi... \"\r\n # Retrieve current FC members from Lodestone and convert to hash\r\n # mapped by ID\r\n url = \"https://xivapi.com/freecompany/9232097761132854687?data=FCM\"\r\n uri = URI(url)\r\n response = Net::HTTP.get(uri)\r\n parse = JSON.parse(response, object_class: OpenStruct).FreeCompanyMembers\r\n lodeMembers = Hash.new\r\n\r\n parse.each do |member|\r\n \tlodeMembers[member.ID] = member\r\n end\r\n puts \"Finished.\"\r\n return lodeMembers\r\nend", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n # error recovery (block-ish so can be shared across the rest of the Facebook methods)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n if Rails.env.production?\n logger.info e.to_s\n nil\n else\n raise e\n ### e.fb_error_xx parses the error, as in e.fb_error_type, e.fb_error_code, ...\n end\n end", "def get\n raise NoMethodError unless is_full_route? @cur_route\n @retrieved_url = @cur_url\n response = HTTParty.get(\"https://api.uwaterloo.ca/v2#{@cur_url}.json\", { query: { key: @api_key, format: 'json' } })\n case response.code\n when 400...600\n raise \"UWaterloo API Server returned a #{response.code} error\"\n end\n @response = RecursiveOpenStruct.new response, recurse_over_arrays: true\n @meta = response['meta']\n @response.data\n end", "def get_character_movies_from_api(character)\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n results = []\n still_searching = true\n\n while still_searching\n results << character_hash[\"results\"] # results pushed into results array on every loop iteration\n if character_hash[\"next\"]\n next_page = RestClient.get(character_hash[\"next\"])\n character_hash = JSON.parse(next_page)\n else\n still_searching = false\n end\n end\n\n results = results.flatten\n results = results.select {|chara| chara[\"name\"].downcase == character}\n # results is an array containing a hash\n\n if results.length > 0\n film_hash = results[0][\"films\"].map do |film_url|\n film = RestClient.get(film_url)\n film = JSON.parse(film)\n end\n end\nend", "def test_consumer_business_response\n # Step 1\n get_inspectify_consumer_business_resp(471096462)\n assert_response(@response, :success)\n assert_inspectify_response(@parsed_response, :success)\n end", "def find_element(h)\n h.each do |key, value|\n if value.is_a? Hash\n find_element(h[key])\n else\n puts value\n end\n end\nend", "def faux_api_response\n api_response_data = [\n {\n \"id\" => \"col-aaaaa\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-aaaaa\",\n \"status\" => \"rejected\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => \"2013-08-13T13:21:58Z\",\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-aaaaa\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-aaaaa\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n },\n {\n \"id\" => \"col-bbbbb\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-bbbbb\",\n \"status\" => \"pending\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => nil,\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-aaaaa\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-aaaaa\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n },\n {\n \"id\" => \"col-ccccc\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-ccccc\",\n \"status\" => \"pending\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => nil,\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-bbbbb\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-bbbbb\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n }\n ]\n # Collection#load is private in fog so we can't just pass our collection\n # into get the correct object initialised.\n api_response_data.map do |datum|\n Fog::Brightbox::Compute::UserCollaboration.new(datum)\n end\n end", "def photos limit = 50\n query = {\n photos: \"SELECT object_id, caption, src_big, owner, link, caption, created FROM photo WHERE owner = #{@id} ORDER BY created DESC LIMIT #{limit}\",\n comments: \"SELECT id, fromid, time, text, object_id, parent_id FROM comment WHERE object_id IN(SELECT object_id FROM #photos) ORDER BY time DESC LIMIT 10\",\n users: \"SELECT uid, name FROM user WHERE uid IN(SELECT owner FROM #photos) OR uid IN(SELECT fromid FROM #comments)\",\n pages: \"SELECT page_id, name FROM page WHERE page_id IN(SELECT owner FROM #photos) OR page_id IN(SELECT fromid FROM #comments)\"\n }\n\n proxy_exceptions do\n query = FbGraph::Query.new(query).fetch(access_token: @access_token)\n\n query[:photos].map do |photo_data|\n Services::Facebook::Photo.new do |photo|\n photo.id = photo_data[:object_id]\n photo.link = photo_data[:link]\n photo.source = photo_data[:src_big]\n photo.caption = photo_data[:caption]\n photo.created_at = Time.at photo_data[:created]\n\n ## The author of a video can be either a User or a Page.\n user_or_page_data = query[:users].find { |user_data| user_data[:uid] == photo_data[:owner] } ||\n query[:pages].find { |page_data| page_data[:page_id] == photo_data[:owner] }\n\n # There may occasionally be no data for the author of a comment, despite the 'fromid' of the comment being\n # set to a valid Facebook ID. There's no documentation as to the circumstances under which this occurs, but it\n # is generally assumed that it is because the user that queries it doesn't have access to view it (for example,\n # the user could fall outside of geographical limitations set by the page that authored the comment).\n if user_or_page_data\n photo.author = new_user user_or_page_data\n end\n\n ## To find the post a comment belongs to, we must compare its 'object_id' attribute and to part of the post's id.\n comments_data = query[:comments].select { |comment_data| comment_data[:object_id] == photo_data[:object_id] }\n\n photo.comments = new_comments comments_data, users: query[:users], pages: query[:pages]\n end\n end\n end\n end", "def movie_info(movie_url)\n movie_hash = get_movies_from_api\n movie_hash[\"results\"].find do |movie_info|\n movie_info[\"url\"] == movie_url\n end\nend", "def results\n response['data']\n end", "def get_source_actions(blob)\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_source_actions] Entering\")\n\n hash = {}\n\n if !blob[\"likes\"].blank? and (blob[\"likes\"][\"count\"] > 0)\n friends = []\n array = blob[\"likes\"][\"data\"][0..4]\n\n if !array.blank?\n array.each do |attr|\n friends << {:name => attr[\"name\"], :id => attr[\"id\"]}\n end\n end\n\n hash[\"likes\"] = {:count => blob[\"likes\"][\"count\"], :meta => {:friends => friends }}\n end\n\n if !blob[\"comments\"].blank? and (blob[\"comments\"][\"count\"] > 0)\n\n friends = []\n array = blob[\"comments\"][\"data\"][0..4]\n\n if !array.blank?\n array.each do |attr|\n friends << {:name => attr[\"from\"][\"name\"], :id => attr[\"from\"][\"id\"]} if !attr[\"from\"].blank?\n end\n end\n\n hash[\"comments\"] = {:count => blob[\"comments\"][\"count\"], :meta => {:friends => friends}}\n end\n\n if !blob[\"shares\"].blank? and (blob[\"shares\"][\"count\"] > 0)\n hash[\"shares\"] = {:count => blob[\"shares\"][\"count\"], :meta => {}}\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_source_actions] Leaving #{hash}\")\n\n hash\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_source_actions] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return {}\n end", "def get_objects(data,*moredata)\n parms = legacy_getparms(data,moredata)\n # def get_objects(objecttype, get, exactget, regexget, exclude, andget, includes=nil, login=nil, password_callback=PasswordCallback)\n objecttype = parms[:objecttype]\n get = parms[:get]\n exactget = parms[:exactget]\n regexget = parms[:regexget]\n exclude = parms[:exclude]\n andget = parms[:andget]\n includes = parms[:includes]\n login = parms[:login]\n password_callback = parms[:password_callback]\n # PS-704 - node_groups controller when format.xml, includes some custom model methods that create a lot of querying joins, so this is\n # a way to 'override' it on cli side - the server will look for that param to skip these def methods when it renders. webparams = {:nodefmeth => 1}\n webparams = parms[:webparams]\n #\n # Package up the search parameters in the format the server expects\n #\n metaget = []\n if get\n get.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exactget\n exactget.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"exact_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exact_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if regexget\n regexget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"regex_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"regex_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exclude\n exclude.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"exclude_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exclude_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if andget\n andget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"and_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"and_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if includes\n # includes = ['status', 'rack:datacenter']\n # maps to\n # include[status]=&include[rack]=datacenter\n includes.each do |inc|\n incstring = ''\n if inc.include?(':')\n incparts = inc.split(':')\n lastpart = incparts.pop\n incstring = 'include'\n incparts.each { |part| incstring << \"[#{part}]\" }\n incstring << \"=#{lastpart}\"\n else\n incstring = \"include[#{inc}]=\"\n end\n metaget << incstring\n end\n end\n if webparams && webparams.kind_of?(Hash)\n webparams.each_pair{|k,v| metaget << \"#{k}=#{v}\"}\n end\n\n querystring = metaget.join('&')\n\n #\n # Send the query to the server\n #\n\n if parms[:format] == 'json'\n if HAS_JSON_GEM\n uri = URI::join(@server, \"#{objecttype}.json?#{querystring}\")\n else\n warn \"Warning: Cannot use json format because json gem is not installed. Using xml format instead.\"\n parms[:format] = 'xml'\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n else\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n\n req = Net::HTTP::Get.new(uri.request_uri)\n warn \"GET URL: #{uri}\" if (@debug)\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Get.new(uri.request_uri)\n response = send_request(req, uri, login, password_callback)\n end\n if !response.kind_of?(Net::HTTPOK)\n puts response.body\n response.error!\n end\n\n if parms[:format] == 'json'\n results = JSON.parse(response.body)\n else\n #\n # Parse the XML data from the server\n # This tries to render the XML into the best possible representation\n # as a Perl hash. It may need to evolve over time.\n puts response.body if (@debug)\n results_xml = REXML::Document.new(response.body)\n results = {}\n if results_xml.root.elements[\"/#{objecttype}\"]\n results_xml.root.elements[\"/#{objecttype}\"].each do |elem|\n # For some reason Elements[] is returning things other than elements,\n # like text nodes\n next if elem.node_type != :element\n data = xml_to_ruby(elem)\n name = data['name'] || data['id']\n if !results[name].nil?\n warn \"Duplicate entries for #{name}. Only one will be shown.\"\n end\n results[name] = data\n end\n end\n end\n\n #puts results.inspect if (@debug)\n puts YAML.dump(results) if (@debug)\n results\n end", "def fetch_data(api_url)\n JSON.parse(RestClient.get(api_url))\nend", "def extract_content_from_json(body)\n begin\n query_hash = body['query']['pages']\n query_id = query_hash.keys.first\n content = query_hash[query_id]['extract']\n if content.empty?\n return \"404. Not a valid UFC PPV\"\n else\n puts content\n content\n end\n rescue\n puts \"404. Not a valid UFC PPV.\"\n end\n end", "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 get_subdomains entity_name, api_key, headers, url\n\n response = http_get_body(url,nil,headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"count\"] != 0\n # Create subdomains\n json[\"cidr\"][\"cidr16\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n # Create subdomains\n json[\"cidr\"][\"cidr24\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n\n # Create list of related organizations\n json[\"data\"][\"as\"][\"results\"].each do |e|\n _create_entity(\"Organization\", \"name\" => e[\"entity\"][\"organization\"])\n end\n\n # Create list of related countrys\n json[\"data\"][\"country\"][\"results\"].each do |e|\n _create_entity(\"PhysicalLocation\", \"name\" => e[\"entity\"][\"value\"])\n end\n\n # Create list of related IPs\n json[\"data\"][\"ip\"][\"results\"].each do |e|\n _create_entity(\"IpAddress\", \"name\" => e[\"entity\"][\"value\"])\n end\n end\n end", "def play\n data = self.get_api_response(\"https://opentdb.com/api.php?amount=3&category=11\")[\"results\"][0]\n return data\n end", "def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend", "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 try\r\n\r\n\tif session[\"fb_access_token\"].present?\r\n\t@fql = Koala::Facebook::API.new(session[\"fb_access_token\"])\r\n\tfql = @fql.fql_query(\"SELECT eid FROM event_member WHERE uid = me()\")\r\n\tend\r\nend", "def get_movies_data(character_data)\n if character_data\n character_films = character_data[\"films\"]\n movie_response_string = character_films.map {|film_url| RestClient.get(film_url)}\n movie_response_string.map {|response_string| JSON.parse(response_string)}\n else\n nil\n end\nend", "def search_by_string entity_name,headers\n begin\n\n page_num = 1\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n\n while json[\"entries\"] do\n page_num += 1\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n end\n\n end\n end\n #exciption\n rescue JSON::ParserError => e\n _log_error \"Unable to parse JSON: #{e}\"\n end\n\n end", "def eval_presign_get_by_node_key(r)\n if r.status == 409\n download_response\n elsif r.status == 200\n JSON.parse(r.content).with_indifferent_access\n elsif r.status == 404\n render file: \"#{Rails.root}/public/404.html\", status: 404, layout: nil\n else\n render file: \"#{Rails.root}/public/500.html\", status: r.status, layout: nil\n end\n end", "def fetch_api_codewars_kata_info\n private_fetch_kata\n end", "def get_metadata_response(metadata)\n if metadata.respond_to?(:has_key?)\n listing = []\n metadata.keys.sort.each do |key|\n value = metadata[key]\n if value.respond_to?(:has_key?)\n listing << key + '/'\n else\n listing << key\n end\n end\n return listing.join(\"\\n\")\n end\n return metadata\n end", "def get_nodegroup(nodegroup_name)\n response = get_nodegroups()\n # Parse the JSON into ruby array of hashes\n JSON.parse(response).each do |record|\n # Return the hash of the nodegroup we were looking for\n if record[\"name\"] == nodegroup_name\n return record\n end\n end\n return nil\nend", "def parse_data_for_parser(doc, _original_url, _jsonld_array)\n set_data_field('description', url)\n\n handle_exceptions(StandardError) do\n @parsed_data[:raw][:api] = @parsed_data[:raw][:oembed] = get_tiktok_api_data(url)\n if url.match(TIKTOK_ITEM_URL)\n match = url.match(TIKTOK_ITEM_URL)\n username = match['username']\n external_id = match['id']\n title = parsed_data['raw']['api']['title']\n elsif url.match(TIKTOK_TAG_URL) \n username = ''\n external_id = ''\n title = \"Tag: \" + url.match(TIKTOK_TAG_URL)['tag']\n else\n username = ''\n external_id = ''\n title = parsed_data['raw']['api']['title']\n end\n\n @parsed_data.merge!({\n username: username,\n external_id: external_id,\n description: title,\n title: title,\n picture: parsed_data['raw']['api']['thumbnail_url'],\n author_url: parsed_data['raw']['api']['author_url'],\n html: parsed_data['raw']['api']['html'],\n author_name: parsed_data['raw']['api']['author_name']\n })\n end\n parsed_data\n end", "def test_get_detail_info\n puts \"## get detail info about an object##\"\n resp = Salesforce::Rest::Account.xget_detail_info()\n\n resp.each {|key, val| pp key + ' => ' + val.to_s}\n #puts \"***now:*** data => \" + resp.body\n assert !resp.nil?\n end", "def data\n _response_entity.fetch(\"data\", {})\n end", "def group_exists(element)\n name = element[\"group\"]\n auth = element[\"auth\"] \n body = {\n \"jsonrpc\" => \"2.0\",\n \"method\" => \"hostgroup.get\",\n \"params\" => {\n \"output\" => \"extend\",\n \"filter\" => {\n \"name\" => name\n }\n },\n \"auth\" => auth,\n \"id\" => rand(9999)\n }\n\n result = json_body(body)\n # puts result \n if result == []\n return result\n else\n result = result[0][\"groupid\"]\n return result \n end\nend", "def getSalesforceRecordByRestforce(query)\n #puts query\n record = @restForce.getRecords(\"#{query}\")\n #puts \"record fetched....in helper\"\n if record.size > 1 then\n puts \"Multiple records handle carefully....!!!\"\n elsif record.size == 0 then\n puts \"No record found....!!!\"\n return nil \n end\n #puts record[0].attrs\n return record\n rescue Exception => e \n puts e\n return nil\nend", "def get_url (token, endpoint, url_params)\n\n # Build url param string from passed hash\n url_params[\"access_token\"] = token\n params = \".json?\"\n url_params.each do |key,value|\n if value != ''\n params = params + key + \"=\" + value + \"&\"\n end\n end\n\n req_url = Base_url + endpoint + params\n #puts\"URL: #{req_url}\"\n\n # GET request from API\n begin\n response = RestClient.get req_url\n rescue => e\n puts \" #{JSON.parse(e.response)[\"message\"]} (#{e.message})\".red\n #puts e.backtrace\n abort \"Aborting!\"\n end\n # Convert JSON response to a hash using symbols\n resp_hash = JSON.parse(response, symbolize_names: true)\n\n # If there is a 'next' link then there is more data, warn user of this\n if resp_hash[:_links][:next] != nil\n puts \"WARNING!: All response data may not be shown, increase 'limit' setting\".red\n end\n \n return resp_hash \nend", "def search_by_emailaddress entity_name,headers\n\n begin\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=1\",nil,headers)\n json = JSON.parse(response)\n puts json\n\n #check if entries different to null\n if json[\"entries\"]\n\n\n json[\"entries\"].each do |e|\n\n #check if email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if IP address different to null and create entity\n if e[\"ip_address\"]\n _create_entity(\"IpAddress\", {\"name\" => e[\"ip_address\"]})\n\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n #create an issue about the investigited email\n _create_issue({\n name: \"leak found related to: #{_get_entity_name}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n end\n while json[\"entries\"] do\n page_num += 1\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n\n end\n return\n end\n end\n #exciption\n rescue JSON::ParserError => e\n _log_error \"Unable to parse JSON: #{e}\"\n end\n\n end", "def graphql_dig(*args)\n formatted_args = args.map { |arg| arg.to_s.camelize(:lower) }\n data = body.dig('data', *formatted_args)\n data.deep_symbolize_keys! if data.is_a?(Hash)\n data.map!(&:deep_symbolize_keys) if data.is_a?(Array)\n data\n end", "def instagram\n @data['social']['instagram']\n end", "def jsonapi_received_relationships\n\t\t\t\t\t# Relationship definitions for current model\n\t\t\t\t\trels = jsonapi_relationships\n\n\t\t\t\t\t# Consider only current relationship for relationship actions\n\t\t\t\t\t# (params[:relationship] contains the relationship name)\n\t\t\t\t\tif params[:relationship] \n\n\t\t\t\t\t\trels.select! do |rel|\n\t\t\t\t\t\t\trel[:name].to_sym == params[:relationship].to_sym\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# If no relationship is received, then return the definition only\n\t\t\t\t\t\tif request.method == \"GET\"\n\t\t\t\t\t\t\treturn rels.collect do |rel|\n\t\t\t\t\t\t\t\t{definition: rel}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\n\t\t\t\t\trels.collect do |relationship|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\treceived_params = nil\n\n\t\t\t\t\t\t\t# Relationship action\n\t\t\t\t\t\t\tif params[:relationship]\n\t\t\t\t\t\t\t\treceived_params = params.permit({\n\t\t\t\t\t\t\t\t\tdata: [\n\t\t\t\t\t\t\t\t\t\t:type, :id\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t# Object action\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\treceived_params = params.require( \n\t\t\t\t\t\t\t\t\t:data\n\t\t\t\t\t\t\t\t).require(\n\t\t\t\t\t\t\t\t\t:relationships\n\t\t\t\t\t\t\t\t).require(\n\t\t\t\t\t\t\t\t\trelationship[:name]\n\t\t\t\t\t\t\t\t).permit({\n\t\t\t\t\t\t\t\t\tdata: [\n\t\t\t\t\t\t\t\t\t\t:type, :id\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# => {\"data\"=>{\"type\"=>\"users\", \"id\"=>1}} # sample value for a to-one association\n\t\t\t\t\t\t\t# => {\"data\"=>[{\"type\"=>\"properties\", \"id\"=>1}, {\"type\"=>\"properties\", \"id\"=>2}]} # sample value for a to-many association\n\n\t\t\t\t\t\t\t# is received data conformant to the database schema? \n\t\t\t\t\t\t\tconformant = true\n\t\t\t\t\t\t\tloop do\n\t\t\t\t\t\t\t\t# to-many\n\t\t\t\t\t\t\t\tif received_params[:data].kind_of? Array\n\t\t\t\t\t\t\t\t\tif relationship[:type] != :to_many\n\t\t\t\t\t\t\t\t\t\tconformant = false\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\treceived_params[:data].each do |item|\n\t\t\t\t\t\t\t\t\t\tnext if item[:type].to_sym == relationship[:receiver][:type]\n\t\t\t\t\t\t\t\t\t\tconformant = false\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t# to-one\n\t\t\t\t\t\t\t\tif relationship[:type] != :to_one\n\t\t\t\t\t\t\t\t\tconformant = false\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tconformant = false unless received_params[:data][:type].to_sym == relationship[:receiver][:type]\n\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tnext unless conformant\n\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdefinition: relationship,\n\t\t\t\t\t\t\t\tparams: received_params\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\trescue ActionController::ParameterMissing => e\n\n\t\t\t\t\t\t\t# nil assignment to to-one relationship?\n\t\t\t\t\t\t\tif relationship[:type] == :to_one\n\t\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\t\tif params[:relationship] # relationship action\n\t\t\t\t\t\t\t\t\t\treceived_params = params.permit(\n\t\t\t\t\t\t\t\t\t\t\t:data\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\treceived_params = params.require( \n\t\t\t\t\t\t\t\t\t\t\t:data\n\t\t\t\t\t\t\t\t\t\t).require(\n\t\t\t\t\t\t\t\t\t\t\t:relationships\n\t\t\t\t\t\t\t\t\t\t).require(\n\t\t\t\t\t\t\t\t\t\t\trelationship[:name]\n\t\t\t\t\t\t\t\t\t\t).permit(\n\t\t\t\t\t\t\t\t\t\t\t:data\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\t# received nil?\n\t\t\t\t\t\t\t\t\tnext if received_params[:data] # TODO: should return error to client?\n\n\t\t\t\t\t\t\t\t\tnext {\n\t\t\t\t\t\t\t\t\t\tdefinition: relationship,\n\t\t\t\t\t\t\t\t\t\tparams: received_params\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trescue ActionController::ParameterMissing => e\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tnil\n\t\t\t\t\t\tend\n\t\t\t\t\tend.compact\n\t\t\t\tend", "def find_custom_data(endpoint, id)\n restHttpGet(\"#{endpoint}/#{id}/custom\")\n case @res.code\n when 200\n JSON.parse(@res)\n when 404\n nil\n else\n @res.code.to_s.should match(/^(200|404)$/)\n end\nend", "def data\n case response_object\n when Hash\n open_envelope(response_object)\n else\n response_object\n end\n end", "def get_social_reach(person)\n person\n\n .loop do |p|\n p.in_e(:FOLLOWS).out_v(type: 'person').uniq\n end\n\n .while do |p, depth|\n if depth == 0\n :loop\n else depth <= 6\n :loop_and_emit\n else\n false\n end\n end", "def read_linked_data_api(entry)\n ld_api.call(entry.url) { |response, data| return response.body, data }\n end", "def index\n @fb_id, access_token = get_fb_info()\n @graph = get_graph(access_token)\n\n if @graph.nil?\n redirect_to '/auth/facebook'\n else\n friends = Hash.new\n begin\n explorer = Explorer.find_by_explorer_id(@fb_id)\n friend_id = (explorer.nil?) ? nil : explorer.friend_id\n\n top_friends = get_top_friends_likes(@graph,friend_id)\n unless top_friends.nil?\n top_friends.each do |friend_hash|\n if friends[friend_hash['user_id']].nil?\n friends[friend_hash['user_id']] = 1\n else\n friends[friend_hash['user_id']] = friends[friend_hash['user_id']] + 1\n end\n end\n @hashAsArrays = friends.to_a # converts into two dimensional array\n @hashAsArrays = @hashAsArrays.sort_by{|k,v| v} #sort by value\n @hashAsArrays = @hashAsArrays.reverse\n @names = get_basic_users_info(@graph, friends.keys)\n friends = nil\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @max_likes }\n end\n rescue => e\n @error_flag = true\n end\n end\n\n end", "def get_coin_data(url, key)\n begin\n response = RestClient.get url\n json_response = JSON.parse(response)\n if (!json_response['result'])\n logger.error 'ERROR OBJECT AT ' + url\n logger.error json_response['error'][0]\n return nil\n elsif (key != '') \n return json_response['result'][key]\n else\n # otherwise return w/o looking for a key\n return json_response['result']\n end\n\n rescue => error\n # if there was an http error, then show it - however return an empty array, so there is something there\n logger.error 'error retrieving url ------------------ ' + url\n logger.error error\n return nil\n end\n end", "def yelp_business_lookup(business_id)\n response = business(business_id)\n\n puts \"Found business with id #{business_id}:\"\n puts JSON.pretty_generate(response)\n\n puts response\n\n puts response['id']\n puts response['name']\n puts response['image_url']\n puts response['photos'][0]\n puts response['photos'][1]\n puts response['photos'][2]\n puts response['coordinates']['latitude']\n puts response['coordinates']['longitude']\n puts response['price']\n\n\n #puts response['photos[1]']\n #puts response['photos[2]']\n\n #puts response['coordinates]['latitude']\n\n\n # Using create command to create record in one-short if the Business record not exists in the database.\n count = Business.count(:yelp_id => response['id'])\n puts \"Business Record Count with this ID = \" + count.to_s\n\n if Business.count(:yelp_id => response['id']) == 0\n\n Business.create(:yelp_id => response['id'],\n :yelp_name => response['name'],\n :image_url => response['image_url'],\n :is_claimed => response['is_claimed'],\n :is_closed => response['is_closed'],\n :url => response['url'],\n :price => '$$$$',\n :rating => response['rating'],\n :review_count => response['review_count'],\n :phone => response['phone'],\n :photo1_url => response['photos'][0],\n :photo2_url => response['photos'][1],\n :photo3_url => response['photos'][2],\n :coordinates_latitude => response['coordinates']['latitude'],\n :coordinates_longitude => response['coordinates']['longitude']\n )\n end\nend", "def jsonapi_deserialize(document)\n\n # Optional fields, if present, convert to snake/symbol\n # data - (if present, flatten it accordingly to jsonapi spec)\n # include\n # fields\n # filter\n # sort\n # page\n # platform\n\n # Duplicate document and convert to JSON\n # if document.is_a?(ActionController::Parameters)\n # primary_data = document.dup.as_json\n if document.respond_to?(:permit!)\n # Handle Rails params...\n primary_data = document.dup.require(:data).permit!.as_json\n elsif document.is_a?(Hash)\n primary_data = document.as_json.deep_dup\n else\n return {}\n end\n\n # This is the hash that is going to be returned\n parsed = {}\n parsed['include'] = primary_data['include'] if primary_data['include']\n parsed['fields'] = primary_data['fields'] if primary_data['fields']\n parsed['filter'] = primary_data['filter'] if primary_data['filter']\n parsed['sort'] = primary_data['sort'] if primary_data['sort']\n parsed['page'] = primary_data['page'] if primary_data['page']\n parsed['platform'] = primary_data['platform'] if primary_data['platform']\n\n # Convert primary_data to snake_case\n _primary_data = primary_data.deep_transform_keys(&:underscore)\n\n if _primary_data['data']\n relationships = _primary_data['data']['relationships'] || {}\n parsed['id'] = _primary_data['id'] if _primary_data['id']\n\n # Map _primary_data['data']['attributes'] to parsed hash\n if _primary_data['data']['attributes'].respond_to? :each\n _primary_data['data']['attributes'].each do |key, val|\n parsed[key] = val\n end\n end\n\n relationships.map do |assoc_name, assoc_data|\n assoc_data = (assoc_data || {})['data'] || {}\n rel_name = jsonapi_inflector.singularize(assoc_name)\n\n if assoc_data.is_a?(Array)\n parsed[\"#{rel_name}_ids\"] = assoc_data.map { |ri| ri['id'] }.compact\n next\n end\n\n parsed[\"#{rel_name}_id\"] = assoc_data['id']\n if (options['polymorphic'] || []).include?(assoc_name)\n rel_type = jsonapi_inflector.classify(assoc_data['type'].to_s)\n parsed[\"#{rel_name}_type\"] = rel_type\n end\n end\n end\n\n # Convert to symbols before returning to client\n parsed.deep_transform_keys!(&:to_sym)\n end", "def json_ld; end", "def query_ol_api(call_number:)\n conn = Faraday.new(url: \"#{catalog_host}/catalog.json\")\n result = conn.get do |req|\n req.params[\"search_field\"] = \"all_fields\"\n req.params[\"f[call_number_browse_s][]\"] = call_number\n end\n\n json = JSON.parse result.body\n # return nil unless json[\"response\"][\"docs\"].count.positive?\n json[\"response\"][\"docs\"].map { |doc| doc[\"id\"] } # will be [] if no results\n end", "def paginate_all_data(url:, more_params: nil)\n query_params = \"since=#{@start_date}&until=#{@end_date}#{more_params ? \"&#{more_params}\" : ''}\"\n total_count = parse_json_from_api(\"#{url}?#{query_params}\")['page']['total_elements']\n puts \"[#{Time.new.strftime('%k:%M')}] total count for #{url}?#{query_params}: #{total_count}\"\n idx = 0\n result = []\n while idx * PER_PAGE < total_count\n result += parse_json_from_api(\"#{url}?page=#{idx}&per_page=#{PER_PAGE}&#{query_params}\")['data']\n idx += 1\n end\n puts \"[#{Time.new.strftime('%k:%M')}] ERROR: result.length #{result.length} != total_count #{total_count}\" if result.length != total_count\n result\nrescue MyApiError\n []\nend", "def describe\n self.mclient = get_metadata_client\n begin\n response = self.mclient.request :describe_metadata do |soap|\n soap.header = get_soap_header \n soap.body = \"<apiVersion>#{MM_API_VERSION}</apiVersion>\"\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s)\n end\n puts \"<br/><br/> describe response: \" + response.to_hash.inspect\n hash = response.to_hash\n folders = Array.new\n hash[:describe_metadata_response][:result][:metadata_objects].each { |object| \n children = []\n if object[:child_xml_names] and object[:child_xml_names].kind_of? String\n children.push(object[:child_xml_names])\n else\n children = object[:child_xml_names]\n end\n folders.push({\n :title => object[:directory_name],\n :isLazy => true,\n :isFolder => true,\n :directory_name => object[:directory_name],\n :meta_type => object[:xml_name],\n :select => CORE_METADATA_TYPES.include?(object[:xml_name]) ? true : false,\n :child_metadata => children,\n :has_child_metadata => ! children.nil?,\n :in_folder => object[:in_folder]\n })\n }\n folders.sort! { |a,b| a[:title] <=> b[:title] }\n puts \"\\n\\n\\n\\n\\n\"\n puts folders.to_json\n return folders.to_json\n end", "def test_parser\n\t\tapi_parser[\"near_earth_objects\"].map do |key,value|\n\t\t\tvalue.map do |array|\n\t\t\t array[\"close_approach_data\"]\n\t\t\tend\n\t\tend\n\tend", "def parse_nested_data(data, key)\n call_response = data[:resultado_operacao][:tipo]\n\n case call_response\n when 'tdreSucesso'\n parsed_data = data[:rows][key]\n parsed_data = [parsed_data] unless parsed_data.is_a? Array\n return parsed_data.compact\n when 'tdreSucessoSemDados'\n return []\n else\n raise \"Nested data \\\"#{data}\\\" is invalid\"\n end\n end", "def parsetitle( titles, type, parentid )\n\n apiurl='http://en.wikipedia.org/w/api.php'\n\n ## resulthash\n links=Hash.new\n\n #### First query, no plcontinue\n query = { \n 'action'=>'query',\n 'prop'=>'info',\n 'redirects'=>'',\n 'inprop'=>'url',\n 'format'=>'json',\n }\n\n ### Separate by type\n case type\n when 0 \n #### seed\n continueterm='incontinue'\n query['titles'] = titles\n\n when 1 \n #### links\n continueterm='gplcontinue'\n linksterm='links'\n query['generator']=linksterm\n query['titles'] = titles\n query['gplnamespace'] = '0'\n query['gpllimit'] = 'max'\n \n when 2\n #### backlinks\n continueterm='gblcontinue'\n linksterm='backlinks'\n query['gbltitle'] = titles\n query['generator'] = 'backlinks'\n query['gblnamespace'] = '0'\n query['gbllimit'] = 'max'\n\n else \n puts \"This shouldn't happen.\"\n exit -1\n end\n # puts query\n # exit;\n \n\n postData = Net::HTTP.post_form(URI.parse(apiurl), query);\n \n ## parse and save result\n result = JSON.parse(postData.body)\n pages=result[\"query\"][\"pages\"].keys\n<<<<<<< HEAD\n \n=======\n\n i=0\n>>>>>>> ff128337f961ce2c8d1c7273ff20bd093e5188a6\n result[\"query\"][\"pages\"].each do |page|\n if page[1][\"title\"] != nil and page[1][\"length\"] != nil\n links[page[1][\"title\"]] = { \n \"length\" => page[1][\"length\"], \n \"url\"=>page[1][\"fullurl\"],\n \"pageid\"=>page[1][\"pageid\"],\n \"parentid\"=>parentid \n }\n<<<<<<< HEAD\n=======\n i=i+1;\n # if i>5 \n # break\n # end\n>>>>>>> ff128337f961ce2c8d1c7273ff20bd093e5188a6\n end\n end\n \n ### Keep going?\n while true\n if result[\"query-continue\"] == nil\n ##puts \"breaking\"\n break\n end\n ##puts \"didn't break\" \n \n plcontinue=result[\"query-continue\"][linksterm][continueterm]\n ## puts plcontinue\n query[continueterm] = plcontinue\n\n postData = Net::HTTP.post_form(URI.parse(apiurl), query);\n result = JSON.parse(postData.body)\n \n pages=result[\"query\"][\"pages\"].keys\n\n result[\"query\"][\"pages\"].each do |page|\n if page[1][\"title\"] != nil and page[1][\"length\"] != nil\n links[page[1][\"title\"]] = { \n \"length\" => page[1][\"length\"], \n \"url\"=>page[1][\"fullurl\"],\n \"pageid\"=>page[1][\"pageid\"],\n \"parentid\"=>parentid \n }\n end\n end\n end\n \n return links\nend", "def parse_ldap(response)\n user = nil\n\n # Check for a successful request\n # Parse the response body, which is in JSON format.\n parsed = JSON.parse(response)\n #puts parsed\n #puts \"Facet #{parsed[\"facet_name\"]}\"\nend", "def response_message\n parsed_response['message']\nend", "def get_occupation(data, hometown)\n # code here\n occupation = nil \n data.each do |key1, value1|\n value1.each do |key_value_pair|\n if key_value_pair[\"hometown\"] == hometown\n occupation = key_value_pair[\"occupation\"]\n break\n end\n end\n end\n occupation\nend", "def get_characters_from_api\n #establish initial url from api\n url = 'http://www.swapi.co/api/people/'\n #get all data from first page of API\n page_of_characters = JSON.parse(RestClient.get(url))\n all_characters = page_of_characters\n \n next_call = page_of_characters[\"next\"]\n\n while next_call do\n next_page = next_call\n next_page_of_characters = JSON.parse(RestClient.get(next_page))\n (all_characters[\"results\"] << next_page_of_characters[\"results\"])\n next_call = next_page_of_characters[\"next\"]\n end\n\n all_characters\nend", "def api_response\n nil\n end", "def lookup_unbounded( value )\n elements = []\n if value.has_key?( \"children\" )\n value[\"children\"].each do |key, value|\n elements << key if value[\"unbounded\"]\n if value.has_key?( \"children\" )\n elements << lookup_unbounded( value )\n end\n end\n end\n elements\n end", "def get_character_movies_from_api(character_name)\n #make the web request\n\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n counter = 1\n films = []\n\n\n while films.size <= 1 do\n\n response_hash[\"results\"].find do |item_name|\n\n if item_name[\"name\"].downcase == character_name.downcase\n films = item_name[\"films\"]\n puts \"Film found\"\n films.collect! do |film_url|\n response_film_url = RestClient.get(film_url)\n response_film_url_hash = JSON.parse(response_film_url)\n response_film_url_hash[\"title\"]\n end\n puts \"Film Convert\"\n return films\n elsif response_hash[\"next\"] == nil\n return puts \"Character not found.\"\n end\n\n counter += 1\n\n response_string = RestClient.get(response_hash[\"next\"])\n response_hash = JSON.parse(response_string)\n end\nend\n\n\n #films = []\n #response_hash[\"results\"].find do |item_name|\n #\n # if item_name[\"name\"].downcase == character_name.downcase\n # films = item_name[\"films\"]\n # end\n #end\n\n #if response_hash[\"results\"][0][\"name\"].downcase == character_name\n # films = response_hash[\"results\"][0][\"films\"]\n #end\n\n #films.collect! do |film_url|\n # response_film_url = RestClient.get(film_url)\n # response_film_url_hash = JSON.parse(response_film_url)\n # response_film_url_hash[\"title\"]\n #end\n\n\n\n\n # iterate over the response hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls, make a web request to each URL to get the info\n # for that film\n # return value of this method should be collection of info about each film.\n # i.e. an array of hashes in which each hash reps a given film\n # this collection will be the argument given to `print_movies`\n # and that method will do some nice presentation stuff like puts out a list\n # of movies by title. Have a play around with the puts with other info about a given film.\nend", "def query_api(path)\n with_http_error_handling do\n res = RestClient.get(endpoint + path)\n h = Hash.from_xml(res.body)\n h[\"response\"]\n end\n end", "def fetch_facebook_wall_posters\n\t\tfb_wall_posters = Array.new\n\t\tidentity = self.identities.find_by_provider_id(ApplicationController.fb_app[:id])\n graph_url_string = getURL( ApplicationController.fb_app[:graph][:query_root_url] + ApplicationController.fb_app[:graph][:query_feed_suffix], {:access_token => identity.authentication.token} )\n\t\twhile !graph_url_string.nil?\n\t puts \"REQUESTING: \"+graph_url_string\n resp = https_get_helper(graph_url_string) \n\t\t\tresp_hash = JSON.parse(resp, :symbolize_names => true)\n\t\t\t# add fetched list of friends to the fb_friends array\n\t\t\tif !resp_hash[:data].nil?\n\t\t\t\tresp_hash[:data].each do |wall_post| \n\t\t\t\t\tputs wall_post.to_s\n\t\t\t\t\t# get ID of the user who created the wall post.\n\t\t\t\t\tif !wall_post[:from].nil?\n\t\t\t\t\t\tfb_wall_posters << wall_post[:from][:id]\n\t\t\t\t\tend\n\t\t\t\t\t# get IDs of all users, if any, who the wall post was addressed to. \n\t\t\t\t\tif !wall_post[:to].nil? and !wall_post[:to][:data].nil?\n\t\t\t\t\t\twall_post[:to][:data].each { |to_user| fb_wall_posters << to_user[:id] }\n\t\t\t\t\tend\n\t\t\t\t\t# get IDs of all users who liked the wall post\n\t\t\t\t\tif !wall_post[:likes].nil? and !wall_post[:likes][:data].nil?\n\t\t\t\t\t\twall_post[:likes][:data].each { |likes_user| fb_wall_posters << likes_user[:id] }\n\t\t\t\t\tend\n\t\t\t\t\t# get IDs of all users who commented on the wall post.\n\t\t\t\t\tif !wall_post[:comments].nil? and !wall_post[:comments][:data].nil?\n\t\t\t\t\t\twall_post[:comments][:data].each do |comment| \n\t\t\t\t\t\t\tfb_wall_posters << comment[:from][:id]\n\t\t\t\t\t\t\tif comment[:message_tags].nil?\n\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# get IDs of all users who were tagged in the comments of the wall post.\n\t\t\t\t\t\t\tcomment[:message_tags].each do |comment_msg_tag|\n\t\t\t\t\t\t\t\tif comment_msg_tag[:type] == \"user\"\n\t\t\t\t\t\t\t\t\tfb_wall_posters << comment_msg_tag[:id]\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# get IDs of all users who were tagged in the wall post.\n\t\t\t\t\tif !wall_post[:message_tags].nil?\n\t\t\t\t\t\twall_post[:message_tags].each_pair do |offset, data|\n\t\t\t\t\t\t\tdata.each do |tag_info| \n\t\t\t\t\t\t\t\tif tag_info[:type] == \"user\" \n\t\t\t\t\t\t\t\t\tfb_wall_posters << tag_info[:id] \n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend #end-resp_hash[:data].each do |wall_post|\n\t\t\tend # end-if !resp_hash[:data].nil?\n if resp_hash[:paging].nil?\n\t\t\t\tgraph_url_string = nil;\n\t\t\telse\n\t\t\t\tgraph_url_string = resp_hash[:paging][:next]\n \tend \n\t\tend\n\t\tputs fb_wall_posters.uniq.to_s\n\t\treturn fb_wall_posters.uniq\n\tend", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n logger.info.e.to_s\n nil\n end" ]
[ "0.5702398", "0.5528554", "0.53503996", "0.5350021", "0.5340665", "0.52850944", "0.5276702", "0.52592266", "0.51877254", "0.5162874", "0.5088703", "0.5076619", "0.5071235", "0.5067893", "0.50149167", "0.4974086", "0.4971136", "0.49441186", "0.49012846", "0.48938686", "0.48807317", "0.48802745", "0.48706737", "0.4835774", "0.48286492", "0.48235393", "0.48210958", "0.4808835", "0.48070893", "0.4796194", "0.47959575", "0.47865188", "0.47855103", "0.47829083", "0.47822252", "0.4778408", "0.47695333", "0.4745813", "0.47401989", "0.47372139", "0.472978", "0.47283342", "0.47242495", "0.47165546", "0.47122326", "0.47085443", "0.470368", "0.4702505", "0.47022876", "0.470187", "0.4701835", "0.46979594", "0.46963406", "0.4687359", "0.46812758", "0.4678704", "0.46785998", "0.46768853", "0.4668411", "0.4667778", "0.46671745", "0.46637392", "0.46615997", "0.4656527", "0.465519", "0.46536362", "0.46529594", "0.4652786", "0.46503246", "0.4642388", "0.46414536", "0.4639062", "0.4636503", "0.4635093", "0.4633645", "0.46315148", "0.4627726", "0.46269852", "0.46260166", "0.46213618", "0.46212336", "0.46174172", "0.46156225", "0.4609889", "0.4607294", "0.4606159", "0.46054968", "0.46038276", "0.46013826", "0.46005958", "0.45980525", "0.45901823", "0.45873815", "0.4584974", "0.45818606", "0.45810297", "0.4575389", "0.45704335", "0.45693228", "0.4566891", "0.45652497" ]
0.0
-1
Looking for all Helper checks, which by convention start with attribute 'helper_start_with' value. Returns a array of strings, method names.
def __list_helper_methods # avoiding '__self__' and '__id__' symbols with last regex part methods.grep(/^#{@@helper_start_with}.*?[^__]$/) do |method| method.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_helper_methods\n @helper_methods ||= __list_helper_methods\n @check_methods ||= __list_check_methods\n end", "def __list_check_methods\n methods.grep(/^#{@@checks_start_with}/) do |method|\n method.to_s\n end\n end", "def all_application_helpers\n extract = /^#{Regexp.quote(helpers_dir)}\\/?(.*)_helper.rb$/\n Dir[\"#{helpers_dir}/**/*_helper.rb\"].map { |file| file.sub extract, '\\1' }\n end", "def modules_for_helpers(modules_or_helper_prefixes); end", "def find_app_helper_classes\n klasses = []\n expression = \"#{Jets.root}app/helpers/**/*\"\n Dir.glob(expression).each do |path|\n next unless File.file?(path)\n class_name = path.sub(\"#{Jets.root}app/helpers/\",\"\").sub(/\\.rb/,'')\n unless class_name == \"application_helper\"\n klasses << class_name.classify.constantize # autoload\n end\n end\n klasses\n end", "def all_application_helpers\n map = []\n helpers_dirs.each do |helpers_dir|\n extract = /^#{Regexp.quote(helpers_dir)}\\/?(.*)_helper.rb$/\n map += Dir[\"#{helpers_dir}/**/*_helper.rb\"].map { |file| file.sub extract, '\\1' }\n end\n map\n end", "def get_helpers\n Hyde::Helpers.constants.inject([Hyde::Helpers]) do |a, constant|\n mod = Hyde::Helpers.const_get(constant)\n a << mod if mod.is_a? Module\n a\n end\n end", "def get_helpers\n @helpers\n end", "def modules_for_helpers(args)\n args.flatten.map! do |arg|\n case arg\n when String, Symbol\n file_name = \"#{arg.to_s.underscore}_helper\"\n begin\n require_dependency(file_name)\n rescue LoadError => e\n raise AbstractController::Helpers::MissingHelperError.new(e, file_name)\n end\n\n mod_name = file_name.camelize\n begin\n mod_name.constantize\n rescue LoadError\n # dependencies.rb gives a similar error message but its wording is\n # not as clear because it mentions autoloading. To the user all it\n # matters is that a helper module couldn't be loaded, autoloading\n # is an internal mechanism that should not leak.\n raise NameError, \"Couldn't find #{mod_name}, expected it to be defined in helpers/#{file_name}.rb\"\n end\n when Module\n arg\n else\n raise ArgumentError, \"helper must be a String, Symbol, or Module\"\n end\n end\n end", "def helpers_paths; end", "def helpers_paths; end", "def helpers_paths; end", "def helpers_paths; end", "def all_application_helpers\n all_helpers_from_path(helpers_path)\n end", "def helper_files\n glob = File.join(config[:test_base_path], 'helpers', '*/**/*')\n Dir.glob(glob).reject { |f| File.directory?(f) }\n end", "def helper_files\n glob = File.join(\"helpers\", \"*/**/*\")\n Util.safe_glob(config[:test_base_path], glob).reject { |f| File.directory?(f) }\n end", "def helper_files\n glob = Dir.glob(File.join(test_folder, \"helpers\", \"*/**/*\"))\n glob.reject { |f| File.directory?(f) }\n end", "def helper(name, controller = nil)\n if controller\n matched_helpers = @helpers.select do |h|\n h.name == name.to_sym && (h.controller.nil? || h.controller == controller)\n end\n else\n matched_helpers = @helpers.select { |h| h.name == name.to_sym && h.controller.nil? }\n end\n matched_helpers.first\n end", "def helpers(helper_name)\r\n extend _package_.load_helper(helper_name)\r\n end", "def handle_help\n self.methods.grep(/^handle_(.*?)/).map {|m| m.to_s.sub(/^(.*?)_/, '')}\n end", "def helpers\n Blush.helpers\n end", "def _magic_insight_methods\n # We want to keep the longer of the methods by num chars in the method name, because these are the ones meant for\n # humans to see (e.g. human_time, filtered_backtrace, display_time)\n sorted = _sorted_methods\n idiomatic = _idiomatic_methods\n # So we delete the shorter of the two\n idiomatic.each do |idiom|\n sorted.each_with_index do |meth, index|\n # first one found will be the shortest, so delete and move to next idiom\n if meth.to_s =~ /#{idiom}/\n sorted.delete_at(index)\n break # to idiomatic loop\n end\n end\n end\n sorted\n end", "def helper_methods\n members - PREDICATE_FIELDS + PREDICATE_FIELDS.map { |f| \"#{f}?\".to_sym }\n end", "def defined_methods\n # TODO: check content type before scanning\n content.scan(/\\s*def\\s+([A-Za-z0-9_\\.]*)/).flatten\n 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 callable_methods\n methods.grep(/^_\\w+[^_]$/)\n end", "def list_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n\n found.concat matches\n end\n end\n\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n\n found.concat matches\n end\n end\n\n found.uniq\n end", "def helper_method(*methods); end", "def helpers(&block)\n mod = (const_get(:Helpers) rescue const_set(:Helpers, Module.new))\n mod.module_eval(&block) if block_given?\n mod\n end", "def load_helpers\n @helpers_loaded ||= helper_loader.load_helpers\n end", "def load_helpers\n load_glob File.join(File.dirname(__FILE__), 'helpers', '*.rb')\n end", "def already_defined?(helper_name)\n ActionView::Base.instance_methods.include?(helper_name) or @module.methods.include?(helper_name)\n end", "def helper_method(*meths)\n meths.flatten!\n self._helper_methods += meths\n\n meths.each do |meth|\n _helpers.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1\n def #{meth}(*args, &blk) # def current_user(*args, &blk)\n controller.send(%(#{meth}), *args, &blk) # controller.send(:current_user, *args, &blk)\n end # end\n ruby_eval\n end\n end", "def define_helpers(list)\n list.each do |method_name, method_info|\n # puts \"define #{method_name}\"\n params = parse_param(method_info[\"params\"])\n if method_name[0] == \".\"\n class_eval %(\n private def #{method_name[1..-1]} (params = { #{params} })\n request(\"#{method_name}\", params)\n end\n ), __FILE__, __LINE__ - 4\n else\n class_eval %(\n def #{method_name} (params = { #{params} })\n request(\"#{method_name}\", params)\n end\n ), __FILE__, __LINE__ - 4\n end\n end\n end", "def parsed_methods\n parsed_include(:method)\n end", "def helpers_require\n ruby_file_path @api, \"#{service_name_full}::Helpers\"\n end", "def sniff\n return [] if context.singleton_method? || context.module_function?\n return [] if context.references_self?\n return [] if num_helper_methods.zero?\n return [] if ignore_method?\n\n [smell_warning(\n lines: [source_line],\n message: \"doesn't depend on instance state (maybe move it to another class?)\")]\n end", "def helpers\n ActionController::Base.helpers\n end", "def mounted_helpers\n MountedHelpers\n end", "def list_methods_matching_orig name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n found.push(*matches)\n end\n end\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n found.push(*matches)\n end\n end\n found.uniq\n end", "def define_helpers; end", "def helpers\n Helper.instance\n end", "def helpers\r\n Helper.instance\r\n end", "def assert_generated_helper_for(name)\n assert_generated_module \"app/helpers/#{name.to_s.underscore}_helper\" do |body|\n yield body if block_given?\n end\n end", "def assert_generated_helper_for(name)\n assert_generated_module \"app/helpers/#{name.to_s.underscore}_helper\" do |body|\n yield body if block_given?\n end\n end", "def provides_for(prefix)\n return [] unless @exposed\n @exposed.select do |meth|\n if instance_methods.include?(meth.to_s) or instance_methods.include?(meth.to_sym)\n true\n else\n RightLinkLog.warn(\"Exposing non-existing method #{meth} in actor #{name}\")\n false\n end\n end.map {|meth| \"/#{prefix}/#{meth}\".squeeze('/')}\n end", "def helpers(&block)\n Helpers.class_eval(&block)\n end", "def helper(helper_module)\n (config.app.helpers << helper_module).uniq!\n end", "def modules_for_helpers(args); end", "def helpers\n dsl.helpers\n end", "def helpers_including_recipes(included_recipes)\n @known_helpers_including_recipes.merge!(included_recipes)\n end", "def load_helpers\n paths = Dir.glob @site.helpers_path.join(\"**.rb\")\n HelperLoader.new(paths: paths).extend_instance(self)\n end", "def derive_default_helpers(options)\n []\n end", "def helper *helpers, &proc\n helpers.each { |h| @helpers[h] = proc }\n self\n end", "def determine_method_sequence(method)\n method = method.to_s\n names = /^is_([\\w\\-]+(\\?)?)$/.match method\n return [[method, :method]] unless names\n \n # Name ends with question mark\n if names[2] == \"?\"\n [[names[0], :method], [names[1], :method]]\n else\n [\n [names[0], :method],\n [names[0] + '?', :method],\n [names[1], :getter],\n [names[1] + '?', :method],\n [names[1].pluralize, :collection]\n ]\n end \n end", "def load_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n methods = []\n\n methods << load_method(store, :class_methods, ancestor, '::', method) if\n [:class, :both].include? types\n\n methods << load_method(store, :instance_methods, ancestor, '#', method) if\n [:instance, :both].include? types\n\n found << [store, methods.compact]\n end\n\n found.reject do |path, methods| methods.empty? end\n end", "def load_methods_matching name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n methods = []\n methods << load_method(store, :class_methods, ancestor, '::', method) if\n [:class, :both].include? types\n methods << load_method(store, :instance_methods, ancestor, '#', method) if\n [:instance, :both].include? types\n found << [store, methods.compact]\n end\n found.reject do |path, methods| methods.empty? end\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 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 mounted_helpers; end", "def helpers; end", "def helpers; end", "def helpers; end", "def helpers\n ActionController::Base.helpers # you can also try @template.helpers OR self.class.helpers OR include ActionView::Helpers\n end", "def scope_helper(*helpers)\n helpers.each do |helper|\n raise 'scope_helper should be a Module' unless helper.instance_of? Module\n @scope_helpers << helper\n end\n end", "def helpers &blk\n @helpers = blk\n end", "def load_helpers(helper_path = nil)\n helper_path ||= HSS::DEFAULT_LIB\n helper_path = File.expand_path(helper_path)\n Dir.glob(File.join(helper_path, '*')).sort.each do |helper|\n require helper\n @helpers << helper\n rescue LoadError, SyntaxError\n raise LoadError, \"Failed to load helper: #{helper}\"\n end\n end", "def include_helpers(scope)\n ActiveSupport.on_load(:action_controller) do\n include scope::Helpers if defined?(scope::Helpers)\n #include scope::UrlHelpers\n end\n\n ActiveSupport.on_load(:action_view) do\n include scope::ViewHelpers\n end\n end", "def load_helper( helper_dir )\n Dir.foreach(helper_dir) do |helper_file|\n unless helper_file =~ /^(#{design_id}_helper).rb$/ or helper_file =~ /^(base_helper).rb$/\n next\n end\n Ziya.logger.info( \">>> ZiYa loading custom helper `#{$1}\" )\n # BOZO !! This will only work in rails ??\n if defined? RAILS_ROOT\n require_dependency File.join(helper_dir, $1) \n else\n require File.join(helper_dir, $1)\n end\n helper_module_name = \"Ziya::\" + $1.gsub(/(^|_)(.)/) { $2.upcase } \n # helper_module_name = $1.to_s.gsub(/\\/(.?)/) { \"::\" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }\n Ziya.logger.debug( \"Include module #{helper_module_name}\")\n Ziya::Gauges::Base.class_eval(\"include #{helper_module_name}\") \n true\n end\n false\n end", "def subcommand_list\n with_underscore, without_underscore = collect_do.partition {|command| command.include?('_')}\n with_underscore.find_all {|do_method| without_underscore.include?(do_method[/^[^_]+/])}\n end", "def helpers(*extensions, &block)\n self.class.helpers(*extensions, &block)\n end", "def helper_module(object)\n (object.class.name + 'Helper').constantize\n end", "def use_class_helpers!\n self.class.class_helpers.each { |helper| use helper }\n end", "def test_methods(patterns=[])\n return @test_methods if !@test_methods.nil?\n\n @test_methods = create.public_methods.find_all { |m|\n m.to_s =~ /^test_/\n }\n\n if !(patterns.nil? or patterns.empty?) then\n # filter\n @test_methods.reject!{ |m|\n patterns.find{ |t| m.to_s.include?(t.to_s) }.nil?\n }\n end\n\n @test_methods\n end", "def clear_helpers\n inherited_helper_methods = _helper_methods\n self._helpers = Module.new\n self._helper_methods = Array.new\n\n inherited_helper_methods.each { |meth| helper_method meth }\n default_helper_module! unless anonymous?\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 all_giraffes\n methods.select { |m| m =~ /_giraffe$/ }\n end", "def all_application_helpers; end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end", "def helper(*klazzes)\n klazzes.each { |klazz| self.class.send(:include, klazz) }\n end", "def check_only_methods\n end", "def find_all_plugin_names(*pattern)\n find_all_plugin_specs(*pattern).map do |spec|\n spec.plugin_name\n end\n end", "def modules_for_helpers(args)\n args += all_application_helpers if args.delete(:all)\n super(args)\n end", "def helpers\n ActionController::Base.helpers\n end", "def helpers\n ActionController::Base.helpers\n end", "def method_strings\t\n [\n \".methods\",\n \".methods(false)\",\n \".instance_methods\",\n \".instance_methods(false)\",\n \".public_methods\",\n \".public_methods(false)\",\n \".public_instance_methods\",\n \".public_instance_methods(false)\",\n \".protected_methods\",\n \".protected_methods(false)\",\n \".private_methods\",\n \".private_methods(false)\"\n ]\nend", "def helpers_paths=(_arg0); end", "def helpers_paths=(_arg0); end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def form_helpers\n ::RPH::FormAssistant::FORM_HELPERS\n end", "def included_methods\n included_modules.map(&:instance_methods).flatten\n end", "def run_checks\n methods.keep_if { |m| m.match(/^check_/) }.each do |check|\n send check.to_sym unless @skip.include? check.to_s.sub 'check_', ''\n end\n end", "def include_helpers(scope); end", "def get_test_fns\n fns = {}\n basename = File.basename(@parts[:fn], @parts[:ext]) + Cpp::get_source_ext(@parts[:ext])\n ['src', 'inc'].each do |type|\n fns[type] = File.join(@parts[:base_dir],\n @parts[:module],\n 'test',\n type,\n @parts[:namespaces],\n basename)\n end\n fns\n end", "def known_methods\n return self.operations.sort\n end", "def helper(*helpers)\r\n helper_object.extend *helpers\r\n end", "def helpers\n ActionController::Base.helpers\nend", "def add_machined_helpers # :nodoc:\n machined.context_helpers.each do |helper|\n case helper\n when Proc\n instance_eval &helper\n when Module\n extend helper\n end\n end\n end", "def grep_methods(obj, pattern=nil)\n klass = obj.is_a?(Class) ? obj : obj.class\n ancs = klass.ancestors\n mtds = pattern ? obj.methods.grep(Regexp.new(pattern.to_s)) : obj.methods\n mtds.sort.each do |e|\n ent = ancs.find {|c| c.instance_methods(false).include?(e) } || \"self\"\n puts \"#{e} in #{ent}\"\n end\n end" ]
[ "0.7056782", "0.65636903", "0.64053917", "0.6373913", "0.6370293", "0.63323843", "0.6151387", "0.60207075", "0.59538853", "0.58915854", "0.58915854", "0.58915854", "0.58915854", "0.5873438", "0.585504", "0.5682456", "0.5680701", "0.56630313", "0.5651014", "0.55674255", "0.5555054", "0.5542356", "0.55234724", "0.55105436", "0.5492069", "0.54913366", "0.54902714", "0.5471551", "0.54683584", "0.5457083", "0.54371244", "0.5403804", "0.53776044", "0.5373957", "0.5347318", "0.53467953", "0.5337454", "0.5317746", "0.53099835", "0.5307245", "0.53022194", "0.53016084", "0.5282281", "0.52722156", "0.52722156", "0.5267643", "0.52616704", "0.5237871", "0.5237423", "0.52319545", "0.522626", "0.5214965", "0.5211248", "0.5184757", "0.5176456", "0.51762986", "0.515727", "0.5153407", "0.5153407", "0.5151118", "0.51421773", "0.51421773", "0.51421773", "0.51338017", "0.51333654", "0.5111102", "0.5110077", "0.5106298", "0.5096299", "0.50856715", "0.50701654", "0.50655186", "0.505727", "0.50481474", "0.5046865", "0.5039995", "0.50361496", "0.5035848", "0.50351304", "0.5030855", "0.5028788", "0.50259197", "0.5022982", "0.50122327", "0.50122327", "0.5010125", "0.5007812", "0.5007812", "0.5002869", "0.5002869", "0.49852207", "0.496807", "0.49662033", "0.49550164", "0.49533808", "0.4953358", "0.4952495", "0.49472824", "0.49430227", "0.49420193" ]
0.7836861
0
Look for method names that start with attribute 'checks_start_with' value. Returns a array of strings.
def __list_check_methods methods.grep(/^#{@@checks_start_with}/) do |method| method.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_methods_matching_orig name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n found.push(*matches)\n end\n end\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n found.push(*matches)\n end\n end\n found.uniq\n end", "def list_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n\n found.concat matches\n end\n end\n\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n\n found.concat matches\n end\n end\n\n found.uniq\n end", "def determine_method_sequence(method)\n method = method.to_s\n names = /^is_([\\w\\-]+(\\?)?)$/.match method\n return [[method, :method]] unless names\n \n # Name ends with question mark\n if names[2] == \"?\"\n [[names[0], :method], [names[1], :method]]\n else\n [\n [names[0], :method],\n [names[0] + '?', :method],\n [names[1], :getter],\n [names[1] + '?', :method],\n [names[1].pluralize, :collection]\n ]\n end \n end", "def callable_methods\n methods.grep(/^_\\w+[^_]$/)\n end", "def run_checks\n methods.keep_if { |m| m.match(/^check_/) }.each do |check|\n send check.to_sym unless @skip.include? check.to_s.sub 'check_', ''\n end\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end", "def parsed_methods\n parsed_include(:method)\n end", "def defined_methods\n # TODO: check content type before scanning\n content.scan(/\\s*def\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def get_hook_names(job, hook_method_prefix)\n methods = (job.respond_to?(:hooks) && job.hooks) || job_methods(job)\n methods.select{|m| m.start_with?(hook_method_prefix)}.sort\n end", "def method_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 3]\n end", "def attribute_methods(name)\n attribute_method_matchers.map { |matcher| matcher.method_name name }\n end", "def all_methods_with_source(string:, match_case: true)\n return [] if string.empty?\n\n self.all_classes_and_modules.flat_map do |klassmod|\n klassmod.select_matching_methods(string, match_case)\n end\n end", "def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end", "def getter_method_names\n @getter_method_names ||= instance_methods.map!(&:to_s).tap do |list|\n list.reject! { |item| item.end_with?(\"=\") }\n end\n end", "def methods_matching(re); end", "def load_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n methods = []\n\n methods << load_method(store, :class_methods, ancestor, '::', method) if\n [:class, :both].include? types\n\n methods << load_method(store, :instance_methods, ancestor, '#', method) if\n [:instance, :both].include? types\n\n found << [store, methods.compact]\n end\n\n found.reject do |path, methods| methods.empty? end\n end", "def provides_for(prefix)\n return [] unless @exposed\n @exposed.select do |meth|\n if instance_methods.include?(meth.to_s) or instance_methods.include?(meth.to_sym)\n true\n else\n RightLinkLog.warn(\"Exposing non-existing method #{meth} in actor #{name}\")\n false\n end\n end.map {|meth| \"/#{prefix}/#{meth}\".squeeze('/')}\n end", "def sniff\n # TODO: Only checks instance methods!\n actual = context.node_instance_methods.length\n return [] if actual <= max_allowed_methods\n\n [smell_warning(\n lines: [source_line],\n message: \"has at least #{actual} methods\",\n parameters: { count: actual })]\n end", "def load_methods_matching name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n methods = []\n methods << load_method(store, :class_methods, ancestor, '::', method) if\n [:class, :both].include? types\n methods << load_method(store, :instance_methods, ancestor, '#', method) if\n [:instance, :both].include? types\n found << [store, methods.compact]\n end\n found.reject do |path, methods| methods.empty? end\n end", "def starts_with(prefix)\n search_arr(prefix.chars)\n end", "def starts_with(prefix)\n extract.grep(/^#{prefix}/)\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 find_matches method_name\n matches = xpath method_name.as_xpath \n matches.any? ? matches : nil\n end", "def method_strings\t\n [\n \".methods\",\n \".methods(false)\",\n \".instance_methods\",\n \".instance_methods(false)\",\n \".public_methods\",\n \".public_methods(false)\",\n \".public_instance_methods\",\n \".public_instance_methods(false)\",\n \".protected_methods\",\n \".protected_methods(false)\",\n \".private_methods\",\n \".private_methods(false)\"\n ]\nend", "def find_by_starts_with(name)\n return nil unless name.present?\n names.select {|e| e.starts_with?(name)}\n end", "def check_only_methods\n end", "def test_methods_with_mark\n results = test_methods_without_mark\n\n # If the MARK environmental variable is fine, we restrict by\n # mark.\n if ENV[\"MARK\"]\n # If we don't have any marks then we have no tests\n return [] if !@marks\n\n interested_marks = ENV[\"MARK\"].split(\",\")\n\n results.select! do |name|\n next false if !@marks[name]\n\n found = interested_marks.find do |single_mark|\n @marks[name].include?(single_mark)\n end\n\n # Success if we found a mark\n !found.nil?\n end\n end\n\n results\n end", "def all_giraffes\n methods.select { |m| m =~ /_giraffe$/ }\n end", "def filter_methods found, name\n regexp = name_regexp name\n filtered = found.find_all do |store, methods|\n methods.any? { |method| method.full_name =~ regexp }\n end\n return filtered unless filtered.empty?\n found\n end", "def string_matchers()\n []\n end", "def filter_methods found, name\n regexp = name_regexp name\n\n filtered = found.find_all do |store, methods|\n methods.any? { |method| method.full_name =~ regexp }\n end\n\n return filtered unless filtered.empty?\n\n found\n end", "def method_names\n return if @method_names.empty?\n @method_names.uniq.sort\n end", "def validates_with_method(*attribute_names)\n options = Macros.extract_options(attribute_names)\n validation_rules.add(Rule::Method, attribute_names, options)\n end", "def method_suffixes\n @method_suffixes ||=\n Class.new do\n include ::ActiveModel::Dirty\n end.attribute_method_matchers.map(&:suffix).select { |m| m =~ /\\A_/ }\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def bornin2 _method, _class\n\n # the patten to grep for\n re = Regexp.new '^' + _method.to_s + '$'\n\n _class.ancestors.each do |ancestor|\n\n #- in methods?\n if ancestor.methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n\t\"..... born in #{ancestor} as a method\".green\n end\n\n #- in instance_methods?\n if ancestor.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n\t\"...... born in #{ancestor} as an instance method\".green\n end\n\n end # scanning ancestors\n\nend", "def passed_checks\n self.completeness_checks.inject([]) do |passed, check| \n case check[:check]\n when Proc\n passed << translate_check_details(check) if check[:check].call(self)\n when Symbol\n passed << translate_check_details(check) if self.send check[:check]\n end\n \n passed\n end\n end", "def methods(src)\n\n # TODO This leaves out methods like [], <<, etc...maybe just check for first non-space?\n method_sigs = /def\\s+[a-z_!?.]+/\n method_names = src.scan(method_sigs).map { |sig| sig.sub(/^def /, '') }\n\n bodies = src.split(method_sigs)[1..-1] # strip off first chunk, the class beginning\n\n method_names.zip(bodies)\n end", "def grep_method match\n match = /#{match}/ unless match.is_a? Regexp\n self.methods.grep(match)\n end", "def filter_for(method_name)\n methods = Array.new\n \n @filter_chain.each do |method_to_call, option|\n if option == true\n methods << method_to_call\n elsif option.has_key?(:only) && option[:only].include?(method_name.to_sym)\n methods << method_to_call \n elsif option.has_key?(:except) && !option[:except].include?(method_name.to_sym)\n methods << method_to_call \n end\n end\n\n return methods.uniq\n end", "def scrape_callseqs(method)\n callseqs = []\n \n method.css('.method-heading').css('.method-callseq').each do |callseq|\n callseqs << callseq.text\n end\n \n if callseqs.empty?\n method.css('.method-heading').each do |heading|\n name = heading.css('.method-name').text\n args = heading.css('.method-args').text\n \n callseqs << name + args\n end\n end\n \n callseqs\nend", "def get_test_names\n if defined?(MiniTest::Unit::TestCase) && self.ancestors.include?(MiniTest::Unit::TestCase)\n self.test_methods\n else\n self.suite.tests.map {|t| t.method_name}\n end\n end", "def method_argument_names\n name, usage = current_method_info\n results = usage.split(name.gsub(/_/,'-')).last || \"\"\n return results.split(' ')\n end", "def metric_method_names\n report.metrics.map { |d| ga_to_method_name(d) }\n end", "def get_all_functions src_file\n code = IO.readlines(src_file)\n functions = []\n puts src_file\n code.each do |line|\n /^\\s*def\\s+([^\\s\\(]+)\\s?.*/ =~ line\n functions << $1 if $1\n end \n functions\n end", "def is_method_start_line?(line)\n split_line = line.split(/\\ /)\n result = false\n if split_line.length == 2\n if split_line.last[-1] == \"(\"\n result = true\n end\n end\n result\nend", "def all_get_methods\n instance_methods.grep /^get_/\n end", "def name_search(namespace)\n search_all_methods(namespace) do |meth|\n meth.name =~ pattern\n end\n end", "def known_methods\n return self.operations.sort\n end", "def given_attrs\n methods.grep(/^given_.+\\?$/).map { |m| m.to_s.gsub(/^given_/, '').gsub(/\\?$/, '')}\n end", "def matchMethodsInClasses(classList, type, mname)\n res = []\n \n for cname in classList\n cl = findClass(cname)\n res.concat cl.findMethods(mname, type == \"::\")\n# meths.each {|m| res << \"#{cname}#{m.type=='class'?'::':'#'}#{m.name}\" }\n end\n\n return res\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(res)\n end\n end", "def trim_jruby_aliases(methods)\n grouped = methods.group_by do |m|\n m.name.sub(/\\A(is|get|set)(?=[A-Z_])/, '').gsub(/[_?=]/, '').downcase\n end\n\n grouped.flat_map do |key, values|\n values = values.sort_by do |m|\n rubbishness(m.name)\n end\n\n found = []\n values.select do |x|\n (!found.any? { |y| x == y }) && found << x\n end\n end\n end", "def find_all_permission_methods\n self.methods.select do |method_name|\n method_name =~ /\\Acan_\\w+[^=]\\Z/\n end\n end", "def test_methods(patterns=[])\n return @test_methods if !@test_methods.nil?\n\n @test_methods = create.public_methods.find_all { |m|\n m.to_s =~ /^test_/\n }\n\n if !(patterns.nil? or patterns.empty?) then\n # filter\n @test_methods.reject!{ |m|\n patterns.find{ |t| m.to_s.include?(t.to_s) }.nil?\n }\n end\n\n @test_methods\n end", "def locate_def str\n has_dot = has_dot? str\n str_upr = starts_upper? str\n if has_dot && str_upr\n splits = str.partition(\".\")\n clas = splits.first\n meth = splits.last\n eval \"clas.method(meth).source_location\"\n elsif !has_dot && !str_upr\n Object.method(str).source_location\n elsif \n code = \"#{str}.instance_methods(false).map {|m| #{str}\"\n code << \".instance_method(m).source_location.first}.uniq\"\n eval code\n end\n end", "def select_methods(pattern)\n methods = []\n class_cache.keys.sort.each do |klass|\n class_cache[klass][\"instance_methods\"].map{|h|h[\"name\"]}.grep(pattern) do |name|\n method = load_cache_for(klass)[klass+'#'+name]\n methods << method if method\n end\n class_cache[klass][\"class_methods\"].map{|h|h[\"name\"]}.grep(pattern) do |name|\n method = load_cache_for(klass)[klass+'::'+name]\n methods << method if method\n end\n end\n methods\n end", "def _magic_insight_methods\n # We want to keep the longer of the methods by num chars in the method name, because these are the ones meant for\n # humans to see (e.g. human_time, filtered_backtrace, display_time)\n sorted = _sorted_methods\n idiomatic = _idiomatic_methods\n # So we delete the shorter of the two\n idiomatic.each do |idiom|\n sorted.each_with_index do |meth, index|\n # first one found will be the shortest, so delete and move to next idiom\n if meth.to_s =~ /#{idiom}/\n sorted.delete_at(index)\n break # to idiomatic loop\n end\n end\n end\n sorted\n end", "def called_signed_methods\n HasType.method_names_where(self) {|sig| sig.method_called? }\n end", "def calls_by_method_name; end", "def lookup_method name\n found = load_methods_matching name\n\n if found.empty?\n if check_did_you_mean\n methods = []\n _, _, method_name = parse_name name\n find_methods name do |store, klass, ancestor, types, method|\n methods.push(*store.class_methods[klass]) if [:class, :both].include? types\n methods.push(*store.instance_methods[klass]) if [:instance, :both].include? types\n end\n methods = methods.uniq\n suggestions = DidYouMean::SpellChecker.new(dictionary: methods).correct(method_name)\n raise NotFoundError.new(name, suggestions)\n else\n raise NotFoundError, name\n end\n end\n\n filter_methods found, 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 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 starting_with(partial_name)\n all.select { |o| o.fullname.start_with?(partial_name) }\n end", "def possible_eval_methods\n valid_criteria[attribute_name].nil? ? DEFAULT_EVAL_METHODS : valid_criteria[attribute_name][\"operators\"].keys.map{|k| [k.gsub(\"_\", \" \"), k]}\n end", "def [](label, check_ptn)\n rgx = check_ptn.is_a?(Regexp) ? check_ptn : Regexp.new(\"\\\\b#{check_ptn}\\\\b\", Regexp::IGNORECASE)\n find_all { |w| w.method(label.to_sym).call =~ rgx }\n end", "def starts_with?(sym)\n if seq? && sym === (v = expr.fetch(1, nil))\n [v]\n elsif alt? && expr.any? {|e| sym === e}\n expr.select {|e| sym === e}\n else\n nil\n end\n end", "def search_all_methods(namespace)\n done = Hash.new{ |h,k| h[k] = {} }\n matches = []\n\n recurse_namespace(namespace) do |klass|\n (Pry::Method.all_from_class(klass) + Pry::Method.all_from_obj(klass)).each do |method|\n next if done[method.owner][method.name]\n done[method.owner][method.name] = true\n\n matches << method if yield method\n end\n end\n\n matches\n end", "def before_methods\n @@before_methods\n end", "def validate_method_name(name)\n KeyWords.include?(name) ? \"do#{valid_class_name(name)}\" : valid_property_name(name)\n end", "def attributes_in(mod)\n result = Set.new\n mod.local_nodes(:call) do |call_node|\n if ATTRIBUTE_METHODS.include?(call_node.method_name)\n call_node.arg_names.each {|arg| result << arg }\n end\n end\n result\n end", "def method_array\n @parser = nil\n @caller_lines.each do |kaller|\n code = Ripper.sexp(kaller.contents)\n code ||= Ripper.sexp(kaller.contents.sub(/^\\W*(if|unless)/, ''.freeze)) # if and unless \"block\" statements aren't valid one line ruby code\n code ||= Ripper.sexp(kaller.contents.sub(/do \\|.*\\|$/, ''.freeze)) # remove trailing do |thing| to make valid code\n code ||= Ripper.sexp(kaller.contents.sub(/(and|or)\\W*$/, ''.freeze))# trailing and || or\n code ||= Ripper.sexp(kaller.contents.sub(/:\\W*$/, ''.freeze)) # multi line ternary statements\n code ||= Ripper.sexp(kaller.contents.sub(/(^\\W*)|({ \\|?.*\\|?)}/, ''.freeze)) # multi line blocks using {}\n\n puts \"LetItGoFailed parse (#{kaller.file_name}:#{kaller.line_number}: \\n \\033[0;31m\"+ kaller.contents.strip + \"\\e[0m\".freeze if ENV['LET_IT_GO_RECORD_FAILED_CODE'] && code.nil? && kaller.contents.match(/\"|'/)\n\n parser = ::LetItGo::WTFParser.new(code, contents: kaller.contents)\n\n if parser.each_method.any? { |m| m.method_name == method_name }\n @line_number = kaller.line_number\n @file_name = kaller.file_name\n\n @parser = parser\n parser.each_method.each(&:arg_types)\n break\n else\n next\n end\n end\n @parser || []\n end", "def find_method(method_name)\n reg = Regexp.new(method_name.to_s, true)\n methods.sort.select { |meth| reg.match?(meth) }\n end", "def spec_events events\n events.select {|e| e.method_name =~ /SPEC/ }\nend", "def validate!(call_name)\n params = self.methods\n params.select { | method | call_name.include?(call_name) }\n end", "def always_return_key?(key)\n key.start_with?('activerecord.attributes.', 'user.', 'sample.', 'helpers.')\n end", "def method_names\n bindings.collect( &:inbound_name )\n end", "def match?(cop_names); end", "def names\n fs = []\n %w( COARSE_GRAIN_BUFFER FINE_GRAIN_BUFFER FINE_GRAIN_SYSTEM ATOMICS ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end", "def method_rules\n [\n Rule.new(:error, 40..41, \"Description\", \"You should include a description for your method.\", proc do |json|\n json[:body_md] && json[:body_md].empty?\n end),\n Rule.new(:warning, 43..45, \"Params\", \"You should give a 'type' for the param, yes, ruby is duck-typey but it's useful for newbies to the language, use `@param [Type] name`.\", proc do |json|\n json[:param_couplets] && json[:param_couplets].flat_map(&:values).include?(nil)\n end),\n Rule.new(:warning, 43..45, \"Unknown Param\", \"You should give a 'type' for the param, yes, ruby is duck-typey but it's useful for newbies to the language, use `@param [Type] name`.\", proc do |json|\n json[:param_couplets] && json[:param_couplets].flat_map(&:values).include?(\"Unknown\")\n end),\n Rule.new(:warning, 46, \"Return Type\", \"If the function has no useful return value, use ` @return [void]` - this will be ignored by documentation generators.\", proc do |json|\n return_hash = json[:tags].find { |tag| tag[:name] == \"return\" }\n !(return_hash && return_hash[:types] && !return_hash[:types].first.empty?)\n end)\n ]\n end", "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 names\n fs = []\n %w( ORDER_RELAXED ORDER_ACQ_REL ORDER_SEQ_CST SCOPE_WORK_ITEM SCOPE_WORK_GROUP SCOPE_DEVICE SCOPE_ALL_DEVICES ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end", "def filter_methods; end", "def dispatch_method_names(command, type = 'bot')\n [type + '_' + command.join('_').downcase,\n type + '_' + command.first.downcase]\n end", "def find_methods name\n klass, selector, method = parse_name name\n types = method_type selector\n klasses = nil\n ambiguous = klass.empty?\n if ambiguous then\n klasses = classes.keys\n else\n klasses = ancestors_of klass\n klasses.unshift klass\n end\n methods = []\n klasses.each do |ancestor|\n ancestors = classes[ancestor]\n next unless ancestors\n klass = ancestor if ambiguous\n ancestors.each do |store|\n methods << [store, klass, ancestor, types, method]\n end\n end\n methods = methods.sort_by do |_, k, a, _, m|\n [k, a, m].compact\n end\n methods.each do |item|\n yield(*item) # :yields: store, klass, ancestor, types, method\n end\n self\n end", "def on_call_starts_with(context, haystack, needle)\n haystack_str = on_call_string(context, haystack)\n needle_str = on_call_string(context, needle)\n\n # https://github.com/jruby/jruby/issues/1923\n return needle_str.empty? || haystack_str.start_with?(needle_str)\n end", "def verify_methods(test_data)\n test_methods = test_data[UseOfCollections::METHOD_LIST.name]\n test_methods = [{ UseOfCollections::METHOD.name => ''}] unless test_methods\n test_methods.each_with_index { |test_method, index| verify_values_match(test_method[UseOfCollections::METHOD.name], element_value(method_input index)) }\n end", "def loader_method_names\n [\"country\",\"aircrafttype\",\"terminal\",\"user\",\"airline\",\"currency\",\n \"airport\",\"flight\",\"account\",\"plane\",\"quantity\",\"string\"] \n end", "def filtered_methods\n @filtered_methods ||= []\n end", "def signatures(method)\n method_cache(method).keys\n end", "def find_method(x)\n case x\n when String\n signature = Signature.new(:string => x)\n when Method\n signature = x.signature\n when Signature\n signature = x\n end\n\n x = @multimethod.select{|mm| mm.matches_signature(signature)}\n # $stderr.puts \"find_method(#{x}) => #{x.inspect}\"\n x = x.collect{|mm| mm.find_method(signature)}.flatten\n\n # $stderr.puts \"find_method(#{x}) => #{x.inspect}\"\n x\n end", "def get_keyword\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n return /^#.*@keywords(.*$)/.match(file_contents)[0].gsub(/^#.*@keywords/, '').strip if /#{self.class.name}/.match(file_contents)\n }\n end", "def decorated_methods_for(type, name)\n Array(decorated_methods[type][name])\n end", "def method_signature(e, method)\n file, line, call_method = e.backtrace.first.split(':')\n call_method = call_method.gsub(/[']/, '').split('`').last\n if call_method && call_method.to_sym == method.to_sym\n source_line = File.open(file).to_a[line.to_i - 1].chomp!\n if source_line =~ /def #{method}/\n signature = source_line.strip.gsub(/,/, '').split(/[ ()]/)\n signature.shift # remove def\n return signature.reject { |a| a =~ /^([={}\\)\\(])*$/ }\n end\n end\n []\n rescue StandardError\n []\n end", "def method_completions\n\n return if @method_completions.empty?\n @method_completions.uniq.sort\n\n end", "def getter_method_names; end", "def split_function_name(line)\n /(\\s*def\\s*)(\\S[^\\(]*)(\\(.*)/.match(line)\nend", "def method_delta_line es, method_name\n es.select {|e| e.method_name == method_name }\n .map(&:method_length)\n .each_cons(2)\n .map {|c,n| [\"^\",\"-\",\"v\"][(c <=> n) + 1] }\n .join\nend", "def starts_with(prefix)\n !!find(prefix)\n end", "def literal_searches(ast)\n return [] unless ast.respond_to?(:xpath)\n ast.xpath(\"//method_add_arg[fcall/ident/@value = 'search' and\n count(descendant::string_embexpr) = 0]/descendant::tstring_content\")\n end" ]
[ "0.57357746", "0.5697502", "0.5663597", "0.5624484", "0.55450225", "0.55113536", "0.5456413", "0.5442157", "0.54063785", "0.53691465", "0.53523296", "0.53294444", "0.532096", "0.5291416", "0.52908707", "0.52880853", "0.527789", "0.5270463", "0.5265387", "0.5263434", "0.5253661", "0.5241706", "0.5241477", "0.5240077", "0.52399176", "0.5225117", "0.5201326", "0.51877165", "0.51781327", "0.5171459", "0.513391", "0.51210433", "0.5111331", "0.51110804", "0.51017797", "0.51017797", "0.5047674", "0.50380474", "0.503626", "0.50248444", "0.5017771", "0.49739027", "0.49543652", "0.494686", "0.49263936", "0.4913319", "0.4908134", "0.48835152", "0.48821983", "0.48781598", "0.48725444", "0.48574713", "0.48570547", "0.48533663", "0.48342064", "0.48249885", "0.4824978", "0.4824955", "0.48208454", "0.48188767", "0.48134932", "0.47863603", "0.47863603", "0.47850782", "0.47788447", "0.47783503", "0.4777369", "0.47738037", "0.47653255", "0.47629738", "0.47572815", "0.47521785", "0.47519046", "0.47471306", "0.4744706", "0.47350833", "0.4729527", "0.47275653", "0.47185755", "0.47135556", "0.4704514", "0.4703372", "0.47002965", "0.46991578", "0.46976623", "0.4675237", "0.46708986", "0.46706077", "0.4669265", "0.46611252", "0.46608463", "0.46551707", "0.46544033", "0.4646368", "0.46451518", "0.46359015", "0.4633072", "0.4603165", "0.45977566", "0.45955554" ]
0.7139151
0
Similar to match_at, but returns true/false instead of MatchData.
def match_at? rexp, pos = 0 MatchAt.match_at? self, rexp, pos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_at? str, pos = 0\n MatchAt.match_at? str, self, pos\n end", "def match\n true\n end", "def match?(metadata)\n @matches.each do |match|\n if filter_select(match, metadata) and !match.negate\n return true\n end\n if filter_select(match, metadata) and match.negate\n return false\n end\n end\n false\n end", "def is_matched(ind)\n\t\treturn @tile_Array[ind].return_match\n\tend", "def match?\n false\n end", "def matches\n attributes.fetch(:matches)\n end", "def match?(locator)\n @match&.call(locator)\n end", "def matches?(value, context); end", "def partial_match?\n @json['results'][0]['partial_match'] == true\n end", "def match\n @match\n end", "def fnmatch?(matcher); end", "def matches?\n raise NotImplementedError, 'You must override the matches? method in your matcher.'\n end", "def matches\n @subject.matches\n end", "def match?(pattern)\n do_scan pattern, false, false, true\n end", "def has_match?\n !match_x.nil? && !match_y.nil?\n end", "def partial_match?(date2)\n self.class::partial_match?(self, date2)\n end", "def match; end", "def match; end", "def match?(ast, pattern, *args)\n Matcher.new(ast, pattern, *args).match?\n end", "def match(p0) end", "def match(p0) end", "def match?(name); end", "def do_match(input)\n @matched = input.match(@on)\n end", "def matches?(*)\n # by default nothing matches\n nil\n end", "def matches?(pattern); end", "def matches\n parse\n end", "def matches?(node); end", "def is_stable?\n # Every person's partner should match up\n @matches.all? { |k,v| is_matched?(k, v) }\n end", "def matches?(value, context = T.unsafe(nil)); end", "def matches?(value, context = T.unsafe(nil)); end", "def offset_matches_rule?(offset, rule_offset); end", "def offset_matches_rule?(offset, rule_offset); end", "def match?(instance)\n match_id?(instance) || match_percentage?(instance) || match_groups?(instance)\n end", "def match(object); end", "def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end", "def return_match\n\t\treturn @matched\n\tend", "def match?(freetime)\n freetime.start.between?(self.start, self.end) || freetime.end.between?(self.start, self.end)\n end", "def match (pattern)\n Predicate.new(:match, pattern: pattern) { |o| pattern === o }\n end", "def taxamatch(str1, str2, return_boolean = true)\n preparsed_1 = @parser.parse(str1)\n preparsed_2 = @parser.parse(str2)\n match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue nil\n return_boolean ? (!!match && match['match']) : match\n end", "def match?(event)\n matchers.all? { |matcher| matcher.match?(event) }\n end", "def =~(ast_node)\n if captures = do_match(match_ast, ast_node)\n CodeTree::MatchData.new(ast_node, ast_node, captures)\n else\n nil\n end\n end", "def accept?(fuzz_match)\n\t\t\t\ttrue\n\t\t\tend", "def match?(name, literal) true end", "def match()\n end", "def matches?(value)\n !!(value.to_s =~ MATCHER)\n end", "def match?(content)\n self.match.present? && content =~ /#{self.match}/\n end", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match(input, offset=0)\n create_match(rule.dup, offset) if rule == input[offset, rule.length]\n end", "def matches\n process_events! unless @matches\n @matches\n end", "def matches?(cell)\n Pattern.matches?(cell, regexp_explicit: @regexp_explicit)\n end", "def match(input); end", "def matchdata\n @matchdata\n end", "def =~(obj)\n obj.match self\n nil\n end", "def match(other, anchor, fuzz=Pixel(0))\n each { |p| return false if !other[anchor + p].approx(self[p], fuzz)}\n true\n end", "def match?(key, regex)\n return (!datas.has_key?(key) or datas[key].to_s.match(regex))\n end", "def match!\n clear!\n tighten_search_area\n @benchmark = Benchmark.measure do\n send(strategy_method)\n end\n save_match_file if highlight_match\n return has_match?\n end", "def set_match\n\t\t@matched = true\n\tend", "def match_position_by_full_string\n\n t_width = template_image.columns\n t_height = template_image.rows\n t_pixels = template_image.export_pixels_to_str(0, 0, t_width, t_height)\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n \n puts \"Checking search image at #{x}, #{y}\" if @verbose\n s_pixels = search_image.export_pixels_to_str(x, y, t_width, t_height)\n \n if s_pixels == t_pixels\n self.match_result = x, y\n throw :found_match\n end\n\n end\n end\n end # catch :found_match\n return match_result\n end", "def function_match(match_ast, ast_node, match_data = {})\n case fname = match_ast[0].function\n when :'_'\n return (match_ast[0].literal == ast_node.function ? true : false)\n when :'?'\n match_data[match_ast[0].literal] = ast_node.function\n return true\n end\n false\n end", "def matcher; end", "def matcher; end", "def map?\n marc_leader_06_match = %w[e f].include?(record.leader.byteslice(6))\n\n marc_006_match = record.fields('006').find do |field|\n %w[e f].include?(field.value.byteslice(0))\n end\n\n marc_007_match = record.fields('007').find do |field|\n field.value.byteslice(0) == 'a'\n end\n\n return true if marc_leader_06_match || marc_006_match || marc_007_match\n end", "def match?(name, value)\n massage_match_args(name, value) { |mname, mvalue|\n match = detect {|n, v|\n n =~ mname && v =~ mvalue\n }\n ! match.nil?\n }\n end", "def match(input, offset=0)\n create_match('', offset) unless input.match(rule, offset)\n end", "def snapshots_match?(s1, s2)\n s1 == s2\n end", "def is_match?(value)\n\t\t\tpattern_groups = group_patterns\n\t\t\tif pattern_groups[:negatives].empty?\n\t\t\t\tnegatives = true\n\t\t\telse\n\t\t\t\tnegatives = pattern_groups[:negatives].all? { |x| is_single_match?(x, value) }\n\t\t\tend\n\n\t\t\tif pattern_groups[:positives].empty?\n\t\t\t\tpositives = true\n\t\t\telse\n\t\t\t\tpositives = pattern_groups[:positives].any? { |x| is_single_match?(x, value) }\n\t\t\tend\n\n\t\t\treturn false if pattern_groups[:positives].empty? && pattern_groups[:negatives].empty?\n\t\t\treturn positives && negatives\n\t\tend", "def __matches_when__(receiver)\n i = @start\n tot = @total + @start\n while i < tot\n return true if @tuple.at(i) === receiver\n i = i + 1\n end\n false\n end", "def __matches_when__(receiver)\n i = @start\n tot = @total + @start\n while i < tot\n return true if @tuple.at(i) === receiver\n i = i + 1\n end\n false\n end", "def responds_to?(message)\n return true unless event_regex\n @match_data = event_regex.match(message)\n return @match_data\n end", "def match(pattern); end", "def match_result\n [match_x, match_y]\n end", "def match_token(token)\n return true\n end", "def matches?(object, query = T.unsafe(nil)); end", "def match(input, offset=0)\n m = rule.match(input, offset)\n extend_match(m, label_name) if m\n end", "def hit?(actual_move)\n return false unless self.length > 1\n\n with(self[0]) do |expected|\n return true if expected == \"*\"\n return true if expected == actual_move.notation\n # from/to coord matching next\n end\n \n false\n end", "def match_result(item, x_pos, y_pos)\n scan_area = @radar_scan.crop(x_pos, y_pos, item.width, item.height)\n match = item.match(scan_area)\n return unless match >= @accuracy\n\n next_x_pos, next_match = scan_proximity(item, match, x_pos, y_pos)\n @result_collector.run(item, next_x_pos, y_pos, next_match)\n end", "def pattern_match?\n @pattern_match == true\n end", "def match(input, offset=0)\n create_match('', offset) if input.match(rule, offset)\n end", "def emit? line\n MATCHER.match line\n end", "def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end", "def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end", "def assert_data_at_equal data, path, match, msg=nil\n last_data = nil\n found = false\n\n Path.find path, data do |d,k,p|\n found = true\n last_data = d[k]\n break if d[k] == match\n end\n\n assert found,\n msg || \"No data found at #{path.inspect} for #{data.inspect}\"\n\n assert_equal match, last_data, msg\n end", "def match?(value, expectation)\n match! value, expectation\n true\n rescue Mismatch\n false\n end", "def match_by_email\n true\n end", "def matches?(opts = {})\n return true if (opts.nil? or opts.empty?)\n opts.each_pair do |name, value|\n return false unless self.has_attribute?(name)\n case value\n when Regexp\n return false unless value =~ self[name]\n else\n return false unless value.to_s == self[name]\n end\n end\n true\n end", "def matches(query)\n @matches ||= search(query)\n end", "def fnmatch(matcher); end", "def matched?\n not @match.equal?(nil)\n end" ]
[ "0.6808222", "0.65436393", "0.6475774", "0.6337492", "0.6333967", "0.6198542", "0.6183951", "0.61207825", "0.61140245", "0.60911065", "0.6012992", "0.5974394", "0.5970091", "0.5938045", "0.59349865", "0.59241116", "0.5920414", "0.5920414", "0.58675194", "0.58136535", "0.58136535", "0.5776447", "0.5772925", "0.5746779", "0.5746244", "0.5740873", "0.5735738", "0.57336855", "0.5718503", "0.5718503", "0.57159984", "0.57159984", "0.5709897", "0.57028794", "0.56906754", "0.5667647", "0.5657211", "0.5642597", "0.56386733", "0.56172407", "0.5601101", "0.5600272", "0.55960166", "0.5573382", "0.5573027", "0.5563796", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5560149", "0.5554074", "0.5551384", "0.5550438", "0.5549945", "0.55474836", "0.5545562", "0.55380243", "0.55309767", "0.5522784", "0.55217934", "0.5517711", "0.5511338", "0.5511085", "0.5511085", "0.54984343", "0.5497242", "0.5494549", "0.54864615", "0.54842824", "0.54586536", "0.54586536", "0.54561967", "0.5452886", "0.5451723", "0.54444134", "0.54438585", "0.5438906", "0.54345125", "0.54296154", "0.54280674", "0.5427133", "0.54261243", "0.54253477", "0.5409791", "0.54086757", "0.5403381", "0.5401782", "0.53932667", "0.53919554", "0.5386817", "0.5384173" ]
0.71745735
0
Similar to match_at, but returns true/false instead of MatchData.
def match_at? str, pos = 0 MatchAt.match_at? str, self, pos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_at? rexp, pos = 0\n MatchAt.match_at? self, rexp, pos\n end", "def match\n true\n end", "def match?(metadata)\n @matches.each do |match|\n if filter_select(match, metadata) and !match.negate\n return true\n end\n if filter_select(match, metadata) and match.negate\n return false\n end\n end\n false\n end", "def is_matched(ind)\n\t\treturn @tile_Array[ind].return_match\n\tend", "def match?\n false\n end", "def matches\n attributes.fetch(:matches)\n end", "def match?(locator)\n @match&.call(locator)\n end", "def matches?(value, context); end", "def partial_match?\n @json['results'][0]['partial_match'] == true\n end", "def match\n @match\n end", "def fnmatch?(matcher); end", "def matches?\n raise NotImplementedError, 'You must override the matches? method in your matcher.'\n end", "def matches\n @subject.matches\n end", "def match?(pattern)\n do_scan pattern, false, false, true\n end", "def has_match?\n !match_x.nil? && !match_y.nil?\n end", "def partial_match?(date2)\n self.class::partial_match?(self, date2)\n end", "def match; end", "def match; end", "def match?(ast, pattern, *args)\n Matcher.new(ast, pattern, *args).match?\n end", "def match(p0) end", "def match(p0) end", "def match?(name); end", "def do_match(input)\n @matched = input.match(@on)\n end", "def matches?(pattern); end", "def matches?(*)\n # by default nothing matches\n nil\n end", "def matches\n parse\n end", "def matches?(node); end", "def is_stable?\n # Every person's partner should match up\n @matches.all? { |k,v| is_matched?(k, v) }\n end", "def offset_matches_rule?(offset, rule_offset); end", "def offset_matches_rule?(offset, rule_offset); end", "def matches?(value, context = T.unsafe(nil)); end", "def matches?(value, context = T.unsafe(nil)); end", "def match?(instance)\n match_id?(instance) || match_percentage?(instance) || match_groups?(instance)\n end", "def match(object); end", "def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end", "def return_match\n\t\treturn @matched\n\tend", "def match?(freetime)\n freetime.start.between?(self.start, self.end) || freetime.end.between?(self.start, self.end)\n end", "def match (pattern)\n Predicate.new(:match, pattern: pattern) { |o| pattern === o }\n end", "def taxamatch(str1, str2, return_boolean = true)\n preparsed_1 = @parser.parse(str1)\n preparsed_2 = @parser.parse(str2)\n match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue nil\n return_boolean ? (!!match && match['match']) : match\n end", "def match?(event)\n matchers.all? { |matcher| matcher.match?(event) }\n end", "def =~(ast_node)\n if captures = do_match(match_ast, ast_node)\n CodeTree::MatchData.new(ast_node, ast_node, captures)\n else\n nil\n end\n end", "def accept?(fuzz_match)\n\t\t\t\ttrue\n\t\t\tend", "def match?(name, literal) true end", "def match()\n end", "def matches?(value)\n !!(value.to_s =~ MATCHER)\n end", "def match?(content)\n self.match.present? && content =~ /#{self.match}/\n end", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend", "def match(input, offset=0)\n create_match(rule.dup, offset) if rule == input[offset, rule.length]\n end", "def matches\n process_events! unless @matches\n @matches\n end", "def matches?(cell)\n Pattern.matches?(cell, regexp_explicit: @regexp_explicit)\n end", "def matchdata\n @matchdata\n end", "def match(input); end", "def =~(obj)\n obj.match self\n nil\n end", "def match(other, anchor, fuzz=Pixel(0))\n each { |p| return false if !other[anchor + p].approx(self[p], fuzz)}\n true\n end", "def match?(key, regex)\n return (!datas.has_key?(key) or datas[key].to_s.match(regex))\n end", "def set_match\n\t\t@matched = true\n\tend", "def match!\n clear!\n tighten_search_area\n @benchmark = Benchmark.measure do\n send(strategy_method)\n end\n save_match_file if highlight_match\n return has_match?\n end", "def match_position_by_full_string\n\n t_width = template_image.columns\n t_height = template_image.rows\n t_pixels = template_image.export_pixels_to_str(0, 0, t_width, t_height)\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n \n puts \"Checking search image at #{x}, #{y}\" if @verbose\n s_pixels = search_image.export_pixels_to_str(x, y, t_width, t_height)\n \n if s_pixels == t_pixels\n self.match_result = x, y\n throw :found_match\n end\n\n end\n end\n end # catch :found_match\n return match_result\n end", "def function_match(match_ast, ast_node, match_data = {})\n case fname = match_ast[0].function\n when :'_'\n return (match_ast[0].literal == ast_node.function ? true : false)\n when :'?'\n match_data[match_ast[0].literal] = ast_node.function\n return true\n end\n false\n end", "def matcher; end", "def matcher; end", "def map?\n marc_leader_06_match = %w[e f].include?(record.leader.byteslice(6))\n\n marc_006_match = record.fields('006').find do |field|\n %w[e f].include?(field.value.byteslice(0))\n end\n\n marc_007_match = record.fields('007').find do |field|\n field.value.byteslice(0) == 'a'\n end\n\n return true if marc_leader_06_match || marc_006_match || marc_007_match\n end", "def match?(name, value)\n massage_match_args(name, value) { |mname, mvalue|\n match = detect {|n, v|\n n =~ mname && v =~ mvalue\n }\n ! match.nil?\n }\n end", "def match(input, offset=0)\n create_match('', offset) unless input.match(rule, offset)\n end", "def snapshots_match?(s1, s2)\n s1 == s2\n end", "def is_match?(value)\n\t\t\tpattern_groups = group_patterns\n\t\t\tif pattern_groups[:negatives].empty?\n\t\t\t\tnegatives = true\n\t\t\telse\n\t\t\t\tnegatives = pattern_groups[:negatives].all? { |x| is_single_match?(x, value) }\n\t\t\tend\n\n\t\t\tif pattern_groups[:positives].empty?\n\t\t\t\tpositives = true\n\t\t\telse\n\t\t\t\tpositives = pattern_groups[:positives].any? { |x| is_single_match?(x, value) }\n\t\t\tend\n\n\t\t\treturn false if pattern_groups[:positives].empty? && pattern_groups[:negatives].empty?\n\t\t\treturn positives && negatives\n\t\tend", "def __matches_when__(receiver)\n i = @start\n tot = @total + @start\n while i < tot\n return true if @tuple.at(i) === receiver\n i = i + 1\n end\n false\n end", "def __matches_when__(receiver)\n i = @start\n tot = @total + @start\n while i < tot\n return true if @tuple.at(i) === receiver\n i = i + 1\n end\n false\n end", "def responds_to?(message)\n return true unless event_regex\n @match_data = event_regex.match(message)\n return @match_data\n end", "def match_result\n [match_x, match_y]\n end", "def match(pattern); end", "def match_token(token)\n return true\n end", "def matches?(object, query = T.unsafe(nil)); end", "def match(input, offset=0)\n m = rule.match(input, offset)\n extend_match(m, label_name) if m\n end", "def hit?(actual_move)\n return false unless self.length > 1\n\n with(self[0]) do |expected|\n return true if expected == \"*\"\n return true if expected == actual_move.notation\n # from/to coord matching next\n end\n \n false\n end", "def match_result(item, x_pos, y_pos)\n scan_area = @radar_scan.crop(x_pos, y_pos, item.width, item.height)\n match = item.match(scan_area)\n return unless match >= @accuracy\n\n next_x_pos, next_match = scan_proximity(item, match, x_pos, y_pos)\n @result_collector.run(item, next_x_pos, y_pos, next_match)\n end", "def pattern_match?\n @pattern_match == true\n end", "def match(input, offset=0)\n create_match('', offset) if input.match(rule, offset)\n end", "def emit? line\n MATCHER.match line\n end", "def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end", "def assert_data_at_equal data, path, match, msg=nil\n last_data = nil\n found = false\n\n Path.find path, data do |d,k,p|\n found = true\n last_data = d[k]\n break if d[k] == match\n end\n\n assert found,\n msg || \"No data found at #{path.inspect} for #{data.inspect}\"\n\n assert_equal match, last_data, msg\n end", "def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end", "def match?(value, expectation)\n match! value, expectation\n true\n rescue Mismatch\n false\n end", "def match_by_email\n true\n end", "def matches?(opts = {})\n return true if (opts.nil? or opts.empty?)\n opts.each_pair do |name, value|\n return false unless self.has_attribute?(name)\n case value\n when Regexp\n return false unless value =~ self[name]\n else\n return false unless value.to_s == self[name]\n end\n end\n true\n end", "def matches(query)\n @matches ||= search(query)\n end", "def fnmatch(matcher); end", "def matched?\n not @match.equal?(nil)\n end" ]
[ "0.7175366", "0.6542506", "0.64755857", "0.633668", "0.63326687", "0.6198063", "0.61816543", "0.6119996", "0.6113595", "0.6090158", "0.6011942", "0.5973166", "0.59689164", "0.5936663", "0.59348756", "0.5923703", "0.5919135", "0.5919135", "0.586688", "0.5812098", "0.5812098", "0.5775354", "0.5771435", "0.57449585", "0.57448405", "0.57394284", "0.57353795", "0.573378", "0.5717573", "0.5717573", "0.5716834", "0.5716834", "0.57099396", "0.5701977", "0.56905556", "0.5665359", "0.5657027", "0.5640593", "0.563716", "0.5616255", "0.56010747", "0.5599473", "0.5594198", "0.557228", "0.5570954", "0.55630696", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.5559426", "0.55534565", "0.55502576", "0.55496454", "0.5549028", "0.55485827", "0.5543585", "0.5537003", "0.55313194", "0.55209166", "0.55209035", "0.55171764", "0.5512581", "0.5509847", "0.5509847", "0.54990834", "0.5495427", "0.5493085", "0.5486621", "0.5483682", "0.5458521", "0.5458521", "0.5455246", "0.5451376", "0.54511726", "0.5442963", "0.54422295", "0.54376775", "0.5433618", "0.5430039", "0.54280424", "0.54258955", "0.5425639", "0.5424246", "0.5410915", "0.54079646", "0.54023397", "0.54019624", "0.539306", "0.53890675", "0.53855234", "0.5382151" ]
0.6807798
1
I worked on this challenge by myself. longest_string is a method that takes an array of strings as its input and returns the longest string +list_of_words+ is an array of strings longest_string(list_of_words) should return the longest string in +list_of_words+ If +list_of_words+ is empty the method should return nil Input: an array of strings of varying lengths Output: either the longest string in the array, or nil (if there are no strings in the array) IF there are strings in the array Create a container object, largest_string, with the contents of the first string in the array FOR each string in the array IF the string is longer than the largest_word container Save this string as the new value of the largest_word container RETURN the value of largest_word Your Solution Below
def longest_string(list_of_words) if list_of_words.length > 0 longest_word = list_of_words[0] for word in list_of_words if word.length > longest_word.length longest_word = word end end return longest_word end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n # max = list_of_words[i]\n # end\n # end\n # end\n #\n # return max\nend", "def longest_string(list_of_words)\n # length = list_of_words.length\n if list_of_words == []\n return nil\n else\n return list_of_words.max_by { |x| x.length }\n end\nend", "def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0 then return nil\n end\n longest_word = list_of_words.max_by { |x| x.length }\n return longest_word\nend", "def longest_string(list_of_words)\n longest = list_of_words[0]\n list_of_words.each do |x|\n if x.length >= longest.length\n longest = x\n end\n end\n if list_of_words.empty?\n return nil\n end\nreturn longest\nend", "def longest_string(list_of_words)\n if list_of_words.size != 0\n longest_str = list_of_words.max_by{|a| a.size}\n return longest_str\n else\n end\nend", "def longest_string(list_of_words)\n # Your code goes here!\n longest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length > longest.length\n longest = word\n end\n }\n\n return longest\nend", "def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n return list_of_words[index]\nend", "def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend", "def longest_string(list_of_words)\n i=0\n long_string=list_of_words[0]\n list_of_words.each do\n if list_of_words[i].length>long_string.length\n long_string=list_of_words[i]\n end\n i+=1\n end\n return long_string\nend", "def longest_string(list_of_words)\n if list_of_words == []\n p nil\n else\n words_and_lengths = {}\n list_of_words.each do |word|\n words_and_lengths[word.length] = word\n end\n p words_and_lengths\n longest_length = list_of_words[0].length\n words_and_lengths.each do|length, word|\n if length > longest_length\n longest_length = length\n end\n end\n p words_and_lengths[longest_length]\n end\nend", "def longest_string(list_of_words)\n longest = nil\n list_of_words.each do |words|\n if longest.nil? || longest.length < words.length\n longest = words\n end\n end\nlongest\nend", "def longest_string(list_of_words)\n\tif list_of_words==[]\n\t\tnil\n\telse\n\t\tlist_of_words.max_by {|x| x.length}\n\tend\nend", "def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend", "def longest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.max == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend", "def longest_string(list_of_words)\n if list_of_words == []\n return nil\n elsif list_of_words == ['']\n return ''\n elsif list_of_words.length == 1\n return list_of_words[0]\n elsif\n sorted_words = list_of_words.sort_by { |x| x.length}\n return sorted_words[-1]\n end\nend", "def longest_word_in_array(array)\n array.max_by{|word|word.length}\nend", "def longest_word_in_array(array)\n longest_word = array[0]\n array.each {|word|\n longest_word = word if longest_word.size<word.size\n }\n longest_word\nend", "def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0\n \treturn nil\n end\n var = list_of_words[0]\n for i in 1 ... list_of_words.length\n \tif i == list_of_words.length\n \t\treturn var\n \telsif var.length < list_of_words[i].length\n \t\tvar = list_of_words[i]\n \tend\n \ti+=1\n end\n return var\nend", "def longest_string(list_of_words)\n initial = list_of_words.kind_of?(Array) && list_of_words[0] != nil ? '' : nil\n\nreturn initial if initial == nil\n\nfor i in 0...list_of_words.length\n curr_val = list_of_words[i] if list_of_words[i].instance_of? String\n puts list_of_words[i].length\n initial = curr_val if i == 0 || initial.length < curr_val.length\nend\n\ninitial\nend", "def longest_string(arr)\n arr.max_by { |word| word.length }\nend", "def longest_string(list_of_words)\n\treturn list_of_words.max {|x,y| x.length <=> y.length}\nend", "def longest_string(list_of_words)\n\tif list_of_words.size == []\n\t\treturn nil\n\telsif list_of_words.size == 1\n\t\treturn list_of_words[0]\n\telsif list_of_words.size >= 2\n\t\tlist_of_words.sort_by! {|word| word.length}\n\t\treturn list_of_words.last\n\tend\nend", "def longest_string(list_of_words)\n list_of_word = list_of_words.sort_by { |x| x.length }\n return list_of_word[-1]\nend", "def find_longest_word(string)\n array = string.split(\" \")\n p array\n array.max_by(&:length) \nend", "def longest_string(list_of_words)\n return list_of_words[0] if list_of_words.length <= 1\n\n longest = list_of_words.pop\n trash = []\n\n list_of_words.each do |test_item|\n if test_item.length < longest.length\n trash.push test_item\n else\n trash.push longest\n longest = test_item\n end\n end\n return longest\nend", "def longest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length < list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend", "def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend", "def longest_string(list_of_words)\n long_string = list_of_words[0]\n list_of_words.each do |measure|\n if long_string.size < measure.size\n long_string = measure\n end\n\n end\n p long_string\nend", "def longest_string(list_of_words)\n long_string = list_of_words[0]\n counter = 0\n while counter < list_of_words.length\n if long_string.length < list_of_words[counter].length\n long_string = list_of_words[counter]\n end\n counter += 1\n end\n p long_string\n #return list_of_words.sort {|x,y| y.length <=> x.length}[0]\nend", "def longest_string(list_of_words)\n list_of_words.max { |a, b| a.length <=> b.length }\n end", "def longest(stringArray)\n\tlongestString = ''\n\tstringArray.each do |word|\n\t\tif word.length > longestString.length\n\t\t\tlongestString = word\n\t\tend\n\tend\n\tp longestString\nend", "def longest_string(list_of_words)\n # Your code goes here!\n word_hash = Hash.new\n list_of_words.each do |word|\n word_hash[word] = word.length\n end\n word_length = Array.new\n word_hash.each_value do |value|\n word_length.push(value)\n end\n length_sorted = word_length.sort\n tall_one = length_sorted.last\n word_hash.key(tall_one)\nend", "def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend", "def longest_string(string_array)\n string_array.max_by(&:length)\nend", "def longest_string array\n array.max_by(&:length)\nend", "def longest_string(list_of_words)\n longestword = list_of_words.pop\n\n\n while list_of_words.count > 0 do\n word = list_of_words.pop\n if longestword.length < word.length\n longestword = word\n end\n end\n p longestword\nend", "def longest_string(list_of_words)\n # Your code goes here!\n list_of_words.each do\n \n if list_of_words.at(0).length > list_of_words.at(-1).length\n list_of_words.pop\n else\n list_of_words.delete_at(0)\n end\n \n if list_of_words.length > 1\n list_of_words.each do\n \n if list_of_words.at(0).length > list_of_words.at(-1).length\n list_of_words.pop\n else\n list_of_words.delete_at(0)\n end\n end\n end\n end\n puts list_of_words\nend", "def longest_string array\n\tarray.max_by(&:length)\nend", "def longest(stringArray)\n return stringArray.max_by(&:length)\nend", "def get_the_longest_word(str)\n words = str.split()\n longest = [0, \"\"]\n\n for word in words\n if word.length > longest[0]\n longest[0] = word.length\n longest[1] = word\n end\n end\n\n print(longest[1])\n return longest[1]\nend", "def longest_word(string_of_words)\n\tas_arr = string_of_words.split(\" \")\n\tlengths = as_arr.map {|string| string.length}\n\tmax_length = lengths.max\n return as_arr.reverse.detect {|string| string.length === max_length}\nend", "def longest_string list\n # longest = ''\n # list.each do |str|\n # if str.length > longest.length\n # longest = str\n # end\n # end\n # longest\n list.max_by{|i| i.length}\n # list.max_by(&:length)\nend", "def longest_word(sentence)\n words = sentence.split(\"\\s\")\n \n max_word = nil\n for word in words do\n if max_word == nil \n max_word = word\n elsif word.length > max_word.length \n max_word = word\n end\n end\n \n return max_word\nend", "def longest_word_in_array(array)\n array.sort_by(&:length).reverse[0]\nend", "def longest_word_in_array(array)\n\tn = %w(here is a bunch of words of different lengths)\n\tsorted = n.sort_by! { | word | word.length }\n\tsorted.last\nend", "def longest_word_in_array(array)\n array.sort_by { | word | word.size }[-1]\nend", "def longest_word(sentence)\n\n#split sentence in words kept in array words \nwords = sentence.split(\" \")\n\n# sets up empty variable longest_word (is this not definted already...?)\nlongest_word = nil \n\n#sets up counter, sets equal to 0 \nwords_idx = 0 \n\n#sets up while statement, constrains loops \nwhile words_idx < words.length\n#defines current words as word position in array based on counter \ncurrent_word = words[words_idx]\n\n#if the longest word is nil (it is, set equal to nil above)\nif longest_word == nil \n #then the longest word is whatever position you are at \n longest_word == current_word\n \n #if the longest word length (nil?) is less than the length of current word length \n #(remember current word is at position word_idx)\n elsif longest_word.length < current_word.length\nlongest_word = current_word \nend\n\nwords_idx += 1 \nend \n\nreturn longest_word\nend", "def longest_length(my_strings)\n\n if my_strings.length == 0\n return nil\n else\n # initialize longest\n longest_string = \"\"\n array = []\n\n #iterate through my_strings\n my_strings.each do |string|\n if string.length >= longest_string.length\n longest_string = string\n array << string\n end\n end\n\n end\n return longest_string\n\nend", "def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\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 longest_string(array)\n\tarray.max_by(&:length)\nend", "def find_longest_word(input)\n array = input.split(\" \")\n array.sort! { |x, y| y.length <=> x.length }\n array[0]\nend", "def longest (string)\n length_string = getlength(string)\n string.each do |word|\n if word.length == length_string.max\n puts word\n end\n end\nend", "def longest_string string \n\tar = ['One','Two','Three','Four','Five']\n\tar.max_by(&:length)\nend", "def LongestWord(sen)\n arr = sen.split(' ')\n longest = arr[0]\n arr.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\nend", "def longest(string)\n if string.class == String\n words = string.split(' ').sort_by! {|word| word.length}\n words.last\n else\n nil\n end\nend", "def longest_string(list_of_words)\n # Your code goes here!\nend", "def longest (arr)\n arr.max_by {|str| str.length}\nend", "def longest(array)\n\tsentenceSplit = sentence\n\tlongestWord = 0\n\tsentenceSplit.each do |word|\n\n\t\tif longestWord < sentenceSplit[word].length\n\t\t\tlongestWord = sentenceSPlit[word].length\n\t\tend\n\tend\nend", "def longest_word(sentence)\n longestWord = \"\" #holds word\n words = sentence.split(' ') #split sentence into array of words.\n\n words.each do |word| #loop through array of words\n if word.length > longestWord.length #if the word the loop is on is greater than the longest word.. \n longestWord = word #set the longest word to that word.\n end\n end\n return longestWord #return longest word\nend", "def longest_word(string_of_words)\n # Give me back the longest word!\n longest = \"\"\n string_of_words.split(\" \").each do | word |\n if longest.length <= word.length\n longest = word\n end\n end\n return longest\nend", "def longest_word(str)\r\n\r\n # temporary variables created\r\n word_length = 0\r\n longest_word = \"\"\r\n\r\n # checks length of each word\r\n str.split(\" \").each {|word|\r\n\r\n if word.length >= word_length\r\n word_length = word.length\r\n longest_word = word\r\n end\r\n\r\n }\r\n\r\n longest_word\r\nend", "def longest_word(str)\n longest_word = \"\"\n words = str.split(' ')\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\nend", "def longest(words=[])\r\n result = ''\r\n words.inject do |memo, word|\r\n result = memo.length > word.length ? memo : word\r\n end\r\n result # don't use puts here, just return a value\r\nend", "def longest_word(words=[])\n longest = words.inject do |memo, word|\n memo.length > word.length ? memo : word\n end\n puts longest\nend", "def longest_word(sentence)\r\n arr = sentence.split\r\n arr_length = arr.length\r\n puts(\"Array length: \" + arr_length.to_s)\r\n idx1 = 0\r\n idx2=idx1 + 1\r\n str_length1 = 0\r\n str_length2 = 0\r\n biggest = 0\r\n if arr_length == 1\r\n return arr[0]\r\n end\r\n while idx1 < arr_length\r\n while idx2 < arr_length\r\n str_length1 = arr[idx1].length\r\n str_length2 = arr[idx2].length\r\n # puts(str_length1)\r\n # puts(str_length2)\r\n if(str_length1 > str_length2)\r\n biggest = arr[idx1]\r\n idx1 = idx1 + 1\r\n idx2 = idx2 + 1\r\n # puts(biggest)\r\n else\r\n biggest = arr[idx2]\r\n idx1 = idx1 + 1\r\n idx2 = idx2 + 1\r\n # puts(biggest)\r\n end\r\n end\r\n return biggest\r\n end\r\nend", "def longest_entry(words)\n return words.max_by(&:length)\n end", "def longest_word(sentence)\n word_arr = sentence.split\n longest = word_arr.shift\n \n word_arr.each do |word|\n longest = word if word.length >= longest.length\n end\n\n longest\nend", "def old_longest_word(str)\n words = str.split\n longest_word = \"\"\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n\n longest_word\nend", "def longest_word(string)\n\t\n\tsplitted_string = string.split(\" \")\n\tword_length = []\n\t\n\tsplitted_string.each { |word| word_length << word.length }\n\t\n\tmax = word_length.max\n\tidx = word_length.index(max)\n\tsplitted_string[idx]\n\t\nend", "def LongestString(array)\n\tlongest_string = ''\n\tarray.each do |string|\n\t\tif string.length > longest_string.length\n\t\t\tlongest_string = string\n\t\tend\n\tend\n\treturn longest_string.length\nend", "def longest_string(array)\n array.map{|x, v| v = x.size;x}.sort.last\n\nend", "def LongestWord(sen)\n words = sen.split(' ').map do |i|\n /[a-zA-Z0-9]+/.match(i)\n end\n\n longest = words.max_by.each do |i|\n i.to_s.length\n end\n\n longest\n\nend", "def longest(input)\n array = input.sort do |first, second|\n first.length <=> second.length # sorts by length from greatest to least\n # can also do array = input.sort_by do |word| word.length end\n # can also do input.max_by do |word| word.length end\n end\n array.last\nend", "def longest_word(sentence)\n\t\n\tarr = sentence.split(\" \")\n\tarr = []\n\tlongest = \"\"\n\t\n\tarr.each do |word|\n\tlongest = word if longest.length < word.length\t\n end\n return longest\nend", "def longest\n @strings.max { |a,b| a.length <=> b.length}\n end", "def longest(array)\n return array.max\nend", "def longest_string(list)\n longest_so_far = list.first\n list.each do |item|\n if longest_so_far.length < item.length\n longest_so_far = item\n end\n end\n longest_so_far\nend", "def cleaver(array)\n longest_word = \"\"\n i = 0\n while i < array.length - 1 \n if array[i].length < array[i+1].length\n longest_word = array[i+1]\n else\n longest_word = array[i]\n end \n i += 1\n end \n return longest_word\nend", "def longest_string(list)\n\tlongest = list.first\n\tlist.each do |current_str|\n\t\tif current_str.length > longest.length\n\t\t\tlongest = current_str\n\t\tend\n\tend\n\n\tlongest\nend", "def LongestWord(str)\n words = str.split.map { |s| s.gsub(/\\W/, '') }\n longest = words [0]\n words.each { |word| longest = word if word.length > longest.length }\n longest\nend", "def longest_string(list)\n\t\tlongest_so_far = list.first \t#look at the first element of the list. use that as the longest string.\n\t\tlist.each do | string |\t\t\t\t#move through the array. make the next element a placeholder.\n\t\t\tif string.length > longest_so_far.length #if this new placeholder value is longer than the longest_so_far length\n\t\t\t\tlongest_so_far = string \t#then the NEW longest string is that placeholder. REPEAT.\n\t\tend\n\tend\n\treturn longest_so_far\t\t\t\t\t\t\t\t\t\t\t\t\t#return the longest string so far.\nend", "def longest_string ar\n return ar.max_by(&:length)\nend", "def longest_in_list list #:nodoc:\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\n end", "def longest_in_list list #:nodoc:\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\n end", "def longest_string ar\n\tar.max_by(&:length)\nend", "def longest_word(sentence) #def longest_word method that takes sentece as a param\r\n words = sentence.split(\" \") #split the sentence\r\n\r\n puts \"after sentence.split #{words}\" #for debug to see the array\r\n\r\n longest_word = nil #create a longest_word var set it to an empty string\r\n\r\n letter_count = 0 #create a word_count var set it to 0\r\n while letter_count < words.length #while word_count is less then the words.length\r\n # puts \"letter count == #{letter_count} words.length == #{words.length}\" #for debug to see word count + letter count\r\n current_word = words[letter_count] #create a new var current_word set it to letter returned\r\n\r\n if longest_word == nil #if the longest_word = \"\" which it does at this point\r\n\r\n longest_word = current_word #longest word = current_word\r\n puts \"==========after ln 24 longest word length, '#{longest_word.length}' ==========\"\r\n puts \"==========after ln 24 current word length, '#{current_word.length}' ==========\"\r\n elsif longest_word.length < current_word.length\r\n puts \"+++++++++++ #{current_word} ++++++++++++++\"\r\n longest_word = current_word\r\n end\r\n letter_count += 1\r\n\r\n end\r\n return longest_word\r\nend", "def longest_fish(array)\n longest = ''\n array.each { |fish| longest = fish if fish.length > longest.length}\n longest\nend", "def longest_words(text)\n greatest_length = unique_words(text).map { |word| word.length }.max\n unique_words(text).select do |word|\n word.length == greatest_length\n end\nend", "def longest_word(sentence)\n\n arr = sentence.split\n idx = arr.length\n cmp = []\n\n n = idx\n while n >= 0\n\n word = arr[n].to_s\n word_length_string = word.length\n word_length_integer = word_length_string.to_i\n cmp.unshift(word_length_integer)\n\n n = n - 1\n end\n\n n = 0\n longest_length = 0\n position = 0\n while n < cmp.length\n if cmp[n] > longest_length\n longest_length = cmp[n]\n position = n\n end\n n = n + 1\n end\n\nreturn arr[position]\n\nend", "def longest_word(phrase)\n longestWord = \"\"\n longestWordLength = 0\n \n wordArray = phrase.split(\" \")\n wordArray.each do |word|\n if word.length > longestWordLength\n longestWord = word\n longestWordLength = word.length\n end\n end\n return longestWord\nend", "def longest_word(sentence)\n\tarr = sentence.split(\" \")\n\tp arr\n\titer = 0\n\twhile iter < arr.length\n\t\tlongest_word = nil\n\t\tcurrent_word = arr[iter]\n\t\tif longest_word == nil\n\t\t\tlongest_word = current_word\n\t\telsif longest_word.length < current_word.length\n\t\t\tlongest_word = current_word\n\t\tend\n\t\titer+=1\n\tend\n\treturn longest_word\nend", "def longest_words(validwords, longest)\n longest_words = []\n validwords.each { |word| longest_words << word if word.length == longest }\n longest_words\nend", "def clever_octopus(arr)\n longest = nil\n\n arr.each do |fish|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend", "def longest(string)\n sliced = string.chars.slice_when {|a,b| a > b}.to_a\n longest = sliced.max_by {|sub_arr| sub_arr.length}.join\nend", "def longest_word(sentence)\n words = sentence.split(\" \") # words = \"hello, you, motherfucker\"\n\n idx = 0\n while idx < words.length # 0 < 3\n current_word = words[idx] # current_word = words[0]\n\n longest_word = \"\" # set initial longest_word as empty string.\n if current_word.length > longest_word.length\n longest_word = current_word\n end\n\n idx += 1\n end\n return longest_word\nend", "def LongestWord(sen)\n arr = sen.split(\" \")\n arr.sort! { |a, b| b.length <=> a.length }\n arr[0]\n\nend", "def longest_word(sentence)\n words = sentence.split(\"\") #This automically creates a new array with the string split already right?\n idx = 0\n # initially the longest word is empty\n \n longest_w = ''\n \n # We will loop over the current word.\n \n while idx < words.length\n if (words[idx].length > longest_w.length)\n longest_w = words[idx]\n else \n longest_w = longest_w\n end\n \n idx = idx + 1\n end\n \n return longest_w\nend", "def clever_octopus(arr)\n longest = \"\"\n arr.each do |el|\n longest = el if el.length > longest.length\n end\n longest\nend", "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" ]
[ "0.8686293", "0.85057205", "0.8470234", "0.8446541", "0.84464157", "0.8362378", "0.83612466", "0.83458966", "0.83437854", "0.83410996", "0.8329575", "0.83033985", "0.8294679", "0.825028", "0.82484376", "0.8204588", "0.8162662", "0.815339", "0.81285286", "0.81212443", "0.8104448", "0.80876553", "0.80809945", "0.8041625", "0.8028555", "0.800568", "0.7997736", "0.797477", "0.79617953", "0.7942015", "0.7939926", "0.79320276", "0.7929505", "0.7921181", "0.78899354", "0.7877628", "0.78704596", "0.7868997", "0.78644806", "0.7852361", "0.78444356", "0.78193384", "0.781895", "0.7813204", "0.7795378", "0.77892536", "0.7775866", "0.776852", "0.7766991", "0.77631557", "0.77420866", "0.7724232", "0.7708", "0.7707155", "0.7690719", "0.76899487", "0.76687723", "0.7666632", "0.7665075", "0.76645154", "0.7655253", "0.7630912", "0.7627853", "0.76088864", "0.76041156", "0.75872886", "0.7570083", "0.75694394", "0.75674826", "0.75640833", "0.75467956", "0.7511604", "0.7489814", "0.74866724", "0.74776965", "0.74667746", "0.7457314", "0.7444034", "0.74314016", "0.7431351", "0.7428302", "0.7419425", "0.7417329", "0.7406518", "0.7406518", "0.73886883", "0.73708797", "0.7350891", "0.734373", "0.7342344", "0.7329328", "0.7325268", "0.7306118", "0.72936314", "0.7284523", "0.7272181", "0.7258498", "0.72574335", "0.725119", "0.7250409" ]
0.85164124
1
GET /item_types/1 GET /item_types/1.xml
def show @item_type = ItemType.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @item_type } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def index\n @itemtypes = Itemtype.all\n end", "def index\n @recipe_types = RecipeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_types }\n end\n end", "def index\n @types = ItemType.all\n end", "def index\n @attr_types = AttrType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attr_types }\n end\n end", "def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def lookup_item_type\n @item_type = ItemType.find(params[:item_type_id])\n end", "def index\n @item_type = params[:type] = \"C\"\n \n params[:id] = nil\n \n # 찜한 상품, 콜렉션\n @collections = Collection.itemList(params)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n \n end", "def index(item_type)\n @title = @list.title\n\n respond_to do |format|\n format.html { html_index(item_type) }\n format.pdf { pdf_index(item_type) }\n format.csv { csv_index(item_type) }\n format.xlsx { xlsx_index(item_type) }\n end\n end", "def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @infraction_types }\n end\n end", "def show\n @rtype = Rtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rtype }\n end\n end", "def index\n @book_types = BookType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @book_types }\n end\n end", "def show\n @uri_type = UriType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end", "def index\n @archetypes = Archetype.by_item(params[:item_id])\n end", "def index\n @inv_types = InvType.order(\"id desc\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @inv_types }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @order_types }\n end\n end", "def index\n unless params[:type]\n @page = Page.find_by_permalink(\"production\", :order => \"position ASC\")\n #@page_ids = []\n else\n @page = Page.find_by_permalink(\"accessories\", :order => \"position ASC\")\n #@items = Item.find_by_page_id(params[:page_id])\n end\n\n #respond_to do |wants|\n # wants.html # index.html.erb\n # # wants.xml { render :xml => @items }\n # end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def index\n @item_attribute_types = ItemAttributeType.all\n end", "def show\n @inventory_item_type = InventoryItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_item_type }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def index\n @vendor_item_types = VendorItemType.all\n end", "def index\n @az_simple_data_types = AzSimpleDataType.all\n @title = 'Простые типы данных'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @az_simple_data_types }\n end\n end", "def show\n @model_type = ModelType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @model_type }\n end\n end", "def type\n return @type if @type\n @type = 'item' if rss.css('item').count > 0\n @type = 'entry' if rss.css('entry').count > 0\n return @type\n end", "def index\n @program_types = ProgramType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @program_types }\n end\n end", "def index\n @subscription_types = SubscriptionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscription_types }\n end\n end", "def item_type_params\n params[:item_type]\n end", "def index\n @event_types = EventType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @event_types }\n end\n end", "def index\n @extension_types = ExtensionType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @extension_types }\n end\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def index\n @link_types = LinkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @link_types }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end", "def show\n @recipe_type = RecipeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe_type }\n end\n end", "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def item_type_as_uri\n code = ITEM_TYPE_TO_URI_CODE.fetch(type.name.to_sym)\n CONTROLLED_VOCABULARIES[:item_type].send(code)\n end", "def item_type_path\n self.class.name.pluralize.underscore\n end", "def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end", "def index\n @provider_types = ProviderType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_types }\n end\n end", "def item\n item_type.name.classify.constantize.find(item_id)\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def index\n @item_formats = ItemFormat.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @item_formats.to_xml }\n end\n end", "def show\n @attr_type = AttrType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def index\n @industry_types = IndustryType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @industry_types }\n end\n end", "def index\n @unit_type = UnitType.all\n\n respond_to do |format|\n format.json { render json: @unit_type }\n format.xml { render xml: @unit_type }\n end\n end", "def index\n @os_types = OsType.find(:all, :order => 'position')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @os_types }\n end\n end", "def index\n @store_type = StoreType.new\n @store_types = StoreType.active\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @store_types }\n end\n end", "def index\n @format_types = FormatType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @format_types }\n end\n end", "def index\n @account_types = AccountType.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @account_types.to_xml }\n end\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def show\n @order_types = OrderType.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n end\n end", "def index\n @az_page_types = AzPageType.find_all_page_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @az_page_types }\n end\n end", "def index\n @myers_briggs_types = MyersBriggsType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @myers_briggs_types }\n end\n end", "def show\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book_type }\n end\n end", "def show\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book_type }\n end\n end", "def item_type_as_uri\n code = ITEM_TYPE_TO_URI_CODE.fetch(type.name.to_sym)\n ControlledVocabulary.era.item_type.from_value(code)\n end", "def type()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Type::TypeRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end", "def index\n @incidenttypes = Incidenttype.find(:all, :order => 'name asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @incidenttypes }\n end\n end", "def index\n @agendaitemtypes = Agendaitemtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendaitemtypes }\n end\n end", "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def set_item_type\n @item_type = ItemType.find(params[:id])\n end", "def show\n @content_type = ContentType.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_type }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestion_types }\n end\n end", "def item_type\n name.singularize.ns_underscore\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @os_type }\n end\n end", "def find_item_type\n if params[:item_type].in? ['contact', 'organization', 'project', 'event']\n @item_type = params[:item_type]\n end\n end", "def find_item_type\n if params[:item_type].in? ['contact', 'organization', 'project', 'event']\n @item_type = params[:item_type]\n end\n end", "def xlsx_index(item_type)\n send_xlsx @list.send(item_type).as_xlsx, \"#{@title} #{item_type}\"\n end", "def show\n @rest_datatype = RestDatatype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @rest_datatype }\n end\n end", "def content_type\n \"text/xml\"\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def set_item_type\n @item_type = ItemType.find(params[:id])\n end", "def find_item_type\n @item_type = catalog.item_types\n .where(:slug => params[:item_type_slug])\n .first!\n end", "def index\n @claim_types = ClaimType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @claim_types }\n end\n end", "def show\n @content_type = ContentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_type }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def show\n @spit_type = SpitType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spit_type }\n end\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def index\n order = filter_sortable_column_order %w{friendly_name receipt_name receipt_item_category.name}\n @receipt_item_types = current_account.receipt_item_types.include_names.order(order)\n respond_with @receipt_item_types\n end", "def show\n @inv_type = InvType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inv_type }\n end\n end", "def index\n\t@dl_types = DlType.paginate(:page=>params[:page]||1,:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dl_types }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def show\n @sitetype = Sitetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitetype }\n end\n end", "def show\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @event_type }\n end\n end", "def index\n @association_types = AssociationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @association_types }\n end\n end" ]
[ "0.7195215", "0.65795684", "0.6447344", "0.6431036", "0.63674945", "0.63319886", "0.63209176", "0.6313038", "0.62947434", "0.6290185", "0.6276911", "0.6197157", "0.61479974", "0.61471194", "0.611879", "0.61072236", "0.6104964", "0.61011845", "0.6089136", "0.60825175", "0.6074971", "0.6070895", "0.60473317", "0.6039175", "0.6039175", "0.6039175", "0.6039175", "0.6039175", "0.6039175", "0.6026691", "0.6007602", "0.6006862", "0.59786785", "0.597559", "0.59722155", "0.59654176", "0.5965105", "0.59610355", "0.5957883", "0.5956875", "0.59546983", "0.5949513", "0.5945082", "0.59373266", "0.5931143", "0.592674", "0.592674", "0.5910975", "0.5905799", "0.59046113", "0.5902405", "0.59003776", "0.5892874", "0.5880578", "0.5880073", "0.58728004", "0.58713305", "0.5867257", "0.58540547", "0.5851401", "0.58490336", "0.5846269", "0.58459795", "0.5841663", "0.58316356", "0.58264273", "0.58264273", "0.58246905", "0.5821941", "0.5812231", "0.58074224", "0.58032084", "0.58011365", "0.57954025", "0.57919115", "0.5789194", "0.5788294", "0.5774526", "0.5765175", "0.5764702", "0.57630706", "0.57630706", "0.57629156", "0.5759158", "0.5758528", "0.5756774", "0.5747625", "0.57439137", "0.5742509", "0.57391286", "0.57374656", "0.5730792", "0.5724235", "0.57203543", "0.57147396", "0.57126087", "0.5710228", "0.57081383", "0.57044727", "0.57035905" ]
0.7143822
1
GET /item_types/new GET /item_types/new.xml
def new @item_type = ItemType.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @item_type } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\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 create\n @item_type = ItemType.new(params[:item_type])\n\n respond_to do |format|\n if @item_type.save\n format.html { redirect_to(:action => 'new', :notice => I18n.t(\"views.notice.model_create\", :model => ItemType.model_name.human)) }\n format.xml { render :xml => @item_type, :status => :created, :location => @item_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @rtype = Rtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rtype }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\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\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\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 create\r\n @item_type = ItemType.new(params[:item_type])\r\n\r\n respond_to do |format|\r\n if @item_type.save\r\n flash[:notice] = 'ItemType was successfully created.'\r\n format.html { redirect_to(@item_type) }\r\n format.xml { render :xml => @item_type, :status => :created, :location => @item_type }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\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 @attr_type = AttrType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def new\n @model_type = ModelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model_type }\n end\n end", "def new\n @recipe_type = RecipeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe_type }\n end\n end", "def new\n @content_type = ContentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_type }\n end\n end", "def new\n @content_type = ContentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_type }\n end\n end", "def new\n @item = BudgetItem.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 @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def new\n params[:item] ||= {}\n @item = \"Vger::Resources::#{params[:item_type]}\".constantize.new(params[:item].merge(:active => true))\n respond_to do |format|\n format.html\n end\n end", "def new\n @page = Page.new\n\t\t@types = Type.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end", "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def new\n @inventory_item_type = InventoryItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_item_type }\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 @receipt_item_type = current_account.receipt_item_types.new\n respond_with @receipt_item_type\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def new\n @sitetype = Sitetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitetype }\n end\n end", "def new\n @tipo_item = TipoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_item }\n end\n end", "def new\n @inv_type = InvType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inv_type }\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 @spit_type = SpitType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spit_type }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n @itemtype = Itemtype.new(itemtype_params)\n\n respond_to do |format|\n if @itemtype.save\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully created.' }\n format.json { render :show, status: :created, location: @itemtype }\n else\n format.html { render :new }\n format.json { render json: @itemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @os_type = OsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @os_type }\n end\n end", "def new\n @provider_type = ProviderType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_type }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @book_type = BookType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book_type }\n end\n end", "def new\n @book_type = BookType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book_type }\n end\n end", "def new\n @receiving_item = ReceivingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end", "def new\n @role_types = RoleTypes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role_types }\n end\n end", "def new\n @transaction_type = TransactionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_type }\n end\n end", "def new\n @repair_type = RepairType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repair_type }\n end\n end", "def new\n @item_alias = ItemAlias.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "def new\n @store_type = StoreType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @store_type }\n end\n end", "def new\n @lookup_type = Irm::LookupType.new(:lookup_level=>'USER')\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_type }\n end\n end", "def new\n @event_type = EventType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @event_type }\n end\n end", "def new\n @typo = Typo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @typo }\n end\n end", "def new\n @link_type = LinkType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link_type }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order_type }\n end\n end", "def new\n @itemstatus = Itemstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstatus }\n end\n end", "def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @mtype = Mtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtype }\n end\n end", "def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_item }\n end\n end", "def new\n @instancia_item = InstanciaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @ss_type = SsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ss_type }\n end\n end", "def new\n @objecttype = Objecttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @objecttype }\n end\n end", "def new\n @product = Product.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 @inventory_item = InventoryItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventory_item }\n end\n end", "def new\n @realty_type = RealtyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @realty_type }\n end\n end", "def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end", "def new\n @incidenttype = Incidenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end", "def new\n @vocabtype = Vocabtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocabtype }\n end\n end", "def new\n @creator_type = CreatorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creator_type }\n end\n end", "def new\n @address_type = AddressType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_type }\n end\n end", "def new\n @file_item = FileItem.cs(self.current_scope).new\n @file_item.item_type = params[:type]\n @file_item.parent_id = params[:parent_id]\n\n respond_to do |format|\n format.html { render :action => \"new_#{@file_item.item_type}\" }\n format.json { render :json => @file_item }\n end\n end" ]
[ "0.7940502", "0.7273418", "0.7221853", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7215997", "0.7191246", "0.7184084", "0.7169594", "0.71622723", "0.7156774", "0.7074482", "0.70645607", "0.7010892", "0.7006894", "0.7006165", "0.68816876", "0.6872764", "0.6872764", "0.6855983", "0.6844435", "0.6844358", "0.6830576", "0.6829443", "0.68236494", "0.6811276", "0.6810303", "0.6795438", "0.67883843", "0.6783601", "0.67544776", "0.6750939", "0.67427593", "0.6690912", "0.66833943", "0.6658633", "0.6658633", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.66583645", "0.6643248", "0.6608462", "0.6607633", "0.6605063", "0.6602225", "0.6602225", "0.6589859", "0.65705997", "0.6569271", "0.6567826", "0.6561966", "0.6560893", "0.65600765", "0.65540886", "0.6550256", "0.654855", "0.6544841", "0.6542257", "0.6540533", "0.653689", "0.6526879", "0.6526879", "0.6522741", "0.65220475", "0.6517737", "0.65131116", "0.65103275", "0.6499146", "0.64984465", "0.6491339", "0.648951", "0.6487367", "0.6485905", "0.648303", "0.648214", "0.64748347", "0.6474567", "0.64699537" ]
0.7870722
1
POST /item_types POST /item_types.xml
def create @item_type = ItemType.new(params[:item_type]) respond_to do |format| if @item_type.save flash[:notice] = 'ItemType was successfully created.' format.html { redirect_to(@item_type) } format.xml { render :xml => @item_type, :status => :created, :location => @item_type } else format.html { render :action => "new" } format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @itemtype = Itemtype.new(itemtype_params)\n\n respond_to do |format|\n if @itemtype.save\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully created.' }\n format.json { render :show, status: :created, location: @itemtype }\n else\n format.html { render :new }\n format.json { render json: @itemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_type = ItemType.new(params[:item_type])\n\n respond_to do |format|\n if @item_type.save\n format.html { redirect_to(:action => 'new', :notice => I18n.t(\"views.notice.model_create\", :model => ItemType.model_name.human)) }\n format.xml { render :xml => @item_type, :status => :created, :location => @item_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_type_params\n params[:item_type]\n end", "def create\n @receipt_item_type = current_account.receipt_item_types.create(receipt_item_type_params)\n if @receipt_item_type\n respond_with @receipt_item_type do |format|\n format.json { render :json => current_account.receipt_item_types.include_names.find(@receipt_item_type.id) }\n end\n else\n respond_with @receipt_item_type\n end\n end", "def create\n @item_attribute_type = ItemAttributeType.new(item_attribute_type_params)\n\n if @item_attribute_type.save\n render :show, status: :created, location: @item_attribute_type\n else\n render json: @item_attribute_type.errors, status: :unprocessable_entity\n end\n end", "def item_type_params\n params.require(:item_type).permit(:name, :string, :base_fee, :fee_per_day, :disclaimer)\n end", "def create\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.new(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to suitability_item_path(@item), notice: 'Suitability Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_type = ItemType.new(item_type_params)\n\n respond_to do |format|\n if @item_type.save\n format.html { redirect_to @item_type, notice: 'ItemType was successfully created.' }\n format.json { render action: 'show', status: :created, location: @suplier }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_post_typenames_and_namespaces()\n type_names_node_set = @request_body_xml.xpath('//csw:DescribeRecord//csw:TypeName',\n 'csw' => 'http://www.opengis.net/cat/csw/2.0.2')\n if (type_names_node_set != nil && type_names_node_set.size > 0)\n @type_names = []\n @namespaces = {}\n namespace_definitions = @request_body_xml.root.namespaces\n type_names_node_set.each do |type_name|\n # must work around to present indetical hashes for model validation for both GET and POST\n node_namespace_prefix_orig = type_name.text.split(':')[0]\n if (node_namespace_prefix_orig == type_name.text)\n # no namespace\n node_namespace_prefix = 'xmlns'\n node_namespace_prefix_orig = 'default'\n else\n node_namespace_prefix = \"xmlns:#{node_namespace_prefix_orig}\"\n end\n node_namespace_href = namespace_definitions[node_namespace_prefix]\n if !node_namespace_href.nil?\n @namespaces[node_namespace_prefix_orig.to_sym] = node_namespace_href\n end\n @type_names << type_name.text\n end\n else\n @type_names = []\n end\n if (@namespaces.nil? || @namespaces.empty?)\n @namespaces = {:gmi => 'http://www.isotc211.org/2005/gmi'}\n end\n end", "def create\n @vendor_item_type = VendorItemType.new(vendor_item_type_params)\n\n respond_to do |format|\n if @vendor_item_type.save\n format.html { redirect_to @vendor_item_type, notice: 'Vendor item type was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_item_type }\n else\n format.html { render :new }\n format.json { render json: @vendor_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_item_type\n @item_type = ItemType.find(params[:id])\n end", "def set_item_type\n @item_type = ItemType.find(params[:id])\n end", "def create\n\n # params enums to integer\n params[:item][:brand_generic_compound] = params[:item][:brand_generic_compound].to_i\n params[:item][:dea_schedule] = params[:item][:dea_schedule].to_i\n params[:item][:drug_class] = params[:item][:drug_class].to_i\n params[:item][:maintenance_code] = params[:item][:maintenance_code].to_i\n\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :type_id, :user_id)\n end", "def item_attribute_type_params\n params.require(:item_attribute_type).permit(:item_id, :attribute_type_id, :display_unit_id, :value)\n end", "def item_params\n params.require(:item).permit(:category_id, :type)\n end", "def index\n @itemtypes = Itemtype.all\n end", "def create\n @inventory_item_type = InventoryItemType.new(params[:inventory_item_type])\n\n respond_to do |format|\n if @inventory_item_type.save\n format.html { redirect_to @inventory_item_type, notice: 'Inventory item type was successfully created.' }\n format.json { render json: @inventory_item_type, status: :created, location: @inventory_item_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventory_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end", "def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def item_params\n params.require(:item).permit(:name, :tag_list, :type_list, :description)\n end", "def create_types\n\t[]\nend", "def create_types\n\t[]\nend", "def set_itemtype\n @itemtype = Itemtype.find(params[:id])\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def create_types\n\t\t[]\n\tend", "def create_types\n\t\t[]\n\tend", "def index\n @item_attribute_types = ItemAttributeType.all\n end", "def create\n @tipo_item = TipoItem.new(params[:tipo_item])\n\n respond_to do |format|\n if @tipo_item.save\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully created.' }\n format.json { render json: @tipo_item, status: :created, location: @tipo_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :itemtype, :price)\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def form_item_params\n params.require(type.underscore.to_sym).permit(:type, :order, :label, :value)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sell_payment_types_create (email, params={})\r\n url = api_url \"/sell/payment_types​/new\"\r\n load = MultiJson.dump email: email\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req \r\n end \r\n end", "def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end", "def vendor_item_type_params\n params.require(:vendor_item_type).permit(:name, :description, :vendor_item_id, :active, :quote_request_item_id)\n end", "def create\n @account = current_person.accounts.find params[:account_id]\n @account_membership = @account.account_memberships.find params[:account_membership_id]\n item_type = params[:item].delete(:type)\n @item = @account_membership.items.new(params[:item]).becomes(Object.const_get(item_type))\n raise 'tried to create a non-item object from an item. this might be an attack' unless @item.is_a?(Item)\n @item.type = item_type\n respond_to do |format|\n if @item.save\n format.js\n else\n format.js { render :text => 'there was an error' }\n end\n end\n end", "def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end", "def item_params\n params.require(:item).permit(:name, :price, :date, :user_id, :group_id, :item_type, { tag_ids: [] })\n end", "def type()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Type::TypeRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end", "def index\n @vendor_item_types = VendorItemType.all\n end", "def index\n @types = ItemType.all\n end", "def new\n @receipt_item_type = current_account.receipt_item_types.new\n respond_with @receipt_item_type\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def create\n @kf_course_item_type = Kf::CourseItemType.new(params[:kf_course_item_type])\n\n respond_to do |format|\n if @kf_course_item_type.save\n format.html { redirect_to kf_course_item_types_url({:page => params[:page]}), notice: 'Course item type was successfully created.' }\n format.json { render json: @kf_course_item_type, status: :created, location: @kf_course_item_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_course_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @outgoing_type = OutgoingType.new(params[:outgoing_type])\n\n respond_to do |format|\n if @outgoing_type.save\n format.html { redirect_to(outgoing_types_path, :notice => 'Outgoing type was successfully created.') }\n format.xml { render :xml => @outgoing_type, :status => :created, :location => @outgoing_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outgoing_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_item_attribute_type\n @item_attribute_type = ItemAttributeType.find(params[:id])\n end", "def lookup_item_type\n @item_type = ItemType.find(params[:item_type_id])\n end", "def add(type, description, options={})\n type = type.downcase\n if type == 'todo' then @items.push TodoItem.new(description, options) #uses ToDoItem class in todo.rb\n elsif type == 'event' then @items.push EventItem.new(description, options) #uses EventItem class in event.rb\n elsif type == 'link' then @items.push LinkItem.new(description, options) #usesLinkItem class in event.rb\n else raise UdaciListErrors::InvalidItemType,\n \"'#{type}' is not a valid data type\" #raise error if type is not one of the 3 required\n end\n end", "def itemtype_params\n params.require(:itemtype).permit(:bike_id, :name, :limitdistance, :memo)\n end", "def types\n commit('types', nil)\n end", "def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_type\n @item.type = bibtex_type\n end", "def create_item(iid, itypes, params={})\n params.merge!(default_params)\n params['pio_iid'] = iid\n format_itypes(itypes, params)\n extract_latlng(params)\n extract_startend(params)\n @connection.post(:items, params).body\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "def item_type\n name.singularize.ns_underscore\n end", "def new\n @questionairre_item = QuestionairreItem.new\n @types = QuestionairreItem::TYPES\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionairre_item }\n end\n end", "def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end", "def type_params\n params.require(:type).permit(:name, :index)\n end", "def create\n @work_item_type = WorkItemType.new(work_item_type_params)\n\n respond_to do |format|\n if @work_item_type.save\n format.html { redirect_to @work_item_type, notice: 'Work item type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @work_item_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @work_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rtype = Rtype.new(params[:rtype])\n\n respond_to do |format|\n if @rtype.save\n flash[:notice] = 'Rtype was successfully created.'\n format.html { redirect_to(@rtype) }\n format.xml { render :xml => @rtype, :status => :created, :location => @rtype }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rtype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def recognized_item_types\n\t\t# , 'DocFile', 'DocImage', 'DocPrivate', 'Path'\n\t\t['Article', 'Document', 'Event', 'Group', 'Page', 'Petition', 'Signature', 'User', 'Weblink']\n\tend", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :value)\n end", "def create\n @item = Item.new(params[:item])\n \n @item.item_locales = []\n\n params[:item_locales].each do |locale, values|\n @item.item_locales << ItemLocale.new(:locale => Locale.new(values), :item => @item)\n end\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n format.xml { render xml: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n format.xml { render xml: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end", "def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def tipo_item_variado_params\r\n params.require(:item_variado).permit(:tipo)\r\n end", "def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end", "def find_item_type\n if params[:item_type].in? ['contact', 'organization', 'project', 'event']\n @item_type = params[:item_type]\n end\n end", "def find_item_type\n if params[:item_type].in? ['contact', 'organization', 'project', 'event']\n @item_type = params[:item_type]\n end\n end", "def item_params\n params.require(:item).permit(:name, :department_id, order_item_ids: [], assembly_item_ids: [])\n end", "def initialize(item_types)\n @types = item_types\n end", "def create\n @author_site_type = current_user.author_site_types.build(author_site_type_params)\n @author_site_type[:item_id] = Author::Item.create_and_get.id\n\n respond_to do |format|\n if @author_site_type.save\n format.html { redirect_to author_site_types_path, notice: 'Site type was successfully created.' }\n format.json { render :show, status: :created, location: @author_site_type }\n else\n format.html { render :new }\n format.json { render json: @author_site_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit!\n end", "def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n if @item_type.update_attributes(params[:item_type])\n format.html { render :action => 'edit', :notice => 'Item type was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def resquest_type_params\n params.require(:resquest_type).permit(:name, :description)\n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generic_item = GenericItem.new(generic_item_params)\n\n respond_to do |format|\n if @generic_item.save\n format.html { redirect_to @generic_item, notice: 'Generic item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @generic_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agendaitemtype = Agendaitemtype.new(agendaitemtype_params)\n\n respond_to do |format|\n if @agendaitemtype.save\n format.html { redirect_to @agendaitemtype, notice: 'Agendaitemtype was successfully created.' }\n format.json { render json: @agendaitemtype, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agendaitemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def push(item_type, item)\n all(item_type).push(normalized(item))\n end", "def add_type(type)\n end", "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "def item_params\n params.require(:item).permit(:nombre, :categorium_id)\n end", "def type_params\n params.require(:type).permit( :name)\n end", "def create\n lip = list_item_params list_type_id: params[:list_type_id]\n new_item = current_user.list_items.create(lip)\n respond_with new_item\n end", "def create\n @part_types = Constants::PART_TYPES\n @item = Item.new(item_params.merge(user_id: current_user.id))\n \n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end", "def create\n @checklist_type = ChecklistType.new(checklist_type_params)\n\n respond_to do |format|\n if @checklist_type.save\n format.html { redirect_to @checklist_type, notice: 'Checked item type was successfully created.' }\n format.json { render :show, status: :created, location: @checklist_type }\n else\n format.html { render :new }\n format.json { render json: @checklist_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def export_type_params\n params.require(:export_type).permit(:type_code, :name)\n end" ]
[ "0.6534142", "0.63591176", "0.6292417", "0.6156293", "0.6115572", "0.60752225", "0.59194267", "0.58974105", "0.5886337", "0.58673686", "0.58271915", "0.5824956", "0.5822386", "0.5808868", "0.5792994", "0.57809806", "0.5780694", "0.57783705", "0.5767671", "0.5733091", "0.56925285", "0.5684722", "0.5684722", "0.5683186", "0.56809866", "0.5629034", "0.5629034", "0.5628227", "0.5605916", "0.5605143", "0.5582678", "0.55760556", "0.55712885", "0.5545688", "0.5525106", "0.5516356", "0.55131626", "0.55048454", "0.5468017", "0.5434288", "0.5429664", "0.5421572", "0.5416046", "0.5396873", "0.5379194", "0.5373059", "0.5359344", "0.5338441", "0.533485", "0.5319359", "0.528108", "0.5272603", "0.52700394", "0.52558917", "0.5254669", "0.52485013", "0.5242411", "0.5230694", "0.5227875", "0.5226492", "0.5208718", "0.52044576", "0.5199455", "0.51922333", "0.51839083", "0.5183353", "0.5183353", "0.51825994", "0.51803887", "0.51723224", "0.51710325", "0.5167891", "0.5158835", "0.5155623", "0.5151398", "0.5151398", "0.5147022", "0.5143282", "0.5140656", "0.51278186", "0.5127595", "0.5126857", "0.51190585", "0.5117596", "0.5116387", "0.51162314", "0.51162314", "0.51124924", "0.5111833", "0.51040494", "0.5091617", "0.50868386", "0.50823545", "0.5078028", "0.5074378", "0.5074345", "0.5071983", "0.50709", "0.5068169", "0.5062306" ]
0.637711
1
PUT /item_types/1 PUT /item_types/1.xml
def update @item_type = ItemType.find(params[:id]) respond_to do |format| if @item_type.update_attributes(params[:item_type]) flash[:notice] = 'ItemType was successfully updated.' format.html { redirect_to(@item_type) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n if @item_type.update_attributes(params[:item_type])\n format.html { render :action => 'edit', :notice => 'Item type was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @itemtype.update(itemtype_params)\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully updated.' }\n format.json { render :show, status: :ok, location: @itemtype }\n else\n format.html { render :edit }\n format.json { render json: @itemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_type.update(item_type_params)\n format.html { redirect_to @item_type, notice: 'ItemType was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_item_type\n @item_type = ItemType.find(params[:id])\n end", "def set_item_type\n @item_type = ItemType.find(params[:id])\n end", "def update\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.find(params[:id])\n respond_to do |format|\n if @item.class.save_existing(params[:id], params[:item])\n format.html { redirect_to suitability_item_path(params[:id]), notice: 'Suitability Item was successfully updated.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item_attribute_type.update(item_attribute_type_params)\n render :show, status: :ok, location: @item_attribute_type\n else\n render json: @item_attribute_type.errors, status: :unprocessable_entity\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[@item.class.to_s.downcase.to_sym])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inventory_item_type = InventoryItemType.find(params[:id])\n\n respond_to do |format|\n if @inventory_item_type.update_attributes(params[:inventory_item_type])\n format.html { redirect_to @inventory_item_type, notice: 'Inventory item type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_itemtype\n @itemtype = Itemtype.find(params[:id])\n end", "def update\n @item = @user.items.find(params[:id])\n\n @item.update(:type_list => \"\", :tag_list => \"\")\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@user, @item], notice: 'item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end", "def set_item_attribute_type\n @item_attribute_type = ItemAttributeType.find(params[:id])\n end", "def update\n respond_to do |format|\n if @vendor_item_type.update(vendor_item_type_params)\n format.html { redirect_to @vendor_item_type, notice: 'Vendor item type was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor_item_type }\n else\n format.html { render :edit }\n format.json { render json: @vendor_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @type.update(type_params)\n end", "def _update type, id, body\n @elasticsupport.client.update index: _index_for(type), type: type.to_s, id: id, body: body\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n params[:item][:item_name] = params[:item][:item_name].upcase\n\n # params enums to integer\n params[:item][:brand_generic_compound] = params[:item][:brand_generic_compound].to_i\n params[:item][:dea_schedule] = params[:item][:dea_schedule].to_i\n params[:item][:drug_class] = params[:item][:drug_class].to_i\n params[:item][:maintenance_code] = params[:item][:maintenance_code].to_i\n\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @item = Vger::Resources::Suitability::Item.find(params[:id], :methods => [:item_type])\n respond_to do |format|\n format.html\n end\n end", "def update\n respond_to do |format|\n instance = get_instance\n set_meta instance\n if instance.update(type_params)\n # Redirect to index\n format.html { redirect_to redirect_address(@type), notice: \"#{type_label} was successfully updated.\" }\n else\n flash[:alert] = \"#{type_label} has not been saved.\"\n format.html { render sti_template(@type, :edit) }\n end\n end\n end", "def update\n @receipt_item_type = current_account.receipt_item_types.find(params[:id])\n params[:receipt_item_type].delete(:user_id) if params[:receipt_item_type]\n @receipt_item_category = current_account.receipt_item_categories.find(params[:receipt_item_type][:receipt_item_category_id]) if params[:receipt_item_type][:receipt_item_category_id]\n if @receipt_item_category\n @receipt_item_type.receipt_item_category_id = @receipt_item_category.id\n params[:receipt_item_type].delete(:receipt_item_type_id)\n end\n if @receipt_item_type.update_attributes(receipt_item_type_params)\n add_flash :notice, t('receipt_item_type.updated')\n respond_with @receipt_item_type do |format|\n format.json { render :json => current_account.receipt_item_types.include_names.find(@receipt_item_type.id) }\n end\n else\n respond_with @receipt_item_type\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |wants|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n wants.html { redirect_to(admin_items_path) }\n wants.xml { head :ok }\n else\n \n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_api_v1_item\n @api_v1_item = Item.find(params[:id])\n end", "def update\n @model_type = ModelType.find(params[:id])\n\n respond_to do |format|\n if @model_type.update_attributes(params[:model_type])\n format.html { redirect_to(@model_type, :notice => 'Model type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @model_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n @part_types = Constants::PART_TYPES\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @object_type = ObjectType.find(params[:id])\n\n if params[:object_type][:prefix] != @object_type.prefix\n entries = Item.joins(:locator).where(\"items.object_type_id = #{@object_type.id} AND locators.item_id = items.id\").count\n if entries != 0\n flash[:error] = \"Cannot change location wizard to #{params[:object_type][:prefix]} because there\n are items associated with this object type using the current wizard whose locations\n might get messed up. To change the wizard, (a) write down all the item numbers; (b)\n delete all the items; (c) change the location wizard; (d) undelete all the items by\n changing their locations to a location that works with the new location wizard.\"\n render action: 'edit'\n return\n end\n end\n\n ok = @object_type.update_attributes(params[:object_type].except(:rows, :columns))\n\n if params[:object_type][:handler] == 'collection'\n @object_type.rows = params[:object_type][:rows]\n @object_type.columns = params[:object_type][:columns]\n @object_type.save\n end\n\n respond_to do |format|\n if ok\n format.html { redirect_to object_types_path, notice: \"Object type '#{@object_type.name}' was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_object_type_path, notice: \"Object type could not be updated. #{@object_type.errors.full_messages.join(', ')}.\" }\n format.json { render json: @object_type.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def set_apiv1_item\n @apiv1_item = Item.find(params[:id])\n end", "def update\n @collection = @entity_type.collection\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spit_type = SpitType.find(params[:id])\n\n respond_to do |format|\n if @spit_type.update_attributes(params[:spit_type])\n format.html { redirect_to(@spit_type, :notice => 'Spit type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spit_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_item(item_id)\n @kind = 2\n @item_id = item_id\n end", "def update\n @rtype = Rtype.find(params[:id])\n\n respond_to do |format|\n if @rtype.update_attributes(params[:rtype])\n flash[:notice] = 'Rtype was successfully updated.'\n format.html { redirect_to(@rtype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rtype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n if @tipo_item.update_attributes(params[:tipo_item])\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_item.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 destroy\r\n @item_type = ItemType.find(params[:id])\r\n @item_type.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(item_types_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def update\n @sales_type = SalesType.find(params[:id])\n\n respond_to do |format|\n if @sales_type.update_attributes(params[:sales_type])\n format.html { redirect_to(sales_types_path, :notice => 'Sales type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sales_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item_type = ItemType.new(params[:item_type])\n\n respond_to do |format|\n if @item_type.save\n format.html { redirect_to(:action => 'new', :notice => I18n.t(\"views.notice.model_create\", :model => ItemType.model_name.human)) }\n format.xml { render :xml => @item_type, :status => :created, :location => @item_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @content_type = ContentType.get(params[:id])\n\n respond_to do |format|\n if @content_type.update_attributes(params[:content_type])\n flash[:notice] = 'ContentType was successfully updated.'\n format.html { redirect_to(@content_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @item_type = ItemType.new(params[:item_type])\r\n\r\n respond_to do |format|\r\n if @item_type.save\r\n flash[:notice] = 'ItemType was successfully created.'\r\n format.html { redirect_to(@item_type) }\r\n format.xml { render :xml => @item_type, :status => :created, :location => @item_type }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @outgoing_type = OutgoingType.find(params[:id])\n\n respond_to do |format|\n if @outgoing_type.update_attributes(params[:outgoing_type])\n format.html { redirect_to(outgoing_types_path, :notice => 'Outgoing type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outgoing_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @uri_type = UriType.find(params[:id])\n\n respond_to do |format|\n if @uri_type.update_attributes(params[:uri_type])\n flash[:notice] = 'UriType was successfully updated.'\n format.html { redirect_to(@uri_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @uri_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_vendor_item_type\n @vendor_item_type = VendorItemType.find(params[:id])\n end", "def update\n @content_type = ContentType.find(params[:id])\n\n respond_to do |format|\n if @content_type.update_attributes(params[:content_type])\n flash[:notice] = 'ContentType was successfully updated.'\n format.html { redirect_to(@content_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def lookup_item_type\n @item_type = ItemType.find(params[:item_type_id])\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @itemtipo = Itemtipo.find(params[:id])\n\n if @itemtipo.update(itemtipo_params)\n head :no_content\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def update\n @kf_course_item_type = Kf::CourseItemType.find(params[:id])\n\n respond_to do |format|\n if @kf_course_item_type.update_attributes(params[:kf_course_item_type])\n format.html { redirect_to kf_course_item_types_url({:page => params[:page]}), notice: 'Course item type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kf_course_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generic_item.update(generic_item_params)\n format.html { redirect_to \"/catalog/#{@generic_item.id}\", notice: 'Generic item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n redirect_url = os_types_url\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n flash[:notice] = 'OsType was successfully updated.'\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @os_type.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if get_instance.update(type_params)\n # Redirect to index\n format.json { render sti_template(@type, :show), status: :ok, location: get_instance } # TODO: test\n else\n format.json { render json: get_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attr_type = AttrType.find(params[:id])\n\n respond_to do |format|\n if @attr_type.update_attributes(params[:attr_type])\n flash[:notice] = 'AttrType was successfully updated.'\n format.html { redirect_to(@attr_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attr_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @item_type = ItemType.find(params[:id])\n # You cannot destroy item types\n respond_to do |format|\n format.html { redirect_to(item_types_url) }\n format.xml { head :ok }\n end\n end", "def update\n @sitetype = Sitetype.find(params[:id])\n\n respond_to do |format|\n if @sitetype.update_attributes(params[:sitetype])\n flash[:notice] = 'Sitetype was successfully updated.'\n format.html { redirect_to(@sitetype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitetype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @gearbox_type = GearboxType.find(params[:id])\n\n respond_to do |format|\n if @gearbox_type.update_attributes(params[:gearbox_type])\n format.html { redirect_to(@gearbox_type, :notice => 'Gearbox type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gearbox_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n if @act_type.update_attributes(params[:act_type])\n format.html { redirect_to @act_type, notice: 'Данные типа документа успешно обновлены.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_content_type old_type, old_resource_type, new_type, new_resource_type\n xml=self.ng_xml\n xml.search('/contentMetadata[@type=\\''+old_type+'\\']').each do |node|\n node['type']=new_type\n xml.search('//resource[@type=\\''+old_resource_type+'\\']').each do |resource|\n resource['type']=new_resource_type\n end\n end\n self.content=xml.to_s\n end", "def update_document_all_types client, s, types\n log.debug \"Will update document #{s} for types #{types}\"\n\n if types\n types.each do |type|\n log.debug \"Updating document #{s} for type #{type}\"\n indexes = Indexes.instance.get_indexes type\n indexes.each do |key, index|\n allowed_groups = index[:allowed_groups]\n log.debug \"Got allowed groups for updated_document_all_types #{allowed_groups}\"\n rdf_type = settings.type_definitions[type][\"rdf_type\"]\n log.debug \"Got RDF type for updated_document_all_types #{rdf_type}\"\n if is_authorized s, rdf_type, allowed_groups\n log.debug \"Our current index knows that #{s} is of type #{rdf_type} based on allowed groups #{allowed_groups}\"\n properties = settings.type_definitions[type][\"properties\"]\n document, attachment_pipeline =\n fetch_document_to_index uri: s, properties: properties,\n allowed_groups: index[:allowed_groups]\n\n document_for_reporting = document.clone\n document_for_reporting[\"data\"] = document_for_reporting[\"data\"] ? document_for_reporting[\"data\"].length : \"none\"\n\n log.debug \"Fetched document to index is #{document_for_reporting}\"\n\n # TODO what is uuid supposed to be here? We abstract its meaning to be get_uuid(s) but are not sure\n uuid = get_uuid(s)\n\n if attachment_pipeline\n log.debug \"Document to update has attachment pipeline\"\n begin\n # client.upload_attachment index, uuid, attachment_pipeline, document\n client.upload_attachment index[:index], uuid, attachment_pipeline, document\n log.debug \"Managed to upload attachment for #{s}\"\n rescue\n log.warn \"Could not upload attachment #{s}\"\n begin\n log.debug \"Trying to update document with id #{uuid}\"\n client.update_document index[:index], uuid, document\n log.debug \"Succeeded in updating document with id #{uuid}\"\n rescue\n log.debug \"Failed to update document, trying to put new document #{uuid}\"\n client.put_document index[:index], uuid, document\n log.debug \"Succeeded in putting new document #{uuid}\"\n end\n end\n else\n begin\n log.debug \"Trying to update document with id #{uuid}\"\n client.update_document index[:index], uuid, document\n log.debug \"Succeeded in updating document with id #{uuid}\"\n rescue\n log.debug \"Failed to update document, trying to put new document #{uuid}\"\n client.put_document index[:index], uuid, document\n log.debug \"Succeeded in putting new document #{uuid}\"\n end\n end\n else\n log.info \"Not Authorized.\"\n end\n end\n end\n end\nend", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @entity_type.update_attributes(params[:entity_type])\n format.html { redirect_to(entity_types_path, :notice => \"Entity Type was successfully updated. #{undo_link}\") }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @checklist_type.update(checklist_type_params)\n format.html { redirect_to @checklist_type, notice: 'Checked item type was successfully updated.' }\n format.json { render :show, status: :ok, location: @checklist_type }\n else\n format.html { render :edit }\n format.json { render json: @checklist_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n if @event_type.update_attributes(event_type_params)\n format.html { redirect_to(@event_type, notice: 'Event type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_object_xml(object_type, id, xml)\n @client.update_business_object_by_public_id({\n :busObNameOrId => object_type,\n :busObPublicId => id,\n :updateXml => xml\n })\n return last_error\n end", "def sell_payment_types_update (payment_type_id, email, params={})\r\n url = api_url \"/sell/payment_types​/#{payment_type_id}\"\r\n load = MultiJson.dump email: email\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.put url, load, req \r\n end \r\n end", "def update\n @objecttype = Objecttype.find(params[:id])\n\n respond_to do |format|\n if @objecttype.update_attributes(params[:objecttype])\n flash[:notice] = 'Objecttype was successfully updated.'\n format.html { redirect_to(@objecttype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @objecttype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item.update!(item_params)\n end", "def update\n respond_to do |format|\n if @inventory_type.update(inventory_type_params)\n format.html { redirect_to @inventory_type, notice: 'Inventory type was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_type }\n else\n format.html { render :edit }\n format.json { render json: @inventory_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work_item_type.update(work_item_type_params)\n format.html { redirect_to @work_item_type, notice: 'Work item type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @work_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_type\n @type = IngredientType.find(params[:id])\n end", "def update\r\n @equipe_type = EquipeType.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @equipe_type.update_attributes(params[:equipe_type])\r\n format.html { redirect_to equipe_types_url, notice: I18n.t(:general_update_success) }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @equipe_type.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update \n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Artikel is succesvol ge-update.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @itemtype = Itemtype.new(itemtype_params)\n\n respond_to do |format|\n if @itemtype.save\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully created.' }\n format.json { render :show, status: :created, location: @itemtype }\n else\n format.html { render :new }\n format.json { render json: @itemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n @lookup_type = Irm::LookupType.find(params[:id])\n\n respond_to do |format|\n if @lookup_type.update_attributes(params[:irm_lookup_type])\n format.html { redirect_to({:action=>\"index\"},:notice => (t :successfully_updated))}\n format.xml { head :ok }\n else\n format.html { render \"edit\" }\n format.xml { render :xml => @lookup_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @itype = Itype.find(params[:id])\n\n respond_to do |format|\n if @itype.update_attributes(params[:itype])\n format.html { redirect_to @itype, notice: 'Itype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @itype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe_type = RecipeType.find(params[:id])\n\n respond_to do |format|\n if @recipe_type.update_attributes(params[:recipe_type])\n flash[:notice] = 'RecipeType was successfully updated.'\n format.html { redirect_to(@recipe_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @store_type = StoreType.find(params[:id])\n\n respond_to do |format|\n if @store_type.update_attributes(params[:store_type])\n flash[:notice] = 'Store Type was successfully updated.'\n format.html { redirect_to(store_types_path) }\n format.xml { head :ok }\n else\n @store_types = StoreType.active\n format.html { render :action => \"index\" }\n format.xml { render :xml => @store_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end", "def update\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n if @book_type.update_attributes(params[:book_type])\n format.html { redirect_to(@book_type, :notice => 'Book type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n @agendaitemtype = Agendaitemtype.find(params[:id])\n\n respond_to do |format|\n if @agendaitemtype.update_attributes(agendaitemtype_params)\n format.html { redirect_to @agendaitemtype, notice: 'Agendaitemtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agendaitemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_type\n raise Error::NotFoundError unless (@type = Type.find(params[:id]))\n end", "def update\n @type = Type.find(params[:id])\n if params[:type]['temp_title'] && params[:type]['temp_description']\n @type.name = params[:type]['temp_title']\n @type.description = params[:type]['temp_description']\n @type.image = params[:type]['temp_image']\n end\n @type.active = true\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71110517", "0.6520673", "0.64976186", "0.64485735", "0.64379025", "0.6312937", "0.62140137", "0.61865044", "0.61409885", "0.61078036", "0.6091348", "0.6023158", "0.5976565", "0.59679115", "0.5936291", "0.5933633", "0.5870948", "0.5834867", "0.5795623", "0.5759428", "0.5748145", "0.5741032", "0.57395244", "0.57223505", "0.5722328", "0.57185674", "0.57066447", "0.56931245", "0.56822723", "0.5681825", "0.5667341", "0.56656003", "0.5663042", "0.5656206", "0.5653981", "0.56472135", "0.56387097", "0.56371313", "0.563366", "0.5623493", "0.56024015", "0.5600197", "0.55956066", "0.5581082", "0.5581082", "0.5581082", "0.5580029", "0.5580014", "0.5575792", "0.55751413", "0.55701447", "0.55701447", "0.55614024", "0.5557553", "0.5554489", "0.55410564", "0.554031", "0.55246955", "0.5521804", "0.5515861", "0.5513763", "0.55100554", "0.5501564", "0.5500159", "0.54951817", "0.5492586", "0.5489706", "0.5489641", "0.5489385", "0.54837143", "0.5478237", "0.5477423", "0.5473574", "0.54696876", "0.54616356", "0.546036", "0.54571253", "0.54561585", "0.5453141", "0.54411477", "0.54400355", "0.5437575", "0.54268974", "0.54265624", "0.5425381", "0.542311", "0.5419338", "0.54183793", "0.54173744", "0.5415524", "0.54136074", "0.54118514", "0.5409776", "0.5407561", "0.54031664", "0.5397465", "0.53892565", "0.53885937", "0.5387492", "0.538645" ]
0.68993264
1
DELETE /item_types/1 DELETE /item_types/1.xml
def destroy @item_type = ItemType.find(params[:id]) @item_type.destroy respond_to do |format| format.html { redirect_to(item_types_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @item_type = ItemType.find(params[:id])\n # You cannot destroy item types\n respond_to do |format|\n format.html { redirect_to(item_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redirect_to item_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemtype.destroy\n respond_to do |format|\n format.html { redirect_to itemtypes_url, notice: 'Itemtype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @item.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(admin_items_url) }\n wants.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @actionitem = Actionitem.find(params[:id])\n @actionitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(actionitems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inventory_item_type = InventoryItemType.find(params[:id])\n @inventory_item_type.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_item_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_attribute_type.destroy\n end", "def destroy\n @rtype = Rtype.find(params[:id])\n @rtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(rtypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @uri_type = UriType.find(params[:id])\n @uri_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(uri_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @receipt_item_type = current_account.receipt_item_types.find(params[:id])\n @receipt_item_type.destroy\n respond_with @receipt_item_type, location: receipt_item_types_url \n end", "def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end", "def destroy\n @action_item = ActionItem.find(params[:id])\n @action_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @content_type = ContentType.find(params[:id])\n @content_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @course.items.find(:first, :conditions => ['lower(name) = ?', params[:id].downcase.gsub('_', ' ')])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_items_url(@course)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_item = TipoItem.find(params[:id])\n @tipo_item.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_items_url }\n format.json { head :no_content }\n end\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @agendaitemtype = Agendaitemtype.find(params[:id])\n @agendaitemtype.destroy\n\n respond_to do |format|\n format.html { redirect_to agendaitemtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_type = ModelType.find(params[:id])\n @model_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(model_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(os_types_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy_item(klass, name, type_name)\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @domicile_type = DomicileType.find(params[:id])\n @domicile_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sitetype = Sitetype.find(params[:id])\n @sitetype.destroy\n\n respond_to do |format|\n format.html { redirect_to(sitetypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy_item(klass, name, type_name)\n begin\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end\n end", "def destroy_item(klass, name, type_name)\n begin\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end\n end", "def destroy_item(klass, name, type_name)\n begin\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException\n ui.warn(\"Could not find a #{type_name} named #{name} to delete!\")\n end\n end", "def destroy_item(klass, name, type_name)\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException => e\n error_message = \"#{e.message}. Could not find a #{type_name} named #{name} to delete!\"\n ui.warn(error_message)\n raise CloudExceptions::ServerDeleteError, error_message\n end", "def destroy\n @content_type = ContentType.get(params[:id])\n @content_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_content_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @itemtipo.destroy\n\n head :no_content\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_type = TransactionType.find(params[:id])\n @transaction_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\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 @recipe_type = RecipeType.find(params[:id])\n @recipe_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipe_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inv_type = InvType.find(params[:id])\n @inv_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(inv_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_items_url) }\n format.xml { head :ok }\n end\n end", "def delete_item\n\nend", "def destroy\n @item_alias = ItemAlias.find(params[:id])\n @item_alias.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_aliases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vendor_item_type.destroy\n respond_to do |format|\n format.html { redirect_to vendor_item_types_url, notice: 'Vendor item type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_user) }\n format.xml { head :ok }\n end\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @receiving_item = ReceivingItem.find(params[:id])\n @receiving_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(receiving_items_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def remove\n ids = params[\"#{model.name.underscore}_ids\"]\n if ids.is_a?(Array) && ids.length > 0\n model.where(id: params[\"#{model.name.underscore}_ids\"]).destroy_all\n flash[:info] = \"Successfully deleted #{ids.length} #{type_label}\"\n end\n redirect_to sti_path(@type)\n end", "def destroy\n @gearbox_type = GearboxType.find(params[:id])\n @gearbox_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(gearbox_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @goods_item = Goods::Item.find(params[:id])\n @goods_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_items_url) }\n format.xml { head :ok }\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 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 delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @kf_course_item_type = Kf::CourseItemType.find(params[:id])\n @kf_course_item_type.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_course_item_types_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @project.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_items_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @incidenttype = Incidenttype.find(params[:id])\n @incidenttype.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidenttypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @order_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(order_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_format = ItemFormat.find(params[:id])\n @item_format.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_item_formats_url }\n format.xml { render :nothing => true }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @az_simple_data_type = AzSimpleDataType.find(params[:id])\n @az_simple_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_simple_data_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asset_item = AssetItem.find(params[:id])\n @asset_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(asset_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mobile_type = MobileType.find(params[:id])\n @mobile_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_mobile_types_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @itype = Itype.find(params[:id])\n @itype.destroy\n\n respond_to do |format|\n format.html { redirect_to itypes_url }\n format.json { head :no_content }\n end\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_item = QuestionItem.find(params[:id])\n @question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @moto_drive_type = MotoDriveType.find(params[:id])\n @moto_drive_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_drive_types_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7154503", "0.6880605", "0.675248", "0.6601346", "0.6601346", "0.6601346", "0.6601346", "0.6601346", "0.6601346", "0.65828943", "0.65648097", "0.6552533", "0.6535749", "0.6530758", "0.6519838", "0.65167946", "0.65074176", "0.65044165", "0.64941686", "0.6457169", "0.6430654", "0.6424364", "0.64054245", "0.6399548", "0.6397978", "0.6394206", "0.6379547", "0.63770145", "0.6374909", "0.6373754", "0.63724804", "0.63717467", "0.63707876", "0.6362946", "0.6358555", "0.635442", "0.6351882", "0.6340075", "0.6331823", "0.63295794", "0.6320169", "0.6300887", "0.6300887", "0.6300887", "0.6300294", "0.6293377", "0.62908274", "0.62804145", "0.6279493", "0.62670404", "0.625786", "0.625466", "0.62276757", "0.622633", "0.62227374", "0.62000537", "0.6190408", "0.61879957", "0.6187167", "0.6186567", "0.6177146", "0.61666346", "0.6152606", "0.61517525", "0.61477953", "0.61399823", "0.61396736", "0.61370784", "0.61252344", "0.61168355", "0.61100894", "0.61100364", "0.61092705", "0.6104053", "0.6102665", "0.61021185", "0.60999423", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.60999113", "0.6099361", "0.609708", "0.60954773", "0.6095033", "0.60884273", "0.6088399", "0.6087974", "0.6087612" ]
0.7449789
0
GET /computer_cases GET /computer_cases.json
def index @computer_cases = ComputerCase.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end", "def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend", "def index\n\t\tif @cases.present?\n \t\trender json: { success: true, response: @cases.as_json(\"case_media\") },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end\n\tend", "def index\n @cases = Case.all\n end", "def index\n @cases = Case.all\n end", "def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end", "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "def show\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clientcase }\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 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 @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end", "def index\n @code_cases = CodeCase.all\n end", "def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def index\n if current_user.district_id and !current_user.admin?\n @cases = Case.where(\"district_id = #{current_user.district_id}\").order(\"id desc\").page params[:page]\n else\n # @cases = Case.all\n @cases = Case.order(\"id desc\").page params[:page]\n end\n # @cases = Case.order(\"id desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cases }\n end\n end", "def cases\n return suite.cases(data.id)\n end", "def current_cases\n p @current_cases\n end", "def case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"cases/#{id}\",options)\n response.case\n end", "def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end", "def show\n\t\tif @case.present?\n \t\t# response to the JSON\n \trender json: { success: true, response: @case.as_json(\"case_show\") },:status=>200\n\t return\n\t else\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end \n\tend", "def case_listing\n @cases = @patient.cases.all.order('created_at ASC')\n end", "def corona_virus\n # endpoint = \"https://corona.lmao.ninja/all\"\n endpoint = 'https://corona.lmao.ninja/v2/all'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result = []\n result<<{\n country: \"world\",\n cases: res[\"cases\"],\n todayCases: res[\"todayCases\"],\n deaths: res[\"deaths\"],\n todayDeaths: res[\"todayDeaths\"],\n recovered: res[\"recovered\"],\n active: res[\"active\"],\n critical: res[\"critical\"],\n casesPerOneMillion: res[\"casesPerOneMillion\"],\n deathsPerOneMillion: res[\"deathsPerOneMillion\"],\n tests: res[\"tests\"],\n testsPerOneMillion: res[\"testsPerOneMillion\"],\n affectedCountries: res[\"affectedCountries\"]\n }\n render json: result\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\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\n @support_cases = SupportCase.all\n end", "def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def cases; Case.get(self.cases_id); end", "def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end", "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end", "def index\n @vf_cases = VfCase.all\n end", "def get_cases_by_title_number(title_no)\n\n response = rest_get_call($CASES_URL + '/cases/property/' + title_no)\n\n return response.body\n\nend", "def index\n @answer_cases = AnswerCase.all\n end", "def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\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_results\n case_id = params[:case_id]\n lab_external_id = params[:lab_id]\n consumer_id = get_consumer_id()\n lab = Lab.find_by(lab_external_id: lab_external_id, api_consumer_id: consumer_id)\n lab_id = lab.id.to_s\n tmp_file = File.join('Data/tmp/', lab_id, case_id + '.json')\n data = File.read(tmp_file)\n send_data(data,\n disposition: 'inline',\n type: 'application/json')\n\n File.delete(tmp_file)\n end", "def index\n json_response(@device.browsers)\n end", "def show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json: @submissions\n return\n end\n end", "def index\n @design_cases = DesignCase.all\n @code_cases = CodeCase.all\n end", "def show\n @case_entry = CaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_entry }\n end\n end", "def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end", "def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @case_studies }\n end\n end", "def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end", "def index\n @casecategories = Casecategory.all\n end", "def index\n @contests = Contest.all\n end", "def index\n @contests = Contest.all\n end", "def index\n @contests = Contest.all\n end", "def index\n @contests = Contest.all\n end", "def show\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_compliance }\n end\n end", "def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end", "def list_cases_cited(database_id, case_id)\n @request.get ['caseCitator', database_id, case_id, 'citedCases']\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def current_case_status\n redirect_to(root_url) && return unless current_user.can_edit_patient?\n\n patient_ids = params[:patient_ids]\n patients = current_user.viewable_patients.where(id: patient_ids)\n unique_pha = patients.distinct.pluck(:public_health_action)\n pui_eligible = !(unique_pha.empty? || (unique_pha.length == 1 && unique_pha.include?('None')))\n render json: { case_status: patients.pluck(:case_status), isolation: patients.pluck(:isolation), monitoring: patients.pluck(:monitoring),\n monitoring_reason: patients.pluck(:monitoring_reason), pui_eligible: pui_eligible }\n end", "def new\n @clientcase = Clientcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def index\n @line_cases = LineCase.all\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 index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def index\n @case_tests = CaseTest.all\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\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 index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end", "def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end", "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end", "def show\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_factor }\n end\n end", "def index\n @decisions = Decision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decisions }\n end\n end", "def index\n\t\t@cases = current_user.present? && current_user.admin? ? Case.all : Case.approved_cases\n\tend", "def index\n @sf_cases = SFCase.all\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 cities\n cities = CS.cities(params[:id], :GB)\n if cities.blank?\n country = ISO3166::Country.find_country_by_alpha3(params[:id])\n cities = country_cites(country)\n return(render json: { message: I18n.t(:invalid_country) }) if cities.blank?\n end\n render json: cities\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\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 @cities = City.all\n\n render json: @cities\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end", "def find_case\n\t\t\t# Finding the particular case\n\t\t\t@case = Case.where( id: params[:id])[0]\n\t\t\tif @case.nil?\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end\n\t\tend", "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 case_list\n\t\t# listing the all the schedule cases with surgeon with ascending schedule date\n\t\t@cases = current_user.cases.order_by(:schedule_date=> :asc)\n\tend", "def index\n @caseworklines = Caseworkline.all\n end", "def status\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}\") )\n end", "def index\n @use_case_groups = @project.use_case_groups\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @use_cases }\n end\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def course_stages(institution, course, kismode, options={})\n self.class.get(\"/Institution/#{institution}/Course/#{course}/#{kismode}/Stages.json\", options).parsed_response\n end", "def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end", "def find_case\n\t\t# Find the case \n\t\t@case = Case.where(id:params[:case_id])[0]\n\t\trender json: {success: false, message: 'Invalid Case ID !'}, status: 400 if @case.nil?\n\tend", "def cases\n return @cases\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 @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end", "def index\n # Check for filters\n @courses = Course.getCourseInformation(params[:dept],params[:course])\n @page_title = \"Browse Courses\"\n respond_to do |format|\n format.html\n format.json {render json: @courses }\n end\n end", "def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end", "def index\n\n @critical_success_factors = CriticalSuccessFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_success_factors }\n end\n end" ]
[ "0.6782567", "0.67478627", "0.65031207", "0.634706", "0.634706", "0.63232917", "0.61729354", "0.6007817", "0.59757996", "0.59757996", "0.5956582", "0.593697", "0.5898582", "0.5896633", "0.58709645", "0.5781257", "0.57515156", "0.5704119", "0.56831974", "0.5677729", "0.56722283", "0.5666609", "0.56661516", "0.5654977", "0.56491685", "0.5646759", "0.5645081", "0.5635638", "0.562527", "0.56020087", "0.5599881", "0.5592971", "0.5592971", "0.5591196", "0.5590616", "0.55841225", "0.55839354", "0.5580989", "0.5577365", "0.55701554", "0.55651593", "0.55651087", "0.5551908", "0.5543829", "0.5541911", "0.54917777", "0.54912", "0.54835176", "0.5474516", "0.5473548", "0.5473548", "0.5473548", "0.5473548", "0.54692197", "0.5453662", "0.54483014", "0.544778", "0.544778", "0.54473805", "0.5439804", "0.5439137", "0.5426247", "0.54262173", "0.54075396", "0.5401708", "0.539751", "0.5396751", "0.5395449", "0.5390117", "0.538961", "0.53869563", "0.5384784", "0.53831095", "0.5382339", "0.53805447", "0.5378748", "0.5378748", "0.537259", "0.53680444", "0.53607005", "0.5359549", "0.5354701", "0.535123", "0.5349065", "0.53466207", "0.534398", "0.53418386", "0.5341291", "0.53330594", "0.53300154", "0.5325391", "0.5319219", "0.53136486", "0.5306257", "0.53040236", "0.5302777", "0.5301895", "0.52938366", "0.52901214", "0.52870655" ]
0.7167471
0
GET /computer_cases/1 GET /computer_cases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @computer_cases = ComputerCase.all\n end", "def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\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 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\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend", "def show\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def index\n\t\tif @cases.present?\n \t\trender json: { success: true, response: @cases.as_json(\"case_media\") },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end\n\tend", "def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end", "def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end", "def index\n @cases = Case.all\n end", "def index\n @cases = Case.all\n end", "def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end", "def get_cases_by_title_number(title_no)\n\n response = rest_get_call($CASES_URL + '/cases/property/' + title_no)\n\n return response.body\n\nend", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end", "def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def show\n @case_entry = CaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_entry }\n end\n end", "def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end", "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "def case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"cases/#{id}\",options)\n response.case\n end", "def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\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\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\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 new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @clientcase = Clientcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def show\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_compliance }\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 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 show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json: @submissions\n return\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n if current_user.district_id and !current_user.admin?\n @cases = Case.where(\"district_id = #{current_user.district_id}\").order(\"id desc\").page params[:page]\n else\n # @cases = Case.all\n @cases = Case.order(\"id desc\").page params[:page]\n end\n # @cases = Case.order(\"id desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cases }\n end\n end", "def show\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab }\n end\n end", "def show\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_factor }\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 fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end", "def new\n @lab = Lab.find(params[:lab_id])\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 show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end", "def show\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine }\n end\n end", "def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end", "def find_case\n\t\t# Find the case \n\t\t@case = Case.where(id:params[:case_id])[0]\n\t\trender json: {success: false, message: 'Invalid Case ID !'}, status: 400 if @case.nil?\n\tend", "def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end", "def show\n @civil_status = CivilStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @civil_status }\n end\n end", "def show\n @research_c = ResearchC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research_c }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: ProjectControl.find(params[:id]) }\n end\n end", "def find_case\n\t\t\t# Finding the particular case\n\t\t\t@case = Case.where( id: params[:id])[0]\n\t\t\tif @case.nil?\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end\n\t\tend", "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 show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def show\n\t\tif @case.present?\n \t\t# response to the JSON\n \trender json: { success: true, response: @case.as_json(\"case_show\") },:status=>200\n\t return\n\t else\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t return\n\t end \n\tend", "def get_results\n case_id = params[:case_id]\n lab_external_id = params[:lab_id]\n consumer_id = get_consumer_id()\n lab = Lab.find_by(lab_external_id: lab_external_id, api_consumer_id: consumer_id)\n lab_id = lab.id.to_s\n tmp_file = File.join('Data/tmp/', lab_id, case_id + '.json')\n data = File.read(tmp_file)\n send_data(data,\n disposition: 'inline',\n type: 'application/json')\n\n File.delete(tmp_file)\n end", "def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end", "def show\n \t@case = Case.find(params[:id])\n end", "def show\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinician }\n end\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\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 @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end", "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\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 index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end", "def show\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @infrastructure }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def show\n @interruption = Interruption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interruption }\n end\n end", "def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end", "def show\n @crust = Crust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crust }\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def show\n @civilization = Civilization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @civilization }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "def show\n @climb_datum = ClimbDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb_datum }\n end\n end", "def show\n headers['Access-Control-Allow-Origin'] = \"*\"\n\n if params[:id]=='0'\n sql=%Q{select * from clavis.issue where manifestation_id=#{params[:manifestation_id]} and start_number notnull order by issue_id desc limit 1;}\n # logger.warn(sql)\n # @clavis_issue = ClavisIssue.all(:order=>'issue_id desc',:limit=>1,:conditions=>{:manifestation_id=>params[:manifestation_id],:start_number=>params[:start_number]})\n @clavis_issue = ClavisIssue.find_by_sql(sql)\n @clavis_issue = @clavis_issue.first if @clavis_issue!=[]\n else\n @clavis_issue = ClavisIssue.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clavis_issue }\n end\n end", "def index\n @code_cases = CodeCase.all\n end", "def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end", "def show\n @cyclist = Cyclist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cyclist }\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 @lab_name = LabName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_name }\n end\n end", "def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end", "def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end", "def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end", "def show\n @matrix_discipline = MatrixDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n json_response(@device.browsers)\n end", "def cases; Case.get(self.cases_id); 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 @competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition_interaction_observation }\n end\n end", "def show\n render json: @course, status: :found\n end" ]
[ "0.67735845", "0.6582313", "0.63812923", "0.63812923", "0.63805693", "0.6357106", "0.6154711", "0.6067852", "0.60589045", "0.6058863", "0.6058863", "0.6042911", "0.6042426", "0.6006772", "0.5984496", "0.59654015", "0.59426546", "0.59426546", "0.59343797", "0.59231365", "0.59111434", "0.58778816", "0.5872646", "0.58462346", "0.5845559", "0.5817603", "0.5817603", "0.5817603", "0.5817603", "0.5816397", "0.5812336", "0.5805404", "0.57838", "0.5766293", "0.5764628", "0.5763898", "0.5763898", "0.5761133", "0.5758297", "0.57563055", "0.57548517", "0.5751216", "0.5750715", "0.5746684", "0.57386875", "0.5729572", "0.5726311", "0.5726311", "0.57119536", "0.5711381", "0.57099974", "0.5706038", "0.56923676", "0.5685934", "0.5679265", "0.5678853", "0.567407", "0.5657941", "0.5640593", "0.5630396", "0.5626951", "0.5618495", "0.56174", "0.56078976", "0.56078976", "0.5592711", "0.5592072", "0.55888295", "0.5587871", "0.5587871", "0.5582904", "0.55771154", "0.55771154", "0.5574519", "0.5565809", "0.55657", "0.5564292", "0.556401", "0.55632126", "0.555785", "0.555329", "0.5552251", "0.55325234", "0.5524313", "0.552222", "0.550858", "0.55082816", "0.55079436", "0.54885507", "0.5487461", "0.5483136", "0.5478041", "0.54776615", "0.5473826", "0.5462818", "0.546022", "0.5458781", "0.5452797", "0.5451236", "0.54512346", "0.54491574" ]
0.0
-1
POST /computer_cases POST /computer_cases.json
def create @computer_case = ComputerCase.new(computer_case_params) respond_to do |format| if @computer_case.save format.html { redirect_to @computer_case, notice: 'Computer case was successfully created.' } format.json { render :show, status: :created, location: @computer_case } else format.html { render :new } format.json { render json: @computer_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# creating the cases with particular surgeon\n\t\tsurgery_case = current_user.cases.create(case_params)\n\t\t# Updating the patient to the particular case\n\t\tsurgery_case.update_attributes(patient_id: params[:patient_id])\n\t\t# redirect to the case index page\n\t\tif surgery_case.present?\n \t# response to the JSON\n\t \trender json: { success: true,message: \"Case Successfully Created.\", response: CaseSerializer.new(surgery_case).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: surgery_case.errors },:status=> 203\n\t end\n\tend", "def create\n @clientcase = Clientcase.new(params[:clientcase])\n\n respond_to do |format|\n if @clientcase.save\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully created.' }\n format.json { render :json => @clientcase, :status => :created, :location => @clientcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n @case.user_id = current_user.id\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.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(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 @health_case = HealthCase.new(health_case_params)\n\n respond_to do |format|\n if @health_case.save\n format.html { redirect_to @health_case, notice: 'Health case was successfully created.' }\n format.json { render :show, status: :created, location: @health_case }\n else\n format.html { render :new }\n format.json { render json: @health_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @study_case = StudyCase.new(study_case_params)\n\n if @study_case.save\n render :show, status: :created\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end", "def create\n @case = Case.new(case_params)\n @case.user_id = User.current.id\n respond_to do |format|\n if @case.save\n format.html { redirect_to back_url, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @code_case = CodeCase.new(code_case_params)\n\n respond_to do |format|\n if @code_case.save\n format.html { redirect_to design_cases_path, notice: 'Code case was successfully created.' }\n format.json { render :show, status: :created, location: @code_case }\n else\n format.html { render :new }\n format.json { render json: @code_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit\n\t\tcontest_id = get_params[:contest_id]\n\t\tstudent_id = current_student.id\n\t\tcproblem_id = get_params[:cproblem_id]\n\t\tstatus = get_params[:status]\n\t\tCproblem.submit(contest_id, cproblem_id, student_id, status)\n\t\trender json: {}\n\tend", "def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @infected_machine = InfectedMachine.new(infected_machine_params)\n\n @incident = @infected_machine.incident\n\n if @infected_machine.save\n redirect_to @infected_machine.incident\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @infected_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 create\n params.permit!\n @security_case = SecurityCase.new(params[:security_case])\n\n respond_to do |format|\n if @security_case.save\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully created.') }\n format.xml { render :xml => @security_case, :status => :created, :location => @security_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(params[:case_study])\n\n respond_to do |format|\n if @case_study.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render json: @case_study, status: :created, location: @case_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_case(project_id,suite_id,sub_section_id,test_case)\n testrail_api_client.send_post(\"add_case/#{sub_section_id || suite_id}\",test_case_data(test_case))\n end", "def index\n @computer_cases = ComputerCase.all\n end", "def create\n @support_case = current_user.support_cases.build(support_case_params)\n\n respond_to do |format|\n if @support_case.save\n format.html { redirect_to @support_case, notice: 'Support case was successfully created.' }\n format.json { render :show, status: :created, location: @support_case }\n else\n format.html { render :new }\n format.json { render json: @support_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_request = CaseRequest.new(case_request_params)\n\n respond_to do |format|\n if @case_request.save\n format.html { redirect_to @case_request, notice: 'Case request was successfully created.' }\n format.json { render :show, status: :created, location: @case_request }\n else\n format.html { render :new }\n format.json { render json: @case_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @it_case = ItCase.new(params[:it_case])\n @it_case.user_id=current_user.id\n @it_case.ipaddress=request.remote_ip\n @it_case.status=ItCase::STATUSES['Waiting']\n @it_case.opened_time=Time.now\n @it_case.created_type='web'\n @it_case.creator_id=current_user.id\n respond_to do |format|\n if @it_case.save\n format.html { redirect_to mycases_path, notice: '工单已建立' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n @casecategory = Casecategory.new(casecategory_params)\n\n respond_to do |format|\n if @casecategory.save\n format.html { redirect_to @casecategory, notice: \"Casecategory was successfully created.\" }\n format.json { render :show, status: :created, location: @casecategory }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @casecategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @design_case = DesignCase.new(design_case_params)\n\n respond_to do |format|\n if @design_case.save\n format.html { redirect_to @design_case, notice: 'Design case was successfully created.' }\n format.json { render :show, status: :created, location: @design_case }\n else\n format.html { render :new }\n format.json { render json: @design_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(params[:case])\n @case.operator_id = current_user.id\n if current_user.district_id and !current_user.admin?\n @districts = District.where(\"id = #{current_user.district_id}\")\n @phis = Phi.where(\"district_id = #{current_user.district_id}\")\n else\n @districts = District.all\n @phis = Phi.all\n @centers = Center.all\n end\n @centers = (@phis.count == 1)? Center.where(\"phi_id = #{@phis.first.id}\") : Center.all\n @hes = He.where(:center_id => @centers.map { |id| id })\n\n @laboratories = Laboratory.all\n @municipalities = Municipality.all\n @agents = Agent.all\n @doctors = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n @icds = Icd.all\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: t(\"record_created\") }\n format.json { render json: @case, status: :created, location: @case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @experiment_control = ExperimentControl.new(params[:experiment_control])\n\n respond_to do |format|\n if @experiment_control.save\n format.html { redirect_to @experiment_control, notice: 'Experiment control was successfully created.' }\n format.json { render json: @experiment_control, status: :created, location: @experiment_control }\n else\n format.html { render action: \"new\" }\n format.json { render json: @experiment_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patentcase = Patentcase.new(params[:patentcase])\n\n respond_to do |format|\n if @patentcase.save\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully created.' }\n format.json { render :json => @patentcase, :status => :created, :location => @patentcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n @test_suite = TestSuite.find(params[:test_suite_id])\n\n #Make sure the tc is linked to the ts\n @test_case.test_suite_id=@test_suite.id\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to test_suite_test_case_path(@test_suite,@test_case), notice: 'Test case was successfully created.' }\n format.json { render :show, status: :created, location: @test_case }\n else\n format.html { render :new }\n format.json { render json: @test_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\n \n @casestudy = Casestudy.new(params[:casestudy])\n\n respond_to do |format|\n if @casestudy.save\n format.html { redirect_to edit_admin_casestudy_path(@casestudy), notice: '成功案例建立完成。' }\n format.json { render json: @casestudy, status: :created, location: @casestudy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @casestudy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ci_experiment = CiExperiment.new(ci_experiment_params)\n\n respond_to do |format|\n if @ci_experiment.save\n format.html { redirect_to @ci_experiment, notice: 'Ci experiment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ci_experiment }\n else\n format.html { render action: 'new' }\n format.json { render json: @ci_experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(case_study_params)\n\n respond_to do |format|\n if @case_study.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render :show, status: :created, location: @case_study }\n else\n format.html { render :new }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def computer_case_params\n params.require(:computer_case).permit(:name, :link, :dollar_price, :euro_price, :size, :performance, :picture)\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 @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vf_case = VfCase.new(vf_case_params)\n\n respond_to do |format|\n if @vf_case.save\n format.html { redirect_to @vf_case, notice: 'Vf case was successfully created.' }\n format.json { render :show, status: :created, location: @vf_case }\n else\n format.html { render :new }\n format.json { render json: @vf_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@problem = Problem.find_by_id(session[:problem_id])\n\t\t@test_case = TestCase.new\n\t\tif lecturer_signed_in?\n\t\t\t@test_case = TestCase.new(post_params)\n\t\t\t@test_case.owner_id = current_lecturer.id\n\t\t\t@test_case.owner_type = \"lecturer\"\n\t\t\t@test_case.problem_id = session[:problem_id]\n\t\telsif teaching_assistant_signed_in?\n\t\t\t@test_case = TestCase.new(post_params)\n\t\t\t@test_case.owner_id = current_teaching_assistant.id\n\t\t\t@test_case.owner_type = \"teaching assistant\"\n\t\t\t@test_case.problem_id = session[:problem_id]\n\t\tend\n\t\tif @test_case.save\n\t\t\t@problem.test_cases << @test_case\n\t\t\tif session[:flag] == \"1\"\n\t\t\t\tredirect_to :controller => 'test_cases', :action => 'index',\n\t\t\t\t\t:problem_id => session[:problem_id], :track_id => session[:track_id], :flag => \"1\"\n\t\t\telsif session[:flag] == \"0\"\n\t\t\t\tredirect_to :controller => 'model_answers', :action => 'new',\n\t\t\t\t\t:problem_id => session[:problem_id], :track_id => session[:track_id], :flag => \"0\"\n\t\t\tend\n\t\telse\n\t\t\trender :action=>'new', :problem_id => @test_case.problem_id, :flag => session[:flag]\n\t\tend\n\tend", "def create\n @use_case = UseCase.new(use_case_params)\n # creating hard info\n @use_case.hard_infos.new(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n @use_case.hard_infos.last.save\n #--\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @use_case }\n format.json { render :show, status: :created, location: @use_case }\n else\n format.html { render :new }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_support = CaseSupport.new(case_support_params)\n\n respond_to do |format|\n if @case_support.save\n format.html { redirect_to @case_support, notice: 'Case support was successfully created.' }\n format.json { render :show, status: :created, location: @case_support }\n else\n format.html { render :new }\n format.json { render json: @case_support.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(params[:test_case])\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully created.') }\n format.xml { render :xml => @test_case, :status => :created, :location => @test_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case.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 create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @ai_contest.update_attributes(permitted_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully created.' }\n format.json { render json: @ai_contest, status: :created, location: @ai_contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_assignment = CaseAssignment.new(case_assignment_params)\n\n respond_to do |format|\n if @case_assignment.save\n format.html { redirect_to @case_assignment, notice: 'Case assignment was successfully created.' }\n format.json { render :show, status: :created, location: @case_assignment }\n else\n format.html { render :new }\n format.json { render json: @case_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def casa_case_params\n params.require(:casa_case).permit(\n :case_number,\n :transition_aged_youth,\n :birth_month_year_youth,\n :court_date,\n :court_report_due_date,\n :hearing_type_id,\n :judge_id\n )\n end", "def create\n original_content = JSON.parse request.body.read\n if original_content.key? ('source') and (original_content['source'] == 'GeneTalk' or original_content['source'] == 'Phenobot')\n content = JSON.parse Patient.convert(original_content)\n else\n content = original_content\n end\n patient_id = content['case_data']['case_id']\n time = Time.now.strftime('%d_%m_%Y_%H_%M_%S')\n log_dir = File.join(API_LOG, patient_id.to_s)\n unless File.directory?(log_dir)\n FileUtils.mkdir_p(log_dir)\n end\n log_path = File.join(log_dir, time + '.log')\n logger = Logger.new(log_path)\n logger.info 'Receive patient data'\n\n # Log the raw JSON data\n original_f = File.join(log_dir, time + '.json')\n File.open(original_f, \"wb\") { |f| f.write(JSON.pretty_generate(original_content)) }\n\n # if a case doesnt exist, process the request and create a new case\n patient_save = true\n msg = {}\n begin\n ActiveRecord::Base.transaction do\n consumer_id = get_consumer_id()\n lab = Patient.parse_lab(content, consumer_id)\n patient = Patient.find_by(case_id: patient_id, lab_id: lab.id)\n if patient.nil?\n patient = Patient.create_patient(content, consumer_id)\n msg = { msg: MSG_CASE_CREATED }\n else\n # Check if there is pedia service running to avoid\n # overwriting the data\n p_services = patient.pedia_services\n unless p_services.empty?\n p_service = p_services.last\n p_status = p_service.pedia_status\n if p_status.workflow_running?\n msg = { msg: MSG_PEDIA_RUNNING_TRY_LATER }\n respond_to do |format|\n format.json { render plain: msg.to_json,\n status: 400,\n content_type: 'application/json'\n }\n end\n return\n end\n end\n\n # Update patient data\n patient.update_json(content['case_data'])\n msg = { msg: MSG_CASE_UPDATE }\n end\n\n dirname = File.join(\"Data\", \"Received_JsonFiles\", lab.id.to_s)\n dir = \"#{Rails.root}/#{dirname}\"\n FileUtils.mkdir(dir) unless File.directory?(dir)\n\n f = \"#{dir}/#{patient_id}.json\"\n File.open(f, \"wb\") { |f| f.write(JSON.pretty_generate(content)) }\n end\n rescue Exception => e\n logger = Logger.new(log_path)\n logger.error e.message\n e.backtrace.each { |line| logger.error line }\n patient_save = false\n msg = { msg: MSG_CASE_ERROR }\n end\n\n respond_to do |format|\n if patient_save\n format.json { render plain: msg.to_json,\n status: 200,\n content_type: 'application/json'\n }\n else\n msg = { msg: MSG_CASE_ERROR }\n format.json { render plain: msg.to_json,\n status: 400,\n content_type: 'application/json'\n }\n end\n end\n end", "def create\n @application_case = ApplicationCase.new(application_case_params)\n @application_case.active = 'Active'\n current_user.application_cases << @application_case\n\n respond_to do |format|\n if @application_case.save\n format.html { redirect_to @application_case, notice: 'Application case was successfully created.' }\n format.json { render :show, status: :created, location: @application_case }\n else\n format.html { render :new }\n format.json { render json: @application_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @success_case = SuccessCase.new(params[:success_case])\n\n respond_to do |format|\n if @success_case.save\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }\n format.xml { render :xml => @success_case, :status => :created, :location => @success_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bench = Bench.new(bench_params)\n\n respond_to do |format|\n if @bench.save\n format.html { redirect_to @bench, notice: 'Bench was successfully created.' }\n format.json { render :show, status: :created, location: @bench }\n else\n format.html { render :new }\n format.json { render json: @bench.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_contest\n\t\t@contest = Contest.new(contest_params)\n\t\t# Store the name of the product for easier readability\n\t\t#binding.pry\n\t\t@contest.product_id = Product.find_by_shopify_product_id(contest_params[:product_id]).try(:name) if contest_params[:product_id].present?\n\t\t@contest.account_id = current_account.id\n\t\t@contest.order_id = 1\n\t\trespond_to do |format|\n\t\t if @contest.save\n\t\t\t# Pick a winner\n\t\t\tcandidates = Order.candidate_list(params)\n\t\t\tcontest_results = ContestResults.new(candidates)\n\t\t\t# Save the winner\n\t\t\t@contest.update_attribute(:order_id, contest_results.results)\n\t\t\tformat.html { redirect_to root_path, notice: \"Contest Winner: <a href='#{order_path(@contest.order)}'>#{@contest.order.email}</a>\" }\n\t\t\tformat.json { render action: 'show', status: :created, location: @contest }\n\t\t else\n\t\t\tformat.html { redirect_to root_path, alert: \"Unable to create a Contest\" }\n\t\t\tformat.json { render json: @contest.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend", "def create\n @contest = Contest.new(params[:contest])\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to contest_path(@contest.path)+'/upload', \n notice: 'Contest was successfully created.' \n }\n #format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\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 routine = Routine.create!(routine_params)\n render json: routine\n end", "def cases=(value)\n @cases = value\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 @ci = Ci.new(params[:ci])\n\n respond_to do |format|\n if @ci.save\n format.html { redirect_to @ci, notice: 'Ci was successfully created.' }\n format.json { render json: @ci, status: :created, location: @ci }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ci.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diagnosis = Diagnosis.new(params[:diagnosis])\n @diagnosis.prof_inspection_id = @prof_inspection.id\n\n respond_to do |format|\n if @diagnosis.save\n format.html { redirect_to client_prof_inspections_path(@prof_inspection.client), notice: I18n.t(:record_created) }\n format.json { render json: @diagnosis, status: :created, location: @diagnosis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diagnosis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end", "def create\n\t\t@problem = AssignmentProblem.find_by_id(new_test_case_params[:assignment_problem_id])\n\t\t@test_case = TestCase.new(new_test_case_params)\n\t\t@test_case.input = new_test_case_params[:input]\n\t\t@test_case.output = new_test_case_params[:output]\n\t\t@test_case.assignment_problem_id = new_test_case_params[:assignment_problem_id]\n\t\tif lecturer_signed_in?\n\t\t\t@test_case.owner_id = current_lecturer.id\n\t\t\t@test_case.owner_type = \"lecturer\"\n\t\t\t@test_case.assignment_problem_id = session[:assignment_problem_id]\n\t\telsif teaching_assistant_signed_in?\n\t\t\t@test_case.owner_id = current_teaching_assistant.id\n\t\t\t@test_case.owner_type = \"teaching assistant\"\n\t\t\t@test_case.assignment_problem_id = session[:assignment_problem_id]\n\t\tend\n\t\tif @test_case.save\n\t\t\tflash[:notice] = \"Your test case is now added\"\n\t\t\tredirect_to :controller => 'assignment_problems', :action => 'new',\n\t\t\t:id => session[:problem_assignment_id]\n\t\telse\n\t\t\trender :action=>'new', :assignment_id => @test_case.assignment_problem_id\n\t\tend\n\tend", "def create\n @casestudy = Casestudy.new(casestudy_params)\n @casestudy.user = current_user\n\n respond_to do |format|\n if @casestudy.save\n format.html { redirect_to @casestudy, notice: \"Casestudy was successfully created.\" }\n format.json { render :show, status: :created, location: @casestudy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @casestudy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_type = CaseType.new(case_type_params)\n\n respond_to do |format|\n if @case_type.save\n format.html { redirect_to @case_type, notice: 'Case type was successfully created.' }\n format.json { render :show, status: :created, location: @case_type }\n else\n format.html { render :new }\n format.json { render json: @case_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @testcase = Testcase.new\n 3.times { @testcase.scripts.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @testcase }\n end\n end", "def contest_params\n # TODO set case based on rights\n # all for admin\n # only vice for committee_head\n # only judge for jury_head\n # etc\n params.require(:contest).permit(:name, :starts_at, :ends_at, :regulations, :committee_head_ids, :jury_head_ids, :committee_vice_ids, jury_judge_ids: [])\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def create\n @testcase = Testcase.find(params[:testcase_id])\n @step = @testcase.steps.new(step_params)\n byebug\n if @step.save\n render :show, status: :created\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def create\n @test_case_result = TestCaseResult.new(test_case_result_params)\n\n respond_to do |format|\n if @test_case_result.save\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_case_result }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case_result.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 @contest = Contest.new(params[:contest])\n @contest.user_id = current_user.id\n parse_and_create_teams(params[:teams]) if params[:teams]\n \n respond_to do |format|\n if @contest.save\n create_open_post\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(contests_path) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\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 index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end", "def create\n @case_study = CaseStudy.new(case_study_params)\n @case_study.user = current_user\n\n respond_to do |format|\n if @case_study.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render :show, status: :created, location: @case_study }\n else\n format.html { render :new }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @citum = Citum.new(citum_params)\n\n respond_to do |format|\n if @citum.save\n format.html { redirect_to @citum, notice: 'Citum was successfully created.' }\n format.json { render :show, status: :created, location: @citum }\n else\n format.html { render :new }\n format.json { render json: @citum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cruise = Cruise.find(params[:cruise_id])\n @observation = @cruise.build_observation\n\n respond_to do |format|\n if @observation.save validate: false\n format.html { redirect_to edit_observation_path(@observation), notice: 'Observation was successfully created.' }\n format.json { render :show, status: :created, location: @observation }\n else\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @experiment_software = ExperimentSoftware.new(params[:experiment_software])\n\n respond_to do |format|\n if @experiment_software.save\n format.html { redirect_to @experiment_software, :notice => 'Experiment software was successfully created.' }\n format.json { render :json => @experiment_software, :status => :created, :location => @experiment_software }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @experiment_software.errors, :status => :unprocessable_entity }\n end\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 @contest = Contest.new(params[:contest])\n @problem_count = 4\n\n @contest.begin_date_str = params[:begin_date]\n @contest.end_date_str = params[:end_date]\n\n problems = []\n for i,p in params[:problems]\n number = p[:number]\n score = p[:score]\n\n next if number.blank? && score.blank?\n @contest.errors[:problem] << \"#{i}'s number is invalid.\" and next if number.blank?\n @contest.errors[:problem] << \"#{i}'s score is invalid.\" and next if score.blank?\n\n aoj_problem = AOJ::Problem.new(number)\n @contest.errors[:problem] << \"#{i} is invalid.\" and next unless aoj_problem.valid?\n problem = Problem.new({\n number: number.to_i,\n name: aoj_problem.name,\n score: score.to_i,\n contest: @contest,\n })\n problems << problem\n end\n @contest.problems = problems\n\n @contest.errors[:problems] << 'are required more than 0.' if problems.size==0\n\n\n unless @contest.errors.empty?\n render action: 'new' and return\n end\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n\n if @incident.save\n render json: @incident, status: :created, location: @incident\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def create\n complaint = Complaint.new(complaint_params)\n \n if complaint.save\n render json: {\n status: 'SUCCESS',\n message: 'Complaint Saved',\n data: complaint\n }, status: :ok\n else\n render json: {\n status: 'ERROR',\n message: 'Complaint not saved',\n data: complaint.errors\n }, status: :unprocessable_entity\n end\n\n check_complaint_sum = Complaint.all.where(\"survivor_id = ?\", params[:survivor_id]).sum(:survivor_id)\n\n if check_complaint_sum >= 5\n Survivor.where(\"id = ?\", params[:survivor_id]).update(infected: 't')\n end\n end", "def create\n @casefile = Casefile.new(casefile_params)\n\n respond_to do |format|\n if @casefile.save\n format.html { redirect_to @casefile, notice: 'Casefile was successfully created.' }\n format.json { render :show, status: :created, location: @casefile }\n else\n format.html { render :new }\n format.json { render json: @casefile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n mytimestamp = Time.now.localtime.strftime(\"%y%m%d-%H%M%S\")\n mytime = \"%s\" % Time.now.to_i\n\n @case = Case.new(params[:case])\n\t@case.caseid = mytimestamp\n\t\n respond_to do |format|\n if @case.save\n format.js \n format.xml { render :xml => @case, :status => :created, :location => @case }\n else\n\t puts \"ERRORS ! ! ! ! ! ! : \"\n\t puts @case.errors.count\n\t\tputs @case.errors.full_messages\n format.js { render :controller => \"application\", :action => \"errdisplay\" }\n format.xml { render :xml => @loc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @routine = Routine.new(params[:routine])\n\n respond_to do |format|\n if @routine.save\n format.html { redirect_to @routine, notice: 'Routine was successfully created.' }\n format.json { render json: @routine, status: :created, location: @routine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cppic = Cppic.new(params[:cppic])\n\n respond_to do |format|\n if @cppic.save\n format.html { redirect_to @cppic, notice: 'Cppic was successfully created.' }\n format.json { render json: @cppic, status: :created, location: @cppic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cppic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case_study = CaseStudy.new(params[:case_study].merge(:summary => 'Welcome to your new case study! May it bring joy to your life, and the lives of others.<hr>You can begin adding content by choosing Actions->Edit.'))\n\n respond_to do |format|\n if @case_study.save\n @contribution = @case_study.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @case_study, notice: 'Case study was successfully created.' }\n format.json { render json: @case_study, status: :created, location: @case_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@machine = Machine.new(machine_params)\n\t\t@machine.req_num = 0\n\t\t@machine.duration = 0\n\t\t@machine.score = 90\n\t\trespond_to do |format|\n\t\t if @machine.save\n\t\t format.html { redirect_to '/admin/machines/' + @machine.id.to_s, notice: 'machine was successfully created.' }\n\t\t format.json { render :show, status: :created, location: @machine }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @machine.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend", "def create\n @inciting_incident = IncitingIncident.new(inciting_incident_params)\n\n if @inciting_incident.save\n render json: @inciting_incident, status: :created, location: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end", "def create\n @sudoku = Sudoku.new(params[:sudoku]) \n \n respond_to do |format|\n if @sudoku.save\n format.html { redirect_to @sudoku, notice: 'Sudoku was successfully created.' }\n format.json { render json: @sudoku, status: :created, location: @sudoku }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n block_non_user\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n Dir::mkdir(\"task_data/contests/#{@contest.id}\")\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @criterion = Criterion.new(params[:criterion])\n\n if @criterion.save\n render json: @criterion, status: :created, location: @criterion\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end", "def create\n @chiropractic_compliance = ChiropracticCompliance.new(params[:chiropractic_compliance])\n\n respond_to do |format|\n if @chiropractic_compliance.save\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully created.' }\n format.json { render json: @chiropractic_compliance, status: :created, location: @chiropractic_compliance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chiropractic_compliance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end", "def new\n @clientcase = Clientcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @clientcase }\n end\n end", "def create\n @interview_criterium = InterviewCriterium.new(interview_criterium_params)\n\n respond_to do |format|\n if @interview_criterium.save\n format.html { redirect_to @interview_criterium, notice: 'Interview criterium was successfully created.' }\n format.json { render :show, status: :created, location: @interview_criterium }\n else\n format.html { render :new }\n format.json { render json: @interview_criterium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_contest\n @contest = Contest.new(contest_params)\n # Store the name of the product for easier readability\n @contest.product_name = Product.find_by_shopify_product_\n id(contest_params[:product_id]).try(:name) if contest_\n params[:product_id].present?\n respond_to do |format|\n if @contest.save\n # Pick a winner\n candidates = Order.candidate_list(params)\n contest_results = ContestResults.new(candidates)\n # Save the winner\n @contest.update_attribute(:order_id,\n contest_results.results)\n format.html { redirect_to root_path, notice: \"Contest Winner: <a href='#{order_path(@contest.order)}'>#{@contest.order.email}</a>\" }\n format.json { render action: 'show', status: :created,\n location: @contest }\n else\n format.html { redirect_to root_path, alert: \"Unable to\n create a Contest\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end" ]
[ "0.6467076", "0.6266084", "0.6266084", "0.6186823", "0.6148943", "0.5934998", "0.5881844", "0.587662", "0.587662", "0.58539176", "0.5840979", "0.5798991", "0.57792073", "0.5759277", "0.5684881", "0.5684881", "0.5684881", "0.56545305", "0.5653701", "0.56327206", "0.56313896", "0.5609552", "0.55910647", "0.5583429", "0.55619633", "0.5552511", "0.554964", "0.55480844", "0.5537667", "0.5527851", "0.552754", "0.5518048", "0.5512422", "0.54985267", "0.5492445", "0.5491696", "0.54682666", "0.54645926", "0.5450918", "0.54314065", "0.54283017", "0.5426991", "0.54226404", "0.54148275", "0.5410043", "0.5391136", "0.53870267", "0.538424", "0.5380452", "0.5378155", "0.53704834", "0.536604", "0.53641623", "0.53523475", "0.5348018", "0.5346598", "0.5344005", "0.53369087", "0.53304607", "0.53142834", "0.5313031", "0.5307524", "0.529529", "0.5288827", "0.52847797", "0.5281962", "0.5275088", "0.5270331", "0.52669173", "0.5265546", "0.5263132", "0.52607596", "0.5255923", "0.5253476", "0.52448964", "0.52400243", "0.52394754", "0.5228121", "0.52237517", "0.522167", "0.5215779", "0.52138615", "0.5213466", "0.52025944", "0.5189645", "0.51838255", "0.5180745", "0.5175795", "0.5175228", "0.5169145", "0.5164599", "0.51605386", "0.5159596", "0.5156427", "0.5156102", "0.51509404", "0.5150428", "0.5149984", "0.51484454", "0.5147566" ]
0.6972714
0
PATCH/PUT /computer_cases/1 PATCH/PUT /computer_cases/1.json
def update respond_to do |format| if @computer_case.update(computer_case_params) format.html { redirect_to @computer_case, notice: 'Computer case was successfully updated.' } format.json { render :show, status: :ok, location: @computer_case } else format.html { render :edit } format.json { render json: @computer_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n if @clientcase.update_attributes(params[:clientcase])\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"cases/#{id}\",options)\n response.case\n end", "def update\n respond_to do |format|\n @computer.versionless do |doc|\n if doc.update(computer_params)\n format.html { redirect_to computers_path, notice: t('computer.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\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 @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 respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to cases_path, notice: 'Case was successfully updated.' }\n format.json { render action: 'index' }\n else\n format.html { render action: 'edit' }\n format.json { render json: @case.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 @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 respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to back_url, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to @case, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to @case, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.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 @case.update(case_params)\n format.html { redirect_to cases_path, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n if @experiment_control.update_attributes(params[:experiment_control])\n format.html { redirect_to @experiment_control, notice: 'Experiment control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n @it_case = ItCase.find(params[:id])\n\n respond_to do |format|\n if @it_case.update_attributes(params[:it_case])\n format.html { redirect_to mycases_path, notice: '已完成评价' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @it_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_case\n api.command :edit, to_case_hash\n end", "def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ci_experiment.update(ci_experiment_params)\n format.html { redirect_to @ci_experiment, notice: 'Ci experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ci_experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n block_non_user\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # updating hard info\n hard_info = HardInfo.where(use_case_no: @use_case.use_case_no, client_name: @use_case.client_name, product_name: @use_case.product_name)\n hard_info.first.update(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n #--\n respond_to do |format|\n if @use_case.update(use_case_params)\n format.html { redirect_to @use_case }\n format.json { render :show, status: :ok, location: @use_case }\n else\n format.html { render :edit }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @contest = Contest.find(params[:id])\n\n if not params[:contest][:category_id].nil?\n @category = Category.find(params[:contest][:category_id])\n @contest.category = @category\n end\n\n if not params[:contest][:event_id].nil?\n @event = Event.find(params[:contest][:event_id])\n @contest.event = @event\n end\n\n if not params[:contest][:judge_sheet_id].nil?\n @judge_sheet = JudgeSheet.find(params[:contest][:judge_sheet_id])\n @contest.judge_sheet = @judge_sheet\n end\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contest = Contest.find_by(path: params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to contest_path(@contest.path)+'/upload' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cabinet = Cabinet.find(params[:id])\n\n respond_to do |format|\n if @cabinet.update_attributes(params[:cabinet])\n format.html { redirect_to @cabinet, notice: 'Cabinet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cabinet.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 @application_case.update(application_case_params)\n format.html { redirect_to @application_case, notice: 'Application case was successfully updated.' }\n format.json { render :show, status: :ok, location: @application_case }\n else\n format.html { render :edit }\n format.json { render json: @application_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n if @collab.update_attributes(params[:collab])\n format.html { redirect_to @collab, notice: 'Collab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collab.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @use_case = UseCase.find(params[:id])\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:subaction]==\"step\"\n format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>\"step\"), notice: 'Use case was successfully updated.' }\n else\n format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.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 respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.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 @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @health_case.update(health_case_params)\n format.html { redirect_to @health_case, notice: 'Health case was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_case }\n else\n format.html { render :edit }\n format.json { render json: @health_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_compliance.update_attributes(params[:chiropractic_compliance])\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_compliance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ai_contest = AiContest.find(params[:id])\n\n respond_to do |format|\n if @ai_contest.update_attributes(ai_contest_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ai_contest.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 if @study_case.update(study_case_params)\n render :show, status: :ok\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end", "def update\n @case = Case.find(params[:id])\n \n\t\n respond_to do |format|\n if @case.update_attributes(params[:case])\n\t \n format.js \n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code_case.update(code_case_params)\n format.html { redirect_to design_cases_path, notice: 'Code case was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_case }\n else\n format.html { render :edit }\n format.json { render json: @code_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n if @case_study.update_attributes(params[:case_study])\n format.html { redirect_to @case_study, notice: 'Case study was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n if @critical_factor.update_attributes(params[:critical_factor])\n format.html { redirect_to @critical_factor, notice: 'Critical factor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critical_factor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tsurgery_case = current_user.cases.where( id: params[:id] )[0]\n\t\tif surgery_case.present?\n\t\t\tsurgery_case.update_attributes(case_params)\n\t\t\t# Updating the patient to the particular case\n\t\t\tsurgery_case.update_attributes(patient_id: params[:patient_id])\n \t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Case Successfully Updated.\", response: surgery_case.as_json(\"case_show\") },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Case is not available\" },:status=> 404\n\t end\n\tend", "def update\n respond_to do |format|\n if @casefile.update(casefile_params)\n format.html { redirect_to @casefile, notice: 'Casefile was successfully updated.' }\n format.json { render :show, status: :ok, location: @casefile }\n else\n format.html { render :edit }\n format.json { render json: @casefile.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update # PATCH\n raise NotImplementedError\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 @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n if @case_study.update_attributes(params[:case_study])\n format.html { redirect_to @case_study, notice: 'Case study was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @case_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @line_case.update(line_case_params)\n format.html { redirect_to @line_case, notice: 'Line case was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_case }\n else\n format.html { render :edit }\n format.json { render json: @line_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patentcase = Patentcase.find(params[:id])\n\n respond_to do |format|\n if @patentcase.update_attributes(params[:patentcase])\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @crust = Crust.find(params[:id])\n\n respond_to do |format|\n if @crust.update_attributes(params[:crust])\n format.html { redirect_to @crust, notice: 'Crust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crust.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n if @clinician.update_attributes(params[:clinician])\n format.html { redirect_to @clinician, notice: 'Clinician was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinician.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update\n params.permit!\n @security_case = SecurityCase.find(params[:id])\n\n respond_to do |format|\n if @security_case.update_attributes(params[:security_case])\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_cases/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_case: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n updated = @complaint.update_attributes(params[:complaint])\n\n update_files if updated\n\n respond_to do |format|\n if updated\n format.html { redirect_to @complaint, notice: I18n.t('complaints.notice.update') }\n format.json { head :ok }\n else\n\t\t\t\t# to initialize the datetime fields\n\t\t\t\tgon.edit_complaint = true\n\t\t\t\tgon.violation_time = @complaint.violation_time.strftime('%m/%d/%Y %H:%M') if @complaint.violation_time\n\n format.html { render action: \"edit\" }\n format.json { render json: @complaint.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(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 update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vf_case.update(vf_case_params)\n format.html { redirect_to @vf_case, notice: 'Vf case was successfully updated.' }\n format.json { render :show, status: :ok, location: @vf_case }\n else\n format.html { render :edit }\n format.json { render json: @vf_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end", "def update\n respond_to do |format|\n if @answer_case.update(answer_case_params)\n format.html { redirect_to @answer_case, notice: 'Answer case was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_case }\n else\n format.html { render :edit }\n format.json { render json: @answer_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n if @clinic_timing.update_attributes(params[:clinic_timing])\n format.html { redirect_to @clinic_timing, notice: 'Clinic timing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinic_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n if @contacter.update_attributes(params[:contacter])\n format.html { redirect_to @contacter, notice: 'Contacter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contacter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:patient_risk_factor][:ethnicity_ids] ||= []\n @patient_risk_factor = PatientRiskFactor.find(params[:id])\n\t@patient = @patient_risk_factor.patient\n\n respond_to do |format|\n if @patient_risk_factor.update_attributes(params[:patient_risk_factor])\n format.html { redirect_to home_path, :notice => 'Data has been succesfully saved. Thanks for your time!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_risk_factor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @bench.update(bench_params)\n format.html { redirect_to @bench, notice: 'Bench was successfully updated.' }\n format.json { render :show, status: :ok, location: @bench }\n else\n format.html { render :edit }\n format.json { render json: @bench.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lab_rack = LabRack.find(params[:id])\n\n respond_to do |format|\n if @lab_rack.update_attributes(params[:lab_rack])\n format.html { redirect_to(@lab_rack, :notice => 'Lab rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lab_rack.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n if @critic.update_attributes(params[:critic])\n format.html { redirect_to @critic, notice: 'Critic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critic.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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_assessment.update_attributes(params[:chiropractic_assessment])\n format.html { redirect_to @chiropractic_assessment, notice: 'Chiropractic assessment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_assessment.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 @ci = Ci.find(params[:id])\n\n respond_to do |format|\n if @ci.update_attributes(params[:ci])\n format.html { redirect_to @ci, notice: 'Ci was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ci.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @infractor.update(infractor_params)\n format.html { redirect_to @infractor, notice: 'Infractor was successfully updated.' }\n format.json { render :show, status: :ok, location: @infractor }\n else\n format.html { render :edit }\n format.json { render json: @infractor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @vspec\n\n respond_to do |format|\n if @vspec.update(vspec_params)\n format.html { redirect_to [@vspec.metric, @vspec], notice: 'Vspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vspec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n if @cppic.update_attributes(params[:cppic])\n format.html { redirect_to @cppic, notice: 'Cppic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cppic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @design_case.update(design_case_params)\n format.html { redirect_to @design_case, notice: 'Design case was successfully updated.' }\n format.json { render :show, status: :ok, location: @design_case }\n else\n format.html { render :edit }\n format.json { render json: @design_case.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 @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n if @success_case.update_attributes(params[:success_case])\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @success_case.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 respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to a_contests_url, notice: I18n.t('a.contests.notices.create') }\n format.json { head :no_content }\n else\n set_data_for_edit_form\n format.html { render action: 'edit' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @research_c = ResearchC.find(params[:id])\n\n respond_to do |format|\n if @research_c.update_attributes(params[:research_c])\n format.html { redirect_to @research_c, notice: 'Research c was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research_c.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cvi = Cvi.find(params[:id])\n @people = Person.all\n\n respond_to do |format|\n if @cvi.update_attributes(params[:cvi])\n format.html { redirect_to @cvi, notice: 'Cvi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cvi.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 @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!(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 @contum = Contum.find(params[:id])\n\n respond_to do |format|\n if @contum.update_attributes(params[:contum])\n format.html { redirect_to @contum, notice: 'Contum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n if @complaint.update_attributes(params[:complaint])\n format.html { redirect_to complaints_path}\n flash[:success] = 'Complaint was successfully updated.'\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @complaint.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66333616", "0.6458671", "0.64299965", "0.6353033", "0.6353004", "0.6338028", "0.63350564", "0.6300484", "0.6285271", "0.6266507", "0.62547123", "0.62547123", "0.62513596", "0.62374556", "0.62067026", "0.61962", "0.6183611", "0.61707747", "0.61301947", "0.6126106", "0.6126106", "0.6123373", "0.6120574", "0.6109638", "0.6098613", "0.6074861", "0.60402566", "0.60349834", "0.60293424", "0.60131073", "0.5998358", "0.59967905", "0.59918183", "0.5991195", "0.59849125", "0.5979317", "0.5975461", "0.5973182", "0.59720284", "0.5964015", "0.59638816", "0.596036", "0.59587705", "0.5955999", "0.5948537", "0.59463364", "0.5941983", "0.5936017", "0.5932172", "0.59299606", "0.5927268", "0.59220576", "0.58999175", "0.58940595", "0.5893411", "0.58896506", "0.58832186", "0.58827823", "0.58788604", "0.5878321", "0.5873299", "0.58722407", "0.5870553", "0.58691907", "0.5865542", "0.58638704", "0.58638704", "0.5859919", "0.58503", "0.5847079", "0.5845669", "0.58436406", "0.58418494", "0.58382535", "0.58366877", "0.5829741", "0.5824692", "0.5823824", "0.58209616", "0.5814447", "0.5811296", "0.581114", "0.58081853", "0.5804883", "0.58005005", "0.57994235", "0.5797188", "0.5785551", "0.5774803", "0.5773342", "0.5773266", "0.5770273", "0.5769807", "0.5769176", "0.57625926", "0.57603115", "0.5759239", "0.57583463", "0.57583463", "0.5751173" ]
0.6847098
0
DELETE /computer_cases/1 DELETE /computer_cases/1.json
def destroy @computer_case.destroy respond_to do |format| format.html { redirect_to computer_cases_url, notice: 'Computer case was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_case.destroy\n respond_to do |format|\n format.html { redirect_to health_cases_url, notice: 'Health case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case = Case.find(params[:id])\n @case.destroy\n\n respond_to do |format|\n format.html { redirect_to cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\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 test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @ci_experiment.destroy\n respond_to do |format|\n format.html { redirect_to ci_experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_delete\n \n respond_to do |format|\n format.html { redirect_to(test_cases_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to admin_cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_request.destroy\n respond_to do |format|\n format.html { redirect_to case_requests_url, notice: 'Case request 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 computers_url }\n format.json { head :ok }\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 @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 destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url, :notice => 'Contest was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @casefile.destroy\n respond_to do |format|\n format.html { redirect_to casefiles_url, notice: 'Casefile was successfully destroyed.' }\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 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 @case.update_columns(deleted: true)\n respond_to do |format|\n format.html { redirect_to cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "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 destroy\n @design_case.destroy\n respond_to do |format|\n format.html { redirect_to design_cases_url, notice: 'Design case was successfully destroyed.' }\n format.json { head :no_content }\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 @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end", "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", "def destroy\n @bench.destroy\n respond_to do |format|\n format.html { redirect_to benches_url, notice: 'Bench was successfully destroyed.' }\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 delete\n request(:delete)\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Case study was successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @crust = Crust.find(params[:id])\n @crust.destroy\n\n respond_to do |format|\n format.html { redirect_to crusts_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 @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find_by(path: params[:id])\n\n destroy_directory(@contest.path)\n destroy_problems(@contest)#with submits\n destroy_participants(@contest)\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n #format.json { head :no_content }\n end\n end", "def destroy\r\n @contest.destroy\r\n respond_to do |format|\r\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @casestudy = Casestudy.find(params[:id])\n @casestudy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_casestudies_url }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format|\n format.html { redirect_to cabinets_url }\n format.json { head :ok }\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 @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 @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 destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @use_case = UseCase.find(params[:id])\n @use_case.destroy\n\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_case.destroy\n respond_to do |format|\n format.html { redirect_to code_cases_url, notice: 'Code case was successfully destroyed.' }\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 @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @casestudy.destroy\n respond_to do |format|\n format.html { redirect_to casestudies_url, notice: \"Casestudy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinical_visit.destroy\n respond_to do |format|\n format.html { redirect_to clinical_visits_url, notice: 'Clinical visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case = Case.find(params[:id])\n @case.destroy\n\n respond_to do |format|\n format.html { redirect_to(cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client.delete( name )\n end", "def destroy\n @cont = Cont.find(params[:id])\n @cont.destroy\n\n respond_to do |format|\n format.html { redirect_to conts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to case_studies_url, notice: 'Case study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to case_studies_url, notice: 'Case study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @routine_interview = RoutineInterview.find(params[:id])\n @routine_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to routine_interviews_url }\n format.json { head :no_content }\n end\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 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 authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to admin_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application_case.destroy\n respond_to do |format|\n format.html { redirect_to application_cases_url, notice: 'Application case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\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 @projects_briefcase.destroy\n respond_to do |format|\n format.html { redirect_to projects_briefcases_url, notice: 'Projects briefcase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @routine = Routine.find(params[:id])\n @routine.destroy\n\n respond_to do |format|\n format.html { redirect_to routines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @routine = Routine.find(params[:id])\n @routine.destroy\n\n respond_to do |format|\n format.html { redirect_to routines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @support_case = SupportCase.find(params[:id])\n @support_case.destroy\n\n respond_to do |format|\n format.html { redirect_to support_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cerc = Cerc.find(params[:id])\n @cerc.destroy\n\n head :no_content\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lab_detail.destroy\n respond_to do |format|\n format.html { redirect_to lab_details_url, notice: 'Lab detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.71422833", "0.69885117", "0.69159096", "0.67867106", "0.6781758", "0.6777597", "0.6732555", "0.6691837", "0.6690607", "0.6681213", "0.6681213", "0.6681213", "0.6681213", "0.66681045", "0.66646785", "0.6655183", "0.664974", "0.664533", "0.6638623", "0.663419", "0.6623732", "0.6623732", "0.65972877", "0.658947", "0.6576186", "0.6558016", "0.654878", "0.6548258", "0.65424937", "0.6538894", "0.6533599", "0.6532448", "0.6530285", "0.65215886", "0.65161604", "0.65094227", "0.649478", "0.6487622", "0.64871895", "0.648092", "0.6469792", "0.6464749", "0.64645624", "0.6461241", "0.6457751", "0.6452958", "0.64395905", "0.6438957", "0.6438957", "0.6438957", "0.6438957", "0.64385474", "0.6428563", "0.64273804", "0.64176553", "0.6415411", "0.6404704", "0.64020383", "0.64009494", "0.6397431", "0.6394115", "0.6389414", "0.63873726", "0.6386658", "0.63843167", "0.6383874", "0.63737804", "0.637214", "0.6371648", "0.63682353", "0.63665664", "0.6366013", "0.6364466", "0.6360038", "0.63600194", "0.63585013", "0.6356552", "0.6353609", "0.63386863", "0.6335698", "0.6335698", "0.63333124", "0.632747", "0.6326929", "0.63268775", "0.63206387", "0.6317142", "0.63103783", "0.63091874", "0.6308342", "0.6307203", "0.6300371", "0.6300371", "0.62965965", "0.6295074", "0.6294518", "0.62943697", "0.62943643", "0.6293172", "0.62930745" ]
0.710179
1
Use callbacks to share common setup or constraints between actions.
def set_computer_case @computer_case = ComputerCase.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 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 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 default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def computer_case_params params.require(:computer_case).permit(:name, :link, :dollar_price, :euro_price, :size, :performance, :picture) 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
value > value_quantity, value_integer lab_test_value > value_codeable_concept also_numeric > multiple_results_allowed range > value_range ratio > value_ratio fraction > value_ratio text_length > value_string
def result_types?(lab_test) lab_test.also_numeric? || lab_test.ratio? || lab_test.range? || lab_test.fraction? || lab_test.text_length.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_value(value)\r\n\t\tvalue\r\n\tend", "def describe_value(value)\r\n\t\t\tvalue\r\n\t\tend", "def ok_values\n %i(decimal upperRoman lowerRoman upperLetter lowerLetter ordinal\n cardinalText ordinalText hex chicago ideographDigital japaneseCounting\n aiueo iroha decimalFullWidth decimalHalfWidth japaneseLegal\n japaneseDigitalTenThousand decimalEnclosedCircle decimalFullWidth2\n aiueoFullWidth irohaFullWidth decimalZero bullet ganada chosung\n decimalEnclosedFullstop\n decimalEnclosedParen\n decimalEnclosedCircleChinese\n ideographEnclosedCircle\n ideographTraditional\n ideographZodiac\n ideographZodiacTraditional\n taiwaneseCounting\n ideographLegalTraditional\n taiwaneseCountingThousand\n taiwaneseDigital\n chineseCounting\n chineseLegalSimplified\n chineseCountingThousand\n koreanDigital\n koreanCounting\n koreanLegal\n koreanDigital2\n vietnameseCounting\n russianLower russianUpper\n none numberInDash\n hebrew1 hebrew2\n arabicAlpha arabicAbjad\n hindiVowels hindiConsonants hindiNumbers hindiCounting\n thaiLetters thaiNumbers thaiCounting\n bahtText\n dollarText custom)\n end", "def get_quantitative_value(value, unit)\n {\n '@type' => 'QuantitativeValue',\n 'value' => value,\n 'unitText' => unit,\n 'unitCode' => (UNIT_MAP[unit] if unit),\n } if value\n end", "def process_value(code,text)\n\n\n # depending on the report code, process the values\n # this is done by reading parameter names and their values\n # and respong on it as needed \n\n case code \n\n # Report parameter value\n when 'R21'\n ard_par_id = -1\n ard_par_val = 0\n\n text.split(' ').each do |param|\n\n par_code = param[0..0].to_s\n par_value = param[1..-1].to_i\n\n case par_code\n when 'P'\n ard_par_id = par_value\n when 'V'\n ard_par_val = par_value\n end\n end\n\n if ard_par_id >= 0\n param = get_param_by_id(ard_par_id)\n if param != nil\n param['value_ar'] = ard_par_val\n end\n end\n\n # Report parameter value and save to database\n when 'R23'\n ard_par_id = -1\n ard_par_val = 0\n\n text.split(' ').each do |param|\n\n par_code = param[0..0].to_s\n par_value = param[1..-1].to_i\n\n case par_code\n when 'P'\n ard_par_id = par_value\n when 'V'\n ard_par_val = par_value\n end\n end\n\n if ard_par_id >= 0\n param = get_param_by_id(ard_par_id)\n if param != nil\n save_param_value(ard_par_id, :by_id, :from_db, ard_par_val)\n end\n end\n\n # Report pin values\n when 'R41'\n pin_id = -1\n pin_val = 0\n\n text.split(' ').each do |param|\n\n par_code = param[0..0].to_s\n par_value = param[1..-1].to_i\n\n case par_code\n when 'P'\n pin_id = par_value\n when 'V'\n pin_val = par_value\n end\n end\n\n if pin_id >= 0\n save_pin_value(pin_id, pin_val)\n end\n\n # Report end stops\n when 'R81'\n text.split(' ').each do |param|\n\n par_code = param[0..1].to_s\n par_value = param[2..-1].to_s\n end_stop_active = (par_value == \"1\")\n\n case par_code\n when 'XA'\n @axis_x_end_stop_a = end_stop_active\n $status.info_end_stop_x_a = end_stop_active\n when 'XB'\n @axis_x_end_stop_b = end_stop_active\n $status.info_end_stop_x_b = end_stop_active\n when 'YA'\n @axis_y_end_stop_a = end_stop_active\n $status.info_end_stop_y_a = end_stop_active\n when 'YB'\n @axis_y_end_stop_b = end_stop_active\n $status.info_end_stop_y_b = end_stop_active\n when 'ZA'\n @axis_z_end_stop_a = end_stop_active\n $status.info_end_stop_z_a = end_stop_active\n when 'ZB'\n @axis_z_end_stop_b = end_stop_active\n $status.info_end_stop_z_b = end_stop_active\n end\n end\n\n # Report position\n when 'R82' \n text.split(' ').each do |param|\n\n par_code = param[0..0].to_s\n par_value = param[1..-1].to_i\n\n case par_code\n when 'X'\n @axis_x_pos = par_value\n @axis_x_pos_conv = par_value / @axis_x_steps_per_unit\n $status.info_current_x = @axis_x_pos_conv\n when 'Y'\n @axis_y_pos = par_value\n @axis_y_pos_conv = par_value / @axis_y_steps_per_unit\n $status.info_current_y = @axis_y_pos_conv\n when 'Z'\n @axis_z_pos = par_value\n @axis_z_pos_conv = par_value / @axis_z_steps_per_unit\n $status.info_current_z = @axis_z_pos_conv\n end \n end\n\n # Report software version\n when 'R83'\n @device_version = text\n\n # Send a comment\n when 'R99'\n puts \">#{text}<\"\n\n end\n end", "def parse_values; end", "def parse_value; end", "def describe_value(value)\r\n\t\tvalues.find(value.to_i).value\r\n\tend", "def describe_value(value)\r\n\t\tvalues.find(value.to_i).value\r\n\tend", "def describe_value(value)\r\n\t\t\tvalues.find(value.to_i).value\r\n\t\tend", "def content_from_value value\n Array.wrap(::Answer.value_from_lookup(value, value_type_code)).join \"\\n\"\nend", "def expected_value; end", "def expected_value; end", "def display_value\n case self.value_type\n when 'Numeric'\n unless self.multiplier.nil? || self.multiplier.blank?\n \"#{self.value} #{self.multiplier}(s) <span class='badge'>#{self.convert_value_by_type} bytes</span>\"\n else\n self.value\n end\n when 'Boolean'\n self.value == '1' ? 'Yes' : 'No'\n else\n self.value\n end\n end", "def value\n \n end", "def parse_value(val, type)\n return nil if val.nil? || val.to_s.strip == ''\n \n case type\n when :raw then\n val\n \n when :string then\n if val.is_a?(Float)\n # Sometimes float values come in for \"integer\" columns from Excel,\n # so if the user asks for a string, strip off that \".0\" if present\n val.to_s.gsub(/\\.0+$/, '')\n else\n # Strip whitespace and we're good to go\n val.to_s.strip\n end\n \n when :integer, :int then \n if val.class < Numeric\n # If numeric, verify that there's no decimal places to worry about\n if (val.to_f % 1.0 == 0.0)\n val.to_i\n else\n nil\n end\n else \n # Convert to string, strip off trailing decimal zeros\n val = val.to_s.strip.gsub(/\\.0*$/, '')\n if val.integer?\n val.to_i\n else\n nil\n end\n end\n \n when :float then\n if val.class < Numeric\n val.to_f\n else \n # Clean up then verify it matches a valid float format & convert\n val = val.to_s.strip\n if val.match(/\\A-?[0-9]+(?:\\.[0-9]+)?\\z/)\n val.to_f\n else\n nil\n end\n end\n \n when :cents then\n if val.is_a?(String)\n val = val.gsub(/\\s*\\$\\s*/, '')\n end\n intval = parse_value(val, :integer)\n if !val.is_a?(Float) && intval\n intval * 100\n else\n floatval = parse_value(val, :float)\n if floatval\n (floatval * 100).round\n else\n nil\n end\n end\n \n when :date then\n # Pull out the date part of the string and convert\n date_str = val.to_s.extract(/[0-9]+[\\-\\/][0-9]+[\\-\\/][0-9]+/)\n date_str.to_date rescue nil\n \n when :bool then\n val_str = parse_value(val, :string).to_s.downcase\n if ['true','yes','y','t','1'].include?(val_str)\n return true\n elsif ['false','no','n','f','0'].include?(val_str)\n return false\n else\n nil\n end\n \n else\n raise \"Unknown column type #{type.inspect} - unimplemented?\"\n end\n end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def parse_standard_field(definition, field, value)\n validate_definition_instance(definition)\n validate_symbol(field)\n validate_not_blank(value)\n validate_hash(value)\n value.map do |operator, operation_value|\n condition_components(operator, definition.table, field, definition.all_fields, operation_value)\n end\n end", "def _reduce_345(val, _values, result)\n result = @builder.multi_lhs(val[0], val[1], val[2])\n\n result\nend", "def value_types; end", "def build_value_for_element valueSet, value\n if value.nil?\n return {\n \"type\" => \"CD\",\n \"code_list_id\" => valueSet[\"id\"],\n \"title\" => valueSet[\"name\"],\n }\n else\n if value and value[\"type\"]\n if value[\"type\"] == \"present\"\n return {\"type\" => \"ANYNonNull\" }\n elsif value[\"type\"] == \"value\"\n return build_range_hash(false, value[\"operator\"], value[\"units\"][\"id\"], value[\"valueLow\"], value[\"valueHigh\"])\n end\n end\n end\n nil\n end", "def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def svalue!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 43 )\n\n type = SVALUE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 377:9: {...}? => ( '\\\"' (~ '\\\"' )* '\\\"' | '\\\\'' (~ '\\\\'' )* '\\\\'' )\n raise FailedPredicate( \"SVALUE\", \" @tagMode \" ) unless ( ( @tagMode ) )\n # at line 378:9: ( '\\\"' (~ '\\\"' )* '\\\"' | '\\\\'' (~ '\\\\'' )* '\\\\'' )\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == 0x22 )\n alt_5 = 1\n elsif ( look_5_0 == 0x27 )\n alt_5 = 2\n else\n raise NoViableAlternative( \"\", 5, 0 )\n end\n case alt_5\n when 1\n # at line 378:11: '\\\"' (~ '\\\"' )* '\\\"'\n match( 0x22 )\n # at line 378:15: (~ '\\\"' )*\n while true # decision 3\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( 0x0, 0x21 ) || look_3_0.between?( 0x23, 0xffff ) )\n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line 378:16: ~ '\\\"'\n if @input.peek( 1 ).between?( 0x0, 0x21 ) || @input.peek( 1 ).between?( 0x23, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 3\n end\n end # loop for decision 3\n match( 0x22 )\n\n when 2\n # at line 379:11: '\\\\'' (~ '\\\\'' )* '\\\\''\n match( 0x27 )\n # at line 379:16: (~ '\\\\'' )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x0, 0x26 ) || look_4_0.between?( 0x28, 0xffff ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 379:17: ~ '\\\\''\n if @input.peek( 1 ).between?( 0x0, 0x26 ) || @input.peek( 1 ).between?( 0x28, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n match( 0x27 )\n\n end\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__, 43 )\n\n end", "def values(*) end", "def allow_value_matcher; end", "def values() end", "def set_value(scalar, units=nil)\n pq_value = PhysicalQuantityResultValue.new(scalar: scalar, units: units)\n self.values << pq_value\n end", "def value() end", "def _reduce_20(val, _values, result)\n @handler.scalar val[0].gsub(/^\"|\"$/, '') \n result\nend", "def quantity_extractor(quantity)\n { units: quantity[:unit], scalar: quantity[:value].to_s }\n end", "def getValue(quantity)\n if self.name.include?(\"BALDOSA\")\n self.value*quantity\n else\n self.value*1\n end\n end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def value; end", "def convert_values(multiply_factor)\n\n\t #Piping and Instrumentation Design Parameters\n\t self.barometric_pressure = (self.barometric_pressure.to_f * multiply_factor[\"Pressure\"][\"Absolute\"].to_f)\n\t self.maximum_operating_pressure_allowance = (self.maximum_operating_pressure_allowance.to_f * multiply_factor[\"Pressure\"][\"Absolute\"].to_f)\n\t self.design_pressure_allowance = (self.design_pressure_allowance.to_f * multiply_factor[\"Pressure\"][\"Absolute\"].to_f)\n\t self.default_pressure_drop_ratio_factor = (self.default_pressure_drop_ratio_factor.to_f * multiply_factor[\"Pressure\"][\"Differential Pressure\"].to_f)\n\t self.minimum_control_value_pressure_drop = (self.minimum_control_value_pressure_drop.to_f * multiply_factor[\"Pressure\"][\"Differential Pressure\"].to_f) \n\t self.maximum_operating_temperature_allowance = convert_temperature(:value => self.maximum_operating_temperature_allowance, :subtype => \"General\")\n\t self.design_temperature_allowance = convert_temperature(:value => self.design_temperature_allowance.to_f, :subtype => \"General\") \n\n\t #Rotating Equiment Design Parameters\n\t self.allowable_centrifugal_compressor_mawt = convert_temperature(:value => self.allowable_centrifugal_compressor_mawt, :subtype => \"General\")\n\t self.allowable_compression_ratio_per_recip_comp_stage_start = convert_temperature(:value => self.allowable_compression_ratio_per_recip_comp_stage_start, :subtype => \"General\")\n\t self.allowable_compression_ratio_per_recip_comp_stage_end = convert_temperature(:value => self.allowable_compression_ratio_per_recip_comp_stage_end, :subtype => \"General\")\n\n\t #Fixed Equipment Design Parameters\n\t self.min_pressure_vessel_design_pressure = (self.min_pressure_vessel_design_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f)\n\t self.minimum_exchanger_design_pressure = (self.minimum_exchanger_design_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f)\n\t self.maximum_collection_header_back_pressure = (self.maximum_collection_header_back_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) \n\t self.minimum_ambient_design_temperature = (convert_temperature(:value => self.minimum_ambient_design_temperature, :subtype => \"General\")) \n\n\t #sizing criteria conversion\n\t self.convert_sizing_criteria_values(multiply_factor)\n\n #line sizing\n line_sizings.each do |line_sizing|\n #Stream Properties\n line_sizing.pressure = (line_sizing.pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.temperature = convert_temperature(:value => line_sizing.temperature, :subtype => \"General\")\n line_sizing.flowrate = (line_sizing.flowrate.to_f * multiply_factor[\"Mass Flow Rate\"][\"General\"].to_f) if !multiply_factor[\"Mass Flow Rate\"].nil?\n line_sizing.vapor_density = (line_sizing.vapor_density.to_f * multiply_factor[\"Density\"][\"General\"].to_f) if !multiply_factor[\"Density\"].nil?\n line_sizing.vapor_viscosity = (line_sizing.vapor_viscosity.to_f * multiply_factor[\"Viscosity\"][\"General\"].to_f) if !multiply_factor[\"Viscosity\"].nil?\n line_sizing.liquid_density = (line_sizing.liquid_density.to_f * multiply_factor[\"Density\"][\"General\"].to_f) if !multiply_factor[\"Density\"].nil?\n line_sizing.liquid_viscosity = (line_sizing.liquid_viscosity.to_f * multiply_factor[\"Viscosity\"][\"General\"].to_f) if !multiply_factor[\"Viscosity\"].nil?\n line_sizing.liquid_surface_tension = (line_sizing.liquid_surface_tension.to_f * multiply_factor[\"Surface Tension\"][\"General\"].to_f) if !multiply_factor[\"Surface Tension\"].nil?\n \n #Sizing Criteria\n line_sizing.system_equivalent_length = (line_sizing.system_equivalent_length.to_f * multiply_factor[\"Length\"][\"Large Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.system_maximum_deltaP = (line_sizing.system_maximum_deltaP.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.pipe_roughness = (line_sizing.pipe_roughness.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n \n line_sizing.sc_required_id = (line_sizing.sc_required_id.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.sc_proposed_id = (line_sizing.sc_proposed_id.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.sc_pipe_size = (line_sizing.sc_pipe_size.to_f * multiply_factor[\"Enthalpy\"][\"General\"].to_f) if !multiply_factor[\"Enthalpy\"].nil?\n line_sizing.sc_calculated_system_dp = (line_sizing.sc_calculated_system_dp.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.sc_calculated_velocity = (line_sizing.sc_calculated_velocity.to_f * multiply_factor[\"Velocity\"][\"General\"].to_f) if !multiply_factor[\"Velocity\"].nil?\n line_sizing.sc_system_equivalent_length = (line_sizing.sc_system_equivalent_length.to_f * multiply_factor[\"Length\"][\"Large Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.sc_fluid_momentum = (line_sizing.sc_fluid_momentum.to_f * multiply_factor[\"Fluid Momentum\"][\"General\"].to_f) if !multiply_factor[\"Fluid Momentum\"].nil?\n \n line_sizing.pipe_sizings.each do |pipe_sizing|\n pipe_sizing.pipe_id = (pipe_sizing.pipe_id.to_f * multiply_factor[\"Length\"][\"Pipe Tube Diameter\"].to_f) if !multiply_factor[\"Length\"].nil?\n pipe_sizing.length = (pipe_sizing.length.to_f * multiply_factor[\"Length\"][\"Large Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n pipe_sizing.elev = (pipe_sizing.elev.to_f * multiply_factor[\"Length\"][\"Large Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n pipe_sizing.p_outlet = (pipe_sizing.p_outlet.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n \n pipe_sizing.save\n end\n \n #Design Conditions\n line_sizing.dc_source_design_pressure = (line_sizing.dc_source_design_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_source_design_temperature = convert_temperature(:value => line_sizing.dc_source_design_temperature, :subtype => \"General\")\n\n line_sizing.dc_source_statice_frictional_dp = (line_sizing.dc_source_statice_frictional_dp.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_destination_design_pressure = (line_sizing.dc_destination_design_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_destination_design_temperature = convert_temperature(:value => line_sizing.dc_destination_design_temperature, :subtype => \"General\")\n\n line_sizing.dc_destination_statice_frictional_dp = (line_sizing.dc_destination_statice_frictional_dp.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n \n line_sizing.dc_maximum_operating_pressure = (line_sizing.dc_maximum_operating_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_maximum_operating_temperature = convert_temperature(:value => line_sizing.dc_maximum_operating_temperature, :subtype => \"General\")\n\n line_sizing.dc_pressure_allowance = (line_sizing.dc_pressure_allowance.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_temperature_allowance = convert_temperature(:value => line_sizing.dc_temperature_allowance, :subtype => \"General\")\n line_sizing.dc_design_pressure = (line_sizing.dc_design_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_design_temperature = convert_temperature(:value => line_sizing.dc_design_temperature, :subtype => \"General\")\n line_sizing.dc_design_vaccum = (line_sizing.dc_design_vaccum.to_f * multiply_factor[\"Pressure\"][\"Absolute\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_min_design_temperature = convert_temperature(:value => line_sizing.dc_min_design_temperature, :subtype => \"General\")\n \n line_sizing.dc_spt_design_perssure = (line_sizing.dc_spt_design_perssure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_spt_design_temperature = convert_temperature(:value => line_sizing.dc_spt_design_temperature, :subtype => \"General\") \n line_sizing.dc_spt_minimum_temperature = convert_temperature(:value => line_sizing.dc_spt_minimum_temperature, :subtype => \"General\") \n line_sizing.dc_spt_allowable_stress = (line_sizing.dc_spt_allowable_stress.to_f * multiply_factor[\"Pressure\"][\"Differential\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_spt_lweld_joint_factor = convert_temperature(:value => line_sizing.dc_spt_lweld_joint_factor, :subtype => \"General\")\n line_sizing.dc_spt_mechanical_thickness_allowance = (line_sizing.dc_spt_mechanical_thickness_allowance.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.dc_spt_erosion_corrosion_allowance = (line_sizing.dc_spt_erosion_corrosion_allowance.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.dc_spt_pressure_design_thickness = (line_sizing.dc_spt_pressure_design_thickness.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n line_sizing.dc_spt_minimum_required_thickness = (line_sizing.dc_spt_minimum_required_thickness.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n \n line_sizing.dc_pc_design_pressure = (line_sizing.dc_pc_design_pressure.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_pc_design_temperature = convert_temperature(:value => line_sizing.dc_pc_design_temperature, :subtype => \"General\") \n line_sizing.dc_pc_flange_pressure_rating = (line_sizing.dc_pc_flange_pressure_rating.to_f * multiply_factor[\"Pressure\"][\"General\"].to_f) if !multiply_factor[\"Pressure\"].nil?\n line_sizing.dc_pc_flange_temperature_rating = convert_temperature(:value => line_sizing.dc_pc_flange_temperature_rating, :subtype => \"General\")\n\n line_sizing.dc_pc_insulation_thickness = (line_sizing.dc_pc_insulation_thickness.to_f * multiply_factor[\"Length\"][\"Small Dimension Length\"].to_f) if !multiply_factor[\"Length\"].nil?\n \n line_sizing.save\n end\n #end line sizing\n\n vessel_sizings.each do |vessel_sizing|\n vessel_sizing.convert_values(multiply_factor)\n end\n\n pump_sizings.each do |pump_sizing|\n pump_sizing.convert_values(multiply_factor)\n end\n \n \n #compressor sizing\n compressor_sizing_tags.each do |compressor_sizing_tag|\n compressor_sizing_tag.compressor_sizings.each do |compressor_sizing|\n compressor_sizing.convert_values(multiply_factor,self)\n end\n end\n\n #electric motor\n electric_motors.each do |electric_motor|\n electric_motor.convert_values(multiply_factor,self)\n end\n \n #steam turbines\n steam_turbines.each do |steam_turbine|\n steam_turbine.convert_values(multiply_factor,self)\n end\n \n #hydraulic turbines\n hydraulic_turbines.each do |hydraulic_turbine|\n hydraulic_turbine.convert_values(multiply_factor,self)\n end\n \n #turbo expanders\n turbo_expanders.each do |turbo_expander|\n turbo_expander.convert_values(multiply_factor,self)\n end\n \n #control valve sizings\n control_valve_sizings.each do |control_valve_sizing|\n control_valve_sizing.convert_values(multiply_factor,self)\n end\n\n #flow element sizings\n flow_element_sizings.each do |flow_element_sizing|\n flow_element_sizing.convert_values(multiply_factor,self)\n end\n\n #storage tank sizings\n storage_tank_sizings.each do |storage_tank_sizing|\n storage_tank_sizing.convert_values(multiply_factor,self)\n end\n \n #column sizings\n column_sizings.each do |column_sizing|\n column_sizing.convert_values(multiply_factor,self)\n end\n \n #heat exchanger sizing\n heat_exchanger_sizings.each do |heat_exchanger_sizing|\n heat_exchanger_sizing.convert_values(multiply_factor,self)\n end\n rescue Exception => e\n\t logger.debug e\n end", "def lenient_value_coercions; end", "def set_values(values)\n case @type\n when /Dword/ # n .. n, step size: n\n if values =~ /(\\d+)\\s*\\.\\.\\s*(\\d+)\\s*,\\s*step size:\\s*(\\d+)/\n @min = $1.to_f\n @max = $2.to_f\n @step = $3.to_f\n else\n puts \"-E- Unrecognized value format: #{values}\"\n end\n when /Choice/ # 'choice 1'[val1], ......, 'choice n'[valn]\n @choices = Hash.new\n values.scan(/\\s*'([^']+)'\\[([^\\]]+)\\]/) do |c, v|\n @choices[v] = c\n end\n when /Button/\n # do nothing\n when /Boolean/\n # do nothing\n else\n puts \"-E- Unrecognized control type #{@type}\"\n end\n end", "def value_with_units(value, units, usage_factor)\n raise \"Error: value must convert to an integer.\" unless value.to_i\n raise \"Error: units must be k, m, g\" unless units =~ /[KMG]/i\n factor = usage_factor.to_f\n raise \"Error: usage_factor is 1.0 Value used: #{usage_factor}\" if factor > 1.0 || factor <= 0.0\n (value * factor).to_i.to_s + units\nend", "def process_operand_value(operand)\n # Separate the operand type and value inside the bracket\n\n operand_type_name, operand_value = separate_operand(operand)\n\n # Enum the operand type, here lower, regex, and equals will be identified\n operand_type =\n begin\n VWO::Enums::OperandValueTypesName.const_get(operand_type_name.upcase)\n rescue StandardError => _e\n nil\n end\n\n # In case of wildcard, the operand type is further divided into contains, startswith and endswith\n if operand_type_name == OperandValueTypesName::WILDCARD\n starting_star, operand_value, ending_star = WILDCARD_PATTERN.match(operand_value)[1..3]\n operand_type =\n if starting_star.to_s.length > 0 && ending_star.to_s.length > 0\n OperandValueTypes::CONTAINS\n elsif starting_star.to_s.length > 0\n OperandValueTypes::STARTS_WITH\n elsif ending_star.to_s.length > 0\n OperandValueTypes::ENDS_WITH\n else\n OperandValueTypes::EQUALS\n end\n end\n\n # In case there is an abnormal patter, it would have passed all the above if cases, which means it\n # should be equals, so set the whole operand as operand value and operand type as equals\n if operand_type.nil?\n operand_type = OperandValueTypes::EQUALS\n operand_value = operand\n end\n [operand_type, operand_value]\n end", "def simple_value_type_code\n value_type_code\nend", "def complete_value\n if last_token_is(COMPARISON_OPERATORS)\n token = tokens[tokens.size - 2]\n val = ''\n else\n token = tokens[tokens.size - 3]\n val = tokens[tokens.size - 1]\n end\n\n field = definition.field_by_name(token)\n return [] unless field && field.complete_value\n\n return complete_set(field) if field.set?\n return complete_date_value if field.temporal?\n return complete_key_value(field, token, val) if field.key_field\n\n special_values = field.special_values.select { |v| v =~ /\\A#{val}/ }\n special_values + complete_value_from_db(field, special_values, val)\n end", "def preprocess_value(value, key)\n return value unless value =~ /\\(\\(.*\\)\\)/\n\n starter = value.index(\"((\")\n ender = value.index(\"))\")\n qualifier = value[starter + 2, ender - starter - 2]\n\n if qualifier == \"random_large\"\n value[starter..ender + 1] = rand(1_000_000_000_000).to_s\n elsif qualifier == \"random_ssn\"\n value = rand(9**9).to_s.rjust(9, '0')\n value.insert 5, \"-\"\n value.insert 3, \"-\"\n elsif qualifier == \"random_selection\"\n list = chain(\"#{key}.options.to_a\")\n\n selected = list.sample.text\n selected = list.sample.text if selected.nil?\n value = selected\n else # rubocop:disable Style/EmptyElse\n # Silent pass through.\n end\n\n value\n end", "def how_many(value)\n end", "def _reduce_343(val, _values, result)\n result = @builder.multi_lhs(val[0], val[1], val[2])\n \n result\nend", "def from_amee_model(rvd)\n rvd.each do |avalue|\n vt=case avalue.valuetype\n when \"CCEB59CACE1B\"\n 'TEXT'\n when \"45433E48B39F\"\n 'DECIMAL'\n end\n value=ReturnValue.new(avalue.type,avalue.type,vt,avalue.unit,avalue.perunit) # Type used twice until AMEE \n # gem supports RVD names\n @values.push value\n end\n validate\n end", "def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end", "def attribute_value\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n value = nil\n string30 = nil\n number31 = nil\n\n begin\n # at line 152:35: ( string | number )\n # at line 152:35: ( string | number )\n alt_38 = 2\n look_38_0 = @input.peek(1)\n\n if (look_38_0 == T__14)\n alt_38 = 1\n elsif (look_38_0 == EOF || look_38_0 == DIGIT || look_38_0 == T__11 || look_38_0 == T__33)\n alt_38 = 2\n else\n raise NoViableAlternative(\"\", 38, 0)\n end\n case alt_38\n when 1\n # at line 152:37: string\n @state.following.push(TOKENS_FOLLOWING_string_IN_attribute_value_1142)\n string30 = string\n @state.following.pop\n # --> action\n value = (string30 && @input.to_s(string30.start, string30.stop))\n # <-- action\n\n when 2\n # at line 152:71: number\n @state.following.push(TOKENS_FOLLOWING_number_IN_attribute_value_1148)\n number31 = number\n @state.following.pop\n # --> action\n value = (number31 && @input.to_s(number31.start, number31.stop)).to_i\n # <-- action\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n end\n\n return value\n end", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def attribute_value\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n value = nil\n quoted_string29 = nil\n number30 = nil\n\n begin\n # at line 125:35: ( quoted_string | number )\n # at line 125:35: ( quoted_string | number )\n alt_43 = 2\n look_43_0 = @input.peek( 1 )\n\n if ( look_43_0 == QUOTE )\n alt_43 = 1\n elsif ( look_43_0 == DIGIT )\n alt_43 = 2\n else\n raise NoViableAlternative( \"\", 43, 0 )\n end\n case alt_43\n when 1\n # at line 125:37: quoted_string\n @state.following.push( TOKENS_FOLLOWING_quoted_string_IN_attribute_value_1234 )\n quoted_string29 = quoted_string\n @state.following.pop\n # --> action\n value = quoted_string29 \n # <-- action\n\n when 2\n # at line 125:85: number\n @state.following.push( TOKENS_FOLLOWING_number_IN_attribute_value_1240 )\n number30 = number\n @state.following.pop\n # --> action\n value = ( number30 && @input.to_s( number30.start, number30.stop ) ).to_i \n # <-- action\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return value\n end", "def _reduce_498(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend", "def _reduce_498(val, _values, result)\n lexer.lex_state = :expr_end\n result = val[1]\n\n result ||= s(:str, \"\")\n\n case result.sexp_type\n when :dstr then\n result.sexp_type = :dsym\n when :str then\n result = s(:lit, result.last.to_sym)\n when :evstr then\n result = s(:dsym, \"\", result)\n else\n debug20 26, val, result\n end\n \n result\nend", "def _reduce_436(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def values\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_int\n ))\n end", "def process_field_value(value)\r\n value\r\n end", "def attribute_list_value(params)\n column = param(params, :name)\n item = param(params, :item)\n\n if column && item\n type = param(params,:type,(item.attributes.include?(column.to_s) ? item.column_for_attribute(column).type : \"other\").to_s).to_s\n type = \"other_record\" if type == \"other\" && item.respond_to?(column.to_s + \"_id\")\n value = case type\n when 'string' then (item_raw_value(item, params) || \"\")\n when 'boolean' then item.send(attribute_name(params)) ? image_tag(\"/autocrud/images/tick.png\", :alt => t('true'), :title => t('true')) : image_tag(\"/autocrud/images/cross.png\", :alt => t('false'), :title => t('false'))\n when 'custom' then send(@singular.underscore+\"_\"+column.to_s+\"_list_value\".to_s, item)\n when 'other_record' then item.send(column).to_s\n when 'date' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%d-%m-%Y\") : \"\"\n when 'time' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%H:%M\") : \"\"\n when 'datetime' then item.send(attribute_name(params)) ? l(item.send(attribute_name(params))) : \"\"\n when 'paperclip' then item.send(column.to_s+'?') ? image_tag(item.send(column.to_s, param(params, :size))) : \"\"\n when 'currency' then number_to_currency(item.send(attribute_name(params)).to_f, :format => \"<span class='currency_show_symbol'>%u</span><span class='currency_show_value'>%n</span>\")\n when 'percentage' then number_to_percentage(item.send(attribute_name(params)).to_f)\n when 'select' then \n values = param(params,:select).collect{|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}.collect{|element| element[1] == item.send(attribute_name(params)).to_s ? element[0] : nil}.compact\n values.length > 0 ? values.first : item.send(attribute_name(params)).to_s\n else class_exists?('Lico::AutoCrud::Types::' + type.classify) ? get_class('Lico::AutoCrud::Types::' + type.classify).to_list_value(item, attribute_name(params)) : (item_raw_value(item, params) || \"\")\n end\n if display_link_to?(:show)\n return link_to(value, { :action => 'show', :id => item }, :class => 'dummy')\n else\n return value\n end\n else\n \treturn ''\n\t\t\t\tend\n end", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_120(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_342(val, _values, result)\n result = @builder.multi_lhs(val[0], val[1], val[2])\n \n result\nend", "def get_multivalue_result\r\n rawResult = read_line()\r\n\r\n if (rawResult[0..2] == \"200\") then\r\n rawResult.slice!(0..2)\r\n pairs = rawResult.split(' ')\r\n\r\n results = {}\r\n pairs.each do |pair|\r\n tmp = pair.split('=')\r\n results[tmp[0]] = tmp[1]\r\n end\r\n \r\n results\r\n else\r\n parse_result(rawResult)\r\n end\r\n end", "def _reduce_575(val, _values, result)\n yyerrok \n result\nend", "def test_arbitrary_value\n value_ = ::Versionomy.create([1, 9, 2, 'pre', 2], :rubygems)\n assert_equal(1, value_.field0)\n assert_equal(9, value_.field1)\n assert_equal(2, value_.field2)\n assert_equal('pre', value_.field3)\n assert_equal(2, value_.field4)\n assert_equal(0, value_.field5)\n assert_equal(0, value_.field6)\n assert_equal(0, value_.field7)\n end", "def describe_value(value)\r\n\t\t(value.nil? or value.empty?) ? '(no options selected)' : value.split(\",\").collect { |v| values.find(v.to_i).value }.join(', ')\r\n\tend", "def parse_values_from_ui\n\t\tunless self.period_value.blank? and self.period_units.blank?\n\t\t\tp = self.period_value.to_i\n\t\t\tself.period = p.send(self.period_units).to_i\n\t\tend\n\t\tunless self.breach_duration_value.blank? and self.breach_duration_units.blank?\n\t\t\tp = self.breach_duration_value.to_i\n\t\t\tself.breach_duration = p.send(self.breach_duration_units).to_i\n\t\tend\n\t\tunless self.lower_breach_scale_increment_action.blank? and self.lower_breach_scale_increment_value.blank? and self.lower_breach_scale_increment_units.blank?\n\t\t\tself.lower_breach_scale_increment = ''\n\t\t\tself.lower_breach_scale_increment = '-' if self.lower_breach_scale_increment_action == 'decrease'\n\t\t\tself.lower_breach_scale_increment += self.lower_breach_scale_increment_value.to_s\n\t\t\tself.lower_breach_scale_increment += '%' if self.lower_breach_scale_increment_units == '%'\n\t\tend\n\t\tunless self.upper_breach_scale_increment_action.blank? and self.upper_breach_scale_increment_value.blank? and self.upper_breach_scale_increment_units.blank?\n\t\t\tself.upper_breach_scale_increment = ''\n\t\t\tself.upper_breach_scale_increment = '-' if self.upper_breach_scale_increment_action == 'decrease'\n\t\t\tself.upper_breach_scale_increment += self.upper_breach_scale_increment_value.to_s\n\t\t\tself.upper_breach_scale_increment += '%' if self.upper_breach_scale_increment_units == '%'\n\t\tend\n\tend", "def parse_value_problem(s_p)\n value_problem = {}\n \n # parse value and problem name\n s_p = s_p[1...-1] # remove starting and trailing brackets\n s_p = s_p.split(\":\", 2) # split on :, at most two parts\n value_text = s_p[0]\n problem_name = s_p[1] # if no : to split on, problem_name is nil\n \n # extract value, return nil if unable to\n value = Float(value_text) rescue nil \n value_problem.update({ \"value\" => value }) if value\n\n # extract problem, ignore problem if problem_name is invalid or not provided\n if problem_name and (problem = self.submission.assessment.problems.find_by_name(problem_name))\n value_problem.update({ \"problem_id\" => problem.id })\n end\n\n return value_problem\n end", "def _reduce_578(val, _values, result)\n yyerrok \n result\nend", "def set_value(value)\n if value.is_a? Array\n @map = nil\n @array = ParsedArray.new @global\n @array.abstractArrayItems = []\n value.each do |item|\n array_item = ParsedArrayItem.new @global\n array_item.arrayValueItem = ParsedArrayValueItem.new @global\n array_item.arrayValueItem.primitive = ParsedPrimitive.new(@global)\n array_item.arrayValueItem.primitive.string = ParsedString.new(item)\n array_item.arrayValueItem.primitive.text = item\n @array.abstractArrayItems << array_item\n end\n @valueItem = nil\n @text = @array.extract_hash\n return\n elsif value.is_a?(ParsedPair)\n @map = value.map ? value.map : nil\n @array = value.array ? value.array : nil\n @valueItem = value.valueItem ? value.valueItem : nil\n return\n elsif value.is_a?(TrueClass) || value.is_a?(FalseClass)\n @map = nil\n @array = nil\n @valueItem = ParsedValueItem.new @global\n @valueItem.value = ParsedValue.new @global\n @valueItem.value.primitive = ParsedPrimitive.new(@global)\n if value\n @valueItem.value.primitive.trueVal = ParsedTrue.instance\n else\n @valueItem.value.primitive.falseVal = ParsedFalse.instance\n end\n @valueItem.value.primitive.text = value\n @valueItem.value.text = value\n @text = value\n return\n end\n value = value.extract_hash unless value.is_a?(String) || value.is_a?(Integer)\n @map = nil\n @array = nil\n @valueItem = ParsedValueItem.new @global\n @valueItem.value = ParsedString.new(value)\n @text = value\n end", "def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend", "def price_definition_set_by_components(quantity,value_quarter_sheet,component,color_mode,options={})\n accumulate_t = 0\n accumulate_tr = 0\n \n \n if options[:by_price_definition_set]\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_id = ? AND component_type = ?\",component.id,component.class.to_s])\n if result\n accumulate_t = result.amount_t*quantity\n accumulate_tr = result.amount_tr*quantity\n else\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_type = ? AND base_amount = ?\",component.class.to_s,true])\n accumulate_t = result.amount_t*value_quarter_sheet\n accumulate_tr = result.amount_tr*value_quarter_sheet\n end\n else\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_type = ? AND base_amount = ?\",component.class.to_s,true])\n accumulate_t = result.amount_t*value_quarter_sheet\n accumulate_tr = result.amount_tr*value_quarter_sheet\n end\n {:t =>accumulate_t.round(2),:tr => accumulate_tr.round(2)}\n end", "def processValuesV2(keyword, value)\n key_orig = keyword\n comp = \"\"\n\n if value[-1..-1] == '>' # bigger\n value = value[0..-2]\n keyword = keyword + \"bigger\"\n comp = \"bigger\"\n \n elsif value[-1..-1] == '<' # smaller\n value = value[0..-2]\n keyword = keyword + \"smaller\"\n comp = \"smaller\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '>=' # min\n value = value[0..-3]\n keyword = keyword + \"min\"\n comp = \"min\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '<=' # max\n value = value[0..-3]\n keyword = keyword + \"max\"\n comp = \"max\"\n end\n\n if key_orig == \"modified_at\" || key_orig == \"created_at\"\n if value =~ /^\\d{4}$/\n keyword += \"year\"\n \n elsif value =~ /^\\d{4}\\-\\d{1,2}$/\n if comp == \"bigger\" || comp == \"max\"\n value += '-31'\n elsif comp == \"\"\n # This is a piece of jenkki-purukumi, When searching for files in a month.\n # This is the first search and from 'value' and 'keyword' will be generated another one\n @conditions.merge!({keyword+'mindate', value+'-01'})\n value += '-31'\n keyword += 'max'\n else\n value += '-01'\n end\n keyword += \"date\"\n # keyword += \"month\"\n elsif value =~ /^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/\n keyword += \"date\"\n elsif QueryController::check_datetime(value)\n puts \"datetime: true\"\n else\n keyword = \"FALSE\"\n end\n end\n\n\n return keyword, value\n end", "def value_read; end" ]
[ "0.61506253", "0.6057433", "0.59969974", "0.5910375", "0.5868922", "0.5801855", "0.57974946", "0.56969607", "0.56969607", "0.5694714", "0.5651178", "0.5544404", "0.5544404", "0.5498453", "0.54752845", "0.5474397", "0.54580843", "0.54580843", "0.54580843", "0.54580843", "0.54580843", "0.54580843", "0.54580843", "0.5450414", "0.5445077", "0.544406", "0.5438196", "0.5418407", "0.54117393", "0.5395755", "0.5388533", "0.536582", "0.5363892", "0.5362055", "0.5351059", "0.53406966", "0.5337614", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53371656", "0.53364885", "0.5334802", "0.53284293", "0.5326562", "0.5325992", "0.5322848", "0.5317193", "0.5306253", "0.5293247", "0.52904356", "0.52871543", "0.5282461", "0.5276028", "0.5271632", "0.5271632", "0.5271632", "0.5271632", "0.5269672", "0.52614415", "0.52614415", "0.52593017", "0.52549654", "0.5248645", "0.52427495", "0.52379304", "0.5232336", "0.5232336", "0.52239037", "0.52080816", "0.52018374", "0.5196694", "0.51958466", "0.51958114", "0.51938397", "0.5191981", "0.5187231", "0.5186854", "0.5186854", "0.5186854", "0.51865643", "0.51855254", "0.51817983" ]
0.0
-1
Single background block of colour for a symbolic letter. Useful in Lego based projects...
def char_to_block c c = bg_white " " if c == "W" c = bg_red " " if c == "R" c = bg_green " " if c == "G" c = bg_yellow " " if c == "Y" c = bg_purple " " if c == "P" c = bg_fuscia " " if c == "F" c = bg_blue " " if c == "B" c = bg_grey " " if c == "E" c = " " if c == "x" c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background(pos, string)\n $background = \"\"\n if pos[0]\n background = pos[1].even? ? \"\\e[1;100m\" : \"\\e[47m\"\n else\n background = pos[1].odd? ? \"\\e[1;100m\" : \"\\e[47m\"\n end\n background + string\n end", "def background_color(color); end", "def simple(color_name, background = false)\n (background ? 40 : 30) + ANSI_COLORS[color_name]\n end", "def simple(color_name, background = false)\n (background ? 40 : 30) + ANSI_COLORS[color_name]\n end", "def simple(color_name, background = false)\n (background ? 40 : 30) + ANSI_COLORS[color_name]\n end", "def background_colour\n @cr[0xf] >> 4\n end", "def hsla_color; end", "def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend", "def auxiliary_colour\n @cr[0xe] >> 4\n end", "def white\n colorize(37)\n end", "def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end", "def bg_red; use_code(41) end", "def c(text, colors)\n text = \"%{B#{colors[:bg]}}#{text}%{B-}\" if colors[:bg]\n text = \"%{F#{colors[:fg]}}#{text}%{F-}\" if colors[:fg]\n text\nend", "def rainbow\n (0..256).each{ |color| \n print Paint[' ',48,5,color] # print empty bg color field\n }\n puts\n end", "def code\n index = 16 +\n RGB.to_ansi_domain(@red) * 36 +\n RGB.to_ansi_domain(@green) * 6 +\n RGB.to_ansi_domain(@blue)\n\n \"#{@ground_code};5;#{index}\"\n end", "def start_color color\n \"\\e[#{COLORS[color]}m\"\n end", "def green\n colorize(32)\n end", "def textbackground(color = nil)\n if color\n @text.background(color)\n else\n @text.background\n end\n end", "def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend", "def bgcolor!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n type = BGCOLOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 360:10: 'bgcolor'\n match( \"bgcolor\" )\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__, 30 )\n\n end", "def bg_dark_grey; use_code(100) end", "def green(text)\n colorize(text, 32)\nend", "def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end", "def start_color\n \"\\033[\"\n end", "def named\n [\"\\e[\", foreground_codes[colour], 'm'].join\n end", "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend", "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend", "def symbol \n return \"♚\" if @color == :black \n return \"♔\" if @color == :white\n end", "def colour(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend", "def colorize txt, fg, bg, flags\n txt\n end", "def get_block_color(x, y, z)\n 0xffeeeeee\n end", "def colorize txt, fg, bg, flags\n fgc = (fg.nil? || Color === fg ) ? fg : Color.parse(fg)\n bgc = (bg.nil? || Color === bg) ? bg : Color.parse(bg)\n esc = []\n esc << '01' if flags[:b]\n esc << '03' if flags[:i]\n esc << '04' if flags[:u]\n esc << '07' if flags[:r]\n esc << \"38;05;#{fgc.xterm256}\" if fgc\n esc << \"48;05;#{bgc.xterm256}\" if bgc\n \n esc.empty? ? txt : \"\\e[#{esc.join(';')}m#{txt}\\e[0m\" \n end", "def purple\n colorize(35)\n end", "def add_bg_color(str, color)\n color = color.to_s.sub(\"bg_\", \"\").to_sym\n str = reset_prev_formatting str, :bg_color\n \"\\e[#{TC_CONFIG[:bg_colors][color].to_s}m#{str}\"\n end", "def red\n colorize(31)\n end", "def draw\n $code.each { |color| print \"[ #{Rainbow(\"o\").background(color)} ] \" }\n puts \"\\n\\n\"\n end", "def open_background_color_span\n \"<span style=\\\"background-color:##{self.html_color};\\\">\"\n end", "def on_49(_) { fg: fg_color(9) } end", "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend", "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend", "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend", "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend", "def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend", "def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend", "def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend", "def background_color\n ::Color::RGB.from_applescript(advanced_typing_apparatus.background_color).html\n end", "def symbol\n @color == \"white\" ? @symbol = \"\\u{2658}\" : @symbol = \"\\u{265e}\"\n end", "def yellow\n colorize(33)\n end", "def colorize!(fg, bg)\n set_colors(fg, bg)\n num = @cwin.maxx * @cwin.maxy\n self.home\n self.go(0, 0) { @cwin.addstr(' '*num) }\n @cwin.refresh\n end", "def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end", "def gprint (text)\n\tprint colorize(colorize(text, \"black\"), \"white_bg\")\nend", "def print_color_block(color)\n color = COLORS[(color + 3) % NUM_COLORS]\n \"\\033[\" + color + 'm' + \"\\xe2\\x96\\x88\"\nend", "def ansi_color(color, text)\n #\"\\x1b[38;5;#{color}m#{text}\\x1b[0m\"\n \"\\e[38;5;#{color}m#{text}\\e[0m\"\nend", "def colorize(s, c = :green)\n %{\\e[#{c == :green ? 33 : 31}m#{s}\\e[0m}\n end", "def color(color); end", "def highlight_gap_marks_in_red!(lb)\n # gap_marks: Skip certain characters and find characters to highlight in red\n gap_mark_complete_regex = Regexp.new(Regexp.escape(tmp_gap_mark_complete))\n l_ch = @options[:language].chars\n chars_to_skip = [\n l_ch[:d_quote_open],\n l_ch[:em_dash],\n l_ch[:s_quote_open],\n ' ',\n '(',\n '[',\n '\"',\n \"'\",\n '}',\n '*',\n '[', # chinese bracket\n '(', # chinese parens\n '一', # chinese dash\n '《', # chinese left double angle bracket\n ].join\n lb.gsub!(\n /\n #{ gap_mark_complete_regex } # find tmp gap mark number and text\n ( # capturing group for first group of characters to be colored red\n (?: # non capturing group\n #{ l_ch[:elipsis] } # elipsis\n (?!#{ l_ch[:elipsis] }) # not followed by another elipsis so we exclude chinese double elipsis\n )? # optional\n )\n ( # capturing group for characters that are not to be colored red\n (?: # find one of the following, use non-capturing group for grouping only\n [#{ Regexp.escape(chars_to_skip) }]+ # special chars or delimiters\n | # or\n …… # chinese double elipsis\n | # or\n \\\\[[:alnum:]]+\\{ # latex command with opening {\n | # or\n \\s+ # eagle followed by whitespace\n )* # any of these zero or more times to match nested latex commands\n )\n ( # capturing group for second group of characters to be colored red\n #{ l_ch[:elipsis] }? # optional elipsis\n [[:alpha:][:digit:]#{ l_ch[:apostrophe] }\\-\\?,]* # words and some punctuation\n )\n /x,\n # we move the tmp_gap_mark_number to the very beginning so that if we\n # have an ellipsis before a latex command, the gap_mark_number will be\n # in front of the entire section that is colored red.\n # \\1: an optional ellipsis (colored red)\n # \\2: an optional latex command or characters not to be colored red\n # \\3: the text to be colored red\n # OPTIMIZATION: We could skip the first \\RtGapMarkText if \\1 is blank\n tmp_gap_mark_number + \"\\\\RtGapMarkText\" + '{\\1}' + '\\2' + \"\\\\RtGapMarkText\" + '{\\3}'\n )\n # If in the gap_mark processing above regex ref \\1 is empty, we end up\n # with empty `\\RtGapMarkText{}` fragments. We remove them in this step:\n lb.gsub!(\"\\\\RtGapMarkText{}\", '')\n # Move tmp_gap_mark_number to outside of quotes, parentheses and brackets\n if !['', nil].include?(tmp_gap_mark_number)\n gap_mark_number_regex = Regexp.new(Regexp.escape(tmp_gap_mark_number))\n chars_to_move_outside_of = [\n l_ch[:apostrophe],\n l_ch[:d_quote_open],\n l_ch[:s_quote_open],\n '(',\n '[',\n ].join\n lb.gsub!(\n /\n ( # capturing group for characters to move outside of\n [#{ Regexp.escape(chars_to_move_outside_of) }]*\n )\n #{ gap_mark_number_regex } # find tmp gap mark number\n /x,\n tmp_gap_mark_number + '\\1' # Reverse order\n )\n # Move tmp_gap_mark_number to after leading eagle\n lb.gsub!(\n /\n (#{ gap_mark_number_regex }) # capture group for tmp gap mark number\n \\s? # followed by eagle and optional space\n /x,\n '\\1' # Reverse order\n )\n # Convert tmp_gap_mark_number to latex command\n lb.gsub!(gap_mark_number_regex, \"\\\\RtGapMarkNumber{}\")\n end\n # Make sure no tmp_gap_marks are left\n if(ltgm = lb.match(/.{0,20}#{ Regexp.escape(tmp_gap_mark_text) }.{0,20}/))\n raise(LeftoverTempGapMarkError.new(\"Leftover temp gap mark: #{ ltgm.to_s.inspect }\"))\n end\n if !['', nil].include?(tmp_gap_mark_number)\n if(ltgmn = lb.match(/.{0,10}#{ Regexp.escape(tmp_gap_mark_number) }.{0,10}/))\n raise(LeftoverTempGapMarkNumberError.new(\"Leftover temp gap mark number: #{ ltgmn.to_s.inspect }\"))\n end\n end\n end", "def scolora(str)\n str.to_s.\n gsub(/\\e\\[1;33m/,''). # colori 16\n gsub(/\\e\\[0m/,''). # colori 64k\n gsub(/\\e\\[38;\\d+;\\d+m/,'') # end color\nend", "def filled_block(fraction, identifier=nil, block_chars=BLOCK_CHARS_V)\n if fraction == 0.0\n block = block_chars[0]\n else\n parts = (fraction.to_f * (block_chars.size.to_f-1)).floor\n block = block_chars[[block_chars.size-1, parts+1].min]\n end\n if identifier\n # ANSI 256-color mode, color palette starts at 10 and contains 216 colors.\n color = 16 + ((identifier * COLOR_SPACING_PRIME) % 216)\n ansi_color(color, block)\n else\n block\n end\nend", "def colorize(text, color = :default, bg_color = :default)\n colors = {\n :default => \"38\",\n :black => \"30\",\n :red => \"31\",\n :green => \"32\",\n :brown => \"33\",\n :blue => \"34\",\n :purple => \"35\",\n :cyan => \"36\",\n :gray => \"37\",\n :dark_gray => \"1;30\",\n :light_red => \"1;31\",\n :light_green => \"1;32\",\n :yellow => \"1;33\",\n :light_blue => \"1;34\",\n :light_purple => \"1;35\",\n :light_cyan => \"1;36\",\n :white => \"1;37\"\n }\n\n bg_colors = {\n :default => \"0\",\n :black => \"40\",\n :red => \"41\",\n :green => \"42\",\n :brown => \"43\",\n :blue => \"44\",\n :purple => \"45\",\n :cyan => \"46\",\n :gray => \"47\",\n :dark_gray => \"100\",\n :light_red => \"101\",\n :light_green => \"102\",\n :yellow => \"103\",\n :light_blue => \"104\",\n :light_purple => \"105\",\n :light_cyan => \"106\",\n :white => \"107\"\n }\n\n color_code = colors[color]\n bg_color_code = bg_colors[bg_color]\n return \"\\033[#{bg_color_code};#{color_code}m#{text}\\033[0m\"\nend", "def red(text)\n colorize(text, 31)\nend", "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend", "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend", "def fg(c)\n return self unless ANSI_COLORS[c]\n return colorize(ANSI_COLORS[c])\n end", "def rainbow; end", "def colorized?; end", "def puts_red(str)\n puts \" \\e[00;31m#{str}\\e[00m\"\nend", "def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend", "def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend", "def crisis_color\n return text_color(17)\n end", "def background(bgcolor)\n names_to_code(\"on_\" + bgcolor)\n end", "def heading_colour\n palette.foreground\n end", "def bgcolor\n @bgcolor || $def_bg_color\n end", "def medium_rainbow_typer(string)\n string.chars.each do |x|\n print x.colorize(selector(@@colours))\n sleep(0.02)\n end\n br\n end", "def color_from_keyword(word)\n key = (word+\"ZZZ\").sub(/[aeiou]/,'')[0,3].upcase.sub(/\\W/,'')\n rgb = key.each_byte.to_a.map{ |i| (i-65)*10 }\n Color::RGB.new(*rgb)\n end", "def back_color1\n Color.new(0, 0, 0, 192)\n end", "def back_color1\n Color.new(0, 0, 0, 192)\n end", "def green(text)\n colorize text, \"\\033[1;32m\"\n end", "def colored_char\n color(char)\n end", "def colorize(text, color)\n\t\"\\e[#{Colors[color]}m#{text}\\e[0m\"\nend", "def colour_for(char)\n return '' if char.colour == @colour\n\n @colour = char.colour\n @colour.to_s\n end", "def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end", "def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend", "def blue(text)\n colorize(text, 34)\nend", "def color_table\n [0, 1, 4, 5, 7].each do |attr|\n puts '----------------------------------------------------------------'\n puts \"ESC[#{attr};Foreground;Background\"\n 30.upto(37) do |fg|\n 40.upto(47) do |bg|\n print \"\\033[#{attr};#{fg};#{bg}m #{fg};#{bg} \"\n end\n puts \"\\033[0m\"\n end\n end\n end", "def format_color(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend", "def back_color1\n Color.new(0, 0, 0, 192)\n end", "def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend", "def colorNormal\n puts \"\\033[0m\"\n end", "def green\n\t\tlight COLOR_KEY_GREEN\n\tend", "def colorize(text = '_', color = 'default', bgcolor = 'default')\n colors = {\n 'default' => 38,\n 'black' => 30,\n 'red' => 31,\n 'green' => 32,\n 'brown' => 33,\n 'blue' => 34,\n 'purple' => 35,\n 'cyan' => 36,\n 'gray' => 37,\n 'dark gray' => '1;30',\n 'light red' => '1;31',\n 'light green' => '1;32',\n 'yellow' => '1;33',\n 'light blue' => '1;34',\n 'light purple' => '1;35',\n 'light cyan' => '1;36',\n 'white' => '1;37'\n }\n bgcolors = {\n 'default' => 0,\n 'black' => 40,\n 'red' => 41,\n 'green' => 42,\n 'brown' => 43,\n 'blue' => 44,\n 'purple' => 45,\n 'cyan' => 46,\n 'gray' => 47,\n 'dark gray' => 100,\n 'light red' => 101,\n 'light green' => 102,\n 'yellow' => 103,\n 'light blue' => 104,\n 'light purple' => 105,\n 'light cyan' => 106,\n 'white' => 107\n }\n\n color_code = colors[color]\n bgcolor_code = bgcolors[bgcolor]\n\n return \"\\033[#{bgcolor_code};#{color_code}m#{text}\\033[0m\"\nend", "def background_color(color)\n self.class.color_codes[color] + 40 if self.class.color_codes[color]\n end", "def background_color(color)\n self.class.color_codes[color] + 40 if self.class.color_codes[color]\n end", "def put_background_color_to(str, color)\n str.colorize(background: :\"#{color}\")\n end", "def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end", "def create_color_pair(bgcolor, fgcolor)\n code = (bgcolor*10) + fgcolor\n FFI::NCurses.init_pair(code, fgcolor, bgcolor)\n return code\n end", "def color_from_symbol(match, symbol); end", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend" ]
[ "0.7145825", "0.6976453", "0.6910981", "0.6910981", "0.6910981", "0.6879282", "0.6626079", "0.6568976", "0.653981", "0.6409608", "0.63920957", "0.6378888", "0.63753265", "0.6338858", "0.63060105", "0.6299998", "0.62906903", "0.62566376", "0.62543094", "0.6245054", "0.6216481", "0.6204605", "0.619671", "0.6190943", "0.6157292", "0.6141588", "0.6141588", "0.6137725", "0.6127896", "0.6111478", "0.61085075", "0.61077756", "0.60942984", "0.6094039", "0.6090508", "0.60712457", "0.606983", "0.6059326", "0.60546464", "0.60546464", "0.60546464", "0.60546464", "0.60546464", "0.603068", "0.603068", "0.6028012", "0.60202575", "0.60185", "0.6004051", "0.5997886", "0.5997761", "0.59896386", "0.59785074", "0.5960703", "0.59582573", "0.59470135", "0.5946839", "0.59409475", "0.5936065", "0.59321594", "0.5924284", "0.5924284", "0.5914446", "0.5913216", "0.5911856", "0.5905212", "0.59050936", "0.59050936", "0.5898357", "0.5893299", "0.58911645", "0.58884126", "0.5887577", "0.5882795", "0.58794594", "0.58794594", "0.5874038", "0.58716667", "0.58699924", "0.58631593", "0.5852506", "0.58451146", "0.58361727", "0.58354634", "0.5829049", "0.5827229", "0.5825091", "0.5816576", "0.58140767", "0.5812799", "0.5809931", "0.5809931", "0.5794399", "0.5790278", "0.5784339", "0.5777172", "0.57735693", "0.57735693", "0.57735693", "0.57735693" ]
0.68734765
6
Identify a user with an option to push immediately or allow a later track event to be associated
def identify(user, push=true) analytics_provider_instance.identify(user) if analytics_provider_instance && Rails.configuration.analytics[:enabled] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end", "def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if offender && offender.new_user?\n end", "def sign_up_for_event(event)\n self.events << event unless self.events.include?(event)\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def gifted(user)\n segment(user).identify(state: 'gifted_sticker')\n segment(user).track('user_gifted_sticker')\n end", "def admit_user user_id = nil\n return if is_global\n if (tagtype != 0) || user_id.nil? || (user_id == User.super_id)\n self.is_global = true\n elsif !owner_ids.include?(user_id) && (user = User.find_by id: user_id)\n self.owners << user unless owners.include?(user)\n end\n end", "def trigger_event_for_user user, event, data=nil\n Pusher[user.private_channel].trigger!(event,data)\n end", "def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end", "def fulfilled_without_acceptance\n UserNotifier.deliver_ready(self, user)\n end", "def sent_by?(user)\n from_user_id == user&.id\n end", "def can_notify? user\n return false if self.id == user.id\n not notification_exists? user\n end", "def alert_user?\n # check the three necessary conditions\n # in order of increasing cost\n self.enabled? && have_statuses_changed?\n end", "def allow_user_submit(user)\n current? and !expired_for_user(user)\n end", "def allow_user_submit(user)\n current? and !expired_for_user(user)\n end", "def allow_user_submit(user)\n current? and !expired_for_user(user)\n end", "def enable_tracking\n @DoNotTrack = false\n #Enable do not track for admin and any future employees. Har har. Employees. Yah right.\n if user_signed_in? && current_user.is_admin?\n @DoNotTrack = true\n end\n true\n end", "def notifications_to_show_user\n notifications ||= UserEvent.where('user_id = ? AND error_during_render = ? AND event_type != ?', self.id, false, UserEvent.event_type_value(:video_play))\n end", "def check_if_needs_approval\r\n self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin\r\n end", "def track_user_event(event, user, props=nil)\n analytics_provider_instance.track_user_event(event, user, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled]\n end", "def first_time_user=(value)\n @first_time_user = !!value\n end", "def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end", "def can_set?(user, event)\n return false unless @events.key? event\n user.power_in(@room) >= @events[event]\n end", "def check_in(uid)\n #TODO: Check if user is in it first\n self.user_channels.create(user_id: uid, timeout: DateTime.in(120))\n end", "def generate_immediate_notification? \n\t submitted && ((not defined? @submitted_value_on_load) || (not @submitted_value_on_load) )\n end", "def current_user_is_task_user_id\n # set status options, removing processing & completed, may add for stripe integration test\n @my_task_status_options = {available: \"Available\", unlist: \"Unlisted\"} # this transfers over to _form via edit call\n if current_user.id != @task.user_id\n redirect_to tasks_path\n end\n end", "def changeState(user)\n if user.current_role == Role.Fachschaft || user.current_role == Role.Admin\n if self.unsubmitted?\n #Set the author of this event revision\n self.author = user\n #Make sure the event is awaiting approval\n self.waiting!\n elsif user.current_role == Role.Admin\n if self.reviewed?\n self.admin = user\n self.submitted!\n self.publish\n end\n end\n end\n save\n end", "def actions_available?(user)\n return false if status == Constants.TASK_STATUSES.on_hold && !on_timed_hold?\n\n actions_allowable?(user)\n end", "def notify_users_after_change\n if !id ||\n saved_change_to_when? ||\n saved_change_to_where? ||\n saved_change_to_location_id? ||\n saved_change_to_notes? ||\n saved_change_to_specimen? ||\n saved_change_to_is_collection_location? ||\n saved_change_to_thumb_image_id?\n notify_users(:change)\n end\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def should_send_push?(look)\n look.votes.count > 25 || look.is_expired?\nend", "def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end", "def added_by_user?(user)\n @sources.length == 1 && @sources[0].id == user.agent.id\n end", "def notify_user(record)\n unless record.user_id == record.author_id\n create_notification(record, record.user)\n end\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def assign_user\n if !Window.find(params[:id]).filled_up && Window.find(params[:id]).get_slot.update_attributes(user_id: current_user.id)\n redirect_to events_url, notice: 'You got yourself a slot.'\n else\n redirect_to events_url, notice: 'You done fucked up.'\n end\n end", "def send_publish_event_notification(event, user, status)\n success = true\n if user.use_email? && user.confirmed? && event.use_email?\n success = handle_send_publish_event_notification(event, user, status, \"email\")\n end\n if user.use_text? && user.confirmed_text? && event.use_text?\n success = handle_send_publish_event_notification(event, user, status, \"text\")\n end\n if user.use_call? && user.confirmed_call? && event.use_call?\n success = handle_send_publish_event_notification(event, user, status, \"call\")\n end\n unless success\n status.not_delivered!\n end\n set_new_state_after_notify(success, event, status)\n end", "def grant_achievement_for_booth_visit_without_notification(user)\n if BOOTH_VISIT_ACHIEVEMENT_ENABLED && request.remote_ip.starts_with?(BOOTH_VISIT_REMOTE_IP)\n achievement = Achievement.find(BOOTH_VISIT_ACHIEVEMENT_ID)\n if !user.achievements.include?achievement\n user.achievements << achievement\n end\n end\n end", "def notify_starting\n\t\tuser_list = []\n\t\tparty_list.each do |uid, uhash|\n\t\t\tuser_list <<= uid if uhash[:status] == STATUS_ATTENDING\t\t\t\n\t\tend\n\t\tnotification = EventNotification.new(NOTIF_EVENT_STARTING, self)\n\t\tnotify(notification, user_list, false)\n\tend", "def has_been_acquired_by_user?(user)\n current_user_profile = Profile.find_by(user_id: user.id)\n addition = Addition.find_by(profile_id: current_user_profile, story_id: self.id)\n addition != nil\n end", "def invite_via_suggestion\n @user = User.create_with_organisation_membership_from_project_invite @invite\n\n if @user.valid?\n RequestMailer.invite_via_suggestion @user, @invite, current_user\n\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"#{@user.email} has been sent an invite\"\n elsif account_has_been_claimed? @user\n @invite.set_handled_suggested_user!\n redirect_to :dashboard, notice: \"This user has already been invited to Digital Social\" \n else\n redirect_to :dashboard, alert: \"There was an error inviting #{@user.email}, please try again later.\" \n end\n end", "def on_users_account\n true\n end", "def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end", "def temp_work_complete?\n user.id == @task_work_offer.task.user.id\n end", "def addUserFeedback user \n feedback = user.feedback.select{ |f| f.choice == self }.first\n unless feedback.nil?\n option = self.options.select{|o| o.id == feedback.option_id }.first\n option[:feedbacks].push( feedback ) if option[:feedbacks].select{ |f| f == feedback }.first.nil? && !option.nil?\n end\n end", "def addUserFeedback user \n feedback = user.feedback.select{ |f| f.choice == self }.first\n unless feedback.nil?\n option = self.options.select{|o| o.id == feedback.option_id }.first\n option[:feedbacks].push( feedback ) if option[:feedbacks].select{ |f| f == feedback }.first.nil? && !option.nil?\n end\n end", "def set_user_tasking_mode_on\r\n if @current_user.facebook_user?\r\n @current_user.is_tasking = true\r\n @current_user.save(false)\r\n else\r\n @current_user.update_attribute(:is_tasking, true)\r\n end\r\n end", "def track_server_event(name, user, properties = {})\n user_id = user ? user.id : 'anonymous'\n @last_event = { name: name, user_id: user_id, properties: properties }\n\n if enabled?\n @segment_io.track(\n user_id: user_id,\n event: name,\n properties: properties\n )\n end\n end", "def saw_notification\n current_user.notice_seen = true\n current_user.save\n end", "def wants_to_be_interviewed(user)\n\t\t@user, @profile = user, user.profile\n\t\tif user.wants_to_be_interviewed\n\t\t\tsendgrid_category 'Provider Wants To Be Interviewed'\n\t\t\tmail subject: 'Provider wants to be interviewed for articles', to: ADMIN_EMAIL\n\t\telse\n\t\t\tsendgrid_category 'Provider No Longer Wants To Be Interviewed'\n\t\t\tmail subject: 'Provider no longer wants to be interviewed for articles', to: ADMIN_EMAIL\n\t\tend\n\tend", "def invited_or_captain\n self.captain || invited?\n end", "def sender? usr\n usr.id == user_id\n end", "def registered(user)\n self.rsvped?(user) || self.isHost?(user)\n end", "def show\n set_user_activity\n end", "def update_user_tracking!\n unless self.new_record?\n self.updater = \n UserTracking.current_user || \n (raise UserTracking::Error, \"current user is not defined\")\n end\n end", "def game_started_for (user)\n user_state[user] == :playing\n end", "def user_nil\n \tPushToken.where(user_id:nil).pluck(:token).each do |f|\n \tsend_notification(f, self.body, \"\", \"\")\n \tend\n \t\tend", "def is_ready_to_start?\n self.is_owner? ? self.ack_get_started_owner : ack_get_started_user\n end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def allow_notification?\n true\n end", "def toggle_subscriber(user) \n if subscribers.include?(user)\n subscribers.delete(user) \n elsif not user.public? and user.permitted?(:tickets, :watch, :project => project)\n subscribers << user\n end\n subscribers.include?(user)\n end", "def require_push_notification?\n if action =~ /up_vote/ && subject.respond_to?(:votes)\n first_notification = !similar_notifications.exists?\n first_notification || subject.votes.count % PUSH_VOTES_INTERVAL == 0\n elsif action =~ /subscription\\.create/\n false\n else\n true\n end\n end", "def notify_unlocked\n ::Notification.create!(\n from: user,\n user_id: user_id,\n seen: false,\n target: self,\n kind: :ACHIEVEMENT_UNLOCKED\n )\n end", "def check_auto_signees!(user)\r\n\r\n check_auto_signees_exception!(user) # brdzaneba, gankarguleba\r\n\r\n return unless AUTO_SIGNEE_DOCTYPES.include?(self.type_id)\r\n unless self.motions.where(receiver_user_id: AUTO_SIGNEE).any?\r\n send_type = Document::ResponseType.find(AUTO_SIGNEE_RESPONSE_TYPE)\r\n motion = Document::Motion.create!(document: self, parent: nil, is_new: 1, ordering: Document::Motion::ORDERING_AUTO_SIGNEE,\r\n send_type: send_type, sender_user: user, receiver_user_id: AUTO_SIGNEE, receiver_role: ROLE_SIGNEE, status: SENT,\r\n sent_at: Time.now, received_at: Time.now)\r\n if motion.should_be_current?\r\n motion.update_attributes!(status: CURRENT)\r\n end\r\n docuser = Document::User.create!(document: self, user_id: AUTO_SIGNEE, is_new: 1, is_changed: 1)\r\n end\r\n end", "def toggle_trackable(kind,names,action)\n klass = kind.singularize.capitalize.constantize\n assoc = user.send(\"user_#{kind}\")\n\n names.each do |name|\n trackable = klass.find_or_create_by(name: name)\n\n # if new trackable (in the past), add as deactivated\n assoc.send(action,trackable,false) if trackable.new_record?\n end\n end", "def handle_notify_event(event, is_being_published)\n event.users.each do |user|\n I18n.with_locale(user.get_locale) do\n status = EventStatus.find_by(user_id: user.id, event_id: event.id)\n if !status.blank? && !status.not_attending?\n if is_being_published\n send_publish_event_notification(event, user, status)\n else\n send_delete_event_notification(event, user)\n end\n end\n end\n end\n end", "def has_new_activity?(user)\n found_notification?(user) || found_comment_notifications?(user)\n end", "def switch_on(active_user, tag = nil)\n update(status: :active,current_user: active_user.id)\n mqtt_control_on\n socket_usage = SocketUsage.create!(user: active_user,\n el_socket: self, start_time: Time.now.utc,\n date: Date.today, start_tag: tag)\n\n active_user.last_usage = socket_usage.id\n active_user.save\n end", "def notify_users_and_add_it\n return # disabled for now\n return true if remote?\n User.find_all_by_notify_on_new_torrents(true).each do |user|\n Notifier.send_new(user,self) if user.notifiable_via_jabber?\n user.watch(self) unless user.dont_watch_new_torrents?\n end\n end", "def after_save(user)\n UserNotifier.deliver_activation(user) if user.recently_activated?\n end", "def notify?\n recent? || (aging? && rand(5) < 3) || rand(5) == 0\n end", "def mark_paid(user)\n event_user = event_user(user)\n event_user.paid_at = Time.now\n event_user.save\n end", "def accepted_by(user)\n return false unless self.active?\n # assign user to startup unless they are already part of a startup\n relationship_role = nil\n\n if self.invite_type == Invite::TEAM_MEMBER\n user.startup_id = self.startup_id if !self.startup_id.blank? or !user.startup_id.blank?\n user.set_account_type(:entrepreneur)\n # Bypass forcing user to setup account if they were invited from startup that is setup, also don't suggest startups\n user.setup_complete! if self.startup.account_setup?\n elsif self.invite_type == Invite::STARTUP\n user.set_account_type(:entrepreneur)\n relationship_role = :startup_startup\n elsif self.invite_type == Invite::MENTOR || self.invite_type == Invite::NREDUCE_MENTOR # Add user as mentor to startup\n user.set_account_type(:mentor)\n user.roles << :nreduce_mentor if self.invite_type == Invite::NREDUCE_MENTOR\n relationship_role = :startup_mentor\n elsif self.invite_type == Invite::INVESTOR\n user.set_account_type(:investor)\n relationship_role = :startup_investor\n end\n\n # Add user to startup if invite came from startup\n if !self.startup.blank? and !relationship_role.blank?\n r = Relationship.start_between(user, self.startup, relationship_role, true)\n if r.blank?\n self.errors.add(:user_id, 'could not be added to startup')\n else\n self.errors.add(:user_id, 'could not be added to startup') unless r.approve!\n end\n end\n \n if user.save\n self.to = user\n self.accepted_at = Time.now\n self.save\n else\n false\n end\n end", "def after_update_actions\n if is_newbie_changed? && is_newbie == false # registration completed\n if Date.today.to_s == \"2017-03-03\" || Date.today.to_s == \"2017-03-04\"\n conv = Conversation.where(key: 'event_intellect').first\n unless conv.present?\n User.bot.conversations.create!(key: 'event_intellect', group_title: 'Intellect', new_members: [id])\n else\n conv.add_participant(id)\n end\n end\n end\n end", "def can_promote?(user)\n (!eql? user) && (team.team_captain.eql? self)\n end", "def alteration_approve\n UserNotifier.deliver_in_process(self, user)\n end", "def on_user1_signal( signo )\n\t\tself.log.info \"Checkpoint: User signal.\"\n\tend", "def allow_user(user_id)\n create_entry(user_id, USER, true)\n end", "def after_create(user)\n if user.invited_by_id?\n invitation = Invitation.new(sender: user.invited_by, friend: user)\n invitation.accept!\n else\n # TODO There's a potential exploit here where someone creates 100 dummy accounts, invites one account and collects all the free time on that one account.\n Invitation.where(email: user.email).each do |invitation|\n invitation.friend = user\n invitation.accept!\n end\n end\n end", "def perform(user_id, event, details, ip)\n \tmixpanel.track(user_id, event, details,ip) unless Rails.env.test?\n end", "def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end", "def made_request?(user)\n all_users.include?(user)\n end", "def new?(user)\n not read? and user != sender\n end", "def create\n @event = Event.new(event_params)\n @event.user = @user\n @event.save\n # Cehck if there is any highschooler interested in talking to this undergraduate\n notify_highschooler if @user.interested_in_me.present?\n end", "def authorized_user\n @event = Event.friendly.find(params[:id])\n if @event.creator_id != current_user.id\n if current_user.email == 'pubudu@eventhub.lk' || current_user.email == 'pavithra@eventhub.lk'\n return true\n end\n redirect_to root_path, alert: \"Oops! You don't have permission to do that\"\n end\n end", "def create\n event = Event.find_or_create_from_lastfm(params[:lastfm_id])\n\n # Populate the event\n event.populate!\n\n user = User.get(params[:user_id])\n if user.events.include?(event) # already been added to profile\n render 'api/v1/base/result.json', locals: {result: 'already added'}\n else\n user.events << event\n\n render 'api/v1/base/result.json', locals: {result: 'success'}\n end\n end", "def game_available_for? (user)\n user_state[user] == :invited\n end", "def started_viewing(user = nil, dont_notify: false)\n if user && !viewing?(user)\n Cache.set_add(viewing_cache_key, collaborator_json_stringified(user))\n end\n received_changes(num_viewers_changed: true) unless dont_notify\n end", "def track options\n symbolize_keys! options\n check_user_id! options\n\n event = options[:event]\n properties = options[:properties] || {}\n timestamp = options[:timestamp] || Time.new\n context = options[:context] || {}\n\n check_timestamp! timestamp\n\n if event.nil? || event.empty?\n fail ArgumentError, 'Must supply event as a non-empty string'\n end\n\n fail ArgumentError, 'Properties must be a Hash' unless properties.is_a? Hash\n isoify_dates! properties\n\n add_context context\n\n enqueue({\n :event => event,\n :userId => options[:user_id],\n :anonymousId => options[:anonymous_id],\n :context => context,\n :integrations => options[:integrations],\n :properties => properties,\n :timestamp => datetime_in_iso8601(timestamp),\n :type => 'track'\n })\n end", "def already_welcomed?(user)\n notification = Notification.welcomed_by(self.id, user.id)\n !notification.empty?\n end", "def can_be_assigned?(_user)\n false # any user can complete operation\n end", "def invite?\r\n admin? or (user.id != user_record.id and streamer?)\r\n end", "def after_create(user)\n #user.reset_perishable_token! # set the perishable token to some value\n #UserNotifier.deliver_signup_notification(user.email, user)\n end", "def saved?\n user_id?\n end", "def activate_user\n self.save\n self.send_user_notification_email\n end", "def moved_up_event_waiting_user\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/events/#{@event.id}\")\n subject = \"[bootcamp] #{@event.title}で、補欠から参加に繰り上がりました。\"\n mail to: @user.email, subject: subject\n end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def is_ad_hoc=(true_or_false)\n if true_or_false\n self.triggered_by = 'ad_hoc_query'\n else\n self.triggered_by = 'scheduled_query'\n end\n end", "def trackable?\n true\n end", "def add\n @event = Event.find(params[:id])\n @user = current_user\n @content = \"is_interested\"\n @object = @event.id\n if current_user \n \t\t@event.users << current_user\n \tredirect_to @event, :notice => I18n.t(:reminders_add)\n else\n redirect_to sign_up_url, :notice => I18n.t(:remindes_add_else)\n \tend\n end" ]
[ "0.6180918", "0.59001356", "0.5869519", "0.58484894", "0.58067536", "0.5787249", "0.5783064", "0.57659817", "0.57608", "0.57014245", "0.5698843", "0.56888914", "0.5673755", "0.5673755", "0.5673755", "0.567198", "0.56612545", "0.5658074", "0.56430125", "0.56401193", "0.5637051", "0.5611807", "0.5605786", "0.55992824", "0.5578023", "0.55587757", "0.55528706", "0.55497164", "0.55328035", "0.5530145", "0.55229753", "0.5521441", "0.55213577", "0.5510876", "0.54962283", "0.54932505", "0.54932404", "0.54801273", "0.5462729", "0.5461745", "0.546134", "0.54516566", "0.5450216", "0.5449812", "0.5449812", "0.5447896", "0.5443176", "0.5441279", "0.5429352", "0.5421314", "0.5413398", "0.54069805", "0.5404132", "0.5381536", "0.53798985", "0.53688234", "0.5365962", "0.53657246", "0.5362858", "0.53593075", "0.5355847", "0.53553927", "0.5350557", "0.5345743", "0.5344387", "0.5339258", "0.53315437", "0.5326149", "0.53251356", "0.5318539", "0.53103244", "0.53089315", "0.530869", "0.53045815", "0.5303019", "0.5297477", "0.5295069", "0.5294088", "0.5293386", "0.52708507", "0.52703685", "0.52683467", "0.52675647", "0.5266952", "0.52643794", "0.5261802", "0.52602345", "0.5259283", "0.5257413", "0.52543515", "0.5249683", "0.52452135", "0.52395153", "0.5239062", "0.5236917", "0.5227725", "0.5227725", "0.5220304", "0.5217639", "0.52174026" ]
0.55434847
28
Track an event for a previously identified user
def track_event(event, membership=nil, application=nil, props=nil) analytics_provider_instance.track_event(event, membership, application, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_user_event(event, user, props=nil)\n analytics_provider_instance.track_user_event(event, user, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled]\n end", "def track_server_event(name, user, properties = {})\n user_id = user ? user.id : 'anonymous'\n @last_event = { name: name, user_id: user_id, properties: properties }\n\n if enabled?\n @segment_io.track(\n user_id: user_id,\n event: name,\n properties: properties\n )\n end\n end", "def log_user_event\n depositor.log_event(event)\n end", "def log_user_event\n\n depositor.log_profile_event(event)\n end", "def log_user_event\n depositor.log_profile_event(event)\n end", "def user\n metadata&.dig('event', 'user')\n end", "def set_event\n @user = User.find(params[:id])\n end", "def receiver\n ep = received_event_parameters\n ep.user if ep\n end", "def acknowledged_event(user,event)\n @greeting = \"Hi\"\n @event = event\n mail to: user.email\n end", "def log_user_event\n depositor.log_event( event ) if depositor.respond_to? :log_event\n end", "def trigger_event_for_user user, event, data=nil\n Pusher[user.private_channel].trigger!(event,data)\n end", "def perform(user_id, event, details, ip)\n \tmixpanel.track(user_id, event, details,ip) unless Rails.env.test?\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def processEvent( client, user, t_event )\n#\t\tclient.room.say(\"Processing Event #{t_event}\")\n if user.id != client.user.id\n $botData['events'].each { |event|\n if event['event'] == t_event\n if event['delivery_method'].to_i == 1\n if event['include_name'].to_i == 0\n client.room.say(event['pre_text'] + event['post_text'])\n else\n client.room.say(event['pre_text'] + user.name + event['post_text'])\n end\n else\n if event['include_name'].to_i == 0\n user.say(event['pre_text'] + event['post_text'])\n else\n user.say(event['pre_text'] + user.name + event['post_text'])\n end\n end\n end\n }\n end\nend", "def view_event(user, event) \n\tend", "def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end", "def on_user1_signal( signo )\n\t\tself.log.info \"Checkpoint: User signal.\"\n\tend", "def track(user, key, value=1)\n user.groups.keys.each do |experiment_name|\n user_experiment_event(user, experiment_name, key, value)\n end\n end", "def find_user_event(event)\n users_events.where(event_id: event.id).first\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def event(data)\n # Prepare the event object.\n id = @next_event_id\n @next_event_id += 1\n event = data.merge :id => id, :server_ts => Time.now.to_f\n @events << event\n\n # Broadcast the event to users.\n @users.each do |user|\n next unless user.session\n user.session.sync_events\n end\n end", "def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def log_user_event(depositor)\n depositor.log_profile_event(event)\n rescue => exception\n Honeybadger.notify(exception)\n end", "def user_event_visit(user, event)\n @user = user\n @event = event\n @meeting = user.meetings.find_by(event: event)\n\n mail(to: @user.email, subject: t('user_event_visit', scope: 'message.email.subjects')) if @user.email.present?\n end", "def resolved_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end", "def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end", "def set_event\n # Get only current user events\n @event = current_user.events.find(params[:id])\n end", "def set_event\n @user = Event.find(params[:id])\n end", "def set_user_event\n @user_event = User::Event.find_by(slug: params[:id])\n end", "def track(options)\n\n check_secret\n\n Util.symbolize_keys! options\n\n event = options[:event]\n user_id = options[:user_id].to_s\n properties = options[:properties] || {}\n timestamp = options[:timestamp] || Time.new\n context = options[:context] || {}\n\n ensure_user user_id\n check_timestamp timestamp\n\n if event.nil? || event.empty?\n fail ArgumentError, 'Must supply event as a non-empty string'\n end\n\n fail ArgumentError, 'Properties must be a Hash' unless properties.is_a? Hash\n Util.isoify_dates! properties\n\n add_context context\n\n enqueue({\n :event => event,\n :userId => user_id,\n :context => context,\n :properties => properties,\n :timestamp => timestamp.iso8601,\n :action => 'track'\n })\n end", "def create\n event = Event.find_or_create_from_lastfm(params[:lastfm_id])\n\n # Populate the event\n event.populate!\n\n user = User.get(params[:user_id])\n if user.events.include?(event) # already been added to profile\n render 'api/v1/base/result.json', locals: {result: 'already added'}\n else\n user.events << event\n\n render 'api/v1/base/result.json', locals: {result: 'success'}\n end\n end", "def user_events(user, options={})\n get(\"/users/#{user}/events\", options, 3)\n end", "def fired_event(event)\n history << event\n\t update_task_status(event)\n end", "def event_tracker(event_type, name = nil)\n event_type = event_type.to_s.singularize.to_sym\n name ||= \"track_#{event_type}\"\n\n define_method(name) do |payload = {}|\n run_callbacks(:track_event) do\n event = event_associations[event_type.to_s.pluralize.to_sym].track(payload)\n set(:last_tracked_at, Time.now)\n try(:attempt_refresh_gauges)\n event\n end\n end\n end", "def log_user_profile_event\n depositor.log_profile_event( event ) if depositor.respond_to? :log_profile_event\n end", "def user_events(user_id=self.username, options={})\n response = connection.get do |req|\n req.url \"/users/#{user_id}/events\", options\n end\n response.body.activity\n end", "def log_user_event(depositor)\n # log the event to the proxy depositor's profile\n proxy_depositor.log_profile_event(event)\n depositor.log_event(event)\n end", "def fired_event(event)\n history << event\n update_task_status(event)\n end", "def set_user_track_log\n @user_track_log = UserTrackLog.find(params[:id])\n end", "def initialize(user, event)\n @user = user\n @event = event\n end", "def set_event\n @user = find_user\n @event = @user.events.find(params[:id])\n end", "def track_user_id(id)\n key = current_key\n redis.sadd(key, id)\n #redis will reset ttl after modified\n redis.expire(key, 10.minutes)\n end", "def track_event args\n unless APP_CONFIG[:actions_to_track].include?(args[:action])\n Rails.logger.error \"Invalid action name #{args[:action]} has been send to track. Args is #{args}\"\n return\n end\n begin\n if args[:type] != 'delete' && args[:type] != 'qgeoinfo'\n detail = {\n actor_gender: current_user.gender,\n actor_id: current_user.id.to_s,\n ip: (Rails.env == 'production' ? request.remote_ip : '73.222.0.206'), \n platform: browser.platform, \n is_mobile: @is_mobile, \n user_agent: request.user_agent,\n browser: browser.name\n }.merge args\n obj = Tracking.create(detail.except(:type))\n end\n Resque.enqueue RunTrackingResqueJob, { \n packet: args.merge(actor_id: current_user.id.to_s),\n tid: (obj.id.to_s rescue nil)\n }\n rescue => e\n Rails.logger.error \"Tracking job could not get added. Error is #{e.message} and args is #{args}\"\n end\n end", "def link_new_user_to_event(params)\n\t\t@token = params[:invitation_token]\n\t\t#puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#{params}\"\n\t\tif @token\n\t\t\t@event = Event.decrypt(@token)\n\t\t\t@user = User.find_by_email(params[:user][:email])\n\t\t\tif @event\n\t\t\t\t@event.invite!(@user.id) unless @user.nil?\n\t\t\tend\n\t\tend\n\tend", "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 set_event_user\n @event_user = EventUser.find(params[:id])\n end", "def set_event_user\n @event_user = EventUser.find(params[:id])\n end", "def set_event\n @event = Event.find_by_id(params[:id])\n @event = {} if different_user?(@event)\n end", "def set_usereventrecord\n @usereventrecord = Usereventrecord.find(params[:id])\n end", "def update_user_tracking!\n unless self.new_record?\n self.updater = \n UserTracking.current_user || \n (raise UserTracking::Error, \"current user is not defined\")\n end\n end", "def add_tracked_user_invites(user_id, track_type)\n tracker.add([self.user_id, user_id, TrackTypes::USER_INVITES, track_type])\n end", "def set_event \n if current_user != nil\n @event = Event.find(params[:id])\n else\n redirect_to('/login?force=true')\n end\n end", "def on_twitter_engine_update(e, user)\n pre = '<Twitter::Engine>'\n @log.info(\"#{pre} Updating: #{user['who']}.\")\n end", "def received_events(user, options={})\n get(\"/users/#{user}/received_events\", options, 3)\n end", "def show\n @theevent = find_event(params[:id])\n if @theevent.user == current_user\n @theuser = current_user\n else\n redirect_to top_path\n end\n end", "def identify(user, push=true)\n analytics_provider_instance.identify(user) if analytics_provider_instance && Rails.configuration.analytics[:enabled]\n end", "def create\n @event = Event.new(event_params)\n @event.user = @user\n @event.save\n # Cehck if there is any highschooler interested in talking to this undergraduate\n notify_highschooler if @user.interested_in_me.present?\n end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def perform(user)\n # Do something later\n ActiveSupport::Notifications.instrument \"event\" , { foo: \"event firing in welcome user\" }\n WelcomeMailer.with(user: user).welcome_email.deliver_now\n end", "def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end", "def set_event\n @event = current_user.events.find(params[:id])\n end", "def set_event\n @event = current_user.events.find(params[:id])\n end", "def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end", "def add_to_user_event_lists(user_list)\n\t\tuser_list.each do |users_id| \n\t\t\tuser = User.find(users_id)\n\t\t\tuser.add_event(self.id)\n\t\tend\n\tend", "def set_events_user\n @events_user = EventsUser.find(params[:id])\n end", "def set_events_user\n @events_user = EventsUser.find(params[:id])\n end", "def moved_up_event_waiting_user\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/events/#{@event.id}\")\n subject = \"[bootcamp] #{@event.title}で、補欠から参加に繰り上がりました。\"\n mail to: @user.email, subject: subject\n end", "def now_playing_user(m)\n\t\t\t\tnick = @backend.get(m.user)\n\t\t\t\tif nick\n\t\t\t\t\tartist, track = get_data(nick)\n\t\t\t\t\tm.reply(\"#{nick} has recently played: #{artist} - #{track}\")\n\t\t\t\tend\n\t\t\tend", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def currentuser\n\n @events = Event.where(user_id: current_user).order('created_at DESC')\n\tend", "def show\n @event = Event.find(params[:id])\n @head_user = User.find(@event.user_id)\n end", "def ga_set_user(email)\n @ga_tracker.set(\"&uid\", email)\n end", "def new_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end", "def record_event(event)\n @events_mutex.synchronize do\n @events << event\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 event_invite(user_event)\n\t headers[\"Custom-header\"] = \"Bar\"\n\t @record = user_event\n\t \tmail(:to => user_event.user.email, :subject => \"Você foi convidado para o Evento #{user_event.event.title}\")\n\tend", "def update!(**args)\n @user_events = args[:user_events] if args.key?(:user_events)\n end", "def set_user_event_detail\n @user_event_detail = UserEventDetail.find(params[:id])\n end", "def create\n @event = Event.find(params[:attended_event_id])\n if current_user.attend(@event)\n flash[:success] = \"Confirmed. Enjoy #{@event.title} on #{@event.date.strftime(\"%a, %b %d %Y %I : %M %p\")}\"\n redirect_to user_path(current_user)\n end\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def logging_in\n # For example:\n guest_tracks = guest_user.tracks.all\n guest_tracks.each do |track|\n track.user_id = current_user.id\n track.save!\n end\n end", "def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend", "def track_added(track)\n @project = track.project\n @track = track\n @user = @track.user\n\n mail to: @user.email,\n bcc: \"pierre@sugaryourcoffee.de\",\n subject: \"[apptrack] New Track in Project #{@project.title}\"\n end", "def set_event_user_status\n @event_user_status = EventUserStatus.find(params[:id])\n end", "def changeState(user)\n if user.current_role == Role.Fachschaft || user.current_role == Role.Admin\n if self.unsubmitted?\n #Set the author of this event revision\n self.author = user\n #Make sure the event is awaiting approval\n self.waiting!\n elsif user.current_role == Role.Admin\n if self.reviewed?\n self.admin = user\n self.submitted!\n self.publish\n end\n end\n end\n save\n end", "def set_event\n @event = @user.events.find(params[:id])\n end", "def getCurrentEventsForUser\n events_currentUser = current_user.getEventsAttending\n gon.user_id = current_user.id\n\n respond_to do |format|\n format.json {render :json => {:events_currentUser => events_currentUser}}\n end\n end", "def set_event\n @event = Event.find(params[:id])\n @current_user_is_participating = @event.participants.find_by(user_id: current_user.id) != nil if user_signed_in?\n end", "def gifted(user)\n segment(user).identify(state: 'gifted_sticker')\n segment(user).track('user_gifted_sticker')\n end", "def eventcodesignup_step2\n @user = current_user\nend", "def create\n \n @user = User.find_by_name(params[:user_track_log][:user_name])\n if @user.blank?\n redirect_to root_url, notice: 'Invalid User Name.' \n return\n end\n \n user_logged_in = UserTrackLog.where('DATE(arrival_time) = ? and user_name = ?', Date.today,params[:user_track_log][:user_name])\n unless user_logged_in.blank?\n redirect_to root_url, notice: 'You have Already Signed in'\n return\n end\n @user_track_log = UserTrackLog.new(user_track_log_params)\n @user_track_log.arrival_time = Time.now \n @user_track_log.is_late = (Time.now > Time.now.beginning_of_day + 10.hours) ? 1 : 0\n @user_track_log.user_id = @user.id\n\n\n if (@user_track_log.is_late == 1)\n message = \"Hello #{params[:user_track_log][:user_name]} you are late today please sing in before 10 AM\"\n else\n message = \"Hello #{params[:user_track_log][:user_name]} you have singned in successfully\"\n end\n respond_to do |format|\n if @user_track_log.save\n format.html { redirect_to root_url, notice: \"#{message}\" }\n format.json { render :show, status: :created, location: @user_track_log }\n else\n format.html { render :new }\n format.json { render json: @user_track_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end", "def user_registered(user)\n @user = user\n\n mail to: \"pierre@sugaryourcoffee.de\",\n subject: \"[apptrack] New User has registered for apptrack\"\n end", "def destroy\n # Get user\n user = AuthorizeApiRequest.call(params).result\n @event = Event.find(params[:event_id])\n #See if event is saved event for that user, if so remove it \n if (@event.going.include?(user.id.to_s) )\n @event.update!(going: @event.going-[user.id.to_s])\n render :attendance_event, status: :ok\n else\n render json: {\n error: e.to_s\n }, status: :unprocessable_entity\n end\n end", "def events_for_authenticated_user page\n events = api_client.received_events(authenticated_user, page: page)\n filter_events events\n end", "def set_tracker\n @tracker = current_user.trackers.find(params[:id])\n end" ]
[ "0.7105728", "0.6900716", "0.6708107", "0.6690832", "0.66451657", "0.6464324", "0.63249314", "0.63192886", "0.62284917", "0.62187856", "0.61510795", "0.6131353", "0.61215115", "0.61215115", "0.61215115", "0.6061356", "0.6057039", "0.60425735", "0.60139596", "0.6008025", "0.60079294", "0.59565514", "0.5892187", "0.58725053", "0.58579797", "0.58361113", "0.5835489", "0.5826915", "0.5822731", "0.58063114", "0.58000773", "0.579778", "0.57931", "0.57839525", "0.5779476", "0.5777349", "0.576092", "0.5752508", "0.57305986", "0.5706086", "0.56934816", "0.5687053", "0.56850034", "0.56836724", "0.56714845", "0.56640244", "0.56576747", "0.56479275", "0.5645052", "0.5645052", "0.56398153", "0.5637214", "0.5637106", "0.56284237", "0.5603347", "0.56005514", "0.5596699", "0.55951107", "0.5590229", "0.5578029", "0.5577089", "0.55747944", "0.55633175", "0.5561932", "0.5561741", "0.55504596", "0.55459696", "0.55381274", "0.55381274", "0.5535691", "0.5534654", "0.5530658", "0.5522816", "0.55203164", "0.5509758", "0.5501882", "0.54943234", "0.5492664", "0.5492582", "0.54877204", "0.5483577", "0.54832375", "0.5477987", "0.5477987", "0.5473945", "0.54637045", "0.54624844", "0.5457859", "0.5457819", "0.5456335", "0.544464", "0.5441019", "0.5439526", "0.543401", "0.5412781", "0.5403098", "0.5394259", "0.5387703", "0.5386743", "0.53803515" ]
0.548468
80
Track an event for a previously identified user
def track_user_event(event, user, props=nil) analytics_provider_instance.track_user_event(event, user, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_server_event(name, user, properties = {})\n user_id = user ? user.id : 'anonymous'\n @last_event = { name: name, user_id: user_id, properties: properties }\n\n if enabled?\n @segment_io.track(\n user_id: user_id,\n event: name,\n properties: properties\n )\n end\n end", "def log_user_event\n depositor.log_event(event)\n end", "def log_user_event\n\n depositor.log_profile_event(event)\n end", "def log_user_event\n depositor.log_profile_event(event)\n end", "def user\n metadata&.dig('event', 'user')\n end", "def set_event\n @user = User.find(params[:id])\n end", "def receiver\n ep = received_event_parameters\n ep.user if ep\n end", "def acknowledged_event(user,event)\n @greeting = \"Hi\"\n @event = event\n mail to: user.email\n end", "def log_user_event\n depositor.log_event( event ) if depositor.respond_to? :log_event\n end", "def trigger_event_for_user user, event, data=nil\n Pusher[user.private_channel].trigger!(event,data)\n end", "def perform(user_id, event, details, ip)\n \tmixpanel.track(user_id, event, details,ip) unless Rails.env.test?\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def processEvent( client, user, t_event )\n#\t\tclient.room.say(\"Processing Event #{t_event}\")\n if user.id != client.user.id\n $botData['events'].each { |event|\n if event['event'] == t_event\n if event['delivery_method'].to_i == 1\n if event['include_name'].to_i == 0\n client.room.say(event['pre_text'] + event['post_text'])\n else\n client.room.say(event['pre_text'] + user.name + event['post_text'])\n end\n else\n if event['include_name'].to_i == 0\n user.say(event['pre_text'] + event['post_text'])\n else\n user.say(event['pre_text'] + user.name + event['post_text'])\n end\n end\n end\n }\n end\nend", "def view_event(user, event) \n\tend", "def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end", "def on_user1_signal( signo )\n\t\tself.log.info \"Checkpoint: User signal.\"\n\tend", "def track(user, key, value=1)\n user.groups.keys.each do |experiment_name|\n user_experiment_event(user, experiment_name, key, value)\n end\n end", "def find_user_event(event)\n users_events.where(event_id: event.id).first\n end", "def set_user_event\n @user_event = UserEvent.find(params[:id])\n end", "def event(data)\n # Prepare the event object.\n id = @next_event_id\n @next_event_id += 1\n event = data.merge :id => id, :server_ts => Time.now.to_f\n @events << event\n\n # Broadcast the event to users.\n @users.each do |user|\n next unless user.session\n user.session.sync_events\n end\n end", "def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def log_user_event(depositor)\n depositor.log_profile_event(event)\n rescue => exception\n Honeybadger.notify(exception)\n end", "def user_event_visit(user, event)\n @user = user\n @event = event\n @meeting = user.meetings.find_by(event: event)\n\n mail(to: @user.email, subject: t('user_event_visit', scope: 'message.email.subjects')) if @user.email.present?\n end", "def resolved_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end", "def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end", "def set_event\n # Get only current user events\n @event = current_user.events.find(params[:id])\n end", "def set_event\n @user = Event.find(params[:id])\n end", "def set_user_event\n @user_event = User::Event.find_by(slug: params[:id])\n end", "def track(options)\n\n check_secret\n\n Util.symbolize_keys! options\n\n event = options[:event]\n user_id = options[:user_id].to_s\n properties = options[:properties] || {}\n timestamp = options[:timestamp] || Time.new\n context = options[:context] || {}\n\n ensure_user user_id\n check_timestamp timestamp\n\n if event.nil? || event.empty?\n fail ArgumentError, 'Must supply event as a non-empty string'\n end\n\n fail ArgumentError, 'Properties must be a Hash' unless properties.is_a? Hash\n Util.isoify_dates! properties\n\n add_context context\n\n enqueue({\n :event => event,\n :userId => user_id,\n :context => context,\n :properties => properties,\n :timestamp => timestamp.iso8601,\n :action => 'track'\n })\n end", "def create\n event = Event.find_or_create_from_lastfm(params[:lastfm_id])\n\n # Populate the event\n event.populate!\n\n user = User.get(params[:user_id])\n if user.events.include?(event) # already been added to profile\n render 'api/v1/base/result.json', locals: {result: 'already added'}\n else\n user.events << event\n\n render 'api/v1/base/result.json', locals: {result: 'success'}\n end\n end", "def user_events(user, options={})\n get(\"/users/#{user}/events\", options, 3)\n end", "def fired_event(event)\n history << event\n\t update_task_status(event)\n end", "def event_tracker(event_type, name = nil)\n event_type = event_type.to_s.singularize.to_sym\n name ||= \"track_#{event_type}\"\n\n define_method(name) do |payload = {}|\n run_callbacks(:track_event) do\n event = event_associations[event_type.to_s.pluralize.to_sym].track(payload)\n set(:last_tracked_at, Time.now)\n try(:attempt_refresh_gauges)\n event\n end\n end\n end", "def log_user_profile_event\n depositor.log_profile_event( event ) if depositor.respond_to? :log_profile_event\n end", "def user_events(user_id=self.username, options={})\n response = connection.get do |req|\n req.url \"/users/#{user_id}/events\", options\n end\n response.body.activity\n end", "def log_user_event(depositor)\n # log the event to the proxy depositor's profile\n proxy_depositor.log_profile_event(event)\n depositor.log_event(event)\n end", "def fired_event(event)\n history << event\n update_task_status(event)\n end", "def set_user_track_log\n @user_track_log = UserTrackLog.find(params[:id])\n end", "def initialize(user, event)\n @user = user\n @event = event\n end", "def set_event\n @user = find_user\n @event = @user.events.find(params[:id])\n end", "def track_user_id(id)\n key = current_key\n redis.sadd(key, id)\n #redis will reset ttl after modified\n redis.expire(key, 10.minutes)\n end", "def track_event args\n unless APP_CONFIG[:actions_to_track].include?(args[:action])\n Rails.logger.error \"Invalid action name #{args[:action]} has been send to track. Args is #{args}\"\n return\n end\n begin\n if args[:type] != 'delete' && args[:type] != 'qgeoinfo'\n detail = {\n actor_gender: current_user.gender,\n actor_id: current_user.id.to_s,\n ip: (Rails.env == 'production' ? request.remote_ip : '73.222.0.206'), \n platform: browser.platform, \n is_mobile: @is_mobile, \n user_agent: request.user_agent,\n browser: browser.name\n }.merge args\n obj = Tracking.create(detail.except(:type))\n end\n Resque.enqueue RunTrackingResqueJob, { \n packet: args.merge(actor_id: current_user.id.to_s),\n tid: (obj.id.to_s rescue nil)\n }\n rescue => e\n Rails.logger.error \"Tracking job could not get added. Error is #{e.message} and args is #{args}\"\n end\n end", "def link_new_user_to_event(params)\n\t\t@token = params[:invitation_token]\n\t\t#puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#{params}\"\n\t\tif @token\n\t\t\t@event = Event.decrypt(@token)\n\t\t\t@user = User.find_by_email(params[:user][:email])\n\t\t\tif @event\n\t\t\t\t@event.invite!(@user.id) unless @user.nil?\n\t\t\tend\n\t\tend\n\tend", "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 set_event_user\n @event_user = EventUser.find(params[:id])\n end", "def set_event_user\n @event_user = EventUser.find(params[:id])\n end", "def set_event\n @event = Event.find_by_id(params[:id])\n @event = {} if different_user?(@event)\n end", "def set_usereventrecord\n @usereventrecord = Usereventrecord.find(params[:id])\n end", "def update_user_tracking!\n unless self.new_record?\n self.updater = \n UserTracking.current_user || \n (raise UserTracking::Error, \"current user is not defined\")\n end\n end", "def add_tracked_user_invites(user_id, track_type)\n tracker.add([self.user_id, user_id, TrackTypes::USER_INVITES, track_type])\n end", "def set_event \n if current_user != nil\n @event = Event.find(params[:id])\n else\n redirect_to('/login?force=true')\n end\n end", "def on_twitter_engine_update(e, user)\n pre = '<Twitter::Engine>'\n @log.info(\"#{pre} Updating: #{user['who']}.\")\n end", "def received_events(user, options={})\n get(\"/users/#{user}/received_events\", options, 3)\n end", "def show\n @theevent = find_event(params[:id])\n if @theevent.user == current_user\n @theuser = current_user\n else\n redirect_to top_path\n end\n end", "def identify(user, push=true)\n analytics_provider_instance.identify(user) if analytics_provider_instance && Rails.configuration.analytics[:enabled]\n end", "def create\n @event = Event.new(event_params)\n @event.user = @user\n @event.save\n # Cehck if there is any highschooler interested in talking to this undergraduate\n notify_highschooler if @user.interested_in_me.present?\n end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def perform(user)\n # Do something later\n ActiveSupport::Notifications.instrument \"event\" , { foo: \"event firing in welcome user\" }\n WelcomeMailer.with(user: user).welcome_email.deliver_now\n end", "def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end", "def set_event\n @event = current_user.events.find(params[:id])\n end", "def set_event\n @event = current_user.events.find(params[:id])\n end", "def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end", "def add_to_user_event_lists(user_list)\n\t\tuser_list.each do |users_id| \n\t\t\tuser = User.find(users_id)\n\t\t\tuser.add_event(self.id)\n\t\tend\n\tend", "def set_events_user\n @events_user = EventsUser.find(params[:id])\n end", "def set_events_user\n @events_user = EventsUser.find(params[:id])\n end", "def moved_up_event_waiting_user\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/events/#{@event.id}\")\n subject = \"[bootcamp] #{@event.title}で、補欠から参加に繰り上がりました。\"\n mail to: @user.email, subject: subject\n end", "def now_playing_user(m)\n\t\t\t\tnick = @backend.get(m.user)\n\t\t\t\tif nick\n\t\t\t\t\tartist, track = get_data(nick)\n\t\t\t\t\tm.reply(\"#{nick} has recently played: #{artist} - #{track}\")\n\t\t\t\tend\n\t\t\tend", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def currentuser\n\n @events = Event.where(user_id: current_user).order('created_at DESC')\n\tend", "def show\n @event = Event.find(params[:id])\n @head_user = User.find(@event.user_id)\n end", "def ga_set_user(email)\n @ga_tracker.set(\"&uid\", email)\n end", "def new_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end", "def record_event(event)\n @events_mutex.synchronize do\n @events << event\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 event_invite(user_event)\n\t headers[\"Custom-header\"] = \"Bar\"\n\t @record = user_event\n\t \tmail(:to => user_event.user.email, :subject => \"Você foi convidado para o Evento #{user_event.event.title}\")\n\tend", "def update!(**args)\n @user_events = args[:user_events] if args.key?(:user_events)\n end", "def track_event(event, membership=nil, application=nil, props=nil)\n analytics_provider_instance.track_event(event, membership, application, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled]\n end", "def set_user_event_detail\n @user_event_detail = UserEventDetail.find(params[:id])\n end", "def create\n @event = Event.find(params[:attended_event_id])\n if current_user.attend(@event)\n flash[:success] = \"Confirmed. Enjoy #{@event.title} on #{@event.date.strftime(\"%a, %b %d %Y %I : %M %p\")}\"\n redirect_to user_path(current_user)\n end\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def logging_in\n # For example:\n guest_tracks = guest_user.tracks.all\n guest_tracks.each do |track|\n track.user_id = current_user.id\n track.save!\n end\n end", "def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend", "def track_added(track)\n @project = track.project\n @track = track\n @user = @track.user\n\n mail to: @user.email,\n bcc: \"pierre@sugaryourcoffee.de\",\n subject: \"[apptrack] New Track in Project #{@project.title}\"\n end", "def set_event_user_status\n @event_user_status = EventUserStatus.find(params[:id])\n end", "def changeState(user)\n if user.current_role == Role.Fachschaft || user.current_role == Role.Admin\n if self.unsubmitted?\n #Set the author of this event revision\n self.author = user\n #Make sure the event is awaiting approval\n self.waiting!\n elsif user.current_role == Role.Admin\n if self.reviewed?\n self.admin = user\n self.submitted!\n self.publish\n end\n end\n end\n save\n end", "def set_event\n @event = @user.events.find(params[:id])\n end", "def getCurrentEventsForUser\n events_currentUser = current_user.getEventsAttending\n gon.user_id = current_user.id\n\n respond_to do |format|\n format.json {render :json => {:events_currentUser => events_currentUser}}\n end\n end", "def set_event\n @event = Event.find(params[:id])\n @current_user_is_participating = @event.participants.find_by(user_id: current_user.id) != nil if user_signed_in?\n end", "def gifted(user)\n segment(user).identify(state: 'gifted_sticker')\n segment(user).track('user_gifted_sticker')\n end", "def eventcodesignup_step2\n @user = current_user\nend", "def create\n \n @user = User.find_by_name(params[:user_track_log][:user_name])\n if @user.blank?\n redirect_to root_url, notice: 'Invalid User Name.' \n return\n end\n \n user_logged_in = UserTrackLog.where('DATE(arrival_time) = ? and user_name = ?', Date.today,params[:user_track_log][:user_name])\n unless user_logged_in.blank?\n redirect_to root_url, notice: 'You have Already Signed in'\n return\n end\n @user_track_log = UserTrackLog.new(user_track_log_params)\n @user_track_log.arrival_time = Time.now \n @user_track_log.is_late = (Time.now > Time.now.beginning_of_day + 10.hours) ? 1 : 0\n @user_track_log.user_id = @user.id\n\n\n if (@user_track_log.is_late == 1)\n message = \"Hello #{params[:user_track_log][:user_name]} you are late today please sing in before 10 AM\"\n else\n message = \"Hello #{params[:user_track_log][:user_name]} you have singned in successfully\"\n end\n respond_to do |format|\n if @user_track_log.save\n format.html { redirect_to root_url, notice: \"#{message}\" }\n format.json { render :show, status: :created, location: @user_track_log }\n else\n format.html { render :new }\n format.json { render json: @user_track_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end", "def user_registered(user)\n @user = user\n\n mail to: \"pierre@sugaryourcoffee.de\",\n subject: \"[apptrack] New User has registered for apptrack\"\n end", "def destroy\n # Get user\n user = AuthorizeApiRequest.call(params).result\n @event = Event.find(params[:event_id])\n #See if event is saved event for that user, if so remove it \n if (@event.going.include?(user.id.to_s) )\n @event.update!(going: @event.going-[user.id.to_s])\n render :attendance_event, status: :ok\n else\n render json: {\n error: e.to_s\n }, status: :unprocessable_entity\n end\n end", "def events_for_authenticated_user page\n events = api_client.received_events(authenticated_user, page: page)\n filter_events events\n end", "def set_tracker\n @tracker = current_user.trackers.find(params[:id])\n end" ]
[ "0.6900716", "0.6708107", "0.6690832", "0.66451657", "0.6464324", "0.63249314", "0.63192886", "0.62284917", "0.62187856", "0.61510795", "0.6131353", "0.61215115", "0.61215115", "0.61215115", "0.6061356", "0.6057039", "0.60425735", "0.60139596", "0.6008025", "0.60079294", "0.59565514", "0.5892187", "0.58725053", "0.58579797", "0.58361113", "0.5835489", "0.5826915", "0.5822731", "0.58063114", "0.58000773", "0.579778", "0.57931", "0.57839525", "0.5779476", "0.5777349", "0.576092", "0.5752508", "0.57305986", "0.5706086", "0.56934816", "0.5687053", "0.56850034", "0.56836724", "0.56714845", "0.56640244", "0.56576747", "0.56479275", "0.5645052", "0.5645052", "0.56398153", "0.5637214", "0.5637106", "0.56284237", "0.5603347", "0.56005514", "0.5596699", "0.55951107", "0.5590229", "0.5578029", "0.5577089", "0.55747944", "0.55633175", "0.5561932", "0.5561741", "0.55504596", "0.55459696", "0.55381274", "0.55381274", "0.5535691", "0.5534654", "0.5530658", "0.5522816", "0.55203164", "0.5509758", "0.5501882", "0.54943234", "0.5492664", "0.5492582", "0.54877204", "0.548468", "0.5483577", "0.54832375", "0.5477987", "0.5477987", "0.5473945", "0.54637045", "0.54624844", "0.5457859", "0.5457819", "0.5456335", "0.544464", "0.5441019", "0.5439526", "0.543401", "0.5412781", "0.5403098", "0.5394259", "0.5387703", "0.5386743", "0.53803515" ]
0.7105728
0