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 |
|---|---|---|---|---|---|---|
prepare formatstring. NOTE: this is not the final value. render adds numbering to this, if user has set numbering option.!!!!
|
def _prepare_format #:nodoc:
fmstr = nil
fmt = []
each_column { |c, i|
## trying a zero for hidden columns
## worked but an extra space is added below and the sep
w = c.width
case c.align
when :right
#fmt << "%.#{w}s "
fmt << "%#{w}.#{w}s "
else
fmt << "%-#{w}.#{w}s "
end
}
## the next line will put a separator after hidden columns also
fmstr = fmt.join(@y)
#puts "format: #{fmstr} " # 2011-12-09 23:09:57
return fmstr
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render\n buffer = []\n _guess_col_widths\n rows = @list.size.to_s.length\n @rows = rows\n _prepare_format\n \n str = \"\"\n if @numbering\n str = \" \"*(rows+1)+@y\n end\n str << @fmstr % @columns\n buffer << str\n #puts \"-\" * str.length\n buffer << separator\n if @list\n if @numbering\n @fmstr = \"%#{rows}d \"+ @y + @fmstr\n end\n #@list.each { |e| puts e.join(@y) }\n count = 0\n @list.each_with_index { |r,i| \n value = convert_value_to_text r, count\n buffer << value\n count += 1\n }\n end\n buffer\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def format!; end",
"def format=(_arg0); end",
"def format=(_arg0); end",
"def format=(_arg0); end",
"def format=(_arg0); end",
"def preformatting\n\n end",
"def format(text); end",
"def format(lines, cur_no)\n lastno = lines.keys.max\n lines.map do |num, line|\n sign = num + 1 == cur_no ? '=> ' : ' ' * 3\n super('%s%*d: %s', sign, lastno.to_s.size, num + 1, line)\n end.join(\"\\n\")\n end",
"def _process_format(format); end",
"def _process_format(format); end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def formats_idx; end",
"def customizeTemplate( \n _displayFormat = \"points\" # specify the type {values, points}\n )\n\n template = File.read(@filename)\n\n\n template.sub!('*****DETAIL*****', @dailyActivity.to_s)\n template.sub!('*****BADGES*****', [].to_s) # empty for now.\n template.sub!('*****FORMAT*****', \"\\\"#{_displayFormat}\\\"\")\n\n template.sub!('*****TOTAL*****', @dailyTotals.to_s)\n template.sub!('*****TARGET*****', @goalTarget.to_s)\n template.sub!('*****START*****', \"\\\"#{@startDate}\\\"\")\n template.sub!('*****END*****', \"\\\"#{@endDate}\\\"\")\n template.sub!('*****NAME*****', \"\\\"#{@name}\\\"\")\n\n return template\n end",
"def formatter=(_arg0); end",
"def formatter=(_arg0); end",
"def formatter=(_arg0); end",
"def format; :n3; end",
"def format\n string =\n if @factor > 1\n \"#{@factor.round}:1\"\n else\n \"1:#{(1 / @factor).round}\"\n end\n string = \"~#{string}\" unless self == self.class.new(string)\n\n string\n end",
"def formats; end",
"def formats; end",
"def format(number)\n # Start with an empty string;\n # maybe change it, but definitely return it.\n \"\".tap do |output|\n @format_data.each do |key, value|\n output << key if even_split?(number, value)\n end\n output << number.to_s if output.empty?\n end\n end",
"def prepare *args, **kwds\n @last_prepared_cmd = Cmds.format render(*args, **kwds), self.format\n end",
"def create_format_method\n end",
"def write_data_label_number_format(format_code)\n source_linked = 0\n\n attributes = [\n ['formatCode', format_code],\n ['sourceLinked', source_linked]\n ]\n\n @writer.empty_tag('c:numFmt', attributes)\n end",
"def format(fmt, *rest) end",
"def b_format_form\n \"#{id} - #{cert_ope}\"\n end",
"def format(format_value)\n @template.format = format_value\n end",
"def number_with_formatting\n if /^(.*)(.{6})(.{6})(.{6})(.{6})(.{6})/i.match(number_without_formatting)\n \"#{$1}-#{$2}-#{$3}-#{$4}-#{$5}-#{$6}\"\n else\n number_without_formatting\n end\n end",
"def format_list_item(out, options)\n if options[:list] == :ul\n out << \"#{'*' * (options[:ul] + 1)} \"\n elsif options[:list] == :ol\n number = options[:number]\n options[:number] = number.next\n out << \"#{number}. \"\n end\n end",
"def render\n raise \"tabular:: list is nil \" unless @list\n $log.debug \" render list:: #{@list.size} \"\n #$log.debug \" render list:1: #{@list} \"\n raise \"tabular:: columns is nil \" unless @columns\n buffer = []\n @separ = nil\n _guess_col_widths\n rows = @list.size.to_s.length\n #@rows = rows\n fmstr = _prepare_format\n $log.debug \"tabular: fmstr:: #{fmstr}\"\n $log.debug \"tabular: cols: #{@columns}\"\n #$log.debug \"tabular: data: #{@list}\"\n\n str = \"\"\n if @numbering\n str = \" \"*(rows+1)+@y\n end\n #str << fmstr % visible_column_names()\n str << convert_heading_to_text(visible_column_names(), fmstr)\n buffer << str\n #puts \"-\" * str.length\n buffer << separator if @use_separator\n if @list ## XXX why wasn't numbering done in _prepare_format ???? FIXME\n if @numbering\n fmstr = \"%#{rows}d \"+ @y + fmstr\n end\n #@list.each { |e| puts e.join(@y) }\n count = 0\n @list.each_with_index { |r,i| \n if r == :separator\n buffer << separator\n next\n end\n if @_hidden_columns_flag\n r = visible_columns(r)\n end\n if @numbering\n r.insert 0, count+1\n end\n #value = convert_value_to_text r, count\n value = convert_value_to_text r, fmstr, i\n buffer << value\n count += 1\n }\n end\n buffer\n end",
"def render\n # need to return the following like this\n # 1) font_size as font-size \n # 2) dot_size as dot-size\n # 3) outline_colour as outline-colour\n # 4) halo_size as halo-size\n # 5) start_angle as start-angle\n # 6) tick_height as tick-height\n # 7) grid_colour as grid-colour\n # 8) threed as 3d\n # 9) tick_length as tick-length\n # 10) visible_steps as visible-steps\n # 11) key_on_click as key-on-click\n returning self.to_json do |output|\n output.gsub!(\"threed\",\"3d\")\n output.gsub!(\"default_dot_style\",\"dot_style\")\n %w(solid_dot font_size dot_size outline_colour halo_size start_angle tick_height grid_colour tick_length no_labels label_colour gradient_fill fill_alpha on_click spoke_labels visible_steps key_on_click dot_style hollow_dot).each do |replace|\n output.gsub!(replace, replace.gsub(\"_\", \"-\"))\n end\n end\n end",
"def format\n @_format\n end",
"def format_order_number(number)\n number.to_s.gsub(/[^\\w_]/, '').rjust(4, \"0\")[0...20]\n end",
"def render\n bari, tenor, alto, soprano = '', '', '', ''\n instrument_strings = [bari, tenor, alto, soprano]\n @notes.each_with_index {|note, index| \n duration_string = '1'\n duration_string = '2' if index == deltas_max_index\n instrument_string = instrument_strings[index]\n note_string = midi_to_lily(note) + duration_string\n instrument_string << note_string\n instrument_string << ' r2' if index == deltas_max_index\n }\n instrument_strings\n end",
"def render_inbook(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and\n else\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editor\"\n end\n r += \". \"\n\n r += p.title.detex.titlecase\n\n if field(p,\"Volume\") then # <$fields.Volume?>\n r += text_for_field(\"Volume\", p, :prefix => \", volume \") #, volume <$fields.Volume/>\n if field(p,\"Series\") then # <$fields.Series?>\n r += text_for_field(\"Series\", p, :prefix => \" of \", :postfix => \"\") # <$fields.Series/>\n end # </$fields.Series?>\n end # </$fields.Volume?>\n\n if field(p,\"Chapter\") then # <$fields.Chapter?>, \n r += \", \"\n if field(p,\"Type\") then # <$fields.Type?>\n r += text_for_field(\"Type\", p, :postfix => \" \") # <$fields.Type/>\n else\n r += \"chapter\" # <?$fields.Type?>chapter\n end # </$fields.Type?>\n r += text_for_field(\"Chapter\", p) # <$fields.Chapter/>\n # <$fields.Pages.stringByPrependingCommaAndSpaceIfNotEmpty/>\n if field(p,\"Pages\") then\n r += text_for_field(\"Pages\", p, :prefix => \", pages \", :postfix => \". \").detex\n end\n else # <?$fields.Chapter?>\n # <$fields.Pages?>, page <$fields.Pages/>\n if field(p,\"Pages\") then\n r += text_for_field(\"Pages\", p, :prefix => \", pages \", :postfix => \". \").detex\n end # </$fields.Pages?>\n end # </$fields.Chapter?>\n\n if field(p,\"Volume\") then #<$fields.Volume?>\n # empty\n else # <?$fields.Volume?>\n if field(p,\"Number\") then # <$fields.Number?>. Number\n r += text_for_field(\"Number\", p, :prefix => \". Number \", :postfix => \"\") #<$fields.Number/>\n if field(p,\"Series\") then # <$fields.Series?>\n r += text_for_field(\"Series\", p, :prefix => \" in \", :postfix => \"\") # <$fields.Series/>\n end #</$fields.Series?>\n else # <?$fields.Number?>\n # <$fields.Series.stringByPrependingCommaAndSpaceIfNotEmpty/>\n r += text_for_field(\"Series\", p, :prefix => \", \")\n end # </$fields.Number?>\n r += \". \"\n end # </$fields.Volume?>.\n\n r += text_for_field(\"Publisher\", p) # <$fields.Publisher/>\n r += text_for_field(\"Address\", p, :prefix => \", \") # <$fields.Address.stringByPrependingCommaAndSpaceIfNotEmpty/>,\n r += text_for_field(\"Edition\", p, :prefix => \", \", :postfix => \" edition\")\n r += month_for_field(\"Month\", p, :prefix => \", \") # <$fields.Month.stringByAppendingSpaceIfNotEmpty/>\n r += text_for_field(\"Year\", p, :prefix => \" \", :postfix => \".\") # <$fields.Year/>. \n r += text_for_field(\"Note\", p, :prefix => \" \", :postfix => \". \").detex # <$fields.Note.stringByPrependingFullStopAndSpace/>.\n return r\nend",
"def draw()\n if (self.pattern != nil)\n @cLabelNumber.text = sprintf(self.pattern, @value.to_s)\n else\n @cLabelNumber.text = @value.to_s\n end\n @cLabelNumber.draw()\n end",
"def render_techreport(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n end\n\n r += p.title.detex.titlecase + \". \"\n\n if field(p,\"Type\") then\n r += text_for_field(\"Type\", p).titlecase.detex\n else\n r += \"Technical Report\"\n end\n r += text_for_field(\"Number\", p, :prefix => \" \", :postfix => \", \").detex\n r += text_for_field(\"Institution\", p, :postfix => \", \").detex\n r += text_for_field(\"Address\", p, :postfix => \", \").detex\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \").detex\n return r\n\nend",
"def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end",
"def format_order_id(num_operacion)\n num_operacion.to_s.rjust(12,'0') \n end",
"def format_key\n formats = CustomFields::AutoNumbering.format_parts(self.format)\n\n formats.select{|f| (f =~ /(\"|#)/).nil? }.join('-')\n end",
"def format=(procedure); end",
"def to_s() designation_number; end",
"def formatters; end",
"def prepare_for_display\n [\"#{film_title.title} #{speech} #{format.name}\", \"#{id}\"]\n end",
"def init_vars #:nodoc:\n # omg, some classes won't have justify !!\n #@justify ||= (@parent.justify || :left)\n unless @justify\n if @parent.respond_to? :justify\n @justify ||= (@parent.justify || :left)\n else\n @justify ||= :left\n end\n end\n @format = @justify.to_sym == :right ? \"%*s\" : \"%-*s\" \n @display_length ||= 10\n # create color pairs once for this 2010-09-26 20:53 \n end",
"def render_article(p)\n r = \"\"\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n r += p.title.detex.titlecase + \". \"\n\n r += text_for_field(\"Journal\", p, :postfix => \", \").detex\n r += text_for_field(\"Volume\", p)\n r += text_for_field(\"Number\", p, :prefix => \"(\", :postfix => \")\").detex\n\n # TODO simplify this complex nested if structures that result from the conversion\n # from BibDesks abbrv template\n if field(p,\"Pages\") then # <$fields.Pages?>\n if field(p,\"Volume\") then # <$fields.Volume?>\n r += \":\"\n else # <?$fields.Volume?>\n if field(p,\"Number\") then #<$fields.Number?>\n r+= \":\"\n else # <?$fields.Number?>\n r += \"page \"\n end # </$fields.Number?>\n end # </$fields.Volume?>\n\n r += text_for_field(\"Pages\", p, :postfix => \", \").detex # <$fields.Pages/>,\n else # <?$fields.Pages?>\n if field(p,\"Volume\") then #<$fields.Volume?>\n r += \", \"\n else # <?$fields.Volume?>\n if field(p,\"Number\") then #<$fields.Number?>\n r += \", \"\n end #</$fields.Number?>\n end\n end #</$fields.Pages?>\n\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \")\n return r\nend",
"def rendered=(_arg0); end",
"def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end",
"def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end",
"def render\n # need to return the following like this\n # 1) font_size as font-size \n # 2) dot_size as dot-size\n # 3) outline_colour as outline-colour\n # 4) halo_size as halo-size\n # 5) start_angle as start-angle\n # 6) tick_height as tick-height\n # 7) grid_colour as grid-colour\n # 8) threed as 3d\n # 9) tick_length as tick-length\n # 10) visible_steps as visible-steps\n # 11) key_on_click as key-on-click\n returning self.to_json2 do |output|\n output.gsub!(\"threed\",\"3d\")\n %w(font_size dot_size outline_colour halo_size start_angle tick_height grid_colour tick_length no_labels label_colour gradient_fill fill_alpha on_click spoke_labels visible_steps key_on_click).each do |replace|\n output.gsub!(replace, replace.gsub(\"_\", \"-\"))\n end\n end\n end",
"def generate_fmtstr_from_buf(num_printed, write_to, buffer, targ = target)\n\t\t\n\t\t# break buffer into shorts\n\t\tarr = fmtstr_gen_array_from_buf(write_to, buffer, targ)\n\t\t\n\t\t# now build the format string in its entirety\n\t\tstuff = fmtstr_gen_from_array(num_printed, arr, targ)\n\tend",
"def write_cat_number_format(axis)\n format_code = axis[:_num_format]\n source_linked = 1\n default_format = true\n\n # Check if a user defined number format has been set.\n if axis[:_defaults] && format_code != axis[:_defaults][:num_format]\n source_linked = 0\n default_format = false\n end\n\n # User override of linkedSource.\n if axis[:_num_format_linked]\n source_linked = 1\n end\n\n # Skip if cat doesn't have a num format (unless it is non-default).\n if !@cat_has_num_fmt && default_format\n return ''\n end\n\n attributes = [\n 'formatCode', format_code,\n 'sourceLinked', source_linked,\n ]\n\n @writer.empty_tag('c:numFmt', attributes)\n end",
"def render( renderstate )\n\t\tvalue = self.evaluate( renderstate ) # :FIXME: or return value # nil or false?\n\n\t\t# Apply the format if there is one\n\t\tif self.format && value\n\t\t\treturn self.format % value\n\t\telse\n\t\t\treturn value\n\t\tend\n\tend",
"def format_arguments; end",
"def format(format, *arguments); end",
"def render( render_state )\n\t\traw = super\n\t\tbuf = String.new( '' )\n\t\tPP.pp( raw, buf )\n\t\treturn self.escape( buf.chomp, render_state )\n\tend",
"def render_book(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n if p.editors.size > 0 then\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editors, \"\n end\n end\n\n r += p.title.detex.titlecase\n\n if field(p,\"Volume\") then\n r += text_for_field(\"Volume\", p, :prefix => \", volume \")\n r += text_for_field(\"Series\", p, :prefix => \" of \")\n elsif field(p,\"Number\") then\n r += text_for_field(\"Number\", p, :prefix => \". Number \")\n r += text_for_field(\"Series\", p, :prefix => \" in \")\n elsif field(p,\"Series\") then\n r += text_for_field(\"Series\", p, :prefix => \". \")\n end\n r += \". \"\n\n r += text_for_field(\"Publisher\", p, :postfix => \", \").detex\n r += text_for_field(\"Address\", p, :postfix => \", \").detex\n r += text_for_field(\"Edition\", p, :postfix => \" edition, \").titlecase.detex\n\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \")\n return r\n\nend",
"def formato\n \"\n Queso Cada 100g o 100ml IR\n \n Valor energético #{nrg_kj} kj #{nrg_kj_ir}%\n (kj/kcal) #{nrg_cal} kcal\n \n Grasas de las #{@grasa} g #{grasa_ir}%\n cuales:\n Saturadas #{@saturada} g #{saturada_ir}%\n Monoinsaturadas #{@monoinsat} g -\n Poliinsaturadas #{@poliinsat} g -\n \n Hidratos de #{@hidrato} g #{hidrato_ir}% \n carbono de los\n cuales:\n Azucares #{@azucar} g #{azucar_ir}%\n Polialcoholes #{@polialco} g -\n Almidones #{@almidon} g -\n \n Fibra alimentaria #{@fibra} g -\n \n Proteinas #{@proteina} g #{proteina_ir}%\n \n Sal #{@sal} g #{sal_ir}%\"\n end",
"def reserve_format\n Pwfmt::Context.reserve_format(\"journal_#{@journal.id}_notes\", @journal.notes) if @journal.respond_to?(:notes)\n end",
"def routing_number_with_format; end",
"def write_number_format(axis) # :nodoc:\n format_code = axis[:_num_format]\n source_linked = 1\n\n # Check if a user defined number format has been set.\n if axis[:_defaults] && format_code != axis[:_defaults][:num_format]\n source_linked = 0\n end\n\n # User override of sourceLinked.\n if ptrue?(axis[:_num_format_linked])\n source_linked = 1\n end\n\n attributes = [\n 'formatCode', format_code,\n 'sourceLinked', source_linked\n ]\n\n @writer.empty_tag('c:numFmt', attributes)\n end",
"def cdr_to_fmt\n '%s'\n end",
"def format(*rules)\n return self.class.zero if zero? && self.class.zero\n\n # This section included for compatiblity since format in this fork\n # uses a splatted array instead of a hash to accept parameters\n # Hashes are needed to pass multi-dimensional parameters such as :precison => 5\n # BEGIN compatibility block\n rules_hash = {}\n rules.each do |rule|\n if rule.is_a?(Hash)\n rule.each_key do |key|\n rules.push(key)\n rules_hash[key] = rule[key]\n end\n end\n end\n # END of compatibility block\n\n # flattening array to allow explicit passing of arrays\n rules = rules.flatten\n\n formatted =\n if rules.include?(:no_cents)\n \"$#{to_s(0)}\"\n elsif rules.include?(:precision)\n \"$#{to_s(rules_hash[:precision])}\"\n else\n \"$#{to_s(2)}\"\n end\n\n # BJM: Apply thousands_separator\n thousands_separator_value = ','\n decimal_separator = '.'\n regexp_decimal = Regexp.escape(decimal_separator)\n\n formatted_parts = formatted.split(decimal_separator)\n integer_part = formatted_parts.first\n decimal_part = formatted_parts.last unless rules.include?(:no_cents)\n\n integer_part.gsub!(/(\\d)(?=(?:\\d{3})+(?:[^\\d]{1}|$))/, \"\\\\1#{thousands_separator_value}\")\n\n formatted = \"#{integer_part}\"\n\n formatted += \"#{decimal_separator}#{decimal_part}\" unless rules.include?(:no_cents)\n\n # BJM: move negative outside ($-2.00 => -$2.00)\n formatted.gsub!('$-', '-$')\n\n # BJM: use parenthesis if requested and required\n if rules.include?(:parenthesize_negative) && formatted.gsub!('-$', '$')\n formatted = \"(#{formatted})\"\n end\n\n if rules.include?(:with_currency)\n formatted << \" \"\n formatted << '<span class=\"currency\">' if rules.include?(:html)\n formatted << currency\n formatted << '</span>' if rules.include?(:html)\n end\n \n formatted\n end",
"def unique_partial_format_name\n string_with_id(partial_format_name)\n end",
"def format_source(value); end",
"def dump\r\n super + \"##{@first_index};\\t// #{to_s}\"\r\n end",
"def render_length=(_arg0); end",
"def fix_format_string(fmt)\n\t\t\tfmt.gsub(\"__\",\"%s\").gsub(\"_\",\"%s\")\n\tend",
"def sub_string\n instance_variable_get(\"@#{config.format_key}\")\n end",
"def c_build_format_string(mne, tokens, field_format)\n fmt_a = []\n\n tokens.each{|t|\n if (field_format.include?(t))\n fmt_a << field_format[t][0]\n else\n fmt_a << t\n end\n }\n\n fmt_s = mne\n\n if (!fmt_a.empty?)\n fmt_s += ' ' + fmt_a.join\n end\n\n return '\"' + fmt_s + '\"'\nend",
"def to_s ; format ; end",
"def to_s\n \"#%-3s %s\" % [ number, name]\n end",
"def format_str(value)\n value ||= '<none>'\n fmt ? (fmt % [value]) : value\n end",
"def render pad, lineno, text\n @renderer.render pad, lineno, text\n end",
"def formatflag(engine=nil,format=nil)\n case getvariable('distribution')\n when 'standard' then prefix = \"--fmt\"\n when /web2c/io then prefix = web2cformatflag(engine)\n when /miktex/io then prefix = \"--undump\"\n else return \"\"\n end\n if format then\n \"#{prefix}=#{format.sub(/\\.\\S+$/,\"\")}\"\n else\n prefix\n end\n end",
"def format(number)\n \"\".tap do |output|\n # The next two lines will only ever give us\n # the fizzbuzz behavior we've been after.\n #\n # What if we wanted to be able to turn these\n # into configuration data being read from\n # our robot's memory bank after we turn it on?\n output << \"fizz\" if even_split?(number, 3)\n output << \"buzz\" if even_split?(number, 5)\n output << number.to_s if output.empty?\n end\n end",
"def template\n if self.style == 'mmyy'\n 'date_field_mmyy'\n else\n 'date_field'\n end\n end",
"def to_s\n super.insert -2, \" (Count = #{count})\"\n end",
"def format\n raise NotImplementedError\n end",
"def cdr_from_fmt\n '%s'\n end",
"def display\n puts \" 0 1 2 3 4 5 6 7 \"\n puts \"#{format}\"\n end",
"def format_market_uid\n @formated_market_uid = market_uid.to_s\n if specifier.present?\n @formated_market_uid += \"^#{specifier.to_s}\" \n self.specifier_name = specifier.to_s\n end\n end",
"def render_booklet(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n end\n r += p.title.detex.titlecase + \". \"\n r += text_for_field(\"Howpublished\", p, :postfix => \", \")\n r += text_for_field(\"Address\", p, :postfix => \", \")\n r += month_for_field(\"Month\", p, :postfix => \" \")\n r += text_for_field(\"Year\", p, :prefix => \" \", :postfix => \". \")\n r += text_for_field(\"Note\", p, :prefix => \" \", :postfix => \". \").detex\n return r\nend",
"def render_to_string(*_arg0); end",
"def format_code\n 0\n end",
"def to_s\n\t\tif (@d != 1)\n\t\t\treturn \"#{@n}/#{@d}\" \n\t\telse \n\t\t\treturn \"#{@n}\"\n\t\tend\n\tend",
"def format_arguments=(_arg0); end"
] |
[
"0.6511823",
"0.61348087",
"0.61348087",
"0.61348087",
"0.61348087",
"0.61348087",
"0.61348087",
"0.61348087",
"0.61348087",
"0.6043329",
"0.6043329",
"0.6030931",
"0.59357977",
"0.59357977",
"0.59357977",
"0.59357977",
"0.5868479",
"0.58615375",
"0.5802222",
"0.57625705",
"0.57625705",
"0.57620466",
"0.57620466",
"0.57620466",
"0.5756702",
"0.5724647",
"0.56928366",
"0.56928366",
"0.56928366",
"0.5686985",
"0.56221634",
"0.56193805",
"0.56193805",
"0.5607371",
"0.55957395",
"0.5595465",
"0.55826104",
"0.5563088",
"0.5550817",
"0.55246",
"0.5508393",
"0.54938585",
"0.5493592",
"0.54861706",
"0.54739445",
"0.54592353",
"0.54584026",
"0.5446878",
"0.5434533",
"0.5417219",
"0.5411086",
"0.54055375",
"0.5394419",
"0.53917396",
"0.5385386",
"0.5381417",
"0.5380066",
"0.5370316",
"0.5364848",
"0.53580344",
"0.5349108",
"0.5349108",
"0.5345161",
"0.5344336",
"0.53435993",
"0.53397965",
"0.533889",
"0.5317843",
"0.5315955",
"0.53147644",
"0.53137356",
"0.5299862",
"0.5297704",
"0.52888745",
"0.528805",
"0.5272459",
"0.52596825",
"0.52526444",
"0.52485776",
"0.52484196",
"0.5244059",
"0.5242664",
"0.5241461",
"0.52411497",
"0.5225784",
"0.5214676",
"0.5213633",
"0.52110595",
"0.520461",
"0.5203934",
"0.52038836",
"0.5195572",
"0.51931715",
"0.51892793",
"0.518729",
"0.5178967",
"0.51759046",
"0.5175271",
"0.51731396",
"0.51727664"
] |
0.60025656
|
12
|
Before filters Requires a user to be signed in.
|
def signed_in_user
if signed_in?
return true
else
redirect_to signin_url and return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run_filters\n set_user\n authorize\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end",
"def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend",
"def set_filters\n @filters = @user.user_filters\n @filter = UserFilter.new\n @parent = @user\n end",
"def before_filter(&block)\n @before_filter = block\n end",
"def before(*args, &block)\n add_filter :before, &(args.empty? ? block : construct_filter(*args, &block))\n end",
"def before_request\n self.login if require_login? && !@authenticating\n end",
"def before_filter; end",
"def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer (cgahan@ideeinc.com)...\"\n\tend",
"def before_filter(&block)\n @before_filter = block\n end",
"def authenticate\n CASClient::Frameworks::Rails::Filter.before(self)\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n\n return unless session[:cas_user] && !allow_access\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end",
"def before(handler = nil, *guards, &block)\n client.register_filter :before, handler, *guards, &block\n end",
"def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filter\n end",
"def signed_in_user\n # Listing 9.18: Adding store_location to the signed-in user before filter.\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end",
"def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def before method_or_filter, options={}, &block\n _add_filter(:before, method_or_filter, options, block)\n end",
"def signed_in_user\n # Listing 9.18: Adding store_location to the signed-in user before filter.\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end",
"def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend",
"def authorize!(current_user)\n RailsMiniProfiler::User.current_user = current_user\n end",
"def user_params\n admin_access? && admin_user_filter || normal_user_filter\n end",
"def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end",
"def filters_for_user(user)\n user.present? ? filters_with_external : public_filters\n end",
"def set_user\n\n if params[:id] == current_user.object_key\n @user = User.find_by(:object_key => params[:id])\n elsif FILTERS_IGNORED\n @user = User.unscoped.find_by(:object_key => params[:id])\n\n if @user.nil?\n redirect_to '/404'\n end\n else\n @user = User.unscoped.find_by(:object_key => params[:id], :organization_id => @organization_list)\n\n if @user.nil?\n if User.find_by(:object_key => params[:id], :organization_id => current_user.user_organization_filters.system_filters.first.get_organizations.map{|x| x.id}).nil?\n redirect_to '/404'\n else\n notify_user(:warning, 'This record is outside your filter. Change your filter if you want to access it.')\n redirect_to users_path\n end\n end\n\n end\n\n return\n end",
"def filter_request(request)\n @token.authenticate(request)\n end",
"def require_no_user(options = {})\n self.before_filter options do |controller|\n controller.send(:require_no_user)\n end\n end",
"def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end",
"def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end",
"def authorize\n redirect_to :login unless user_signed_in?\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def users_only\n deny_access(\"You must be signed in to access this page.\") unless signed_in?\n end",
"def before_filter(filter_name, options)\n [options[:only]].flatten.each do |action|\n add_filter(filter_name, action)\n end\n end",
"def filter_users\n allowed_keys=[\"email\", \"admin\"]\n filtering_keys=allowed_keys & params.keys\n filtering_keys.each {|key| filter_by_key(key)}\n end",
"def before_capturable_sign_in(capture_data, params)\n end",
"def authorize_user\n unless current_user.id == @profile.user_id\n flash[:unauthorized] = \"Not authorized\"\n redirect_to listings_path\n end \n end",
"def authenticated_only(&block)\n if logged_in?\n block.call\n end\n end",
"def authenticated_only(&block)\n if logged_in?\n block.call\n end\n end",
"def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to tasks_index_path, notice: \"Please log in\"\n end\n end",
"def before_each(req)\n if dealership(req).nil? then not_found\n elsif !authenticated?(req) then unauthenticated\n elsif !authorized?(role(req), session_user(req)) then unauthorized\n else super\n end\n end",
"def authorize\n\t\tredirect_to '/login' unless current_user\n\tend",
"def authorize_signed_in!\n redirect_to user_session_path, alert: \"You have to be signed in to do that!\" unless current_user\n end",
"def ensure_authenticated_user\n puts \"#{!is_report_request}\"\n if !is_report_request\n head :unauthorized unless current_user\n end\n #head :unauthorized unless current_user\n end",
"def authorize\n \t\t\tunless User.find_by(id: session[:user_id])\n \t\t\t\tredirect_to login_url, notice: \"Please Log-in\"\n \t\t\tend\n \t\tend",
"def login_required\n not_authorized unless current_user\n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end",
"def before filter\n @station.before filter\n end",
"def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def owner_required\n ## before filter for owner of channel. \n if logged_in? && current_user.login == THUMBWEBS_AUTHORIZED_USER\n return true\n else\n flash[:error] = \"Unauthorized Access-Must be logged-in as owner.\"\n redirect_to thumbwebs_root_path\n end\nend",
"def authorize\n if !logged_in? || current_user.nil?\n redirect '/login'\n else\n @user = current_user\n @user_chores = current_user.chores\n @user_gadgets = current_user.gadgets\n end\n end",
"def authorize\n unless User.find_by_id(session[:user_id])\n redirect_to :log_in, :notice => \"Please log in\"\n end\n end",
"def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end",
"def authorized\n redirect_to new_user_session_path unless logged_in?\n end",
"def index\n params['filters'] ||= 'volunteers'\n @users = case params['filters']\n when 'all'\n User.all.order(created_at: :asc)\n when 'team'\n User.where(admin: true).order(created_at: :asc)\n when 'volunteers'\n User.where(active: true, admin: nil, organization_id: nil).order(created_at: :asc)\n when 'org'\n User.where(active: true).where.not(organization_id: nil).order(created_at: :asc)\n when 'inactive'\n User.where(active: false).order(created_at: :asc)\n end\n authorize @users\n end",
"def authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end",
"def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to login_url, notice: \"Please log in\"\n end\n end",
"def set_current_user\n current_user\n authorize\n end",
"def pre_authorize_cb; end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def set_user_and_verify #TODO: Make this common to both items and tags\n @user = User.find_by(id: params[:user_id])\n if @user.blank?\n head :forbidden\n end\n end",
"def user_signin_status\n unless user_signed_in?\n redirect_to root_url\n end\n end",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end",
"def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end",
"def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def declared_user\n if logged_in?\n if Protege.find_by(user_id: current_user.id.to_i).nil? and Trainer.find_by(user_id: current_user.id.to_i).nil?\n redirect_to root_path\n end\n else\n redirect_to root_path\n end\n end",
"def authorize_user\n if @user.nil? and not current_user.is_a? AdminUser\n # TODO check if we can rewrite the URL and scope the resources\n # only for the current_user, instead of redirecting\n redirect_to root_url\n end\n end",
"def logged_in_authorize\n unless logged_in?\n unauthorized_access\n end\n end",
"def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end",
"def verify_user\n redirect_to forbidden_path unless user_signed_in? && @review.user_id == current_user.id\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def before(&b)\n filter :before, &b\n end",
"def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\t end\n end",
"def check_user\n if user_signed_in? && (current_user.has_role?(:admin) || current_user.id == @listing.user_id )\n else \n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to root_path\n end\n end",
"def authorize_user\n unless current_user\n flash[:notice] = \"Sorry, you need to be logged in to access that feature\"\n redirect_to new_session_path\n end\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def require_signin\n deny_access if !signed_in?\n end",
"def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end",
"def scope\n return super if spree_current_user.present?\n\n super(skip_cancancan: true)\n end",
"def authorize_user\n puts \"AUTHORIZE USER\"\n puts \"params[:id] \" + params[:id].to_s\n # render json: { status: 401, message: 'Unauthorized' } unless get_current_user.id == params[:id].to_i\n render json: { status: 401, message: 'Unauthorized' } unless get_current_user\n end",
"def check_user\n unless user_signed_in?\n redirect_to root_url, alert: \"Sorry, only authorized users can add.\"\n end\n end",
"def logged_in_user\n if user_signed_in? then\n \n else\n redirect_to root_path\n end \n \n end",
"def authorize_user\n if !current_user.admin_user? then\n redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n end\n end",
"def authorize_user\n if !current_user.admin_user? then\n redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n end\n end",
"def require_petsitter_signin\n\n # how we can tell if a user who is a petsitter is signed in is by checking current_petsitter method which would either return nil or a petsitter object\n\n # we want to redirect to sign in page unless there is a petsitter object(meaning a petsitter is signed in)\n unless current_petsitter\n\n # if we enter inside this block it means there is no signed in user and the action that was to be run whether edit or update wont be run because we will redirect\n redirect_to new_session_path , alert: \"Please sign in first!!\"\n\n end\n\n end",
"def authorize_users\n authorize :user\n end"
] |
[
"0.78381836",
"0.7587757",
"0.73553073",
"0.72756255",
"0.64653397",
"0.6460761",
"0.6436536",
"0.6396451",
"0.6379741",
"0.6356206",
"0.6328723",
"0.6291878",
"0.62910926",
"0.6284429",
"0.62798274",
"0.62528664",
"0.62285143",
"0.6216747",
"0.6209073",
"0.62071157",
"0.61858714",
"0.6180397",
"0.61712956",
"0.61647975",
"0.61555237",
"0.6122219",
"0.6117722",
"0.609787",
"0.6058456",
"0.6025689",
"0.6024271",
"0.60212255",
"0.6018679",
"0.6005062",
"0.60042554",
"0.59802246",
"0.596339",
"0.59611225",
"0.59564626",
"0.59564626",
"0.5922309",
"0.59155816",
"0.58914596",
"0.58768016",
"0.5856991",
"0.58385515",
"0.58384836",
"0.5835038",
"0.5826757",
"0.5819318",
"0.5814033",
"0.5809215",
"0.57993823",
"0.5784345",
"0.57828474",
"0.57628334",
"0.5757436",
"0.57488036",
"0.5746354",
"0.57462984",
"0.5745871",
"0.5742168",
"0.57366437",
"0.5736051",
"0.5720218",
"0.5717498",
"0.57121843",
"0.57101685",
"0.57101685",
"0.57101685",
"0.57101685",
"0.57101685",
"0.57101685",
"0.57101685",
"0.57101685",
"0.5703305",
"0.56999576",
"0.56974244",
"0.5695203",
"0.5695203",
"0.5694805",
"0.5690087",
"0.5686238",
"0.5680254",
"0.56793183",
"0.5673884",
"0.56737083",
"0.56690186",
"0.5661934",
"0.56567854",
"0.5654677",
"0.56497765",
"0.56486267",
"0.56478167",
"0.562857",
"0.56255573",
"0.56179386",
"0.5616947",
"0.5616947",
"0.56103593",
"0.5607263"
] |
0.0
|
-1
|
Requires the current user to be the same one for which the action is performed.
|
def correct_user
redirect_to root_url if params[:username] != current_user.username
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def require_same_user\n if current_user != @user\n flash[:error] = \"You do not have permisions to edit a user other than yourself\"\n redirect_to root_path\n end \n end",
"def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"def require_same_user\n if current_user != @user && !current_user.admin?\n flash[:alert] = \"you dont have access to do anything with #{@user.username}'s account\"\n redirect_to user_path(@user)\n \n end\n \n end",
"def same_user_required\n unless @current_user == User.find(params[:id])\n flash[:error] = \"Non puoi modificare un utente diverso dal tuo\"\n redirect_to timetables_url\n end\n end",
"def require_same_user\n # if the user is on another user's edit or update page\n if current_user != @user and !current_user.admin?\n # flash message\n flash[:danger] = \"Access denied.\"\n # and redirect to articles listing\n redirect_to articles_path\n end\n end",
"def require_current_user\n \tunless User.find(params[:id]) == current_user\n \t\tflash[:error] = \"Sorry! Viewing not authorized.\"\n \tend\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin?\n flash[:danger] = \"You do not own this article and thus cannot edit nor delete it\"\n redirect_to root_path\n end\n end",
"def correct_user_to_edit\n not_allow if (@job.user.id != current_user.id) \n end",
"def require_same_user\n if current_user != @recipe.chef and !current_user.admin?\n flash[:danger] = \"You can only edit your own recipes\"\n redirect_to recipes_path\n end\n \n end",
"def require_same_user\n if params[:id].to_i != current_actor.id\n flash[:error] = \"Unable to complete withdrawal. Invalid user.\".t\n redirect_to money_path(current_actor) and return\n end\n end",
"def correct_user(user)\n user == current_user\n end",
"def require_same_user\n if current_user != @article.user and !current_user.admin?\n flash[:danger] = \"You can only update your own articles!\"\n redirect_to root_path\n end\n end",
"def require_user\n end",
"def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end",
"def check_owner\n if current_user != Checklist.find(params[:format]).user\n flash[:notice] = \"Trying to be cheeky are we? You cannot modify a task that's not yours!\"\n redirect_to '/'\n end\n end",
"def require_same_user\n if current_user.id != @art_plan.user_id\n flash[:danger] = \"You can only edit or delete your own art project plan\"\n redirect_to art_plans_path\n end\n end",
"def check_user_ownership\n if @question.user != current_user\n redirect_to(request.referrer || root_url, flash: { danger: 'You do not have permission to do that.' })\n end\n end",
"def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end",
"def defer_user\n\t\tif(current_user)\n\t\t\tredirect_to(user_path(current_user))\n\t\tend\n\tend",
"def require_ownership\n\t\tunless current_user\n\t\t\tredirect_to login_path\n\t\tend\n\tend",
"def check_user\n unless @user == current_user\n flash[:alert] = \"You don't have permission to access this page.\"\n redirect_to root_path\n end\n end",
"def set_current_user\n current_user\n authorize\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin?\n flash[:alert] = \"You can only edit or delete your own article\"\n redirect_to @article\n end\n end",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def ensure_user_has_rights\n redirect_to root_path unless current_user\n end",
"def ensure_no_user\n !current_user? || redirect_back_or_default\n end",
"def own_user_or_admin_required\n if current_user\n if (current_user.id == params[:id]) || current_user.admin\n return\n end\n end\n redirect_to \"/login\", notice: 'Logga in som denna användare för att ändra uppgifter.'\n end",
"def prevent_other_user_edits\n @user = User.find(params[:id])\n\n if !(logged_in?)\n redirect_to login_path\n flash[:danger] = \"You must be logged in to visit this page\"\n\n else\n if (current_user.id != @user.id)\n redirect_to home_path\n flash[:danger] = \"You must be logged in as the correct user to visit this page\"\n end\n end\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def check_current_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) || is_manager_or_admin?\n end",
"def this_user!\n this_user || User.new(permission: :unapproved)\n end",
"def require_same_user\r\n if current_user != @cart_item.user\r\n flash[:danger] = \"Incorrect user...\"\r\n\t redirect_to root_path\r\n end\r\n end",
"def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin\n flash[:alert] = \"You can only edit/delete from your own article listings\"\n redirect_to @article\n end\n end",
"def require_same_user\n if current_user != @article.user && !current_user.admin\n flash[:alert] = \"You can only edit or delete your own article\"\n redirect_to @article\n end\n end",
"def require_current_user\n if !current_user?(@user)\n redirect_to root_path\n end\n end",
"def ensure_user!\n unless current_user\n redirect_to root_url\n flash[:danger] = \"You are not permitted\"\n end\n end",
"def check_work_user\n owner = Work.friendly.find(params[:id]).user\n unless owner == current_user || current_user.is_admin?\n store_location\n flash[:error] = 'You are not authorized to perform this action.'\n redirect_to login_path\n end\n end",
"def may_not_be_user_required\n\t\tcurrent_user.may_not_be_user?(@user) || access_denied(\n\t\t\t\"You may not be this user to do this\", user_path(current_user))\n\tend",
"def same_user\n if current_user \n if (current_user.id == params[:id].to_i) || (current_user.hierarchy < 1)\n true\n else\n if request.xhr?\n flash[:error] = \"You don't have permission to do that.\"\n render :js => \"window.location = '#{root_path}';\"\n else\n flash[:error] = \"You don't have permission to do that.\"\n redirect_to root_path\n end\n end \n else\n flash[:error] = \"You don't have permission to do that. Please log in\"\n redirect_to login_path\n end\n end",
"def require_owner\n @messsage = \"You don't have the permission to do this operation.\"\n render :file => \"shared/message\" unless @user.eql?(current_user)\n end",
"def require_owner\n @messsage = \"You don't have the permission to do this operation.\"\n render :file => \"shared/message\" unless @user.eql?(current_user)\n end",
"def requestee_user\n unless @friendship.requested == current_user\n flash[:warning] = \"You are not authorized.\"\n redirect_to root_path\n end\n end",
"def require_creator\n unless logged_in? && current_user = @post.user\n flash[:error] = \"Can't be done\"\n redirect_to root_path\n end\n end",
"def require_same_user_or_admin\n # Note: set_recipe has already been executed first because of before_action above and @recipe object now exists.\n if (current_user != @recipe.chef) && !current_user.admin?\n flash[:danger] = \"You can only edit your own recipes\"\n redirect_to recipes_path\n else \n return true\n end\n end",
"def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end",
"def ensure_correct_user!\n @member = Member.find(params[:id])\n @user = @member.warband.user\n redirect_to(user_path(current_user), :alert => \"You may not perform this action on another user's Warband member!\") and return unless current_user?(@user)\n end",
"def correct_user\n reservation = Reservation.find(params[:id])\n return if current_user?(reservation.space.user)\n\n redirect_to root_url\n flash[:danger] = 'You are not authorised.'\n end",
"def user_method\n current_user\n end",
"def verify_access\n unless current_user.id == @worker.user_id\n flash[:warning] = \"You do not have authority to access that.\"\n redirect_to user_path(current_user.id)\n end\n end",
"def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end",
"def pundit_user\n # if action_name == \"new\"\n # current_user\n # else\n current_user || current_company\n # end\n end",
"def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n\t\tunless current_user.id == Deck.find(params[:id]).user_id or Deck.find(params[:id]).share == true\n\t\t\tflash[:error] = \"You do not have permission to look at this deck\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end",
"def current_user\n raise NotImplementedError\n end",
"def current_user\n raise NotImplementedError\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n end",
"def require_user\n unless current_user\n flash[:error] = 'Es necesario que te identifiques primero.'\n redirect_to root_path\n end\n end",
"def correct_user\n render_forbidden unless current_user?(@user)\n end",
"def check_permission\n unless @therapist.user_id == current_user.id\n redirect_back(fallback_location: root_path,\n alert: \"Error: Permission denied - Invalid User\")\n end\n end",
"def check_current_user\n if !current_user.nil?\n Thread.current[:user] = current_user\n end\n end",
"def check_current_user\n redirect_to '/' unless @user.id == current_user.id\n end",
"def edit_current_user\n end",
"def current_user\n super\n end",
"def current_user\n super\n end",
"def require_same_user\n @profile = Profile.find(params[:id])\n if @profile.user_id != current_user.id\n flash[:danger] = \"You are not right User to made this changes\"\n redirect_to root_path\n end\n end",
"def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end",
"def acting_user\n current_user\n end",
"def check_eligibility\n if params[:user_id].to_i == current_user.id\n redirect_to root_path, alert: \"Error: Owner can't collaborate\"\n end\n end",
"def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end",
"def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end",
"def check_correct_user(user)\n \tcurrent_user?(user)\n end",
"def current_user\n nil\n end",
"def ensure_current_user\n unless current_user\n redirect_to root_path\n # otherwise redirect somewhere root_path\n end\n end",
"def correct_user\n @jogtime = Jogtime.find(params[:id])\n redirect_to(root_url) unless (current_user.id == @jogtime.user_id) || current_user.admin?\n end",
"def current_user?\n \n end",
"def correct_user\n @reservation = Reservation.find(params[:id])\n return if current_user?(@reservation.space.user)\n\n redirect_to root_url\n flash[:danger] = 'You are not authorised.'\n end",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def current_user\n import_user\n end",
"def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end",
"def require_user\n if current_user\n return true\n end\n redirect_to root_url\n end",
"def correct_user\n unless Presenter.find_by(user_id: current_user) == find_presenter\n if current_user.admin?\n redirect_to edit_presenter_profile_path\n else\n flash[:danger] = \"Unauthorized Access\"\n redirect_to root_url\n end \n end\n end",
"def correct_user\n if @submission.user != current_user.sk && !current_user.sk.admin && (!current_user.sk.corrector || !current_user.sk.pb_solved?(@problem))\n render 'errors/access_refused' and return\n end\n end",
"def correct_user\n #to define the correct user and omit it when edit and update\n @user=User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n\t\t\tif !current_user?(@user) && !current_user.orgadmin?\n\t\t\t\tredirect_to(users_path)\n\t\t\tend\n\t\tend",
"def declared_user\n if logged_in?\n if Protege.find_by(user_id: current_user.id.to_i).nil?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n else\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def ensure_correct_user\n @post = Post.find_by(id: params[:id])\n if @post.user_id != @current_user.id\n flash[:notice] = \"You cannot edit this post. Redirected to your personal page.\"\n redirect_to(\"/users/#{@current_user.id}\")\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end",
"def match_user\n unless admin?\n user = User.find(current_user)\n\n unless user.id == set_user.id\n redirect_to user_path(current_user), notice: 'You do not have any permission to grant this page !'\n end\n end\n end",
"def require_current_user!\n redirect_to new_session_url if current_user.nil?\n end",
"def require_permission\n if Retirement.find(params[:id]).user != current_user\n redirect_to retirements_url, flash: { error: \"You do not have permission to do that.\"}\n end\n end",
"def is_this_user\n\t\t@user.id == current_user.id\n\tend",
"def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user 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 verify_current_user\n instance_variable_set '@' + resource_name, resource.find_by_id(params[:id])\n if resource_instance.nil?\n flash[:error] = \"Cannot find the requested record.\"\n redirect_to(action: 'index') && return\n else\n unless auth_user.is_a?(Parent) # Perhaps rule might change, so child could edit\n flash[:error] = \"You do not have permission to access this.\"\n redirect_to(action: 'index') && return\n else\n\n # Avoid hack to change address of someone else's\n if params[resource_param_name].is_a?(Hash)\n params[resource_param_name].delete(:user_id)\n params[resource_param_name].delete('user_id')\n end\n end\n end\n end"
] |
[
"0.76964",
"0.7661109",
"0.76570326",
"0.7537279",
"0.7330094",
"0.7206853",
"0.7205295",
"0.7197443",
"0.71946627",
"0.71814543",
"0.71730334",
"0.7167931",
"0.7153418",
"0.7148843",
"0.71041554",
"0.7098771",
"0.70688915",
"0.7053807",
"0.70324826",
"0.7027397",
"0.7017128",
"0.70163697",
"0.6997018",
"0.6986576",
"0.6984181",
"0.6983465",
"0.69817233",
"0.6976335",
"0.6955974",
"0.6953068",
"0.694412",
"0.6943689",
"0.6936923",
"0.6928102",
"0.69220436",
"0.6918758",
"0.69092655",
"0.6895397",
"0.68933666",
"0.68931943",
"0.689247",
"0.68874943",
"0.6886949",
"0.68815356",
"0.6880374",
"0.68704396",
"0.68655574",
"0.68519783",
"0.68364364",
"0.6829206",
"0.68207353",
"0.68156457",
"0.6812924",
"0.6812061",
"0.6810267",
"0.67963076",
"0.67961395",
"0.67961395",
"0.67927116",
"0.6789273",
"0.6787625",
"0.6787122",
"0.6786475",
"0.6784248",
"0.6777233",
"0.67763746",
"0.67763746",
"0.67711043",
"0.6770074",
"0.6769169",
"0.67668915",
"0.6765434",
"0.6763021",
"0.6758565",
"0.67583364",
"0.6753794",
"0.6752808",
"0.6752457",
"0.67444324",
"0.6743819",
"0.6742769",
"0.67395616",
"0.673921",
"0.6729137",
"0.6728365",
"0.6727237",
"0.6725828",
"0.6723109",
"0.67139053",
"0.67131335",
"0.67121565",
"0.6711988",
"0.6708298",
"0.6706306",
"0.67030734",
"0.6703065",
"0.67009234",
"0.66999865",
"0.66999865",
"0.66999865",
"0.66978014"
] |
0.0
|
-1
|
Requires session[request.path] to be set to 'shared' or a user to be signed in as same one for which the action is performed.
|
def correct_user_or_shared_page
if session[request.path] != "shared"
# Run normal callbacks
signed_in_user && correct_user
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def owner_only(user_id)\n if session['user_id'] == user_id\n true\n else\n redirect '/'\n end\nend",
"def require_session_ownership\r\n if session_user.screen_name == params[:screen_name]\r\n @user = session_user\r\n return true\r\n end\r\n\r\n # wrong screen_name in url doesn't match session_user! redir to the current session\r\n # user's stats page\r\n params[:screen_name] = session_user.screen_name\r\n redirect_to url_for(params)\r\n end",
"def user_authorized\n redirect_to \"/\" unless session[:user_id]\n end",
"def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"def same_user\n if current_user \n if (current_user.id == params[:id].to_i) || (current_user.hierarchy < 1)\n true\n else\n if request.xhr?\n flash[:error] = \"You don't have permission to do that.\"\n render :js => \"window.location = '#{root_path}';\"\n else\n flash[:error] = \"You don't have permission to do that.\"\n redirect_to root_path\n end\n end \n else\n flash[:error] = \"You don't have permission to do that. Please log in\"\n redirect_to login_path\n end\n end",
"def session ; request.session ; end",
"def session() request.session end",
"def login_required\n \n if not protect?(action_name)\n return true \n end\n\n if @session['user'] and authorize?(@session['user'])\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n # call overwriteable reaction to unauthorized access\n access_denied\n return false \n end",
"def admin_required\n #just a patch until i can implement users and roles\n \n # \"Speak friend, and enter\" (Moria)\n session[:friend] ||= params[:friend]\n session[:friend] || redirect_to(home_path)\n end",
"def require_login\n redirect_to login_path, notice: 'The requested action requires you to log in' unless session[:user_id]\n end",
"def require_login\n redirect_to root_path unless session.include?(:user_id)\n end",
"def check_aut\n if session[:user].blank?\n session[:intended_controller] = controller_name\n session[:intended_action] = action_name\n redirect_to :controller =>'user', :action => 'login'\n end\n end",
"def login_required\n return true unless protect?(action_name)\n\n user = session_user\n return true if user && authorize?(user)\n\n # store current location so that we can\n # come back after the user logged in\n store_location\n\n # call overwriteable reaction to unauthorized access\n access_denied\n false\n end",
"def signin_required\n if not protect?(action_name)\n return true\n end\n\n if @current_user and authorize?(@current_user)\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n # call overwriteable reaction to unauthorized access\n access_denied\n return false \n end",
"def require_ownership_or_sharing\n model = content_type_from_controller(self.class).find(params[:id])\n unless model.user == current_user || publicly_shared?(model)\n if current_user\n redirect_to send(redirect_path), notice: t(:no_do_permission)\n else\n redirect_to new_user_session_path, notice: t(:no_do_permission)\n end\n end\n end",
"def require_user\n \n #First, check to see if user is already logged in\n unless current_user \n \n # Second, check to see if session negotiation is ongoing \n if params[:session_action]\n if params[:request_url] # preserve a passed along request url\n redirect_to new_user_path(:request_url => params[:request_url]) and return if params[:session_action]==\"new_user\"\n else\n redirect_to new_user_path and return if params[:session_action]==\"new_user\" \n end\n end \n \n # Third, check to see if this is a logged-in, existing user (w/signed approval form Hot Ink) or a request_token authorization callback response\n if params[:oauth_token]\n if params[:sig]\n \n # This is where we actually authenticate\n access_token = OauthToken.find_by_token(params[:oauth_token])\n \n if access_token&¶ms[:sig]==Digest::SHA1.hexdigest(access_token.token + access_token.secret)\n \n # Signature matches, it's really Hot Ink and the user checks out. Log 'em in.\n UserSession.create!(access_token.user)\n \n # If a request url was forwarded along, send them there. \n # This will preserve any query-string values set by Hot Ink. \n if params[:request_url] \n redirect_to(params[:request_url])\n return\n end\n \n else\n # Either Hot Ink is confused, or someone's trying to break in\n render :text => \"Oauth verification not accepted.\", :status => 401\n return\n end\n \n else\n redirect_to new_user_path(:oauth_token => params[:oauth_token], :request_url => params[:request_url])\n return\n end \n end\n \n \n \n # Last resort, this must be a fresh user request. Forward along to Hot Ink to authenticate.\n redirect_to \"#{HOTINK_SETTINGS.site}/remote_session/new?key=#{HOTINK_SETTINGS.token}&request_url=#{request.request_uri}\"\n return false\n end\n end",
"def signin_required\n return if signed_in?\n session[:return_to] = request.path if request.path\n redirect_to \"/auth/twitter\"\n end",
"def viewer\n authorize @session\n end",
"def require_current_students_request\n if current_user.student?\n unless current_user.id == @request.user_id\n flash[:danger] = \"You don't have access to that request!\"\n redirect_back(fallback_location: new_request_path)\n end\n end\n end",
"def login_required\n return true unless protect?(action_name)\n\n return true if user? && authorize?(session[:user])\n\n # store current location so that we can\n # come back after the user logged in\n store_location\n\n # call overwriteable reaction to unauthorized access\n access_denied\n false\n end",
"def valid_session\n { return_to: tasks_path }\n end",
"def require_signin\n \tunless current_user\n # Stores the URL of the requested page in the session\n # before redirecting to the sign-in form.\n session[:intended_url] = request.url \n \t\tredirect_to new_session_url, alert: \"Please sign in first!\"\n \tend\n end",
"def permitAccess\n\tif session[:id] == nil\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def require_same_user\n # if the user is on another user's edit or update page\n if current_user != @user and !current_user.admin?\n # flash message\n flash[:danger] = \"Access denied.\"\n # and redirect to articles listing\n redirect_to articles_path\n end\n end",
"def store_location\n if (request.fullpath != \"/users/sign_in\" &&\n request.fullpath != \"/users/sign_up\" &&\n request.fullpath != \"/users/password\" &&\n request.fullpath != \"/users/sign_out\" &&\n !request.xhr? && # don't store ajax calls\n (request.format == \"text/html\" || request.content_type == \"text/html\"))\n session[:return_to] = request.fullpath\n # session[:last_request_time] = Time.now.utc.to_i\n end\n end",
"def store_location\n session[:return_to] = request.fullpath if request.get? and controller_name != \"user_sessions\" and controller_name != \"sessions\"\n end",
"def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end",
"def user?\n session.key? 'user'\nend",
"def show\n # Remember where the user is so if they're not logged in here, we can bring them back after sign in.\n session[:return_to] = request.url\n end",
"def valid_session\n {\"warden.user.user.key\" => session[\"warden.user.user.key\"]}.merge(return_to: contacts_path)\n end",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def authorization_check\n # sessions take user info from db and hold it\n # during their session so not continually going to db\n # and so we know a current session exists for them\n if session[:current_user] == nil\n redirect '/not_authorized'\n else\n return true\n end\nend",
"def authenticate_request\n session[:requested_url] = request.fullpath\n\n url = logged_in? ? shibbolite.access_denied_url : shibbolite.login_url\n\n # redirect to the selected url\n respond_to do |format|\n format.html { redirect_to url }\n format.js { render js: \"window.location.assign('#{url}');\"}\n end\n end",
"def require_login\n redirect_to sessions_new_path unless session.include? :name\n end",
"def is_authenticated\n campaign = get_campaign\n params[:campaign] = campaign\n\n if authenticated? || campaign && !campaign.is_gated?(params, session)\n if campaign && campaign.path\n redirect_to root_path(:campaign_path => campaign.path)\n else\n redirect_to '/'\n end\n end\n end",
"def login_required\n if session[:user]\n begin\n load_session_user\n rescue\n logout_and_redirect_to_login\n else\n return session[:user]\n end\n else\n self.store_location\n redirect_to users_login_url, :alert => \"You don't have access to that, please login.\"\n end\n end",
"def current_user( user = :get )\n if( user == :get )\n session[:user] ||= guest_account\n else\n session[:user] = user\n end\n end",
"def require_user\n return if current_uid\n\n store_location\n flash[:notice] = 'You must be logged in to access the page you requested'\n ret = url_for_with_proto({ controller: 'user_sessions', action: 'guest_login' })\n redirect_to(ret) && return\n end",
"def check_session\n if session[:user_id].nil?\n session[:return_to] = request.request_uri\n flash[:messgae] = \"Please sign-in or sign-up to access any of these pages.\"\n redirect_to :controller => 'user', :action => 'index'\n return\n end\n end",
"def require_login \n # puts \"#{@@count}\" \n # @@count+=1; \n if !(session[:user_id])\n # puts \"#{@@count} require_login method of application controller found no user logged in: \", session[:user_id]\n redirect_to '/main'\n # else\n # puts \"#{@@count} using require_login private method: Someone is already logged in: \", session[:user_id]\n # current_user = User.find(session[:user_id])\n #return current_user\n end\n end",
"def require_same_user\n if current_user != @user && !current_user.admin?\n flash[:alert] = \"you dont have access to do anything with #{@user.username}'s account\"\n redirect_to user_path(@user)\n \n end\n \n end",
"def current_user\n User.find_by_id(session[:user_id]) if session[:user_id] \n end",
"def session!\n redirect(settings.session_fail) unless session? || settings.session_fail == request.path_info\n end",
"def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend",
"def show\n authorize Session\n end",
"def user_logged_in\n redirect_to \"/scripts\" if session[:user_id]\n end",
"def login_required\n access_denied unless session_login || cookie_login\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def session\n end",
"def check_user_session()\n unless session\n redirect_to session[:return_to]\n end\n end",
"def signed_in_user\n\n\t\t# If check to see if user is signed in\n \tunless signed_in?\n\n \t\t# Store the last the requested action and store it\n \t\tstore_location\n\n \t\t# Redirect to the signin url with notice to signin\n \t\tredirect_to signin_url, notice: \"Please sign in.\"\n \tend\n \tend",
"def require_login\n redirect_to '/' if session[:user_id] == nil\n end",
"def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end",
"def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end",
"def request_user\n # request_valid? is called first which creates a @session instance\n # variable which acts like the global session object of a normal request.\n @request_user ||= User.find(@session[:user_id]) if request_valid?\n end",
"def logged_in?\n act = StudyListAction.new(self)\n act.get\n !(act.redirected_to_login?)\n end",
"def current_user\n User.find_by(id: session[:user_id])\nend",
"def store_action\n return unless request.get?\n if (request.path != \"/admins/sign_in\" &&\n request.path != \"/admins/sign_up\" &&\n request.path != \"/admins/password/new\" &&\n request.path != \"/admins/password/edit\" &&\n request.path != \"/admins/sign_out\" &&\n !request.xhr?) # don't store ajax calls\n store_location_for(:admin, \"/dashboard\")\n end\n end",
"def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => :login and return false\n else\n redirect_to :controller => 'authentication', :action => :setup and return false\n end\n end",
"def hello\n redirect_to controller: 'sessions', action: 'new' unless session[:name] #TRY current_user\n end",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def authenticated?\n session[:access_token]\nend",
"def require_signin\n\t\tunless current_user\n\t\t\t# session[:intended_url] = request.url\n\t\t\t# redirect_to new_session_url, alert: \"Please sign in first\"\n\t\t\trender nothing: true, status: :unauthorized\n\t\tend\n\tend",
"def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end",
"def save_login_state\n if session[:user_id]\n redirect_to requests_path\n return false\n else\n return true\n end\n end",
"def check_user_access\n check_access_and_redirect(@request)\n end",
"def curator_required\n unless logged_in? && current_user.is_curator?\n flash[:notice] = t(:only_curators_can_access_that_page)\n if session[:return_to] == request.fullpath\n redirect_to root_url\n else\n redirect_back_or_default(root_url)\n end\n end\n end",
"def user_session_request?(env)\n env.url.to_s.include?('users/v2/session?processRules=true')\n end",
"def current_user\n User.find(session[:id])\nend",
"def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end",
"def logged_in?\n !!current_<%= file_name %>\n end\n\n # Accesses the current <%= file_name %> from the session.\n # Future calls avoid the database because nil is not equal to false.\n def current_<%= file_name %>\n @current_<%= file_name %> ||= login_from_session unless @current_<%= file_name %> == false\n end\n\n # Store the given <%= file_name %> id in the session.\n def current_<%= file_name %>=(new_<%= file_name %>)\n session[:<%= file_name %>_id] = new_<%= file_name %> ? new_<%= file_name %>.id : nil\n @current_<%= file_name %> = new_<%= file_name %> || false\n end\n\n # Check if the <%= file_name %> is authorized\n #\n # Override this method in your controllers if you want to restrict access\n # to only a few actions or if you want to check if the <%= file_name %>\n # has the correct rights.\n #\n # Example:\n #\n # # only allow nonbobs\n # def authorized?\n # current_<%= file_name %>.login != \"bob\"\n # end\n def authorized?\n logged_in?\n end\n\n # Filter method to enforce a login requirement.\n #\n # To require logins for all actions, use this in your controllers:\n #\n # before_filter :login_required\n #\n # To require logins for specific actions, use this in your controllers:\n #\n # before_filter :login_required, :only => [ :edit, :update ]\n #\n # To skip this in a subclassed controller:\n #\n # skip_before_filter :login_required\n #\n def login_required\n authorized? || access_denied\n end\n\n # Redirect as appropriate when an access request fails.\n #\n # The default action is to redirect to the login screen.\n #\n # Override this method in your controllers if you want to have special\n # behavior in case the <%= file_name %> is not authorized\n # to access the requested action. For example, a popup window might\n # simply close itself.\n def access_denied\n respond_to do |format|\n format.html do\n store_location\n #redirect_to new_<%= sessions_singular_name %>_path\n redirect_to :controller => 'sessions', :action => 'index'\n end\n end\n end\n\n # Store the URI of the current request in the session.\n #\n # We can return to this location by calling #redirect_back_or_default.\n def store_location\n session[:return_to] = request.request_uri\n end\n\n # Redirect to the URI stored by the most recent store_location call or\n # to the passed default.\n def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end\n\n # Inclusion hook to make #current_<%= file_name %> and #logged_in?\n # available as ActionView helper methods.\n def self.included(base)\n base.send :helper_method, :current_<%= file_name %>, :logged_in?\n end\n\n # Called from #current_<%= file_name %>. First attempt to login by the <%= file_name %> id stored in the session.\n def login_from_session\n self.current_<%= file_name %> = <%= class_name %>.find_by_id(session[:<%= file_name %>_id]) if session[:<%= file_name %>_id]\n end\nend",
"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 require_same_user\n if current_user != @user\n flash[:error] = \"You do not have permisions to edit a user other than yourself\"\n redirect_to root_path\n end \n end",
"def login_required\n return true if session[:affiliate]\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n redirect_to :action =>\"login\" and return false \n end",
"def is_accessing_self?\n if session[:user_id] != params[:id].to_i\n flash[:error] = \"You do not have access to this profile\"\n custom_redirect_back\n end\n end",
"def login_required\n if session[:user_id]\n @user = current_user if @user.nil?\n return true if @user\n end\n flash[:warning]='Please login to continue'\n session[:return_to]=request.fullpath\n redirect_to :controller => \"user\", :action => \"login\"\n return false \n end",
"def require_login\n redirect_to sessions_new_path unless current_account.present?\n end",
"def require_login\n unless logged_in?\n session[:request_uri] = request.request_uri\n redirect_to(new_session_path)\n end\n end",
"def permiso_requerido\n if not protect?(action_name)\n return true\n end\n if @session['user'] and autorizado?(@session['user'], controller_name)\n return true\n end\n store_location\n access_denied\n return false\n end",
"def require_logged_in\n redirect_to new_session_url unless logged_in?\n end",
"def ensure_auth # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n if session[:prospect_params]\n # we have an application going so we've probably just refreshed the\n # screen\n redirect_to action: 'new', controller: 'prospects'\n elsif session[:cas].nil? || session[:cas][:user].nil?\n render status: :unauthorized, plain: 'Redirecting to SSO...'\n else\n user = User.find_by cas_directory_id: session[:cas][:user]\n if user.nil?\n render status: :forbidden, plain: 'Unrecognized user'\n else\n update_current_user(user)\n end\n end\n nil\n end",
"def logged_in?\n session[:user]\n end",
"def require_ownership\n\t\tunless current_user\n\t\t\tredirect_to login_path\n\t\tend\n\tend",
"def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end",
"def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend",
"def authorization_check\n if session[:current_user] == nil\n redirect '/not_authorized'\n else\n return true\n end\nend",
"def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to tasks_index_path, notice: \"Please log in\"\n end\n end",
"def authorize\n unless User.find_by_id( session[ :user_id ] )\n session[ :original_uri ] = request.request_uri\n flash[ :notice ] = \"Please log in\"\n redirect_to :controller => :login, :action => :login\n end\n end",
"def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"def require_current_user!\n redirect_to new_session_url if current_user.nil?\n end",
"def logged_in_user\n unless logged_in?\n store_location # This line uses a method in sessions_helper to store request location so that it may redirect them to that location upon login.\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def user_action\r\n\t\tif controller.nil? || !controller.respond_to?(:session) || controller.session[:user].nil?\r\n\t\t\treturn false\r\n\t\tend\r\n\t\t\r\n\t\treturn true\r\n\trescue\r\n\t\treturn false\r\n\tend",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def login_required?\n\n # check for user session\n if current_user and user_signed_in? then\n bootstrap current_user, :name => :current_user\n return false\n end\n\n # don't redirect when trying to login\n return false if params[\"controller\"] == \"sessions\" && (params[\"action\"] == \"index\" || params[\"action\"] == \"create\")\n\n # render a response directly\n if request.xhr? or request.format != \"text/html\" then\n # return an error response instead\n return render :text => \"not logged in\", :status => 401\n end\n\n u = URI.parse(request.url)\n s = u.path\n s += \"?\" + u.query if u.query\n session[:return_to] = s\n\n qp = params.clone\n qp.delete(:controller)\n qp.delete(:action)\n path = params[:i].blank? ? login_index_path : login_index_path(qp)\n\n redirect_to path\n end",
"def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => 'login' and return false\n else\n redirect_to :controller => 'authentication', :action => 'create_admin' and return false\n end\n end"
] |
[
"0.6771916",
"0.65909594",
"0.64256215",
"0.6393042",
"0.6380926",
"0.6374899",
"0.63572735",
"0.63547885",
"0.6350289",
"0.6337064",
"0.6288977",
"0.62833196",
"0.62702364",
"0.62471616",
"0.6222235",
"0.6213984",
"0.6212755",
"0.6205202",
"0.6182407",
"0.6177145",
"0.61763513",
"0.6173514",
"0.61614984",
"0.6160215",
"0.6140835",
"0.61195",
"0.6086355",
"0.6081309",
"0.60759586",
"0.6061593",
"0.60585177",
"0.60523814",
"0.6042359",
"0.6038931",
"0.60332096",
"0.6032318",
"0.6022287",
"0.6020639",
"0.6017364",
"0.60140043",
"0.60112834",
"0.6010169",
"0.6009544",
"0.6002084",
"0.6001467",
"0.60014015",
"0.59994644",
"0.59991527",
"0.5992603",
"0.59917647",
"0.59890705",
"0.59794974",
"0.59775245",
"0.59775245",
"0.59774053",
"0.59752977",
"0.59741795",
"0.59703445",
"0.59623516",
"0.59601784",
"0.595931",
"0.595931",
"0.595931",
"0.595931",
"0.595931",
"0.5955229",
"0.5952884",
"0.59473866",
"0.5941884",
"0.5939598",
"0.59347975",
"0.59347415",
"0.59346706",
"0.5930693",
"0.5929662",
"0.5929662",
"0.5925119",
"0.59180063",
"0.59179187",
"0.5915581",
"0.5914212",
"0.5906567",
"0.59028065",
"0.5898004",
"0.5893997",
"0.58934635",
"0.58837116",
"0.5876368",
"0.5874421",
"0.58739656",
"0.5873321",
"0.58713526",
"0.5868119",
"0.58671665",
"0.5866629",
"0.5866529",
"0.58650744",
"0.58650744",
"0.5864917",
"0.58640754"
] |
0.6863033
|
0
|
Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. Requirements You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've solved it on pen and paper!
|
def simulate_roll(min = 1, max = 7)
rand(max) + min
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dice_roll\n rand(1..6)\n end",
"def roll_a_dice\n\t\trand(1..6)\n\tend",
"def roll(dice)\n rand(1..6)*dice\nend",
"def roll\n # code goes here\n rand(1..6)\n # bonus solve using array\n #possible_rolls = (1..6).to_a\n #possible_rolls[rand(0..5)]\nend",
"def dice\n rand(1..6) + rand(1..6)\nend",
"def roll_dice\n dice = rand(6) + 1\n end",
"def roll\n dice_roll = (1..6)\n #.. includes 6\nrand(dice_roll)\n # code goes here\nend",
"def dice_roll\n return (rand(6) + 1)\n end",
"def roll_dice(num_rolls)\n num_rolls.times do\n puts \"Roll: #{rand(1..6)}\"\n end\nend",
"def roll(n)\n @dice = (1..n).map { rand(6) + 1 }\n end",
"def roll_dice(num_dice)\n\tdice_roll_result = num_dice.times.map{ 1 + Random.rand(6) }\n\treturn dice_roll_result\nend",
"def roll_dice(dice = 1)\n total = 0\n dice.times do |n|\n total += Random.rand(1..6)\n end\n total\nend",
"def roll_dice(n=1)\n result = 0\n n.times do\n dice = rand(6) + 1 \n result += dice\n end\n return result\nend",
"def roll\n # answer using ranges\n #rand(6)+1\n\n #answer using arrays\n values = [1,2,3,4,5,6]\n values[rand(6)]\nend",
"def roll(1...7)\n puts rand(1...7)\nend",
"def roll\n dice = (1..6).to_a\n dice.shuffle[4]\nend",
"def roll\n #rand(1..6)\n ans = (1..6).to_a\n ans[rand(0..5)]\nend",
"def roll\n rand(1...7)\nend",
"def roll\n rand(1..6)\nend",
"def roll\n rand(1..6)\nend",
"def roll_die\n Random.new.rand(1..6)\nend",
"def roll_die\n die_roll = rand(1..6)\n #\nend",
"def roll\n # code goes here\n\n # Generates a random integer between 1-6, inclusive\n # Using ranges\n rand(1..6)\n\n # Using an array\n [1,2,3,4,5,6].sample\nend",
"def roll_dice\n Random.rand(100)\nend",
"def roll\n random_nums = rand(1..6)\n random_nums\nend",
"def roll\n Random.rand(1..6)\nend",
"def roll\n dice_sides = [1, 2, 3, 4, 5, 6]\n dice_sides.sample\nend",
"def dice(minimum, maximum)\n rand(minimum..maximum)\nend",
"def roll\n di = [1,2,3,4,5,6]\n di_roll = rand(6)\n di[di_roll]\nend",
"def roll (sides = 6)\n\trand(1..sides)\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll()\n raise InvalidSidesException.new(\"A number of sides is needed for a die.\") if @sides == 0\n raise InvalidSidesException.new(\"An appropriate number of sides is required.\") if @sides < 6\n \n rand(@sides) + 1\n end",
"def rollDice\n value = 1\n loop do\n value = (rand * 6.5).to_i\n break if value >0\n end\n return value\n end",
"def roll\n rand(6) #=> gives a random number between 0 and 6 inclusively\n rand(1..6) #=> gives a random number between 1 and 6 inclusively \nend",
"def roll(n, d)\n return 0 unless n.kind_of?(Integer)\n return 0 unless d.kind_of?(Integer)\n return 0 if n <= 0\n return 0 if d <= 0\n\n (1..n).inject(0) {|sum,dummyvar| sum + (rand(d) + 1)}\nend",
"def dice\n number = rand(6)\n if number == 0\n return 6\n else\n return number\n end\nend",
"def score( dice )\n res = 0\n val = { \"111\" => 1000, \"666\" => 600, \"555\" => 500, \"444\" => 400,\n \"333\" => 300, \"222\" => 200, \"1\" => 100, \"5\" => 50 }\n\n [*1..6].each do |num|\n next if dice.count(num).nil?\n many = dice.count(num)\n if many >= 3\n res += val[num.to_s * 3]\n many -= 3\n end\n if num == 1 || num == 5\n until many < 1\n res += val[num.to_s]\n many -= 1\n end\n end\n end\n \n res\nend",
"def roll\n # code goes here\n 1 + rand(6)\nend",
"def roll\n # code goes here\n # rand(1..6)\n counter = 1\n arr = []\n while counter <= 6\n arr.push(counter)\n counter += 1\n end\n arr[rand(0..5)]\nend",
"def roll\n # code goes here\n range = rand(6) + 1\n \n range = [1,2,3,4,5,6]\n result = range[rand(6)]\n result \nend",
"def roll\n # code goes here\n # Generate an integer from 0 to 10\n\n\trand(1..6)\n\t\nend",
"def roll\n return rand 1..6\nend",
"def roll\n Random.rand(6) + 1\nend",
"def roll_the_dice\n numbers = [0..9]\n puts @list.shuffle[rand(5) + rand(5)]\nend",
"def dice(sides, num=1, bonus=0)\n tally = 0\n # Repeat the next block of code for each die to be rolled.\n num.times do\n # rand(x) returns a number from 0 to x-1. Add one to that and you\n # got a single die roll. Add that result to the running tally.\n tally += 1 + rand(sides)\n end\n # the result of the last line in the function is what ruby returns.\n # Here, we want to add the bonus to our final tally, and the sum\n # will be returned.\n tally + bonus\nend",
"def roll\n 1 + rand(6)\nend",
"def roll\n Random.rand(6)+1\n end",
"def roll\n # code goes here\n return 1 + rand(6)\nend",
"def roll\n # code goes here\n for i in 1..6\n r = rand 1..6\n return r\n end\nend",
"def roll\n return rand(6) + 1\nend",
"def roll\n number = rand(1..6)\n number\nend",
"def roll\n @number = rand(1..6)\n end",
"def die_rolls(number_of_words)\n # The Diceware method specifies five rolls of the die for each word.\n die_rolls_per_word = 5\n total_die_rolls = number_of_words * die_rolls_per_word\n die_roll_sequence = generate_random_numbers(total_die_rolls, 6, 1)\n group_die_rolls(die_roll_sequence, number_of_words, die_rolls_per_word)\n end",
"def roll_die(sides)\n\tresult = 1 + rand(sides)\nend",
"def roll_dice(upper_limit)\n number = rand(1..upper_limit)\n puts \"You rolled a \" + number.to_s\nend",
"def roll\n # code goes here\n #roll = rand(1..6)\n #roll\n roll_array = [1, 2, 3, 4, 5, 6]\n roll_array.sample\nend",
"def roll(x = (0..5))\n 1 + rand(x)\nend",
"def roll\n 1 + rand(6)\n # the code below also works! Keep in mind for the deli counter problem.\n # my_array = (1..6).to_a \n # random_sample = my_array.sample\nend",
"def roll\n return 1 + rand(6)\n end",
"def roll\n # code goes here\n # rand(1..6)\n values = [1,2,3,4,5,6]\n result = rand(0..5)\n return values[result]\nend",
"def roll\n return rand(1..6) #if you use two dots it includes the 6 at the end\n # if you use three dots it excludes the last number in this case the 6\nend",
"def roll\n\t\tputs \"Rolling a #{@sides} sided die #{@rolls} times.\"\n\t\t#puts 1 + rand(@sides)\n\t\ti = 0\n\t\ttotal = 0\n\t\twhile i < @rolls do\n\t\t\troll_value = 1 + rand(@sides)\n\t\t\ttotal = total + roll_value\n\t\t\ti += 1\n\t\t\tputs \"Roll number #{i}: #{roll_value}\"\t\n\t\tend\n\t\tputs \"Total of all rolls: #{total}\"\n\tend",
"def dice_roller2\n (1..6).each do |roll1|\n (1..6).each do |roll2|\n puts \"#{roll1} #{roll2}\"\n end\n end\nend",
"def roll_dice(sides, dice)\n\tfor i in 1..dice\n\t\tresult = 1 + rand(sides)\n\t\tif result == sides\n\t\t\t# this is fixed \n\t\t\tputs result.to_s.red\n\t\telse\n\t\t\tputs result\n\t\tend\n\tend\nend",
"def roll\n @number = Random.new.rand(6) + 1\n end",
"def roll\n\n #random number using range\n rand(1..6)\n\n#random number using array\n ary = [1,2,3,4,5,6]\n ary[rand(ary.length)]\nend",
"def dice_results\r\n Array.new(number_of_dice) { rand(1..number_of_sides) }\r\n end",
"def roll\n result = rand(1..6)\n print result\n result\nend",
"def first_roll\n # code goes here\n num = rand(1..6)\n num\nend",
"def roll\n randomValue = rand(6)+1\n randomValue\nend",
"def roll\n rand(1..@sides)\n end",
"def roll #this method takes no argument\n rand(1..6) #return a random number between 1 and 6 (a range)\nend",
"def rand5()\n rand(1..5)\nend",
"def roll\n rand(sides)+1\n end",
"def roll(dice)\n dice\n end",
"def score( dice )\n total = []\n one_and_five = [[1000, 100], [500, 50]]\n [1, 5].each_with_index do |e, i|\n arr_size = dice.select {|s| s == e}.size\n if arr_size > 0\n if arr_size == 3\n total << one_and_five[i][0]\n elsif arr_size < 3\n total << one_and_five[i][1] * arr_size\n else\n total << one_and_five[i][1] * (arr_size - 3) + one_and_five[i][0]\n end\n end\n end\n [2, 3, 4, 6].each do |e|\n total << e * 100 if dice.join.count(e.to_s) >= 3\n end\n total.sum\nend",
"def rand5\n rand(1..5)\nend",
"def roll(num_rolls=1)\n \n #holding array\n rolls = []\n \n #for each roll\n num_rolls.times do |r|\n \n #generate a uniformly-distributed random number between 1 and num_sides\n rolls << rand(@num_sides) + 1\n \n end\n \n return rolls\n \n end",
"def score( dice )\n @result = []\n values = [*1..6]\n values.each do |i|\n if dice.count(i) >= 3\n case i\n when 1\n result << 1000\n when 2\n result << 200\n when 3\n result << 300\n when 4\n result << 400\n when 5\n result << 500\n when 6\n result << 600\n end\n if (dice.count(i) - 3) > 0\n case i\n when 1\n result << 100 * (dice.count(1) - 3)\n when 5\n result << 50 * (dice.count(5) - 3)\n end\n end\n else\n once_check(i)\n # case i\n # when 1\n # result << 100 * dice.count(1)\n # when 5\n # result << 50 * dice.count(5)\n # end\n end\n end\n result.sum\nend",
"def roll\n @numberShowing = 1 + rand(6)\n end",
"def roll( dice, sides, array, total )\n # Recursively roll dice and tally the frequency of each possible result.\n if 0 < dice\n (1..sides).each {|s| roll( dice - 1, sides, array, s + total )}\n else\n array[total - 1] += 1.0\n end\n end",
"def roll\n # code goes here\n counter = 1\n arr = []\n while counter <= 6\n arr.push(counter)\n counter += 1\nend\narr[rand(0..5)]\nend",
"def simulate_roll(min = 1, max = 5)\n rand(max)\nend",
"def roll\n range = [1,2,3,4,5,6]\n result = range[rand(0..5)]\n print result\n print \"\\n\"\n return result\nend",
"def roll\n # range code goes here\n rand(1..6)\n # array code goes here\n arr = Array(1..6)\n arr.at(rand(6))\nend",
"def roll\n @roll_count += 1\n @random.rand(1..6)\n end",
"def roll\n dice = [1, 2, 3, 4, 5, 6]\n dice_roll = dice[rand(dice.length)]\nend",
"def roll\n # code goes here\n 1 + rand(6) #1st method\n number = [1, 2, 3, 4, 5, 6] #2nd method\n number.sample #2nd method\nend",
"def game\n i = 0 # Incrementation for the game\n u_s = 0 # stair where the user begin the game\n\n\n until u_s == $s do\n throw_dice = rand(1..6) # Get a value between 1 and 6 (included)\n\n if (throw_dice == 5) || (throw_dice == 6)\n u_s += 1\n elsif (throw_dice == 1)\n u_s -= 1\n end\n\n #puts \"#{throw_dice}: #{u_s} - #{$s} -> #{i}\" # Debug\n i += 1\n end\n\n return i\nend",
"def rand5\n rand(0...5)\nend",
"def roll\n [1 , 2 , 3, 4, 5, 6].sample\n \nend",
"def roll\n return @showing = Random.rand(6) + 1 #instead of 0-5 inclusive, it becomes 1-6\n end",
"def dice_outcomes(die=1, rolls=1)\n\tresults = Hash.new(0)\n\n\t# Roll the dice rolls times and track the sums in hash\n\trolls.times do \n\t\tresults[roll_dice(die)] += 1 # Utilize existing function! Ruby will evaluate L side first\n\tend\n\n\t# Print out number each possible outcome occurred\n\t(1..(6*die)).each do |key|\n\t\tputs \"#{key}: \" + \"\\#\"*results[key]\n\tend\nend",
"def roll\n puts 1\n puts 2\n puts 3\n return 1 + rand(6)\nend",
"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 roll\n [1, 2, 3, 4, 5, 6].sample\nend",
"def roll\n [1, 2, 3, 4, 5, 6].sample\nend"
] |
[
"0.7668775",
"0.7516878",
"0.7464262",
"0.7389701",
"0.738864",
"0.7342712",
"0.73310095",
"0.731832",
"0.7280669",
"0.71963984",
"0.7123245",
"0.7053284",
"0.7021797",
"0.70187956",
"0.70172846",
"0.694591",
"0.6872699",
"0.6869779",
"0.68639505",
"0.68639505",
"0.6810902",
"0.68055",
"0.68018657",
"0.6780138",
"0.6769748",
"0.6738032",
"0.67318887",
"0.67196834",
"0.66891485",
"0.66886616",
"0.66745883",
"0.66739523",
"0.66739523",
"0.66739523",
"0.6672017",
"0.6670708",
"0.6669714",
"0.66569364",
"0.6645793",
"0.66207963",
"0.6616305",
"0.66155475",
"0.66111726",
"0.6604418",
"0.6600449",
"0.65863085",
"0.65484154",
"0.65450424",
"0.65349025",
"0.65249246",
"0.6502033",
"0.6481225",
"0.64795935",
"0.6470519",
"0.6465053",
"0.6437264",
"0.6426966",
"0.64019084",
"0.6397428",
"0.6395021",
"0.63855946",
"0.63816226",
"0.6372178",
"0.6368956",
"0.6359632",
"0.6323532",
"0.63234204",
"0.6322942",
"0.6321096",
"0.6300697",
"0.628606",
"0.6261176",
"0.62551194",
"0.6243446",
"0.62427497",
"0.62378967",
"0.62232745",
"0.61816496",
"0.6172431",
"0.6171526",
"0.6163313",
"0.6158818",
"0.61572045",
"0.6144491",
"0.614422",
"0.6142245",
"0.61359",
"0.61206865",
"0.6114904",
"0.61098117",
"0.60876876",
"0.60862744",
"0.6084015",
"0.6079014",
"0.6069996",
"0.60667604",
"0.6066514",
"0.6044616",
"0.60314214",
"0.60314214"
] |
0.6229266
|
76
|
creates the Mechanize agent used to do the scraping and sets a nice user agent header for good net educate
|
def create_agent
self.agent = WWW::Mechanize.new
agent.user_agent = "Mozilla/4.0 (compatible; Blackbook #{Blackbook::VERSION})"
agent.keep_alive = false
agent
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_agent(agent)\n headers.update 'User-Agent' => agent\n end",
"def init_agent\r\n agent = Mechanize.new{|a| a.history.max_size = 10}\r\n agent.user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5'\r\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n agent\r\nend",
"def initialize\n @agent = Mechanize.new\n @agent.set_defaults if @agent.respond_to?(:set_defaults)\n @agent.user_agent = @@user_agent ||= \"bahn.rb\"\n end",
"def agent\n @agent ||= Mechanize.new do |agent|\n agent.user_agent_alias = 'Mac Safari'\n end\n end",
"def user_agent=(user_agent); end",
"def get_agent\n\t\tagent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }\n\tend",
"def agent\n @agent ||= Sawyer::Agent.new('', sawyer_options) do |http|\n http.headers[:user_agent] = user_agent\n end\n end",
"def initialize\n @agent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def setUserAgent(agent)\n @helper.setUserAgent(agent)\n self\n end",
"def user_agent= user_agent\n @agent.user_agent = user_agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end",
"def user_agent; end",
"def user_agent; end",
"def user_agent; end",
"def mech\n @mech ||= Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }\n end",
"def init_user_agent(options)\n @headers ||= {}\n @headers['User-Agent'] = options[:user_agent] || default_user_agent\n end",
"def initialize_agent(agent = Mechanize.new)\r\n @agent = (agent.nil? ? Mechanize.new : agent)\r\n @agent.log = Logger.new(\"#{Rails.root}/log/scrapers/mechanize.log\")\r\n @agent.log.formatter = Utf8LogFormatter.new\r\n @agent.user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'\r\n # @agent.max_history = 1\r\n end",
"def user_agent(user_agent)\n @user_agent = user_agent\n end",
"def init_agent\n agent = login(make_spider)\n unless agent.page.content.include? 'You are logged in.'\n SouvlakiRS.logger.error 'Audioport user login failed'\n raise 'Mechanize failed to create agent' if agent.nil?\n end\n\n agent\n end",
"def setup\n agent = Mechanize.new { |a| a.log = Logger.new(@pw + \"../log/mechanize.log\") }\n agent.user_agent_alias = \"Linux Firefox\"\n\n page = agent.get(\"http://www.almasryalyoum.com/rss_feed_term/2/rss.xml\")\n begin\n result = RSS::Parser.parse(page.body)\n rescue Exception => e\n puts e\n return\n end\n\n end",
"def user_agent\n @headers['User-Agent']\n end",
"def user_agent\n @headers['User-Agent']\n end",
"def user_agent\n @headers['User-Agent']\n end",
"def useragent=(value)\n Curl.set_option(:useragent, value_for(value, :string), handle)\n end",
"def user_agent= new_ua\n @headers['User-Agent'] =\n new_ua && Kronk.config[:user_agents][new_ua.to_s] ||\n new_ua || Kronk::DEFAULT_USER_AGENT\n end",
"def user_agent= new_ua\n @headers['User-Agent'] =\n new_ua && Kronk.config[:user_agents][new_ua.to_s] ||\n new_ua || Kronk::DEFAULT_USER_AGENT\n end",
"def initialize(agent=nil, url_base=DEFAULT_URL)\n @agent = agent\n @url_base = url_base\n if @agent.nil?\n @agent = Mechanize.new\n @agent.user_agent_alias = 'Mac Firefox'\n end\n end",
"def get_user_agent\n user_agent\n end",
"def user_agent\n @agent.user_agent\n end",
"def user_agent\n @user_agent || USER_AGENT\n end",
"def user_agent\n @user_agent || USER_AGENT\n end",
"def make_spider\n Mechanize.new do |agent|\n agent.user_agent_alias = 'Mac Safari'\n agent.follow_meta_refresh = true\n # agent.redirect_ok = true\n agent.keep_alive = true\n agent.open_timeout = 60\n agent.read_timeout = 60\n agent.pluggable_parser['audio/mpeg'] = Mechanize::Download\n end\n end",
"def ua_parser(agent)\n # Load all user agent data / regexp / patterns once\n @ua ||= UserAgentParser::Parser.new\n @ua.parse(agent)\n end",
"def initialize user_agent\n @user_agent = user_agent.strip\n end",
"def initialize user_agent\n @user_agent = user_agent.strip\n end",
"def initialize user_agent\n @user_agent = user_agent.strip\n end",
"def initialize user_agent\n @user_agent = user_agent.strip\n end",
"def initialize user_agent\n @user_agent = user_agent.strip\n end",
"def user_agent\n headers[\"HTTP_USER_AGENT\"] || headers[\"USER-AGENT\"]\n end",
"def user_agent=(user_agent)\n @request_headers['User-Agent'] = user_agent\n @request = Net::HTTP::Get.new(@uri.request_uri, @request_headers)\n end",
"def initialize\n @agent = Mechanize.new\n end",
"def agent\n @agent ||= Sawyer::Agent.new(endpoint, sawyer_options) do |http|\n http.headers[:accept] = default_media_type\n http.headers[:content_type] = \"application/json\"\n http.headers[:user_agent] = user_agent\n end\n end",
"def initialize(agent_alias)\n @agent = Mechanize.new\n @agent.user_agent_alias = agent_alias\n\n end",
"def ua\n @ua ||= begin\n request.env['HTTP_USER_AGENT'].downcase\n rescue\n ''\n end\n end",
"def generate_user_agent(extra_ids = [])\n agent_app = @config.read('authentication.user_agent')\n extra_ids << ['AwApi-Ruby/%s' % YahooAdApi::ApiConfig::CLIENT_LIB_VERSION]\n super(extra_ids, agent_app)\n end",
"def user_agent\n @request['User-Agent']\n end",
"def post_request(url, header, data)\n agent = Mechanize.new\n # agent.set_proxy(\"p.webshare.io\", 80, 'ssewadpd-rotate', 'ewpc7poi760o')\n agent.user_agent_alias = \"Windows Mozilla\"\n res = agent.post(url, data, header)\n\n return res\nend",
"def some_user_agent\n \"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20090920 Firefox/3.5.3 (Swiftfox)\"\n end",
"def headers\n { 'User-Agent' => user_agent }\n end",
"def user_agent\n @data[\"user_agent\"]\n end",
"def user_agent\n self.class.user_agent ||= USER_AGENTS.shuffle.first\n end",
"def getUserAgent()\n\t\t\tUSER_AGENT\n\t\tend",
"def user_agent=(user_agent)\n @attributes[\"user_agent\"] = user_agent\n end",
"def default_header\n {\n \"User-Agent\" => user_agent\n }\n end",
"def generate_user_agent(extra_ids = [])\n agent_app = @config.read('authentication.user_agent')\n extra_ids << ['AwApi-Ruby/%s' % BingAdsApi::ApiConfig::CLIENT_LIB_VERSION]\n super(extra_ids, agent_app)\n end",
"def initialize\n @agent = Mechanize.new\n @agent.agent.set_socks('localhost', 9050) # use Tor\n @agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @login_form = login_form\n @consumer_page = consumer_page\n @account_page = account_page\n @balance_page = balance_page\n @usage_page = usage_page\n end",
"def user_agent\n if defined?(::RUBY_VERSION) && defined?(::RUBY_PLATFORM)\n ruby_description = \"(ruby #{::RUBY_VERSION} #{::RUBY_PLATFORM}) \" # NOTE: the trailing space!\n end\n zlib_version = \"zlib/#{Zlib.zlib_version}\" if defined?(::Zlib) && Zlib.respond_to?(:zlib_version)\n \"NewRelic-RubyAgent/#{NewRelic::VERSION::STRING} #{ruby_description}#{zlib_version}\"\n end",
"def getUserAgent()\n printDebugMessage('getUserAgent', 'Begin', 11)\n clientRevision = '$Revision$'\n clientVersion = '0'\n if clientRevision.length > 11\n clientVersion = clientRevision[11..-3]\n end\n userAgent = \"EBI-Sample-Client/#{clientVersion} (#{self.class.name}; Ruby #{RUBY_VERSION}; #{RUBY_PLATFORM}) \"\n printDebugMessage('getUserAgent', \"userAgent: #{userAgent}\", 11)\n printDebugMessage('getUserAgent', 'End', 11)\n return userAgent\n end",
"def getUserAgent()\n printDebugMessage('getUserAgent', 'Begin', 11)\n clientRevision = '$Revision$'\n clientVersion = '0'\n if clientRevision.length > 11\n clientVersion = clientRevision[11..-3]\n end\n userAgent = \"EBI-Sample-Client/#{clientVersion} (#{self.class.name}; Ruby #{RUBY_VERSION}; #{RUBY_PLATFORM}) \"\n printDebugMessage('getUserAgent', \"userAgent: #{userAgent}\", 11)\n printDebugMessage('getUserAgent', 'End', 11)\n return userAgent\n end",
"def initialize(user_agent)\n self.class.headers 'User-Agent' =>\n \"#{user_agent} CWSrb/#{Cwsrb::VERSION} (#{RUBY_ENGINE}/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL})\"\n end",
"def user_agent=(name)\n @user_agent = USER_AGENT[name] || USER_AGENT['bot']\n end",
"def harvest_user_agent\n return \"TimeTrackingConsolidator (patel.aneeesh@gmail.com)\"\n end",
"def headers\n {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'}\n end",
"def user_agent\n \"SocketLabs-ruby/#{VERSION};ruby(#{RUBY_VERSION})\"\n end",
"def user_agent\n \"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3\"\n end",
"def user_agent\n ruby_description = ''\n # note the trailing space!\n ruby_description << \"(ruby #{::RUBY_VERSION} #{::RUBY_PLATFORM}) \" if defined?(::RUBY_VERSION) && defined?(::RUBY_PLATFORM)\n zlib_version = ''\n zlib_version << \"zlib/#{Zlib.zlib_version}\" if defined?(::Zlib) && Zlib.respond_to?(:zlib_version)\n \"NewRelic-RubyAgent/#{NewRelic::VERSION::STRING} #{ruby_description}#{zlib_version}\"\n end",
"def http_user_agent\n # User agent is required for cookie validation\n request.env['HTTP_USER_AGENT'].to_s\n end",
"def use_agent=(use_agent); end",
"def user_agent\n @request[FUA]\n end",
"def default_user_agent\n \"#{NAME}/#{VERSION} (Ruby/#{RUBY_VERSION})\"\n end",
"def user_agent\n kernel = Facter[:kernel] ? Facter[:kernel].value : 'unknown'\n kvers = Facter[:kernelversion] ? Facter[:kernelversion].value : 'unknown'\n values = {\n 'razor' => MK::VERSION,\n 'facter' => Facter.version, # sigh\n 'ruby' => RUBY_VERSION,\n 'kernel' => \"#{kernel}-#{kvers}\"\n }.reject{|k,v| v.nil?}.map{|k,v| k+'/'+v}.join(' ')\n end",
"def user_agent_on_header\n request.headers['HTTP_USER_AGENT']\n end",
"def headers\n super\n @headers['User-Agent'] = \"Recurly Ruby Client v#{VERSION}\"\n @headers\n end",
"def headers=(headers)\n @headers = headers.merge({\"User-Agent\" => user_agent})\n end",
"def start\n # Very important object. Don't lose or overwrite it. Required for scraping.\n agent = Mechanize.new\n\n begin\n # Authenticates in this method call.\n links = authenticate agent\n # Scrapes in this method call.\n acquire links, agent\n\n puts \"Grades acquired.\".foreground(:cyan)\n rescue Exception => e\n puts e.message\n rescue Mechanize::ResponseCodeError, Net::HTTPNotFound\n puts \"Looks like the website has changed. Contact the developer to fix this issue.\".foreground(:red)\n end\n\n end",
"def user_agent\n @options[:user_agent] || \"Ruby Twitter Gem\"\n end",
"def engine\n Agent.engine_for_user_agent string\n end",
"def touch_and_customize_cookies\n agent = Mechanize.new\n # retrieve the jsessionid and init the cookies\n begin\n agent.get(FORM_URL)\n rescue Mechanize::ResponseCodeError => e \n end\n\n agent.get(SEARCH_URL)\n agent.get(\"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=0&spectext=\")\n \n agent\nend",
"def touch_and_customize_cookies\n agent = Mechanize.new\n # retrieve the jsessionid and init the cookies\n begin\n agent.get(FORM_URL)\n rescue Mechanize::ResponseCodeError => e \n end\n\n agent.get(SEARCH_URL)\n agent.get(\"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=0&spectext=\")\n \n agent\nend",
"def browser_parser\n @browser_parser ||= DoubleAgent.browser_parser(user_agent)\n end",
"def initialize\n @headers = {\"User-Agent\" => \"cookies\"}\n end",
"def initialize(connection_name = 'mechanize')\n @agent = Mechanize::HTTP::Agent.new(connection_name)\n @agent.context = self\n @log = nil\n\n # attr_accessors\n @agent.user_agent = AGENT_ALIASES['Mechanize']\n @watch_for_set = nil\n @history_added = nil\n\n # attr_readers\n @pluggable_parser = PluggableParser.new\n\n @keep_alive_time = 0\n\n # Proxy\n @proxy_addr = nil\n @proxy_port = nil\n @proxy_user = nil\n @proxy_pass = nil\n\n @html_parser = self.class.html_parser\n\n @default_encoding = nil\n @force_default_encoding = false\n\n # defaults\n @agent.max_history = 50\n\n yield self if block_given?\n\n @agent.set_proxy @proxy_addr, @proxy_port, @proxy_user, @proxy_pass\n end",
"def browser\n Browser.new(user_agent)\n end",
"def agent\n anonymous? ? nil : user.agent\n end",
"def browser_user_agent(browser, agent, orientation)\nsetup_watir_webdriver\nbrowser =\"firefox\"\nagent = \"iphone\"\norientation=\"portrait\"\nrequire 'watir-webdriver'\nrequire 'webdriver-user-agent'\ndriver = Webdriver::UserAgent.driver(:browser => :\"#{browser}\", :agent => :\"#{agent}\", :orientation => :\"#{orientation}\")\nbrowser = Watir::Browser.new(driver)\nend",
"def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end",
"def initialize \n @root =\"http://web.archive.org/web/20030820233527/\" +\n \"http://bytravelers.com/journal/entry\" # Initialize the variables. The root of the URL to the cached copy of the site is here. \n @agent = Mechanize.new\n end",
"def connection_options\n {\n :headers => {\n :user_agent => user_agent\n }\n }\n end",
"def connection_options\n {\n :headers => {\n :user_agent => user_agent\n }\n }\n end",
"def user_agent(value)\n value || DEFAULT_USER_AGENT\n end"
] |
[
"0.7416943",
"0.74113935",
"0.7377459",
"0.72215647",
"0.7173405",
"0.712079",
"0.7058507",
"0.701807",
"0.6987984",
"0.6987984",
"0.6987984",
"0.6987984",
"0.6987984",
"0.6987984",
"0.6987984",
"0.6963631",
"0.6885625",
"0.6885625",
"0.6885625",
"0.6885625",
"0.6885625",
"0.68515515",
"0.68515515",
"0.68515515",
"0.67504597",
"0.6746503",
"0.6727769",
"0.65958905",
"0.6581688",
"0.65640104",
"0.655969",
"0.655969",
"0.655969",
"0.6551942",
"0.6551938",
"0.6551938",
"0.6542976",
"0.6526711",
"0.65138996",
"0.65097976",
"0.65097976",
"0.6495641",
"0.6477955",
"0.64322525",
"0.64322525",
"0.64322525",
"0.64322525",
"0.64322525",
"0.642659",
"0.64131576",
"0.63878316",
"0.63771826",
"0.6375684",
"0.6308455",
"0.6301422",
"0.62935936",
"0.6290022",
"0.6273282",
"0.6270225",
"0.626351",
"0.6231328",
"0.6220591",
"0.6206883",
"0.62048334",
"0.6177783",
"0.61739904",
"0.6142806",
"0.613237",
"0.613237",
"0.612496",
"0.612101",
"0.61182016",
"0.61072487",
"0.6096356",
"0.6079768",
"0.6055023",
"0.6030168",
"0.60193276",
"0.6017818",
"0.59935296",
"0.5991358",
"0.59404683",
"0.59403557",
"0.5940001",
"0.59088236",
"0.59019536",
"0.5897351",
"0.58922935",
"0.58922935",
"0.5877245",
"0.58624494",
"0.5860998",
"0.58541775",
"0.5844894",
"0.58387786",
"0.58349115",
"0.58325624",
"0.58092725",
"0.58092725",
"0.5798546"
] |
0.7401067
|
2
|
Page scrapers will follow a fairly simple pattern of instantiating the agent, prepping for the scrape and then the actual scrape process
|
def fetch_contacts!
create_agent
prepare
scrape_contacts
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start\n # Very important object. Don't lose or overwrite it. Required for scraping.\n agent = Mechanize.new\n\n begin\n # Authenticates in this method call.\n links = authenticate agent\n # Scrapes in this method call.\n acquire links, agent\n\n puts \"Grades acquired.\".foreground(:cyan)\n rescue Exception => e\n puts e.message\n rescue Mechanize::ResponseCodeError, Net::HTTPNotFound\n puts \"Looks like the website has changed. Contact the developer to fix this issue.\".foreground(:red)\n end\n\n end",
"def start_crawling\n begin\n if @params[:url]\n page = @agent.get(@params[:url])\n else\n @pre_middlewares.each { |mw| mw.call(@params) }\n page = @params[:page]\n raise 'internal error' if page.nil?\n end\n rescue => _\n raise CrawlingException::InitializationError.new\n end\n\n # starting from Depth 0\n process(page, 0)\n end",
"def run\n super\n\n uri = _get_entity_attribute \"name\"\n\n # Scanner options\n @opt_threads = _get_option(\"threads\").to_i\n @opt_max_pages = _get_option(\"max_pages\").to_i\n #@opt_user_agent = _get_option \"user_agent\"\n @opt_extract_uris = _get_option \"extract_uris\" # create an object for each page\n @opt_extract_dns_records = _get_option \"extract_dns_records\" # create an object for each dns_record\n @opt_extract_file_metadata = _get_option \"extract_file_metadata\" # create a Uri object for each page\n @opt_extract_patterns = _get_option(\"extract_patterns\").split(\",\") # only extract entities withthe following patterns\n\n crawl_and_extract(uri)\n\n end",
"def run\n reset!\n\n pages.each do |page|\n log.puts\n\n if page.respond_to?(:read)\n html = page.read\n elsif page.respond_to?(:call)\n result = instance_eval(&page)\n\n html = case result\n when String\n result\n else\n @agent.page.body\n end\n else\n begin\n html = fetch(page)\n rescue FetchError => e\n log.puts(e.message.red)\n next\n end\n end\n\n process!(html)\n end\n\n report\n\n selectors_to_review\n end",
"def initialize_agent(agent = Mechanize.new)\r\n @agent = (agent.nil? ? Mechanize.new : agent)\r\n @agent.log = Logger.new(\"#{Rails.root}/log/scrapers/mechanize.log\")\r\n @agent.log.formatter = Utf8LogFormatter.new\r\n @agent.user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'\r\n # @agent.max_history = 1\r\n end",
"def single_scrape\n next_page()\n save_page()\nend",
"def create_agent\n self.agent = WWW::Mechanize.new\n agent.user_agent = \"Mozilla/4.0 (compatible; Blackbook #{Blackbook::VERSION})\"\n agent.keep_alive = false\n agent\n end",
"def scrape\n end",
"def scrape_page\n self.url = page.url # gives a resolved url\n self.title = page.title\n self.description = page.description\n end",
"def init_agent\n agent = login(make_spider)\n unless agent.page.content.include? 'You are logged in.'\n SouvlakiRS.logger.error 'Audioport user login failed'\n raise 'Mechanize failed to create agent' if agent.nil?\n end\n\n agent\n end",
"def initialize\n @agent = Mechanize.new\n @agent.agent.set_socks('localhost', 9050) # use Tor\n @agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @login_form = login_form\n @consumer_page = consumer_page\n @account_page = account_page\n @balance_page = balance_page\n @usage_page = usage_page\n end",
"def initialize\n @agent = Mechanize.new\n @agent.set_defaults if @agent.respond_to?(:set_defaults)\n @agent.user_agent = @@user_agent ||= \"bahn.rb\"\n end",
"def initialize\n @agent = Mechanize.new\n end",
"def scrapePage\n # expects to be passed in a Watir:Browser object\n # gets the header from the current browser page and records it, the page url and the next page's url to the array\n pageDoc = getPage\n nextPageUrl = getFirstLinkUrl(pageDoc)\n pageEntry = getPageRecord(pageDoc, nextPageUrl)\n recordEntry(pageEntry)\n\n LOGGER.debug(\"Information scraped from: #{pageEntry[:url]}\")\n end",
"def initialize(url = BASE_URL)\n @agent = Mechanize.new\n @current_page = @agent.get url\n end",
"def load(agent, type_id)\n page = ScraperWiki.get_var(PAGE, 0)\n url = SEARCH_BASE + \"?SEARCH=1&run=#{page}&corp_type_id=#{type_id}\"\n puts url\n\n # Finish loading and processing current results\n results_page = agent.get(url)\n reset_error_count()\n load_results(results_page)\n process_results(agent)\n\n # Move on to the next page\n while results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/)\n puts \"Next\"\n page = page + 1\n ScraperWiki.save_var(PAGE, page)\n\n # Load and process results\n results_page = results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/).click\n load_results(results_page)\n process_results(agent)\n end\n\n page = 0 # Reset page to 0\n ScraperWiki.save_var(PAGE, page)\nend",
"def load(agent, type_id)\n page = ScraperWiki.get_var(PAGE, 0)\n url = SEARCH_BASE + \"?SEARCH=1&run=#{page}&corp_type_id=#{type_id}\"\n puts url\n\n # Finish loading and processing current results\n results_page = agent.get(url)\n reset_error_count()\n load_results(results_page)\n process_results(agent)\n\n # Move on to the next page\n while results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/)\n puts \"Next\"\n page = page + 1\n ScraperWiki.save_var(PAGE, page)\n\n # Load and process results\n results_page = results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/).click\n load_results(results_page)\n process_results(agent)\n end\n\n page = 0 # Reset page to 0\n ScraperWiki.save_var(PAGE, page)\nend",
"def initiate\n Scraper.initiate_scrape\n puts \"\\n\\nWelcome to Today on Crowder! To exit type 'exit'.\"\n list_articles\n end",
"def create\n @scraping_page = ScrapingPage.new(scraping_page_params)\n\n #--- Set url and new mechanize ---#\n url = @scraping_page.page_url\n uri = URI.parse(url) # ex) https://example.com/ -> set \"example.com\"\n agent = Mechanize.new\n page = agent.get(url)\n\n #--- Set title ---#\n title = page.title if page.respond_to?(:title) # For undefiend page.title method error (ex: RSS or missing title meta tag WebSite).\n title = \"#{title} #{uri.host}\"\n @scraping_page.title = title\n\n #--- Set charset ---#\n @scraping_page.charset = set_charset(page.body)\n\n #--- Obey robots.txt ---#\n robotex = Robotex.new \"Crawler\"\n @scraping_page.is_robots_allowed = robotex.allowed?(url)\n\n #--- Set scraping HTML file name ---#\n @scraping_page.directory_path = create_directory(url) # concerns/file_savable.rb\n\n respond_to do |format|\n if @scraping_page.save\n format.html { redirect_to @scraping_page, notice: 'Scraping page was successfully created.' }\n format.json { render :show, status: :created, location: @scraping_page }\n else\n format.html { render :new }\n format.json { render json: @scraping_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scrap = Scrap.new(params[:scrap])\n\n\n\n require 'scrapifier'\n require 'nokogiri'\n require 'open-uri'\n require 'addressable/uri'\n require 'mechanize'\n require 'pattern-match'\n require 'rubygems'\n \n\n r = @url\n \n case r\n when /http?:\\/\\/www.gizmobaba.com[\\S]+/\n\tpage = Nokogiri::HTML(open(url,'User-Agent'=>'Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20100101 Firefox/12.0 FirePHP/0.7.1')) \n \t#@url = r\n\t@title = page.xpath(\"//div[@class='ctl_aboutbrand']/h1\").text\n \t@desc = page.xpath(\"//p[@itemprop='description']\").text\n \t@price = page.xpath(\"//span[@itemprop='price']\").text\n \t@img = page.xpath(\"////img[@id='bankImage']/@src\")\n\n when /http?:\\/\\/www.myntra.com[\\S]+/\n\tpage = Nokogiri::HTML(open(url,'User-Agent'=>'Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20100101 Firefox/12.0 FirePHP/0.7.1'))\n \t#@url = r\n\t@title = page.xpath(\"//h1[@class='title']\").text\n \t@desc = page.xpath(\"//div[@class='description']/p\").text\n \t@price = page.xpath(\"//div[@class='price']\").text\n \t@img = page.xpath(\"//div[@class='blowup']/img/@src\")\n\n else\n agent = Mechanize.new\n\tdata = r.scrapify(images: [:jpg] )\n\t@url = data[:uri]\n\t@title = data[:title]\n\t@desc = data[:description] \n\tcase r\n\t\twhen /http?:\\/\\/www.jabong.com[\\S]+/\n \t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='price']\") \n \t @image = code.at(\"//img[@itemprop ='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.flipkart.com[\\S]+/\n\t code = agent.get(r)\n \t\t@price = code.at(\"//span[@class='fk-font-verybig pprice vmiddle fk-bold']\")\n \t\t@image = code.at(\"//img[@id ='visible-image-small']/@src\")\n \n \t\twhen /http?:\\/\\/www.99lens.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t @image = code.at(\"//img[@id ='image']/@src\")\t\n\n\t\twhen /http?:\\/\\/www.amazon.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='priceblock_ourprice']\")\n\t\t@image = code.at(\"//img[@id ='landingImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.americanswan.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='product-price-12782']\")\n\t\t@image = code.at(\"//img[@id ='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.babyoye.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='current_product_price']\")\n\t\t@image = code.at(\"//img[@class ='google-analytics-event']/@src\")\n\n\t\twhen /http?:\\/\\/www.basicslife.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//a[@class='MagicZoomPlus']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.bhaap.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//div[@class='product-img-box']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.coke2home.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//p[@class='online_price29']\")\n\t\t@image = code.at(\"//a[@class='jqzoom2']/@href\")\n\n\t\twhen /http?:\\/\\/crazyflorist.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='regular-price']\")\n \t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.dailyobjects.com[\\S]+/\t\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//div[@class='do_detail_page_product_price']\")\n\t\t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n \t\twhen /http?:\\/\\/www.fashionara.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='lowprice']\")\n\t\t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.fnp.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='INR']\")\n\t\t@image = code.at(\"//div[@class='slider']/ul/li/img/@src\")\n\n\t\twhen /http?:\\/\\/www.freecultr.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='product-price-14473']\")\n\t\t@image = code.at(\"//img[@id='zoom1']/@src\")\n\n\t\twhen /http?:\\/\\/www.gizmobaba.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='offer']\")\n\t\t@image = code.at(\"//img[@id='bankImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.grabmore.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//div[@class='appr_price']\")\n\t\t@image = code.at(\"//img[@id='zoom1']/@src\")\n\n\t\twhen /http?:\\/\\/www.haladirams.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//img[@id='zoom_Img']/@src\")\n\t\n\t\twhen /http?:\\/\\/www.healthgenie.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='product-price-8924']\")\n\t\t@image = code.at(\"//img[@id='image1']/@src\")\n\n\t\twhen /http?:\\/\\/www.high5store.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='our_price_display']\")\n\t\t@image = code.at(\"//img[@id='bigpic']/@src\")\n\n\t\twhen /http?:\\/\\/www.indireads.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//p[@class='price']\")\n\t\t@image = code.at(\"//img[@class='attachment-shop_single wp-post-image']/@src\")\n\n\t\twhen /http?:\\/\\/www.kidzdeals.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//p[@class='product-image product-image-zoom']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.metroshoes.net[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='price']\")\n\t\t@image = code.at(\"//img[@id='bankImage']/@src\")\n\n\n\t\twhen /http?:\\/\\/www.pannkh.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='mrp']\")\n\t\t@image = code.at(\"//img[@id='largeImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.pepperfry.com[\\S]+/\n \t\tcode = agent.get(r)\n\t @price = code.at(\"//li[@class='you_pay_price']\")\n\t\t@image = code.at(\"//img[@id='zoom_01']/@src\")\n\n\t\twhen /http?:\\/\\/www.planetsportsonline.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='offer']\")\n\t\t@image = code.at(\"//img[@id='bankImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.purplle.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='normal-price d-b']\")\n\t\t@image = code.at(\"//img[@class='product-img']/@src\")\n\n\t\twhen /http?:\\/\\/www.shopatplaces.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//div[@class='price']\")\n\t\t@image = code.at(\"//img[@id='image']/@src\")\n\n\n\t\twhen /http?:\\/\\/www.slassy.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='price']\")\n\t\t@image = code.at(\"//a[@class='productzoom']/@href\")\n\n\t\twhen /http?:\\/\\/www.smiledrive.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='product-price-77']\")\n\t\t@image = code.at(\"//a[@id='zoom1']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.stalkbuylove.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//img[@class='my_image_box']/@src\")\n\n\t\twhen /http?:\\/\\/www.yebhi.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@itemprop='price']\")\n \t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.yepme.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@id='lblPayHead']\")\n\t\t@image = code.at(\"//img[@id='img2']/@src\")\n\n\t\twhen /http?:\\/\\/www.zovi.com[\\S]+/\n\t\tcode = agent.get(r)\n \t\t@price = code.at(\"//label[@id='price']\")\n\t\t@image = code.at(\"//section[@id='detail-image']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.fabally.com[\\S]+/\n\t\tcode = agent.get(r)\n\t\t@price = code.at(\"//div[@class='codeArea']/span\")\n\t\t@image = code.at(\"//img[@id='prdimage']/@src\")\n\n\t\twhen /http?:\\/\\/www.beebayonline.com[\\S]+/\n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//p[@class='product-image product-image-zoom']/a/@href\")\n\n\t\twhen /http?:\\/\\/www.foodpanda.in[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"//div[@class='restaurant-list-table last']\")\n\t\t@image = code.at(\"//div[@class='restaurant-content clearfix']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.jewelskart.com[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"div[@class='lenskart']\")\n\t\t@image = code.at(\"//div[@id='slide-img']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.lenskart.com[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"div[@class='lenskart']\")\n\t\t@image = code.at(\"//div[@id='slide-img']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.moodsofcloe.com[\\S]+/ \n\t\tcode = agent.get(r)\n\t\t@price = code.at(\"//p[@class='productPrice color']\")\n\t\t@image = code.at(\"//div[@class='zImg om']/a/@href\")\n\n\t\twhen /http?:\\/\\/www.watchkart.com[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"div[@class='lenskart']\")\n\t\t@image = code.at(\"//div[@id='slide-img']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.clapone.com[\\S]+/\n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"//div[@class='price']\")\n\t\t@image = code.at(\"//img[@id='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.fabfurnish.com[\\S]+/\n \t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='special_price_box']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.fashionequation.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='money']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.shopclues.com[\\S]+/\n \t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@id='sec_discounted_price_2631066']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.miladyavenue.com[\\S]+/\n \t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='price-new']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.limeroad.com[\\S]+/\n \t\tcode = agent.get(r)\n \t\t#@price = code.at(\"//span[@class='price']\")\n\t\t#@image = \n\t\t\n\t\telse\n\t\t puts \" waiting for authentication to publish\"\n\t\n\n end\n\n end\n \n \n@scrap.save \n\n\n respond_to do |format|\n if @scrap.save\n format.html { redirect_to @scrap, notice: 'Scrap was successfully created.' }\n format.json { render :show, status: :created, location: @scrap }\n else\n format.html { render :new }\n format.json { render json: @scrap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def agent\n @agent ||= initialize_agent\n end",
"def initialize(driver)\n super\n visit\n verify_page\n end",
"def scrape_it\n \n end",
"def initialize \n @root =\"http://web.archive.org/web/20030820233527/\" +\n \"http://bytravelers.com/journal/entry\" # Initialize the variables. The root of the URL to the cached copy of the site is here. \n @agent = Mechanize.new\n end",
"def setup\n agent = Mechanize.new { |a| a.log = Logger.new(@pw + \"../log/mechanize.log\") }\n agent.user_agent_alias = \"Linux Firefox\"\n\n page = agent.get(\"http://www.almasryalyoum.com/rss_feed_term/2/rss.xml\")\n begin\n result = RSS::Parser.parse(page.body)\n rescue Exception => e\n puts e\n return\n end\n\n end",
"def crawlPage pageURL\n agent = Mechanize.new\n page = agent.get pageURL\n return page\nend",
"def initialize(attrs = {})\n agent\n @urls = []\n @handlers = {}\n @results = []\n @proxies = []\n @current_proxy = 0\n self.class.start_urls.each { |url| handle url, *self.class.handlers[url] }\n @request_interval = attrs[:request_interval] || DEFAULT_REQUEST_INTERVAL\n @proxy_port = attrs[:proxy_port]\n @proxy_addr = attrs[:proxy_addr]\n\n # When set to true Spidey will automatically retrieve Proxy Server details from via proxynova\n # Proxy IPs will be automatically rotated when each `handle` method is called\n @random_proxy = attrs[:random_proxy]\n if @random_proxy == true\n @proxies = Proxynova.get_list\n @total_proxies = @proxies.count\n end\n end",
"def scrape\n # import all the new articles\n Importer.new.import_all\n\n # redirect to the first page\n redirect_to login_path\n end",
"def agent\n @agent ||= Helpers.agent\n end",
"def setup\n @agent = Mechanize.new\n uri = URI.join('file:///', File.absolute_path(\"test/data/view.html\"))\n @page = @agent.get uri.to_s\n @view = PortfolioView.new uri.to_s, @page, \"test mameber\", \"test portfolio\", \"View1\", \"testgroup\"\n\n @analyzer = PortfolioStatistics::DescriptiveViewAnalyzer.new\n end",
"def scrape_all\n\t\tpage = fetch_page(@base_url)\n\t\turl_list = get_url_list(page)\n\t\turl_list.each do |url|\n\t\t\t#scrape the page\n\t\t\tuser = User.new(url,@user_agent)\n\t\t\tuser.scrape\n\t\tend\n\tend",
"def agent\n @agent ||= Helpers.agent\n end",
"def initialize(opts = {})\r\n opts = {\r\n agent: Mechanize.new,\r\n logger: Scrapers.default_logger,\r\n cache: {}\r\n }.merge!(opts)\r\n\r\n @logger = opts[:logger]\r\n @cache = opts[:cache]\r\n\r\n initialize_agent agent\r\n\r\n end",
"def init_agent\r\n agent = Mechanize.new{|a| a.history.max_size = 10}\r\n agent.user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5'\r\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n agent\r\nend",
"def spiral_scrape(agent, base_url)\n main_page = agent.get(base_url)\n\n # Gets each faculty search page url\n engineering_faculty = main_page.parser.xpath('//div[@class=\"tp_download1 col-md-6 col-lg-3\"]/a').map { |link| link['href'] }\n medicine_faculty = main_page.parser.xpath('//div[@class=\"tp_download2 col-md-6 col-lg-3\"]/a').map { |link| link['href'] }\n ns_faculty = main_page.parser.xpath('//div[@class=\"tp_download3 col-md-6 col-lg-3\"]/a').map { |link| link['href'] }\n business_faculty = main_page.parser.xpath('//div[@class=\"tp_download4 col-md-6 col-lg-3\"]/a').map { |link| link['href'] }\n\n faculty_pages = Array.new\n faculty_pages << engineering_faculty[0]\n faculty_pages << medicine_faculty[0]\n faculty_pages << ns_faculty[0]\n faculty_pages << business_faculty[0]\n\n threads = Array.new(4)\n # Scrape each faculty on a new thread\n faculty_pages.each do |faculty_page|\n threads << Thread.new do\n scrape_faculty(agent, faculty_page, base_url)\n end\n end\n\n # Ensure threads don't kill each other\n threads.each do |t|\n if !t.nil?\n t.join\n end\n end\n end",
"def agent; end",
"def initialize(agent, res, options = {})\n @agent = agent\n @status = res.status\n @headers = res.headers\n @env = res.env\n @body = res.body\n @rels = process_rels\n @started = options[:sawyer_started]\n @ended = options[:sawyer_ended]\n end",
"def find_jobs(agent, page)\n search_count = 0\n\n loop do\n # Strip html tags\n links = page.search \"//div//h3//a\"\n\n # Print jobs and links\n output_jobs(links) if links.length > 0\n\n # Update cumulative number of jobs\n search_count += links.length\n\n # Look to see if there are multiple pages\n nodes = page.xpath('//a[contains(@class, \"next_page\")]')\n\n break if nodes.empty?\n\n # Go to next page\n path = nodes.first['href']\n page = agent.get(\"https://www.jobsatosu.com#{path}\")\n sleep 1\n end\n search_count\nend",
"def use_agent?; end",
"def initialize\n @agent = Mechanize.new\n @page = @agent.get(@@url)\n @form = @page.forms.first\n end",
"def page(agent, page)\n url = \"https://www.planningportal.nsw.gov.au/planning-panel?field_status_value=2&page=#{page}\"\n\n page = agent.get(url)\n block = page.at(\".page__content .grid__row\")\n return 0 if block.nil?\n urls = block.element_children.map do |application|\n (page.uri + application.at('a')[\"href\"]).to_s\n end\n\n urls.each do |url|\n page = agent.get(url)\n v = page.at(\".project__details\").search(\".row\").map do |row|\n label = row.at(\"b\").inner_text.squish\n value = row.at(\"div\").inner_text.squish\n [label, value]\n end\n fields = Hash[v]\n\n yield(\n \"council_reference\" => fields[\"Planning panel reference number\"],\n \"address\" => fields[\"Project Address\"] + \", NSW\",\n \"description\" => page.at(\".field-field-project-description\").inner_text.squish,\n \"info_url\" => url,\n \"date_scraped\" => Date.today.to_s,\n \"date_received\" => convert_date(fields[\"Referral date\"])\n )\n end\n\n # Return number of applications found\n urls.count\nend",
"def scrape_connect\n Mechanize.new\nend",
"def scrape_connect\n Mechanize.new\nend",
"def load_page\n page.visit('')\n end",
"def initialize(page, _url = nil)\n @page = page\n #@page.click_button('Continue') if @page.has_text?('Maintainence')\n @page.visit(target_base_url + '/sources')\n end",
"def fetch\n puts \"fetching #{@uri.to_s}\".green.on_black\n start_time = Time.now\n begin\n request = Net::HTTP::Get.new(@uri.request_uri)\n request[\"User-Agent\"] = UserAgents.random\n response = @http.request(request) \n end_time = Time.now\n case response\n when Net::HTTPSuccess then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_head: response.instance_variable_get(\"@header\"),\n response_body: response.body,\n response_time: (end_time-start_time).to_f,\n crawled_time: (Time.now.to_f*1000).to_i)\n when Net::HTTPRedirection then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_head: response.instance_variable_get(\"@header\"),\n response_body: response.body,\n response_time: (end_time-start_time).to_f,\n redirect_url: response['location'])\n when Net::HTTPNotFound then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_time: (end_time-start_time).to_f)\n end\n rescue Exception => e\n puts e.inspect\n puts e.backtrace\n end\n end",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def initialize(username , limit)\n @username = username\n @limit = limit\n #pass only the username into methods so we generate the urls we need as we scrape them\n #dont call the next method here, use the object created in its place of creaton\n #to call further scraping methods class methods\n end",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def get_page(agent, creds, url, params, referer = nil)\n page = get_with_ref(agent, url, params, referer)\n if /text\\/html/ =~ page.response['content-type']\n if page.form && page.form.field_with(value: 'setup_admin')\n setup_admin = page.form\n setup_admin.username = creds[:username]\n setup_admin.password1 = creds[:password]\n setup_admin.password2 = creds[:password]\n abort \"Error: can't configure an unconfigured server unless an email address is given with --email or in secrets.yml\" unless creds[:email]\n setup_admin.email = creds[:email]\n page = setup_admin.submit\n end\n unless page.css('div#login_form').empty?\n login_form = page.forms[0]\n login_form.username = creds[:username]\n login_form.password = creds[:password]\n page = agent.submit(login_form)\n abort 'Error: login failed' unless page.css('div#login_form').empty?\n page = get_with_ref(agent, url, params, referer)\n end\n if page.form_with(id: 'oobepost')\n skip_trial = page.form\n page = skip_trial.submit(skip_trial.button_with(name: 'skiptrial'))\n end\n end\n page\nend",
"def make_spider\n Mechanize.new do |agent|\n agent.user_agent_alias = 'Mac Safari'\n agent.follow_meta_refresh = true\n # agent.redirect_ok = true\n agent.keep_alive = true\n agent.open_timeout = 60\n agent.read_timeout = 60\n agent.pluggable_parser['audio/mpeg'] = Mechanize::Download\n end\n end",
"def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend",
"def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend",
"def run\n super\n \n require 'nokogiri'\n require 'open-uri'\n require 'cgi'\n \n # Search URI\n search_uri = \"http://www.hoovers.com/search/company-search-results/100005142-1.html?type=company&term=#{@object.name}\"\n doc = Nokogiri::HTML(open(search_uri))\n company_path = doc.xpath(\"//*[@class='company_name']\").first.children.first['href']\n company_uri = \"http://www.hoovers.com#{company_path}\"\n \n # Open Page & Parse\n doc = Nokogiri::HTML(open(company_uri))\n \n # Get Company Profile\n # TODO\n \n # Get Address & Clean up\n address = (doc/\"/html/body/div[3]/div[2]/table/tbody/tr/td/strong/span\").inner_html\n puts \"Got Address: #{address}\"\n \n # Get Users\n user = (doc/\"/html/body/div[3]/div[2]/div[9]/table/tbody/tr/td\").inner_html\n\n unless user.blank?\n names = user.gsub(\"a href=\\\"/marketing/free-trial/100004836-1.html\\\" title=\\\"Email lists, email contacts, contact phone numbers, email leads, phone leads\\\" relatedarticles=\\\"false\\\" id=\\\"100004836\\\">E-mail</a>\",\"\").split(\"<\") \n puts \"Got Users: #{names.join(\" \")}\"\n \n names.each do |name| \n name.gsub!(\" \",\" \")\n fname,lname = name.split(\" \")\n create_object User, { :fname => fname, :lname => lname }\n end\n end\n \n\tnil\nend",
"def crawler_page\n open(crawler_url)\n end",
"def scrape_search_page(agent, alphabetical_search_page, base_url)\n\n # Retrieves paper tags, meaning names and URLs\n paper_tags = alphabetical_search_page.parser.xpath('//tr//td//a')\n paper_urls = paper_tags.map { |link| link['href'] }\n paper_names = paper_tags.map { |link| link.text.strip }\n\n # Creates array of paper download links per page\n paper_links = Array.new\n paper_urls.each do |paper|\n # handles relative URIs && login\n paper_url = base_url + paper\n agent.add_auth(paper_url, ENV['IC_USERNAME'], ENV['IC_PASSWORD'])\n begin\n paper_page = agent.get(paper_url)\n paper_link = paper_page.parser.xpath('//a[contains(text(), \"Download\")]').map { |link| link['href'] }\n paper_links << paper_link[0]\n rescue Exception => e\n puts(e.message)\n end\n end\n\n thread = Thread.new do\n download_files_from_URLs(agent, Dir.pwd, paper_links, paper_names, URI(base_url))\n end\n thread.join\n end",
"def initialize node, page\n @node = node\n @page = page\n @mech = page.mech\n end",
"def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty?\n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then\n uri = URI.parse(page)\n host = "#{uri.scheme}://#{uri.host}"\n open(page, "User-Agent" => USER_AGENT) { |s|\n (Hpricot(s)/"a").each { |a|\n url = scrub(a.attributes['href'], host)\n newfound_pages << url unless url.nil? or !robot.allowed? url or newfound_pages.include? url\n }\n }\n end\n rescue => e\n print "\\n** Error encountered crawling - #{page} - #{e.to_s}"\n rescue Timeout::Error => e\n print "\\n** Timeout encountered - #{page} - #{e.to_s}"\n end\n }\n pages = newfound_pages\n File.open(LAST_CRAWLED_PAGES, 'w') { |out| YAML.dump(newfound_pages, out) }\n end",
"def process_page page_url\n page = SuperCrawler::Scrap.new(page_url) # Scrap the current page\n\n current_page_links = page.get_links # Get current page internal links\n new_links = current_page_links - @links # Select new links\n\n new_links.each { |link| @links_queue.push(link) } # Add new links to the queue\n @links += new_links # Add new links to the links list\n @crawl_results << { # Provide current page crawl result as a hash\n url: page.url, # The crawled page\n links: current_page_links, # Its internal links\n assets: page.get_assets # Its assets\n }\n\n SuperCrawler::Render.log_status( page_url, @crawl_results.length, @links.length ) if @option_debug # Display site crawling status\n end",
"def scrape(options = nil)\n @max_blog_entries = options[:max_blog_entries] if options != nil\n @completed = false\n \n #TODO: pw should be optional\n page = login #if @pw != nil #only do the login thing if you have pw\n page =goto_weblog(page)\n \n #create new xml document from template\n #at some point in future, you want to pass in non-default options here\n create_new_xml_document\n \n scrape_1_page(page)\n next_link = page.links.reject{|i| i.to_s != \"Next 5 >>\" }\n while next_link.size == 1 and @completed != true do\n sleep(1)\n p \"clicking on next link: #{next_link[0].uri.to_s}\"\n page = @agent.click(next_link[0])\n scrape_1_page(page)\n \n #now update the next_link\n next_link = page.links.reject{|i| i.to_s != \"Next 5 >>\" }\n end\n \n #dump @doc out as the output\n file = File.new(\"wordpress.#{Time.now.strftime(\"%Y-%m-%d\")}.xml\", \"w+\")\n file.puts( @doc.inner_html )\n file.close\n \n @doc\n end",
"def scrape_campaigns\n # Initialize crawler\n more_campaigns = true\n campaign_page = 0\n transalt_campaigns = []\n\n puts \"Scraping campaigns...\"\n # Collect all campaigns\n while more_campaigns do\n puts \"Scraping ?page=#{campaign_page}\"\n scraper = CampaignCrawler.new(campaign_page)\n output = scraper.crawl\n\n transalt_campaigns = transalt_campaigns + output['campaigns']\n\n output['campaigns'].empty? ? (more_campaigns = false) : campaign_page +=1\n end\n\n puts \"Scraped #{campaign_page} pages\\n\\n\"\n\n transalt_campaigns\n end",
"def initialize\n @firstpage ||= lambda {\n uri = '/en-us/security/bulletin/dn602597.aspx'\n res = send_http_get_request(\"#{TECHNET}#{uri}\")\n return res.body\n }.call\n end",
"def go(uri)\n\n foaf='http://xmlns.com/foaf/0.1/' \n contact=\"http://www.w3.org/2000/10/swap/pim/contact#\" \n air= 'http://www.megginson.com/exp/ns/airports#'\n\n ayf = SimpleScutter.new uri\n\n pagecount=0\n # a code block to output basic info about each RDF page encountered\n # \n page_summary = Proc.new do |crawler,page| \n puts \"RDFDOC: count='#{pagecount}': uri:#{crawler.uri} gave RDF graph #{page} \\\n\twith #{page.size} triples\\n\" \n pagecount=pagecount+1\n end\n\n # a code block to see if some page provides nearestAirport information: \n #\n # <contact:nearestAirport><wn:Airport air:icao=\"EGGD\" air:iata=\"BRS\"/>...\n #\n airports = Proc.new do |crawler,page| \n\n #page.reg_xmlns 'http://www.megginson.com/exp/ns/airports#', 'air'\n \n rs = page.ask Statement.new(nil, air+\"iata\", nil)\n rs.objects.each do |a|\n a.graph=page\n puts \"AIRPORT: #{a} got airport code in #{crawler.uri})\" if (a.to_s =~ /\\S/) \n end\t\t\t\t\t# the 'if' is fix for parser bug\n end\n\n\n # the mugshots and htmler blocks are related, and share some state:\n report=\"\"\n seenpic=Hash.new(0) \t# counter\n\n # basic image metadata harvesting\n #\n mugshots = Proc.new do |crawler,page|\n images=[]\n img = page.ask Statement.new(nil, foaf+'img', nil)\n img.objects.each {|a| images.push a.to_s }\n img = page.ask Statement.new(nil, foaf+'depiction',nil)\n img.objects.each {|a| images.push a.to_s }\n\t\t # todo: store this state locally instead of inside crawler\n images.each do |pic|\n next if (!pic =~ /\\S/) #bug in Liber RDF parser.\n if seenpic[pic]==0 ### how to do this as a Proc? fixme\n report += \"<img src='#{pic}' width='128' height='128' />\" \n report += \"<!-- linked at: #{crawler.uri} -->\\n\\n\"\n end\n seenpic[pic]=seenpic[pic]+1\n end\n end\n\n # a code block that writes an html page based on the crawler's .out property \n #\n htmler = Proc.new do |crawler,page|\n html = \"<html><head><title>all your foaf depictions...</title></head>\\n<body>\\n\"\n html += \"<h1>AllYourFoaf Image Index</h1>\\n\" \n html += \"<p><strong>stats:</strong>: left.size=#{crawler.left.size} \\\n\tseen.size=#{crawler.seen.size} seenpic.size=#{seenpic.size} current:#{crawler.uri} </p> \"\n html += \"<hr />\\n\\n\" + report\n html += \"</body></html>\\n\\n\"\n SimpleScutter.writefile(crawler.outfile,html)\n end\n\n # stats to be output at start of each loop \n #\n loopstats = Proc.new do |s|\n puts \"INIT: s.left.size=#{s.left.size} s.seen.size=#{s.seen.size} current: #{s.uri}\"\n end\n\n error_logger = Proc.new {|e| puts \"ERROR: #{e}\" }\n\n # register some handlers:\n ayf.pagehandlers.push page_summary, airports, mugshots, htmler\n ayf.inithandlers.push loopstats\n ayf.errorhandlers.push error_logger \n ayf.run # set crawler running!\nend",
"def scrape_more_pages\n\n pages_to_scrape = 0\n\n clear_screen\n clear_screen\n\n # loop untl we get a valid number of pages to scrape\n until pages_to_scrape != 0\n print \"\\nHow many pages would you like to scrape?: \".blue\n pages_to_scrape = gets.chomp.to_i\n end\n\n ending_page = last_scraped_page + pages_to_scrape # calculate our last page number\n @last_scraped_page += 1\n\n puts \"\\n\"\n (@last_scraped_page..ending_page).each.with_index(1) do |page, index|\n progress_bar(index.to_f / pages_to_scrape)\n @scraper.scrape_data_from_url(\"#{@scraper.base_url}#{page}\").each do |job_hash|\n FreelancerFinder::Job.new(job_hash) unless FreelancerFinder::Job.all.detect {|job| job.path == job_hash[:path]} # next create a job instance from the data we just scraped unless it exists already\n end\n end\n\n puts \"\\nSuccesfully Scraped #{pages_to_scrape} Pages!\".magenta\n\n @last_scraped_page = ending_page\n\n FreelancerFinder::Job.all\n end",
"def on page_class, visit=false, &block\n $current_page = page_class.new @browser, visit\n block.call $current_page if block\n $current_page\n end",
"def scrape()\n scrapeForCurrentData\n end",
"def testCrawler()\r\n\t#since no start page is defined it defaults to IU\r\n\tc = Crawler.new(100, \"https://en.wikipedia.org/wiki/Main_Page/\")\r\n\tputs(c)\r\n\tc.hello()\r\n\tputs(c.currentHTMLPage.page.class)\r\n\tputs(c.currentHTMLPage.to_s)\r\n\t#c.savePage()\r\n\t#puts(c.currentHTMLPage.links)\r\n\t#puts(c.currentHTMLPage.lines)\r\n\t#puts(c.currentHTMLPage.rawText)\r\n\t#c.getPage(\"https://www.wikipedia.org/\" , c.currentHTMLPage.address, (c.currentHTMLPage.rank / c.currentHTMLPage.links.size))\r\n\t#puts(c.currentHTMLPage.to_s)\r\n\t#puts(c.currentHTMLPage.index)\r\n\t#testLoad = Crawler.loadCrawledPage()\r\n\tputs(c.pageLimit.to_s)\r\n\tc.crawlPages()\r\nend",
"def initialize\n @api_url = 'http://booking.uz.gov.ua'\n @agent = Mechanize.new\n\n get_token\n set_headers\n end",
"def setup\n\n if BROWSER == \"chrome\"\n @driver = Selenium::WebDriver.for :chrome, switches: %w[--incognito]\n elsif BROWSER == \"firefox\"\n @driver = Selenium::WebDriver.for :firefox\n else\n puts \"invalid browser name\"\n exit\n end\n @driver.manage.delete_all_cookies\n @driver.manage.window.maximize\n puts \"opening website '#{BASE_URL}'\"\n @driver.navigate.to \"#{BASE_URL}\"\n @page_objs = File.read('./page-objects.json')\n @data_hash = JSON.parse(@page_objs)\n\n # this extra sleep is needed if captcha needs to be handled manually\n # sleep 165\n end",
"def before\n\n # executes before anything else\n super()\n \n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n end",
"def perform(url)\n scrape_url(url)\n end",
"def execute\n super()\n\n # executes test case info\n\n # workaround pages that need to login to secondary domains\n auth_workarounds()\n\n # Change this to 0 to get retries in buyflow test\n timeout_count = 1 \n \n begin\n puts @report.url\n\n # Navigate to the site\n @page.browser.driver.browser.get @report.url if(@report.url)\n\n\n\n\n\n # ------------ Marketing section, Landing Page ------------ \n\n @report.browser = @page.browser_name\n\n\n # pull the operating System from the user agent or other sources\n @report.os = @page.os_name\n\n # pull the brand from the page variables or domain\n @report.buyflow_report.brand = @page.brand\n\n # pull the uci code from omniture\n @report.uci_report.uci_mp = @page.uci\n\n if(@configuration['Brand'] == 'Marajo' || @configuration['Brand'] == 'smileactives')\n puts \"products hiiiiiiiii\"\n @page = @page.go_to_productpage()\n puts \"done product button\"\n else\n puts \"going to order page\"\n @page = @page.go_to_orderpage()\n puts @page\n puts \"done fetching orderpage\"\n end\n\n # navigate to the SAS page if that page section isn't present.\n # @page = @page.go_to_orderpage()\n\n\n\n\n @report.buyflow_report.lastpagefound = \"sas\"\n\n # ------------ SAS Section ------------ \n\n @report.uci_report.uci_sas = @page.uci\n \n # If an offer is not present in test\n if(@offer == nil)\n # navigate to the cart using default options\n @page = @page.skip_to_cart\n else\n # ...otherwise select the options defined by the offer\n \n @page = @page.select_options(@offer)\n end\n\n # exclude_from_selection_workaround = BrandsExcludedSelectionWorkaround.all.select('brand').collect(&:brand)\n # if(@offer)\n # if(timeout_count == 1 && @offer['OfferCode'])\n # if(exclude_from_selection_workaround.include?(@configuration[\"Brand\"].downcase) == false)\n # selection_workaround(@page.browser)\n # end\n # end\n # end\n\n \n\n\nputs \"Proceed to cart section\"\n\n # ------------ Cart Section ------------ \n\n @report.uci_report.uci_op = @page.uci\n\n @report.buyflow_report.lastpagefound = \"cart\"\n\n @report.buyflow_report.offer_code = @page.offercode\n puts \"offercode\"\n puts @report.buyflow_report.offer_code\n\n @report.grcid = @page.grcid\n puts \"grcid\"\n puts @report.grcid\n\n # catch_and_display_error do\n\n @report.buyflow_report.total_pricing = @page.total_pricing\n puts \"total_pricing\"\n puts @report.buyflow_report.total_pricing\n\n @report.buyflow_report.subtotal_price = @page.subtotal_price\n puts \"subtotal_price\"\n puts @report.buyflow_report.subtotal_price\n\n # pull the pricing for the SAS for any sections still in the same page as the cart\n begin\n @report.buyflow_report.saspricing = @page.check_sas_pricing(@report.buyflow_report.subtotal_price)\n rescue => e\n @report.buyflow_report.saspricing = \"No Offer Associated with this Test\"\n end\n \n @report.buyflow_report.saspricing = '' if @report.buyflow_report.saspricing == nil\n puts \"saspricing\"\n puts @report.buyflow_report.saspricing\n @report.buyflow_report.sasprices = @page.check_sas_prices\n puts \"sasprices\"\n puts @report.buyflow_report.sasprices\n\n # pull the cart description from the order summary section\n @report.buyflow_report.cart_language = @page.cart_description\n puts \"cart description\"\n puts @report.buyflow_report.cart_language\n\n @report.buyflow_report.cart_title = @page.cart_title\n puts \"productname\"\n puts @report.buyflow_report.cart_title\n\n @report.buyflow_report.sas_kit_name = @page.check_sas_kit_name(@report.buyflow_report.cart_title)\n\n @report.buyflow_report.kitnames = @page.cart_title\n\n @report.buyflow_report.cart_quantity = @page.quantity\n puts \"quantity\"\n puts @report.buyflow_report.cart_quantity\n\n if(@report.buyflow_report.cart_quantity.nil?)\n @report.buyflow_report.cart_quantity = \"[Quantity Dropdown Missing] - Locator may be missing\"\n end\n\n @report.buyflow_report.shipping_standard = @page.shipping('Standard')\n puts \"shipping\"\n puts @report.buyflow_report.shipping_standard\n \n # Rush Shipping\n @report.buyflow_report.shipping_rush = @page.shipping('Rush') \n\n # Overnight Shipping\n @report.buyflow_report.shipping_overnight = @page.shipping('Overnight')\n\n @report.buyflow_report.shipping_standard = 'N/A' if @report.buyflow_report.shipping_standard.nil?\n \n @report.buyflow_report.shipping_rush = 'N/A' if @report.buyflow_report.shipping_rush.nil?\n\n @report.buyflow_report.shipping_overnight = 'N/A' if @report.buyflow_report.shipping_overnight.nil?\n\n if(@offer)\n @offer.each do |offer|\n # Continuity Shipping \n @report.buyflow_report.continuity_shipping = @page.continuity(offer)\n puts \"Continuity\"\n puts @report.buyflow_report.continuity_shipping\n end\n end\n # end\n\n # get the shipping selection price\n puts \"cart_shipping_selection_price\"\n cart_shipping_selection_price = @page.current_shipping_cost\n puts cart_shipping_selection_price\n\n @page.place_order(@configuration['ConfEmailOverride'])\n\n # Submit order in order to reach confirmation page\n @page = @page.submit_order\n\n # ------------ Confirmation Page ------------\n\n puts \"proceeding to confirmation page\"\n\n @page.expand_order_details()\n \n # pull the confirmation number\n @report.buyflow_report.confirmation_number = @page.get_confirmation_number\n\n @report.buyflow_report.lastpagefound = \"confirmation page\"\n # pull the uci number for the confirmation page\n @report.uci_report.uci_cp = @page.uci\n\n # Compare the billing and shipping information to the data that was entered in the cart\n check_billing_info(@report.buyflow_report, @page)\n\n # get the offer code from the confirmation page\n @report.buyflow_report.confoffercode = @page.offercode\n\n # get the confirmation page pricing for the main product\n @report.buyflow_report.confpricing = @page.confpricing\n\n # check the shipping price matches the shipping selected in the cart\n puts \"shipping_conf\"\n shipping_conf = @page.conf_shipping_price\n puts shipping_conf\n\n if(shipping_conf == cart_shipping_selection_price)\n @report.buyflow_report.shipping_conf = \"match\"\n @report.buyflow_report.shipping_conf_val = shipping_conf\n @report.buyflow_report.selected_shipping = cart_shipping_selection_price\n else\n begin\n @report.buyflow_report.shipping_conf_val = shipping_conf\n\n rescue\n end\n begin\n @report.buyflow_report.selected_shipping = cart_shipping_selection_price\n rescue\n\n end\n begin\n @report.buyflow_report.shipping_conf = shipping_conf.to_s + \" - expected: \" + cart_shipping_selection_price.to_s\n rescue\n @report.buyflow_report.shipping_conf = \"Problem with gathering data: confirmation - \" + shipping_conf.class.to_s + \" cart - \" + cart_shipping_selection_price.class.to_s\n end\n end\n\n @report.buyflow_report.conf_kit_name = @page.cart_title\n\n # -------- Failure Checks ---------\n if(@report.grcid.nil?)\n fail 'GRCID not found for this page (AKA Campaign Code)'\n end\n\n if(@report.uci_report.uci_mp.nil?)\n fail 'UCI code for Marketing section was not found'\n end\n\n if(@report.uci_report.uci_op.nil?)\n fail 'UCI code for Cart section was not found'\n end\n \n if(@report.uci_report.uci_sas.nil?)\n fail 'UCI code for SAS section was not found'\n end \n \n if(@report.uci_report.uci_cp.nil?)\n fail 'UCI code for Confirmation page was not found'\n end\n\n if(@report.buyflow_report.subtotal_price.nil?)\n fail 'subtotal price was not found'\n end\n\n if(@report.buyflow_report.cart_title.to_s.downcase.include? 'kit')\n if(@report.buyflow_report.cart_language.nil?)\n fail 'cart language was not found'\n end\n end\n\n if(@report.buyflow_report.cart_title.nil?)\n fail 'cart title was not found'\n end\n\n # Check Shipping matches given offer if present\n if(@offer)\n if(@offer.length == 1)\n @offer.each do |offer|\n if(@report.buyflow_report.shipping_standard != offer['StartSH'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Entry -a #{@report.buyflow_report.shipping_standard} -e #{offer['StartSH'].gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_rush != offer['Rush'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Rush -a #{@report.buyflow_report.shipping_rush} -e #{offer['Rush'].gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_overnight != offer['OND'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - OND -a #{@report.buyflow_report.shipping_overnight} -e #{offer['OND'].gsub('$','').strip()}\"\n end\n end\n else\n standard_data = ''\n rush_data = ''\n ond_data = ''\n if((@report.buyflow_report.cart_title.to_s.downcase.include? 'kit') && (@report.buyflow_report.brand == 'Marajo'))\n @offer.each do |offer|\n next unless offer.Offer.to_s.downcase.include? 'kit'\n standard_data = offer['StartSH'].gsub('$','').strip()\n rush_data = offer['Rush'].gsub('$','').strip()\n ond_data = offer['OND'].gsub('$','').strip()\n break\n end\n else\n standard_data = '$0.00'\n @offer.each do |offer|\n rush_data = offer['Rush'].gsub('$','').strip()\n ond_data = offer['OND'].gsub('$','').strip()\n break\n end\n end\n \n if(@report.buyflow_report.shipping_standard != standard_data.gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Entry -a #{@report.buyflow_report.shipping_standard} -e #{standard_data.gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_rush != rush_data)\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Rush -a #{@report.buyflow_report.shipping_rush} -e #{rush_data}\"\n end\n\n if(@report.buyflow_report.shipping_overnight != ond_data)\n fail \"Shipping price did not match - #{offer.Offer.to_s} - OND -a #{@report.buyflow_report.shipping_overnight} -e #{ond_data}\"\n end\n end\n end \n\n if(@report.buyflow_report.conf_kit_name.nil?)\n fail 'confirmation kit name was not found'\n end\n\n if(@report.buyflow_report.confpricing.nil?)\n fail 'confirmation price was not found'\n end\n\n if(@report.buyflow_report.billname == 'FAILED' || @report.buyflow_report.billaddress == 'FAILED' || @report.buyflow_report.billemail == 'FAILED' || @report.buyflow_report.shipaddress == 'FAILED')\n fail 'The billing/shipping info on the confirmation page did not match data input on cart page'\n end\n\n if(@report.buyflow_report.shipping_conf != 'match')\n fail 'Shipping did not match cart on confirmation page' \n end\n\n if(@report.buyflow_report.confoffercode.nil?)\n fail 'Could not find Offer code on the confirmation page'\n end\n\n if(@report.buyflow_report.offer_code.nil?)\n fail 'Could not find Offer code on the cart page'\n end\n\n if(@offer)\n @offer.each do |offer|\n puts @report.buyflow_report.offer_code\n puts @report.buyflow_report.confoffercode\n puts offer.OfferCode.to_s\n if(@report.buyflow_report.expected_offer_code)\n if @report.buyflow_report.offer_code.to_s.downcase.include?(offer.OfferCode.to_s.downcase) == false\n raise \"OfferCode didn't match in cart page\"\n end\n end\n\n if(@report.buyflow_report.expected_offer_code)\n if @report.buyflow_report.confoffercode.to_s.downcase.include?(offer.OfferCode.to_s.downcase) == false\n raise \"OfferCode didn't match in confirmation page\"\n end\n end\n# puts offer.offer_data_detail.offerdesc\n# puts @report.buyflow_report.cart_language\n if(offer.offer_data_detail)\n if(@report.buyflow_report.cart_language)\n if cleanup_format(@report.buyflow_report.cart_language).include?(cleanup_format(offer.offer_data_detail.offerdesc)) == false\n raise \"Cart language did not match\"\n end\n end\n\n if(@report.buyflow_report.cart_title)\n if @report.buyflow_report.cart_title.to_s.downcase.include?(offer.offer_data_detail.offer_title.to_s.downcase) == false\n raise \"Cart title did not match\"\n end\n end\n else\n if(@report.buyflow_report.cart_title)\n if @report.buyflow_report.cart_title.to_s.downcase.include?(offer.Offer.to_s.downcase) == false\n raise \"Cart title did not match\"\n end\n end\n end\n end\n end\n\n # ------- end of testing --------\n\n\n rescue T5::PasswordMatchException => e\n raise e\n\n rescue Net::ReadTimeout, Selenium::WebDriver::Error::UnknownError => e\n net_timeout_timeout = 0\n begin\n net_timeout_timeout += 1\n sleep(5)\n soft_browser_quit()\n # create browser for new attempt\n @browser = BrowserFactory.create_browser(@browsertype)\n\n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n auth_workarounds()\n exp = @report.buyflow_report.expected_offer_code\n @report.buyflow_report = GRReporting::BuyflowReport.new()\n @report.buyflow_report.expected_offer_code = exp\n rescue => exc\n if net_timeout_timeout < 5\n retry\n else\n raise e\n end\n end\n retry\n rescue => e\n timeout_count += 1;\n # Change the limit of retries here.\n raise e if(timeout_count > 1)\n soft_browser_quit()\n @browser = BrowserFactory.create_browser(@browsertype)\n\n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n auth_workarounds()\n exp = @report.buyflow_report.expected_offer_code\n @report.buyflow_report = GRReporting::BuyflowReport.new()\n @report.buyflow_report.expected_offer_code = exp\n retry\n end\n end",
"def use_agent=(use_agent); end",
"def perform\n @page_source = search_google\n @links = count_links\n @results = search_stats\n @ad_words = ad_words_count\n @html = html_source\n @page_source.quit # quits the webdriver.\n\n self # returns the self object with readable attribures.\n end",
"def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty? \n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then \n uri = URI.parse(page)\n host = \"#{uri.scheme}://#{uri.host}\"\n open(page, \"User-Agent\" => USER_AGENT) { |s|\n (Hpricot(s)/\"a\").each { |a| \n url = scrub(a.attributes['href'], host)\n newfound_pages << url unless url.nil? or !robot.allowed? url or newfound_pages.include? url\n }\n } \n end\n rescue => e \n print \"\\n** Error encountered crawling - #{page} - #{e.to_s}\"\n rescue Timeout::Error => e\n print \"\\n** Timeout encountered - #{page} - #{e.to_s}\"\n end\n }\n pages = newfound_pages\n File.open(LAST_CRAWLED_PAGES, 'w') { |out| YAML.dump(newfound_pages, out) }\n end \n end",
"def initialize\n @agent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }\n end",
"def initialize(web_browser, visit = false)\n super(web_browser, nil)\n @page_ready_limit = DEFAULT_PAGE_READY_LIMIT\n goto if visit\n end",
"def scrape(url)\n\t\n $log.info \"START #{__FILE__}.#{__method__}\"\n\t\n \n def initialize \n super ARGV[0],\"groupon\"\n end\n \n begin\n html = open(url)\n doc = Nokogiri::HTML(html.read)\n doc.encoding = \"utf-8\"\n $log.info \"Open url : #{url}\"\n\n $log.info \"Fetching from : #{url}\"\n \n title \t\t= doc.at_xpath($deal_config[$site_name][\"title\"])\n deal_url\t= URI.parse(url)\n price \t\t= doc.at_xpath($deal_config[$site_name][\"price\"])\n location \t= doc.at_xpath($deal_config[$site_name][\"location\"])\n sold \t\t= doc.at_xpath($deal_config[$site_name][\"sold\"])\n items\t\t= doc.at_xpath($deal_config[$site_name][\"items\"])\n category\t= doc.at_xpath($deal_config[$site_name][\"category\"])\n deal_thumb\t= doc.at_xpath($deal_config[$site_name][\"deal_thumb\"])['src']\n description = doc.at_xpath($deal_config[$site_name][\"description\"]) \n discount = doc.at_xpath($deal_config[$site_name][\"discount\"])\n expiry = doc.at_xpath($deal_config[$site_name][\"expiry\"])['value'] \n city = doc.at_xpath($deal_config[$site_name][\"location_city\"])\n\n # check if there is an imagemap\n # if so, insert latitude and longitude\n # else try geocoding\n image_map = doc.at_xpath($deal_config[$site_name][\"image_map\"])\n lat = nil\n long = nil\n if !image_map.nil? && image_map.to_s != \"\"\n uri = URI.parse(URI.encode(image_map['src']))\n uri_params = CGI.parse(uri.query)\n if !uri_params[\"center\"].nil?\n lat, long = uri_params[\"center\"][0].chomp.split(',')\n end\n \n else\n # geocode address\n loc=GeoKit::Geocoders::MultiGeocoder.geocode(location.content.to_s.strip) \n if !loc.success\n #if loc.lat.nil?\n lat = nil \n long = nil\n elsif loc.success\n lat = loc.lat\n long = loc.lng\n end\n end\n \t\t\n $arr_deals << Deal.new(title, deal_url, deal_thumb, price, location, sold, items, category, description, lat, long, discount)\n \n # set the following to site name\n $arr_deals[-1].author = $deal_config[$site_name][\"author\"]\n \n # specialized code for expiry\n time = Time.now + expiry.to_i/1000\n $arr_deals[-1].expiry = time.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n # add city to location 20120328\n cit = city.content.to_s.strip\n $arr_deals[-1].location += \", #{cit}\"\n # puts $arr_deals[-1].location\n \n # print ...\n #\t\tputs \"#{$arr_deals[-1].title} \\n\"\n #\t\tputs \"#{$arr_deals[-1].price} \\n\"\n #\t\tputs \"#{$arr_deals[-1].sold} \\n\"\n # \tputs \"#{$arr_deals[-1].items} \\n\"\n #\t\tputs \"#{$arr_deals[-1].location} \\n\"\n #\t\tputs \"#{$arr_deals[-1].deal_url} \\n\"\n #\t\tputs \"#{$arr_deals[-1].deal_thumb} \\n\"\n #\t\tputs \"#{$arr_deals[-1].category} \\n\"\n #\t\tputs \"#{$arr_deals[-1].description} \\n\"\n #\t\tputs \"#{$arr_deals[-1].latitude} \\n\"\n #\t\tputs \"#{$arr_deals[-1].longitude} \\n\"\n #\t\tputs \"#{$arr_deals[-1].discount} \\n\"\n\n $insert_number += 1\n puts \"inserting deal #{$insert_number}...\"\n $db.insert_deal($arr_deals[-1])\n \n $log.info \"Successfully retrieved data : #{url}\"\n\n rescue Exception=>e\n\t\n print \"Could not retrieve values. Maybe the site has changed?\"\n $log.error e.to_s\n puts e.to_s\n\t\t\n end\n\t\n $log.info \"END #{__FILE__}.#{__method__}\"\n\t\n end",
"def initialize node, page\n\t\t@node = node\n\t\t@page = page\n\t\t@mech = page.mech\n\tend",
"def crawl(options = {})\n unless @proxy_addr.nil? || @proxy_port.nil?\n @agent.set_proxy @proxy_addr, @proxy_port\n end\n\n @errors = []\n i = 0\n each_url do |url, handler, default_data|\n break if options[:max_urls] && i >= options[:max_urls]\n begin\n if @random_proxy == true\n proxy = ip_cycle\n @proxy_addr = proxy[:ip]\n @proxy_port = proxy[:port]\n @agent.set_proxy @proxy_addr, @proxy_port\n end\n page = @agent.get(url)\n Spidey.logger.info \"Handling #{url.inspect} - Proxy:#{@proxy_addr}:#{@proxy_port}\"\n send handler, page, default_data\n rescue => ex\n add_error url: url, handler: handler, error: ex\n end\n sleep request_interval if request_interval > 0\n i += 1\n end\n end",
"def initialize\n set_robot_agents\n end",
"def generate_stories(start_page)\n require 'open-uri'\n debug = false\n\n if !debug\n\n # Open the first page To get the page numbers\n doc = Nokogiri::HTML(open('http://www.fanfiction.net/tv/Glee/'))\n #get the number of pages to scrape\n pages = []\n doc.xpath('//center/a').each do |page|\n pages.push(page.content)\n @pages = pages[pages.length-2].gsub!(',', '').to_i\n #last page is the second to last linked page\n end\n end\n\n # hard coding pages for now to save some time\n # in a for loop from 1 - number of pages\n if debug\n puts \"Debugging Mode Enabled\"\n @pages = 4\n end\n\n (start_page..@pages).each do |i|\n if debug\n doc= Nokogiri::HTML(open(\"/Users/paigep/Documents/scraper/test#{i}.html\"))\n else\n begin\n doc = Nokogiri::HTML(open(\"http://www.fanfiction.net/tv/Glee/10/0/0/1/0/0/0/0/0/#{i}/\"))\n parse_doc(doc)\n rescue\n print \"Connection failed: #{$!}\\n On Page: #{i}...Restarting...\"\n generate_stories(i) # restart the generating on the failed page\n next\n end\n end\n end\n end",
"def fetch\n hydra = Typhoeus::Hydra.new(:max_concurrency => @threads)\n page, pages = nil, []\n\n @urls.each do |url|\n request = Typhoeus::Request.new(url, :timeout => @timeout, :followlocation => false, :headers => {\"Accept\" => \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\", \"Cache-Control\" => \"no-cache\", \"Pragma\" => \"no-cache\", \"User-Agent\" => UserAgents.random})\n request.on_complete do |response|\n uri = URI(url)\n if response.success?\n puts \"fetching #{url}\".green.on_black\n page = Page.new(uri, response_code: response.code,\n response_head: response.headers,\n response_body: response.body,\n response_time: response.time*1000,\n crawled_time: (Time.now.to_f*1000).to_i)\n elsif (300..307).include?(response.code)\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### redirect to #{response.headers['Location']}\".white.on_black\n page = Page.new(uri, response_code: response.code,\n response_head: response.headers,\n response_body: response.body,\n response_time: response.time*1000,\n redirect_url: response.headers['Location'])\n elsif 404 == response.code\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### not found #{url}\".magenta.on_black\n page = Page.new(uri, response_code: response.code,\n response_time: response.time*1000)\n else\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### failed #{url}\".magenta.on_black\n puts \"### Time: #{response.time} ### #{response.return_message}\".magenta.on_black\n page = Page.new(uri, response_code: response.code,\n response_time: response.time*1000)\n end\n pages << page\n end\n hydra.queue(request)\n end\n hydra.run\n return pages\n end",
"def start(url, conf)\n # Using Absolute value of the constant here\n # Since there is no need to pass the form selector\n # When it is going to be in the global namespace anyway\n login_form = @agent.get(url).form(Configuration::AppConfig::FORM_CSS_SELECTOR)\n login_form = fill(login_form, conf)\n\n # First response page\n # This page corresponds to\n # confirm Mobile number, CGPA page\n response_page = submit_form(login_form)\n\n # Needn't tamper with mobile number / student CGPA\n # I'm assuming it is filled by default\n # Response to Mob/CGPA page is PU/Student Home\n @student_home = submit_form(response_page.form(Configuration::AppConfig::FORM_CSS_SELECTOR))\n\n # Extract unread notifications\n # using regex on appropriate element(s)\n # @TODO Hack alert! find a better way to match notification count\n # @TODO Potential bug: add a begin...rescue NoMethodError for match returning nil\n @unread_notification_count = @student_home.links[5].text.match(/[0-9]+/).to_s.to_i\n\n # Click to go to the notices page\n # And get pdf links for unread notifications\n if unread_notification_count.zero?\n # Action for no new\n Greeting.dl(:new => false, :username => conf.client_data.username)\n else\n # Action for new notifications found\n # Scan notices page for links and click\n # Extract unread links into an Array\n notice_page = @student_home.link_with(text: @student_home.links[5].text).click\n unread_links = notice_page.links_with(text: \"Download\")[0...unread_notification_count]\n\n # Greetz?\n Greeting.dl(:new => true, :username => conf.client_data.username, :file_count => unread_links.count)\n save_pdfs(unread_links)\n end\n\n end",
"def initialize(db)\n @db = db\n #initialize the scraper with a database\n end",
"def agent\n @agent\n end",
"def acquire(links, agent)\n puts \"Acquiring data...\".foreground(:cyan)\n\n links.each do |link|\n name = link.inner_html.to_s\n code = link[\"href\"].to_s.sub course_url, \"\"\n\n if name == \"\" || code == \"\"\n raise \"Incorrect parsing. Please contact the developer.\".foreground(:red)\n end\n \n grade = Grade.new name, code, agent\n course = Course.new name, code, grade\n\n @learn_courses << course\n @learn_grades << grade\n end \n end",
"def initialize\n super # required for creating logger and directory\n # define @mechanize = Mechanize.new { |agent| agent.open_timeout...} if you need add some options to mechanize agent\n # your code here\n end",
"def initialize(agent_alias)\n @agent = Mechanize.new\n @agent.user_agent_alias = agent_alias\n\n end",
"def run(search_opts)\r\n\r\n # We need to close the processors if user presses ctrl-c.\r\n trap(\"INT\") do \r\n puts \"\\n**Interrupt received**\\n***Closing processors...\\n\"\r\n close_processors(search_opts.processor_instances)\r\n Process.exit\r\n end\r\n\r\n Anemone.crawl(search_opts.url, :user_agent => search_opts.user_agent, :verbose => true) do |anemone|\r\n anemone.skip_links_like(search_opts.skip_patterns || [])\r\n\r\n # At least one search processor must be specified.\r\n anemone.on_every_page do |page|\r\n search_opts.processor_instances.each do |processor|\r\n processor.process_page(page, anemone.pages)\r\n end\r\n end\r\n\r\n # Close callback on all processors.\r\n anemone.after_crawl do |pages|\r\n close_processors(search_opts.processor_instances)\r\n end\r\n\r\n end\r\n end",
"def agent\n @agent ||= Sawyer::Agent.new('', sawyer_options) do |http|\n http.headers[:user_agent] = user_agent\n end\n end",
"def on(page_class, browser = @browser)\n page = page_class.new(browser)\n yield page if block_given?\n page\n end",
"def scraper\n\turl = \"https://www.indeed.com/jobs?q=Ruby%20on%20Rails&l&vjk=ac03f2f61f05d2b8\"\n\tunparsed_page = HTTParty.get(url) if url\n\n\tparsed_page = Nokogiri::HTML(unparsed_page.body)\n\tjobs = Array.new\n\tjob_listings = parsed_page.css('td.resultContent')\n\t\n\t# starting page\n\tpage = 1\n\t# Get # of listings per page\n\tper_page =job_listings.size\n\t# Get total listings. \tsuper fragile clean up of the total\n\ttotalListings = parsed_page.css('div#searchCountPages').text.split(' ')[3].gsub(',','').to_i\n\tlast_page = (totalListings.to_f / per_page).round\n\n\t# Loop through pages see https://www.youtube.com/watch?v=b3CLEUBdWwQ&t=385s 26:30\n\tjob_listings.each do |job_listing|\n\t\tjob = {\n\t\t\ttitle: job_listing.css('div.singleLineTitle').text,\n\t\t\tcompany: job_listing.css('span.companyName').text,\n\t\t\tlocation: job_listing.css('div.companyLocation').text,\n\t\t\trating: job_listing.css('span.ratingsDisplay').text,\n\t\t\tsalary: job_listing.css('.salary-snippet-container').text\n\t\t}\n\t\tjobs << job\n\tend\n\tbyebug\nend",
"def continue_crawl\n # puts \"I am on #{@url} (#{@links.size} links)-> I want to navigate to #{@links.map{|l| l['href']}}\" #links - Array\n\n @links.each_with_index do |link, i|\n href = link[\"href\"]\n next if href.blank? or (href.split('/').last && href.split('/').last.starts_with?(\"#\"))\n if not href.starts_with?(\"htt\")\n href = href[1..-1] if href.starts_with?('/')\n href = @stored_page.domain + '/' + href\n end\n if page_found = Page.find_by_address_and_crawler_id(href, @crwlr.id)\n #puts \"Loop for #{href}\"\n if @stored_page #Page\n @stored_page.pages << page_found\n end\n else\n #puts \"Adding job for CID: #{@crwlr.id} HREF: #{href} SPID: #{@stored_page.id} #{} #{} #{}\"\n @stack.enqueue Crawl.new(@crwlr.id, href, @depth+1, @stack, @stored_page.id, @options)\n end\n end\n end",
"def visit_page \n visit URL \n end",
"def page_load; end",
"def user_agent=(user_agent); end"
] |
[
"0.68575025",
"0.6791944",
"0.67878217",
"0.67681825",
"0.6592999",
"0.6542702",
"0.65378666",
"0.6483583",
"0.64605254",
"0.643426",
"0.638668",
"0.6369418",
"0.6363492",
"0.63087505",
"0.6293656",
"0.62583214",
"0.62583214",
"0.624673",
"0.6234375",
"0.6192175",
"0.6176534",
"0.6167262",
"0.6166479",
"0.61660576",
"0.61510813",
"0.61371744",
"0.61369836",
"0.6081554",
"0.60690796",
"0.6067802",
"0.6052238",
"0.60511315",
"0.6019676",
"0.5989533",
"0.5967974",
"0.59632504",
"0.5963208",
"0.59627575",
"0.5957297",
"0.5953431",
"0.59276974",
"0.5920941",
"0.5920941",
"0.5900929",
"0.58907425",
"0.58867806",
"0.58792955",
"0.58792955",
"0.5848458",
"0.58326054",
"0.58326054",
"0.58326054",
"0.58326054",
"0.58134407",
"0.58116",
"0.58052635",
"0.58052635",
"0.5801436",
"0.579695",
"0.57853043",
"0.577339",
"0.57700306",
"0.57613945",
"0.5758786",
"0.5758574",
"0.57461417",
"0.57371396",
"0.5736625",
"0.57362026",
"0.57270175",
"0.57229733",
"0.57198966",
"0.57190394",
"0.5707015",
"0.57048404",
"0.56778437",
"0.5674157",
"0.566835",
"0.5660522",
"0.56464344",
"0.56444126",
"0.5641073",
"0.56371486",
"0.5629651",
"0.5612297",
"0.5611811",
"0.56056404",
"0.5600193",
"0.55854094",
"0.55809957",
"0.55800843",
"0.557904",
"0.55702263",
"0.55669826",
"0.55630815",
"0.5558602",
"0.55518275",
"0.55510926",
"0.55507606",
"0.55353427",
"0.55245715"
] |
0.0
|
-1
|
Providers will often require you to login or otherwise prepare to actual scrape the contacts
|
def prepare; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scrape_contacts; end",
"def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end",
"def scrape_contacts \n unless auth_cookie = agent.cookies.find{|c| c.name =~ /^Auth/}\n raise( Blackbook::BadCredentialsError, \"Must be authenticated to access contacts.\" )\n end\n \n # jump through the hoops of formulating a request to get printable contacts\n uri = agent.current_page.uri.dup\n inputs = agent.current_page.search(\"//input\")\n user = inputs.detect{|i| i['type'] == 'hidden' && i['name'] == 'user'}\n utoken = user['value']\n\n path = uri.path.split('/')\n path.pop\n path << 'addresslist-print.aspx'\n uri.path = path.join('/')\n uri.query = \"command=all&sort=FirstLastNick&sortDir=Ascending&nameFormat=FirstLastNick&user=#{utoken}\"\n page = agent.get uri.to_s\n\n # Grab all the contacts\n rows = page.search(\"table tr\")\n name, email = nil, nil\n \n results = []\n rows.each do |row|\n new_name = row.search(\"span[@class='fullName']\").inner_text.strip\n if name.blank? || !new_name.blank?\n name = new_name\n end\n next if name.blank?\n \n email = row.search(\"td[@class='sectionContent'] span:last\").inner_text.strip\n next if email.blank?\n \n results << {:name => name, :email => email}\n name, email = nil, nil\n end\n results\n end",
"def scrape_contacts\n unless agent.cookies.find{|c| c.name == 'MSPPre' && c.value == options[:username]}\n raise( Blackbook::BadCredentialsError, \"Must be authenticated to access contacts.\" )\n end\n\n page = agent.get('PrintShell.aspx?type=contact')\n rows = page.search(\"//div[@class='ContactsPrintPane cPrintContact BorderTop']\")\n rows.collect do |row|\n vals = {}\n row.search(\"table/tr\").each do |pair|\n key = pair.search(\"td[@class='TextAlignRight Label']\").first.inner_text.strip rescue nil\n next if key.nil?\n val = pair.search(\"td[@class='Value']\").first.inner_text.strip\n vals[key.to_sym] = val\n end\n vals[:name] = vals['Name:'.to_sym] rescue ''\n vals[:email] = (vals['Personal e-mail:'.to_sym] || vals['Work e-mail:'.to_sym] || vals['Windows Live ID:'.to_sym]).split(' ').first rescue ''\n vals\n end\n end",
"def index\n ignore = contact_emails_rejected\n @contacts = resource_owner.contacts.reject do |c|\n ignore.include?(c.emailaddress.downcase)\n end.each{ |c| authorize c }\n session[:ret_url] = contacts_path\n end",
"def contacts\r\n\r\n end",
"def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end",
"def contacts\n\t\t@user = current_user\n\t\tcheck_if_myself\n\t\t@contacts = @user.contacts\n\tend",
"def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end",
"def add_contacts\n \tap \"adding contacts\"\n # asking whether we are already authorized\n AddressBook.request_authorization unless AddressBook.authorized?\n\n \n if AddressBook.authorized?\n 25.times do\n person = AddressBook::Person.create(\n :first_name => Forgery::Name.first_name, \n :last_name => Forgery::Name.last_name, \n :email => [{ :value => Forgery(:internet).email_address , :label => 'Home'}], :phones => [{ :value => rand(10 ** 10).to_s, :label => 'Mobile'}])\n end\n else\n #ap \"This app is not authorized to access the address book.\"\n end\n #enVd\n end",
"def contactus\r\n end",
"def fetch_contact_info\n lambda {\n user.vet360_contact_info\n }\n end",
"def index\n # only show contacts for current login user\n @user = User.find_by_id(current_user.id)\n if (!@user.nil?)\n @contacts = @user.contacts\n end\n end",
"def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end",
"def index\n #@contacts = Contact.all\n @contacts = current_user.contacts\n\n if session[:xero_auth] && $xero\n begin\n @remote_contacts = $xero.Contact.all(:order => 'Name')\n rescue\n #expired session\n session[:xero_auth] = nil\n $xero = nil\n end\n else\n @remote_contacts = []\n end\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def prepare_contacts\n return unless defined? @user\n @user.user_default_emails.sort_by{|a| a.role_id.to_i}\n end",
"def contact; end",
"def contactus\n end",
"def contact \n\n end",
"def contact\n\n end",
"def contact\n\n end",
"def request_contacts\n\t\tname = params[:name]\t\t\t\t\t\t\t\n\t\temail = params[:email]\n\t\ttelephone = params[:telephone]\n\t\tmessage = params[:message]\n\t\tif email.blank?\n\t\tflash[:alert] = I18n.t('request_contacts.no_email')\n\t\telse\n\t\t\tContactMailer.contact_email(email, name, telephone, message).deliver_now\n\t\t# Send an email\n\t\tflash[:notice] = I18n.t('request_contacts.email_sent')\n\t\tend\n\t\tredirect_to root_path\n\n\n\tend",
"def list_contact_methods\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:contact_methods_page] = params['page']\n\n\t\t render_list_contact_methods\n\n\t\t return \n\telse\n\t\tsession[:contact_methods_page] = nil\n\tend\n\n\tlist_query = \"@contact_method_pages = Paginator.new self, ContactMethod.count, @@page_size,@current_page\n\t @contact_methods = ContactMethod.find(:all,\n\t\t\t\t :limit => @contact_method_pages.items_per_page,\n\t\t\t\t :offset => @contact_method_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_contact_methods\nend",
"def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end",
"def index\n\t\t@page_title = \"My Contacts\"\n\t\t@contacts = current_agendify_user.contacts\n\tend",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def app_contact\n end",
"def contacts\n contact_client.contacts\n end",
"def index\n\t\t@contacts = current_user.contacts.get_active_contacts\n\tend",
"def common\n #if Contact.where(:organization_id => current_user.organization.id).any?\n # #@users = current_user.organization.contacts.group_by{|u| u.first_name[0]}\n # @users = Contact.where(:organization_id => current_user.organization.id).order(\"name,first_name\")\n #end\n # Contact.all.each do |contact|\n # contact.update_column :created_by, current_user.id\n # end\n begin\n lastcontact = current_user.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n unless lastcontact.present?\n lastcontact = current_user.organization.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n\n end\n if lastcontact.present?\n if lastcontact && lastcontact.activity_type == \"IndividualContact\"\n @contact = IndividualContact.find(lastcontact.activity_id)\n get_contact_attrs\n elsif lastcontact && lastcontact.activity_type == \"CompanyContact\"\n @contact = CompanyContact.find(lastcontact.activity_id)\n get_contact_attrs\n end\n else\n contacts=current_user.organization.individual_contacts\n @contact = contacts.last\n get_contact_attrs\n end\n rescue ActiveRecord::RecordNotFound\n flash[:bowarning]=\"It seems you don't have sufficient privilege to access this item or something went wrong with your account permissions. Please contact Admin to get this fixed.\"\n #redirect_to contacts_path\n end\n\n end",
"def contacts\n @contacts = @seller.get_contacts\n end",
"def find_contacts\n logger.debug \"**** FIND CONTRIBUTORS ****\"\n show_params(params) #debug params and put them in logs\n \n \n @person_query = params[:search][:person]\n @org_query = params[:search][:organisation]\n \n \n #This populates @contacts \n @found_contacts = search_by_name_and_organisation(@person_query, @org_query)\n session[:contacts_from_search] = @found_contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n render :layout => false\n end",
"def get_google_contacts\n url = \"https://www.google.com/m8/feeds/contacts/default/full?access_token=#{token}&alt=json&max-results=100\"\n response = open(url)\n json = JSON.parse(response.read)\n my_contacts = json['feed']['entry']\n\n my_contacts.each do |contact|\n name = contact['title']['$t'] || nil\n email = contact['gd$email'] ? contact['gd$email'][0]['address'] : nil\n tel = contact['gd$phoneNumber'] ? contact[\"gd$phoneNumber\"][0][\"$t\"] : nil\n if contact['link'][1]['type'] == \"image/*\"\n picture = \"#{contact['link'][1]['href']}?access_token=#{token}\"\n else\n picture = nil\n end\n contacts.first_or_create({name: name, email: email, tel: tel})\n end\n end",
"def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end",
"def list_contact_methods_parties\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:contact_methods_parties_page] = params['page']\n\n\t\t render_list_contact_methods_parties\n\n\t\t return \n\telse\n\t\tsession[:contact_methods_parties_page] = nil\n\tend\n\n\tlist_query = \"@contact_methods_party_pages = Paginator.new self, ContactMethodsParty.count, @@page_size,@current_page\n\t @contact_methods_parties = ContactMethodsParty.find(:all,\n\t\t\t\t :limit => @contact_methods_party_pages.items_per_page,\n\t\t\t\t :offset => @contact_methods_party_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_contact_methods_parties\nend",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def contacts\n @contacts = Employee.by_company_id(params[:company_id]).by_search(params[:search]).by_contacts(current_user).paginate :page => params[:page]\n @active_employers = current_user.employers.active_employers.all\n end",
"def contacts\n\t #begin\n\t autopilot_contact = params[\"contact\"]\n\t autopilot_event = params[\"event\"]\n\t if autopilot_contact.has_key?(\"Company\") && autopilot_contact[\"Company\"] != \"\"\n company_id = get_freshdesk_company_id(autopilot_contact[\"Company\"])\n #Rails.logger.debug \"comp id==>#{company_id}\"\n autopilot_contact[\"Company\"] = company_id \n end\n @freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n @freshdesk_data[\"company_id\"] = autopilot_contact[\"Company\"] unless autopilot_contact[\"Company\"] == \"\"\n\n\t #@freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n\t get_custom_fields(autopilot_contact)\n\t if autopilot_event == \"contact_added\"\n\t \t response = contact_added(@freshdesk_data)\n\t elsif autopilot_event == \"contact_updated\"\n\t\t #Rails.logger.info \"Update response from autopilotttttttttttttttttt\"\n\t response = contact_updated(@freshdesk_data, @freshdesk_contact_id)\n\t\t #Rails.logger.debug \"#{response}\"\t\t\n\t end \n\t response.parsed_response.has_key?(\"errors\") ? failure_response(response) : success_response\n\t #rescue Exception => e\n\t #\tputs e.message\n\t #end\n\tend",
"def get_user_contacts username_for, options = {}\n do_request 'get_user_contacts', options.merge(username_for: username_for)\n end",
"def call(address)\n go_to_form\n fill_form(address)\n get_all_contacts\n end",
"def index\n @contacts = current_user.get_address_book_contacts\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end",
"def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end",
"def primary_service_learning_contacts\n u = Unit.find_by_abbreviation(\"carlson\")\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => u.id, :primary_contact => true}})\n c.empty? ? position_supervisor_contacts : c\n end",
"def index\n @contacts = current_user.contacts\n end",
"def display_all_contacts\n\t\t@rolodex.contacts.each do |user|\n\t\t\tputs \"First Name:#{user.first_name}\" \n\t\t\tputs \"Last Name: #{user.last_name}\"\n\t\t\tputs \"Email Address:#{user.email}\" \n\t\t\tputs \"Note: #{user.note}\"\n\t\tend\n\tend",
"def contacts() @contacts ||= Flickr::Contacts.new(self) end",
"def authenticate\n # initiate authentication w/ gmail\n # create url with url-encoded params to initiate connection with contacts api\n # next - The URL of the page that Google should redirect the user to after authentication.\n # scope - Indicates that the application is requesting a token to access contacts feeds.\n # secure - Indicates whether the client is requesting a secure token.\n # session - Indicates whether the token returned can be exchanged for a multi-use (session) token.\n next_param = authorise_user_contacts_url(@user)\n scope_param = \"https://www.google.com/m8/feeds/\"\n session_param = \"1\"\n root_url = \"https://www.google.com/accounts/AuthSubRequest\"\n query_string = \"?scope=#{scope_param}&session=#{session_param}&next=#{next_param}\"\n redirect_to root_url + query_string\n end",
"def contacts\n @contacts ||= CreditorContactProxy.new(self)\n end",
"def index\n @contacts = current_user.contacts.all\n\n\n end",
"def fetch(email, revoke = true)\n get_token\n\n uri = URI.parse \"http://www.google.com/m8/feeds/contacts/#{email}/full\"\n\n loop do\n res = request uri\n\n xml = Nokogiri::XML res.body\n\n parse xml\n\n next_uri = xml.xpath('//xmlns:feed/xmlns:link[@rel=\"next\"]').first\n break unless next_uri\n\n uri += next_uri['href']\n end\n\n yield if block_given?\n ensure\n revoke_token if revoke and token?\n end",
"def ensure_authenticated\n if current_facebook_user.nil? && params[:Caller].blank?\n redirect_to url_for(:controller => \"login\")\n else\n if params[:Caller]\n phone = params[:Caller].match(/(\\d){10}$/)[0]\n @user = Phone.find_by_number(phone).try(:user)\n unless @user\n redirect_to url_for(:controller => \"login\", :action => \"not_found\", :format => :xml)\n return\n end\n offline_client = Mogli::Client.new(@user.facebook_access_token, nil)\n fb_user = Mogli::User.find(@user.facebook_id, offline_client) # reusing current_facebook_user breaks use in else, somehow\n else\n @user = User.find_or_create_by_facebook_id(current_facebook_user.id)\n #not the best place, but ...\n set_access_token\n current_facebook_user.fetch\n end\n @feed = FbFeed.new(@user)\n logger.debug(\"twilio, #{ @feed }\")\n logger.debug(\"url = https://graph.facebook.com/#{ @user.facebook_id }/home?access_token=#{ @user.facebook_access_token }\")\n end\n end",
"def contacts #allows the contacts page to display all the members and their contact info\n @users = User.all\n @users.each do |user|\n puts user.username\n end\n end",
"def show\n if not current_user.nil?\n @contacts = Contact.all\n else\n redirect_to contactp_path\n end\n end",
"def access_live_contacts_api\n Net::HTTP.version_1_1\n http = http = Net::HTTP.new('livecontacts.services.live.com', 443)\n http.use_ssl = true\n\n response = nil\n http.start do |http|\n request = Net::HTTP::Get.new(\"/users/@L@#{@consent_token.locationid}/rest/invitationsbyemail\", {\"Authorization\" => \"DelegatedToken dt=\\\"#{@consent_token.delegationtoken}\\\"\"})\n response = http.request(request)\n end\n\n return response.body\n end",
"def init_user\r\n #logger.info session.inspect\r\n @store_user = session[:web_user]\r\n @store_user.request_path = request.path + \"?\" + request.query_string\r\n @customer = ERP::Customer.find_by_account_num @store_user.erp_account_number\r\n \r\n if @customer.nil?\r\n render :partial => \"unaccessible\", :layout => false\r\n return false\r\n end\r\n \r\n @user = @customer.contact_people.find_by_email @store_user.email_address\r\n if @user.nil?\r\n @user = ERP::ContactPerson.new\r\n @user.attributes = {\r\n :erp_customer_id => @customer.id,\r\n :first_name => @store_user[:name],\r\n :last_name => @store_user[:name],\r\n :name => @store_user[:name],\r\n :email => @store_user[:email_address]\r\n }\r\n end\r\n end",
"def contacts\n collection = CapsuleCRM::ContactCollection.new(self,CapsuleCRM::Contact, [])\n collection.concat emails\n collection.concat phone_numbers\n collection.concat websites\n collection.concat addresses\n collection\n end",
"def display_contacts\n # Fill this in\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods\n Contact.all.each do |contacts|\n puts \":#{contacts.full_name}, #{contacts.email}, #{contacts.id}, #{contacts.note}\"\n end\n end",
"def import\n # GET http://www.google.com/m8/feeds/contacts/default/base\n token = params[:token]\n uri = URI.parse(\"https://www.google.com\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = \"/m8/feeds/contacts/default/full?max-results=10000\"\n headers = {'Authorization' => \"AuthSub token=#{token}\", 'GData-Version' => \"3.0\"}\n resp, data = http.get(path, headers)\n # extract the name and email address from the response data\n # HERE USING REXML TO PARSE GOOGLE GIVEN XML DATA\n xml = REXML::Document.new(data)\n contacts = []\n xml.elements.each('//entry') do |entry|\n person = {}\n person['name'] = entry.elements['title'].text\n gd_email = entry.elements['gd:email']\n logger.debug(entry)\n if gd_email\n person['email'] = gd_email.attributes['address'] \n @user.profile.contacts << person if person\n end \n end\n @user.profile.save\n redirect_to root_url , :notice => \"imported successfully\"\n end",
"def show\n\n @contact_addresses = @user.contact.contact_addresses\n @extra = @user.extra_detail\n @numbers = @user.contact.phone_numbers\n @agent = ClientAgent.agents(@user).first\n @global_setting = @user.global_setting\n\n if current_user != @user \n if !current_user.is_broker_of?(@user) && @user.has_agent_and_is?(current_user)\n flash[:notice] = \"You can't see this, Sorry\";\n redirect_to(application_cases_path);\n end\n end\n\n end",
"def show\n @user = User.find_by_email(@listing.host_email)\n @activity_service = ActivityService.new\n @major_cities = MajorCity.none\n end",
"def contact_mix_2\n $testCaseID = \"VT229-0020\"\n con_remove\n createContact 20\n @contact = Rho::RhoContact.find(:all, :per_page => 5, :offset => 5, :select => [\"id\", \"last_name\"], :conditions => {:phone => 'is_nil', :email => 'is_nil'})\n puts @contact\n redirect :action => :index\n end",
"def contacts\n @contacts ||= DebtorContactProxy.new(self)\n end",
"def call_api(email)\n user = generate_email\n status_url = 'https://rapportive.com/login_status?user_email=' + user\n profile_url = 'https://profiles.rapportive.com/contacts/email/' + email\n\n # exponential backoff to get session_token\n response = exp_backoff 2, status_url\n session_token = response['session_token'] if response\n\n if response.nil? || response['error']\n false\n elsif response['status'] == 200 && session_token\n header = { 'X-Session-Token' => session_token }\n\n response = exp_backoff 2, profile_url, header\n if response.nil?\n false\n elsif response['success'] != 'nothing_useful'\n response['contact']\n end\n end\nend",
"def contacts(reload = false)\n self.cache(CostAgent::Contact, :all, reload) do\n (self.api(\"contacts\")/\"contact\").collect do |contact|\n projects = self.projects(:all, reload).select { |p| p.contact_id == (contact/\"id\").first.inner_text.to_i }\n Contact.new(\n :id => (contact/\"id\").first.inner_text.to_i,\n :organisation_name => (contact/\"organisation-name\").first.inner_text,\n :first_name => (contact/\"first-name\").first.inner_text,\n :last_name => (contact/\"last-name\").first.inner_text,\n :address1 => (contact/\"address1\").first.inner_text,\n :address2 => (contact/\"address2\").first.inner_text,\n :address3 => (contact/\"address3\").first.inner_text,\n :town => (contact/\"town\").first.inner_text,\n :region => (contact/\"region\").first.inner_text,\n :country => (contact/\"country\").first.inner_text,\n :postcode => (contact/\"postcode\").first.inner_text,\n :phone_number => (contact/\"phone-number\").first.inner_text,\n :email => (contact/\"email\").first.inner_text,\n :billing_email => (contact/\"billing-email\").first.inner_text,\n :contact_name_on_invoices => (contact/\"contact-name-on-invoices\").first.inner_text == \"true\",\n :sales_tax_registration_number => (contact/\"sales-tax-registration-number\").first.inner_text,\n :uses_contact_invoice_sequence => (contact/\"uses-contact-invoice-sequence\").first.inner_text == \"true\",\n :account_balance => (contact/\"account-balance\").first.inner_text.to_f,\n :projects => projects)\n end\n end\n end",
"def index\n @contacts = current_user.contacts.order(:email_address)\n end",
"def fetch_contacts! \n cards = Vpim::Vcard.decode(open(options[:file].path))\n \n contacts = Array.new\n cards.each do |card|\n h = Hash.new\n h[:name] = card.name.fullname.to_s\n h[:email] = card.email.to_s\n contacts << h\n end\n \n contacts\n end",
"def find_contact_for_signin(email:, firstname:, lastname:, date_of_birth:)\n filter = filter_pairs(emailaddress2: email, emailaddress1: email)\n\n store.fetch(Contact, filter: filter, limit: 20, order: 'createdon desc')\n .find { |c| c.signin_attributes_match? firstname, lastname, date_of_birth }\n .tap { |c| crmlog \"Read contact #{c.contactid}\" if c }\n end",
"def contacts(consent)\n process_consent(consent)\n contacts_xml = access_live_contacts_api()\n contacts_list = WindowsLive.parse_xml(contacts_xml)\n end",
"def apply_trusted_services(omniauth) \n # Merge user_info && extra.user_info\n user_info = omniauth['user_info']\n\n if omniauth['extra'] && omniauth['extra']['user_hash']\n user_info.merge!(omniauth['extra']['user_hash'])\n end \n\n # try name or nickname\n if self.name.blank?\n self.name = user_info['name'] unless user_info['name'].blank?\n self.name ||= user_info['nickname'] unless user_info['nickname'].blank?\n self.name ||= (user_info['first_name'] + \" \" + user_info['last_name']) unless \\\n user_info['first_name'].blank? || user_info['last_name'].blank?\n end \n\n if self.email.blank?\n self.email = user_info['email'] unless user_info['email'].blank?\n # if user_info['email'].present?\n # self.email = user_info['email'] unless user_info['email'].blank?\n # else\n # self.email = \"#{Time.now.to_i}#{rand(777)}@roomieapp.com\"\n # end\n end \n\n # Set a random password for omniauthenticated users\n self.password, self.password_confirmation = String::RandomString(16)\n\n end",
"def retrieve_contact_by_email\n unless @rolodex.is_empty?\n print \"Please, provide the email of the contact in question: \"\n contact = @rolodex.search_contact(gets.chomp)\n if contact\n @rolodex.display_particular(contact)\n else\n puts \"Error: contact not found.\"\n end\n else\n contact = false\n puts \"Error: the Rolodex is empty.\"\n end\n return contact\n end",
"def index\n # todo implement search and sort and paginate\n @contacts = Legacy::LegacyContact.order(\"first_name\").paginate(:page => params[:page])\n end",
"def contact\n # STUB\n end",
"def request(email)\n status_url = 'https://rapportive.com/login_status?user_email=' + email\n profile_url = 'https://profiles.rapportive.com/contacts/email/' + email\n\n # exponential backoff to get session_token\n response = exp_backoff 2, status_url\n session_token = response['session_token'] if response\n\n if response.nil? || response['error']\n false\n elsif response['status'] == 200 && session_token\n header = { 'X-Session-Token' => session_token }\n\n # Create a Profile for valid email\n response = exp_backoff 2, profile_url, header\n if response.nil?\n false\n elsif response['success'] != 'nothing_useful'\n Profile.new(response['contact'])\n end\n end\nend",
"def initialize\n @contacts = []\n end",
"def initialize\n @contacts = []\n end",
"def contacts\n parser.contacts\n end",
"def import_contacts(email, password, with_names = false)\n data = { :email => email, :password => password }\n data[:names] = 1 if with_names\n self.api_post(:contacts, data)\n end",
"def index\n @title = \"Step 3.1: Gather Addresses\"\n @col_layout = \"two_col\"\n items_per_page = 25\n \n @pages, @mpd_contacts = paginate :mpd_contacts, :include => \"mpd_priorities\", :order => process_sort(params[:sort]), :conditions => process_conditions('letter_sent = false'), :joins => :mpd_contact_actions, :per_page => items_per_page \n\n if request.xml_http_request?\n render :partial => \"shared/mpd_contact_to_complete\", :locals => {:event => 'letter_sent'}, :layout => false\n end\n end",
"def initialize #what attritubes\n\t\t@contacts = []\n\tend",
"def getContacts\n @contact_list.each_with_index do |c, i|\n #puts \"#{i +1}) #{c}\"\n puts \"#{i +1}) #{c[:first_name]} #{c[:last_name]} #{c[:email]}\"\n end\n end",
"def contactinfo\n @id = nil\n # TODO similar processing for organisation session variable\n @person = get_person_from_session\n if !@person.blank?\n # find all person's contact infos\n @person_contactinfos = PersonContactinfo.find(:all, :conditions => ['person_id =?', @person.person_id])\n if @person_contactinfos.empty?\n redirect_to :action => 'new'\n else\n for contactinfo in @person_contactinfos\n if contactinfo.preferred == true\n @id = contactinfo.contactinfo_id\n else \n if contactinfo.preferred == false && @id == nil\n @id = contactinfo.contactinfo_id\n end\n end\n end\n redirect_to :action => 'edit', :id => @id\n end\n end\n end",
"def index\n @user_contact_information = current_user.user_contact_information\n end",
"def contacts\r\n @contact = @customer.contact_people.find_by_id params[:id]\r\n \r\n # Delete contact\r\n if @contact && params[:method] == \"delete\"\r\n @store_user.my_account_log(@contact,\"Delete Contact #{@contact.name}\")\r\n @contact.destroy\r\n @customer.update_ax( :contacts => [@contact] )\r\n redirect_to :id => nil\r\n end\r\n \r\n # Add or update contact\r\n if request.post? && params[:contact]\r\n @contact ||= @customer.contact_people.build\r\n @contact.attributes = params[:contact]\r\n if @contact.save\r\n redirect_to :id => nil\r\n else\r\n @customer.contact_people.delete @contact\r\n render\r\n end\r\n \r\n # Synchronize customer\r\n @customer.update_ax( :contacts => [@contact] ) if @contact.errors.empty?\r\n @store_user.my_account_log(@contact,\"Add or Update Contact #{@contact.name}\")\r\n end\r\n end",
"def get_matters_and_contacts\n\t\tget_matters\n\t\tget_all_contacts\n\tend",
"def test_fetch_email\n contacts = Contacts.new(:hotmail, @account.username, @account.password).contacts\n @account.contacts.each do |contact|\n assert contacts.any?{|book_contact| book_contact.last == contact.last }, \"Could not find: #{contact.inspect} in #{contacts.inspect}\"\n end\n end"
] |
[
"0.7529925",
"0.7276081",
"0.71477276",
"0.7097228",
"0.667431",
"0.6569449",
"0.6544356",
"0.6449844",
"0.64204705",
"0.6291629",
"0.62460005",
"0.62452877",
"0.62139946",
"0.62041926",
"0.6182687",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.61376256",
"0.6092999",
"0.6079517",
"0.6048556",
"0.6029814",
"0.60241115",
"0.60241115",
"0.595844",
"0.5951418",
"0.59510875",
"0.595075",
"0.59387404",
"0.5936713",
"0.5930557",
"0.5919905",
"0.590685",
"0.59057057",
"0.5889111",
"0.5887207",
"0.58871365",
"0.5879757",
"0.5864375",
"0.5864375",
"0.58425486",
"0.5833932",
"0.58067876",
"0.5791305",
"0.57899314",
"0.5767296",
"0.5762449",
"0.57587844",
"0.57373744",
"0.57367206",
"0.57274526",
"0.57237315",
"0.5723628",
"0.5713431",
"0.57086504",
"0.5685189",
"0.5673692",
"0.5667353",
"0.5660943",
"0.56453156",
"0.5634193",
"0.5620197",
"0.56069493",
"0.55819726",
"0.5580781",
"0.5578141",
"0.5574853",
"0.5573692",
"0.55699235",
"0.55648625",
"0.5556437",
"0.5551329",
"0.55508626",
"0.5540606",
"0.55261654",
"0.5524056",
"0.5513564",
"0.55095106",
"0.54927164",
"0.54927164",
"0.549052",
"0.548834",
"0.5488041",
"0.5486537",
"0.54780275",
"0.5476853",
"0.5474949",
"0.54721874",
"0.5469332",
"0.5469264"
] |
0.0
|
-1
|
stub Some providers have a single page you can scrape from (like Gmail's HTML Contacts page) while others might require you to navigate several pages, scraping as you go.
|
def scrape_contacts; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_page\n page.visit('')\n end",
"def loadHandinPage()\n end",
"def fetchPage(url)\n Nokogiri::HTML(open(url, 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.152 Safari/535.19').read, nil, 'utf-8')\n end",
"def page(site)\n Nokogiri::HTML(RestClient.get(site))\nend",
"def retrieve_page\n return nil unless url\n spurl = url.gsub(/^http:/, \"https:\")\n spurl << (spurl.include?(\"?\") ? \"&\" : \"?\")\n spurl << \"pagewanted=all\"\n p = super(spurl)\n\n # If it fails, reset the session and try one more time\n unless retreive_successful?(p)\n self.class.retrieve_session ||= WebPageParser::HTTP::Session.new\n p = super(spurl)\n end\n if retreive_successful?(p)\n p\n else\n raise RetrieveError, \"Blocked by NYT paywall\"\n end\n end",
"def scrapePage\n # expects to be passed in a Watir:Browser object\n # gets the header from the current browser page and records it, the page url and the next page's url to the array\n pageDoc = getPage\n nextPageUrl = getFirstLinkUrl(pageDoc)\n pageEntry = getPageRecord(pageDoc, nextPageUrl)\n recordEntry(pageEntry)\n\n LOGGER.debug(\"Information scraped from: #{pageEntry[:url]}\")\n end",
"def sample_page\n\n end",
"def load_page\n @page ||= @mechanize.get(url)\n end",
"def uses_page page # only works with IE\n new_url = self.class.html_root + page\n browser.goto new_url unless browser.url == new_url\n end",
"def test_valley_smoketest\n @driver.get(@base_url)\n verify_home_page()\n verify_services_page()\n verify_about_page()\n verify_contact_page()\n verify_faq_page()\n verify_links_page()\n end",
"def more_navigate\n page(FeedDetailsPage).await\n page(FooterTabBarPage).select_tab(\"More\")\n page(MorePage).seemenu\nend",
"def page\n get_page\n nil\n end",
"def main_page\n find_by(url: 'http://class.rambler.ru/')\n end",
"def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend",
"def load_page\n @mechanize_instance.get(@url)\n end",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def scrape_page(page, url)\n # clean up page so valid enough for Nokogiri to parse\n page.gsub!('<p />','</p><p>')\n page.sub!('<hr />','<p>')\n page.gsub!('<hr ','</p><hr ')\n doc = Nokogiri.HTML(page)\n doc.search('a[@href*=\"getHRGHTML\"]').each do |a|\n save_company_from_element(a.parent)\n end\nrescue Exception => e\n puts \"Exception (#{e.inspect}) raised while getting or parsing data (source url=#{url}). Data: #{page.to_s}\\n\\nBacktrace:\\n#{e.backtrace}\"\nend",
"def scrape_page(page, url)\n # clean up page so valid enough for Nokogiri to parse\n page.gsub!('<p />','</p><p>')\n page.sub!('<hr />','<p>')\n page.gsub!('<hr ','</p><hr ')\n doc = Nokogiri.HTML(page)\n doc.search('a[@href*=\"getHRGHTML\"]').each do |a|\n save_company_from_element(a.parent)\n end\nrescue Exception => e\n puts \"Exception (#{e.inspect}) raised while getting or parsing data (source url=#{url}). Data: #{page.to_s}\\n\\nBacktrace:\\n#{e.backtrace}\"\nend",
"def single_scrape\n next_page()\n save_page()\nend",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\n @browser.pluggable_parser.html = Mechanize::Page\n\n previous_length != @results.size\n end",
"def scrape_it\n \n end",
"def fetch_page\n Varnisher.log.info \"Looking for external resources on #{@url}...\"\n\n begin\n @html = Net::HTTP.get_response(@uri).body\n rescue\n Varnisher.log.info \"Hmm, I couldn't fetch that URL. Sure it's right?\\n\"\n return\n end\n end",
"def load_page(uri) # searchText, type\n Nokogiri::HTML(Net::HTTP.get(URI(uri)))\n end",
"def pages; end",
"def scrape\n end",
"def get_page\n\tpage = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\"))\n\treturn page\nend",
"def page_for_url(url)\n @mechanize_instance.get(url)\n end",
"def page_load; end",
"def get_info(i, url)\n\n def displayed?(locator)\n locs=[]\n locs = @driver.find_elements(:css,locator)\n if locs.length>0\n return true\n else\n return false\n end\n end\n puts i\n presentation = @driver.title\n\n # presenter name locators are not consistent from page to page so have to check which locator to use to get presenter name\n if displayed?(\"#gallery > div.ad-image-wrapper > div.ad-image > div.ad-image-description > h2 > a\")\n presenter_locator = @driver.find_element(:css,\"#gallery > div.ad-image-wrapper > div.ad-image > div.ad-image-description > h2 > a\")\n elsif displayed? (\"#content_responsive > div.content_grey > div > div:nth-child(1) > div.presenter_col.col-sm-5.col-md-3 > div.presenter_meta > div.member_info > h2 > a\")\n presenter_locator = @driver.find_element(:css, \"#content_responsive > div.content_grey > div > div:nth-child(1) > div.presenter_col.col-sm-5.col-md-3 > div.presenter_meta > div.member_info > h2 > a\")\n elsif displayed?(\"#gallery > div.ad-image-wrapper > div.ad-image > div.ad-image-description > h2\")\n presenter_locator = @driver.find_element(:css,\"#gallery > div.ad-image-wrapper > div.ad-image > div.ad-image-description > h2\")\n else\n presenter_locator = @driver.find_element(:css, \"#content_responsive > div.content_grey > div > div:nth-child(1) > div.presenter_col.col-sm-5.col-md-3 > div.presenter_meta > div.member_info > h2\")\n end\n presenter = presenter_locator.text\n\n presenter_organization = @driver.find_element(:css,\".presenter\").text\n\n views_locator = @driver.find_element(:css, \"#content_responsive > div.content_grey > div > div:nth-child(2) > div.col-sm-12.col-md-3.hidden-xs.hidden-sm > div.social_panel > div > div:nth-child(1) > h3\")\n views = views_locator.text\n\n# NSF grans are links while non-NSF grants are not links. The first condition finds all the grants the are links. The second just finds the p element with the list of non-link grants and returns them as one unit.\n if displayed? (\"#abstract_scroll > p:nth-child(2) > a\")\n grant_list = @wait.until{@driver.find_elements(css: \"#abstract_scroll > p:nth-child(2) > a\")}\n has_link=true\n grant_list_length = grant_list.length\n else\n grant_list = @wait.until{@driver.find_element(css: \"#abstract_scroll > p:nth-child(2)\" )}\n grant_list_length = 1\n end\n # puts \"grant_list is #{grant_list}. grant_list_length is #{grant_list_length}\"\n\n\n if has_link #checks to see if the grants are links and gets each text individually. Otherwise return the enter p element regardless of how many grants there are\n case grant_list_length\n when 1\n grant_1 = @wait.until{@driver.find_element(:css, \"#abstract_scroll > p:nth-child(2) > a\").text} #abstract_scroll > p:nth-child(2) > a\n grant_2 = \"\"\n grant_3 = \"\"\n when 2\n grant_1 = @wait.until{@driver.find_element(:css, \"#abstract_scroll > p:nth-child(2) > a:nth-child(1)\").text}\n grant_2 = @wait.until{@driver.find_element(:css, \"#abstract_scroll > p:nth-child(2) > a:nth-child(2)\").text}\n grant_3 = \"\"\n when 3\n grant_1 = @wait.until{@driver.find_element(:css, \"#abstract_scroll > p:nth-child(2) > a:nth-child(1)\").text}\n grant_2 = @wait.until{@driver.find_element(:css, \"#abstract_scroll > p:nth-child(2) > a:nth-child(2)\").text}\n grant_3 = @wait.until{@driver.find_element(:css, \"#abstract_scroll > p:nth-child(2) > a:nth-child(3)\").text}\n end\n else grant_1 = @wait.until{@driver.find_element(css: \"#abstract_scroll > p:nth-child(2)\" ).text}\n end\n\n discussions = @wait.until{@driver.find_element(:css, \"#panel-mc-count\").text.tr('()','').to_i}\n kw_list=@wait.until{@driver.find_elements(:css, \".kw\")}\n kw_list_length = kw_list.length\n kw_first = 2\n # puts \"ks_list_length is #{kw_list_length}\"\n\n case kw_list_length\n when 1\n keyword_1 = @wait.until{@driver.find_element(:css, \"#panel_video > div.presentation_extra > a:nth-child(2)\").text}\n keyword_2 = \"\"\n keyword_3 = \"\"\n when 2\n keyword_1 = @wait.until{@driver.find_element(:css, \"#panel_video > div.presentation_extra > a:nth-child(2)\").text}\n keyword_2 = @wait.until{@driver.find_element(:css, \"#panel_video > div.presentation_extra > a:nth-child(3)\").text}\n keyword_3 = \"\"\n when 3\n keyword_1 = @wait.until{@driver.find_element(:css, \"#panel_video > div.presentation_extra > a:nth-child(2)\").text}\n keyword_2 = @wait.until{@driver.find_element(:css, \"#panel_video > div.presentation_extra > a:nth-child(3)\").text}\n keyword_3 = @wait.until{@driver.find_element(:css, \"#panel_video > div.presentation_extra > a:nth-child(4)\").text}\n end\n\n puts \"Presentation is #{presentation}, Grant_1 is #{grant_1}, Grant_2 is #{grant_2}, Grant_3 is #{grant_3}, Num Views is #{views}, Discussions is #{discussions}, Keyword_1: #{keyword_1}, Keyword_2: #{keyword_2}, Keyword_3: #{keyword_3}, url is #{url}\"\n view_num = views.to_i\n write_to_file(i,presenter, presenter_organization, presentation, grant_1, grant_2, grant_3, view_num, discussions, keyword_1,keyword_2, keyword_3, url)\nend",
"def get_page()\n @page = Nokogiri::HTML(open(@url).read)\n end",
"def extract_data_and_get_next_page\n scrape_table(@page.body)\n link = @page.at('table#WFDGRDCompanies tr.form span~a') # get the link after the current page (which is the only one in a span)\n if link && (event_target = link[:href].scan(/WFDGRDCompanies[^']+/).first.gsub('$',':')) \n form = @page.form_with(:name => 'eForm')\n @page = submit_form_with_event_target(form, event_target)\n extract_data_and_get_next_page\n end\n#rescue Exception, Timeout::Error => e #timeout errors all too common, but as this is being run daily, don't worry about missing a few entries\n# puts \"Exception raised while getting data: #{e.inspect}\"\nend",
"def extract_data_and_get_next_page\n scrape_table(@page.body)\n link = @page.at('table#WFDGRDCompanies tr.form span~a') # get the link after the current page (which is the only one in a span)\n if link && (event_target = link[:href].scan(/WFDGRDCompanies[^']+/).first.gsub('$',':')) \n form = @page.form_with(:name => 'eForm')\n @page = submit_form_with_event_target(form, event_target)\n extract_data_and_get_next_page\n end\n#rescue Exception, Timeout::Error => e #timeout errors all too common, but as this is being run daily, don't worry about missing a few entries\n# puts \"Exception raised while getting data: #{e.inspect}\"\nend",
"def i_could_reach(which_page)\n return if which_page.nil? or '#'==which_page \n case which_page\n when Tag\n i_could_reach(which_page[:href])\n when Array\n which_page.each{|link| i_could_reach(link)}\n when String\n result = browser.headers_fetch(which_page)\n assert Net::HTTPSuccess===result, __last_because + \" (could not reach #{which_page}: #{result})\"\n else\n raise ArgumentError, \"Unable to use #{which_page} for i_could_reach\"\n end\n end",
"def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend",
"def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend",
"def scrape_and_look_for_next_link(page, request_url, next_page_num)\n while add_position(next_page_num).nil? do\n next_page_num += 1\n end\n \n link = page.link_with(:text => 'Tiếp')\n if link\n got_page = @br.get request_url\n view_state = got_page.forms[0].field_with(:name => \"__VIEWSTATE\").value\n \n page.form_with(:id => 'aspnetForm') do |f|\n f['__EVENTTARGET'] = 'ctl00$ContentPlaceHolder1$ucPaging$lkbNext'\n f['__EVENTARGUMENT'] = ''\n f['__LASTFOCUS'] = ''\n f['__VIEWSTATE'] = view_state\n f['viet_method'] = 'on'\n f['ctl00$Header$ucSearch$txtSearch'] = 'Tìm địa điểm, thông tin khuyến mãi, hàng giảm giá...'\n f['ctl00$ContentPlaceHolder1$hdfPage'] = next_page_num\n # I learned that I don't need to include some of the above but the coder of the site I am scraping\n # ask for stuff that he doesn't need when submitting the form,\n # it will return an empty page if not most of them are submitted\n # so I just leave them here\n f['ctl00$ContentPlaceHolder1$hdfKey'] = ''\n f['ctl00$ContentPlaceHolder1$hdfKey1'] = ''\n f['ctl00$ContentPlaceHolder1$hdfLocation'] = -1\n f['ctl00$ContentPlaceHolder1$hdf_usseachResult'] = 0\n f['ctl00$ucPopUpThank$dlstThanks$ctl00$RadbThank'] = 1\n f['ctl00$ucPopUpThank$hdfThankID'] = 1\n f['ctl00$ucPopUpThank$ucPopUpThank$hdfText'] = ''\n f['ctl00$ucPopUpThank$txtMessage'] = ''\n f['ctl00$hdfFreUserID'] = ''\n f['ctl00$hdfThankForPU'] = ''\n f['ctl00$hdfIDTemplate'] = ''\n page = f.submit()\n end\n scrape_table(page.body)\n scrape_and_look_for_next_link(page, request_url, next_page_num + 1)\n end\nend",
"def collect_raw_univ_pages(mirrors, univ_name)\n if mirrors.is_a? Array\n mirrors.each do | url|\n if url =~ /http:\\/\\/pastesite.com\\// # use pastesite only \n begin\n mc = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }\n page = mc.get(url)\n rescue => e\n $no_data_univs << univ_name\n puts \"[Error] retrieving #{url} \"; puts e.message; puts e.backtrace\n page = nil\n ensure\n #puts page.inspect ; #puts page.content\n #return page\n end \n dump_web_pages_of_univ(\"#{univ_name.gsub(/\\s+/, '')}\", page.body ) if page\n end\n end\n end\n \nend",
"def scrape_page\n self.url = page.url # gives a resolved url\n self.title = page.title\n self.description = page.description\n end",
"def scrape_and_look_for_next_link(page)\n scrape_table(page.body)\n link = page.link_with(:text => '2')\n if link\n page.form_with(:name => 'aspnetForm') do |f|\n f['__EVENTTARGET'] = 'ctl00$ContentPlaceHolder1$tab21$GVProcesos'\n f['__EVENTARGUMENT'] = 'Page$2'\n page = f.submit()\n p page.body\n end\n scrape_and_look_for_next_link(page)\n end\nend",
"def scrape_and_look_for_next_link(page)\n scrape_table(page.body)\n link = page.link_with(:text => '2')\n if link\n page.form_with(:name => 'aspnetForm') do |f|\n f['__EVENTTARGET'] = 'ctl00$ContentPlaceHolder1$tab21$GVProcesos'\n f['__EVENTARGUMENT'] = 'Page$2'\n page = f.submit()\n p page.body\n end\n scrape_and_look_for_next_link(page)\n end\nend",
"def scrape_and_look_for_next_link(page)\n scrape_table(page.body)\n link = page.link_with(:text => '2')\n if link\n page.form_with(:name => 'aspnetForm') do |f|\n f['__EVENTTARGET'] = 'ctl00$ContentPlaceHolder1$tab21$GVProcesos'\n f['__EVENTARGUMENT'] = 'Page$2'\n page = f.submit()\n p page.body\n end\n scrape_and_look_for_next_link(page)\n end\nend",
"def scrape_and_look_for_next_link(page)\n scrape_table(page.body)\n link = page.link_with(:text => '2')\n if link\n page.form_with(:name => 'aspnetForm') do |f|\n f['__EVENTTARGET'] = 'ctl00$ContentPlaceHolder1$tab21$GVProcesos'\n f['__EVENTARGUMENT'] = 'Page$2'\n page = f.submit()\n p page.body\n end\n scrape_and_look_for_next_link(page)\n end\nend",
"def load_page\n logger.info 'Loading Core homepage'\n get ConfigCore.base_url\n when_exists(page_heading, Config.medium_wait)\n end",
"def page(agent, page)\n url = \"https://www.planningportal.nsw.gov.au/planning-panel?field_status_value=2&page=#{page}\"\n\n page = agent.get(url)\n block = page.at(\".page__content .grid__row\")\n return 0 if block.nil?\n urls = block.element_children.map do |application|\n (page.uri + application.at('a')[\"href\"]).to_s\n end\n\n urls.each do |url|\n page = agent.get(url)\n v = page.at(\".project__details\").search(\".row\").map do |row|\n label = row.at(\"b\").inner_text.squish\n value = row.at(\"div\").inner_text.squish\n [label, value]\n end\n fields = Hash[v]\n\n yield(\n \"council_reference\" => fields[\"Planning panel reference number\"],\n \"address\" => fields[\"Project Address\"] + \", NSW\",\n \"description\" => page.at(\".field-field-project-description\").inner_text.squish,\n \"info_url\" => url,\n \"date_scraped\" => Date.today.to_s,\n \"date_received\" => convert_date(fields[\"Referral date\"])\n )\n end\n\n # Return number of applications found\n urls.count\nend",
"def crawl\n # TODO flush the page cache. We cache the crawled pages.\n begin\n account_detail_page #This will get us as far as we want to go, through several pages\n rescue *ERRORS_TO_RESCUE_FROM => e\n errors[:message] = e.message\n errors[:page_url] = e.page.uri\n errors[:page_body] = e.page.body\n return nil\n end\n end",
"def browse_page(search)\n\t\tresponse = fetch_via_mechanize(search)\n\t\trequest_successful(response) ? parse_page(response) : false\n\tend",
"def driver_method\n flash[:alert] = \"Your resume has been sent to the company. You will be contacted if you are a good fit for this job.\"\n bumeran = \"http://bumeran.com.mx/\"\n page = HTTParty.get(bumeran)\n parsed_page = Nokogiri::HTML(page)\n #add some variables here that can access the data from bumeran\n end",
"def initialize(driver)\n super\n visit\n verify_page\n end",
"def page; self end",
"def pull_offers(keyword, indeed_offers)\n puts \"Pulling result cards from the \\\"#{keyword}\\\" search\"\n domain = 'https://www.indeed.com.mx/'\n url = \"trabajo?q=#{keyword}&remotejob=032b3046-06a3-4876-8dfd-474eb5e7ed11\"\n html_content = open(domain + url).read\n doc = Nokogiri::HTML(html_content)\n # This var verifies if there are multiple pages of results\n next_page_button = doc.search('path')\n next_page_button = next_page_button.search('*[d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z\"]').text\n unless next_page_button.empty?\n # If there are multiple pages it will iterate though all of the result pages\n gather_offers_per_page(doc, indeed_offers)\n current_page = 1\n while next_page_button.empty? == true\n next_page = \"&start=#{current_page}0\"\n html_content = open(domain + url + next_page).read\n doc = Nokogiri::HTML(html_content)\n # This var verifies if there are multiple pages of results\n gather_offers_per_page(doc, indeed_offers)\n current_page += 1\n next_page_button = doc.search('path')\n next_page_button = next_page_button.search('*[d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z\"]')\n end\n else\n gather_offers_per_page(doc, indeed_offers)\n end\n end",
"def get_info_page_links(page)\n info_links = page.links_with(href: %r{info.html})\n if not info_links\n info_links = page.links_with(href: %r{aboutus.html})\n end\n if not info_links\n info_links = page.links_with(text: '会社概要')\n end\n return info_links\nend",
"def set_page\n end",
"def initialize\n @firstpage ||= lambda {\n uri = '/en-us/security/bulletin/dn602597.aspx'\n res = send_http_get_request(\"#{TECHNET}#{uri}\")\n return res.body\n }.call\n end",
"def fetch\n puts \"fetching #{@uri.to_s}\".green.on_black\n start_time = Time.now\n begin\n request = Net::HTTP::Get.new(@uri.request_uri)\n request[\"User-Agent\"] = UserAgents.random\n response = @http.request(request) \n end_time = Time.now\n case response\n when Net::HTTPSuccess then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_head: response.instance_variable_get(\"@header\"),\n response_body: response.body,\n response_time: (end_time-start_time).to_f,\n crawled_time: (Time.now.to_f*1000).to_i)\n when Net::HTTPRedirection then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_head: response.instance_variable_get(\"@header\"),\n response_body: response.body,\n response_time: (end_time-start_time).to_f,\n redirect_url: response['location'])\n when Net::HTTPNotFound then\n page = Page.new(@uri, response_code: response.code.to_i,\n response_time: (end_time-start_time).to_f)\n end\n rescue Exception => e\n puts e.inspect\n puts e.backtrace\n end\n end",
"def load_page()\n page = @mech.get(PARENT + PAGE)\n\n # Catch exception - 404 => Net::HTTPNotFound\n end",
"def selected_page_content\n parse_uri_from_env\n case\n\n when @uri.to_s == \"http://favicon.ico\" # automatic request from most browsers\n true # ignore it\n\n when @uri.class == URI::Generic\n WebStrip.welcome_page # put up a default page\n\n when @uri.class == URI::HTTP\n parse_page_handler_from_uri\n load_page_handler_definition_file\n get_filtered_page_from_page_handler\n\n else\n msg = \"PageRouter: URI::class '#{@uri.class}' not handled.\"\n @logger.write \"#{msg}\\n\"\n raise NotImplementedError, msg\n end\n end",
"def next_page; end",
"def is_available(page)\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n return !page.nil? \nend",
"def is_available(page)\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n return !page.nil? \nend",
"def load_page\n @page = Nokogiri::HTML(@browser.html)\n end",
"def page\n nil\n end",
"def crawlPage pageURL\n agent = Mechanize.new\n page = agent.get pageURL\n return page\nend",
"def is_available(page)\n\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n\n return !page.nil? \n\nend",
"def is_available(page)\n\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n\n return !page.nil? \n\nend",
"def website_content(url)\r\n # Give the content of the website on the given url\r\n require 'restclient'\r\n Nokogiri::HTML(RestClient.get(url))\r\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend",
"def get_pages(count, page_array)\n count ||= 1\n page_array ||= []\n scraper = Mechanize.new\n base_url = \"https://www.goodreads.com/author/quotes/24956.Dorothy_Parker?page=#{count}\"\n page = scraper.get(base_url)\n if !page.search('div.quoteText').empty?\n page_array.push(page)\n count += 1\n get_pages(count, page_array)\n else\n puts \"Found #{page_array.length} pages of Dorothy Parker quotes.\"\n end\n page_array\nend",
"def result_page_info(headers)\n link = headers[:link]\n\n return [] if link.nil?\n\n page_strings = link.split('page=')\n\n pages = []\n\n page_strings.each_with_index do |item, index|\n next if index == 0\n\n pages << item.to_i\n end\n\n pages\nend",
"def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def visit_page \n visit URL \n end",
"def retrieve_content(url)\n begin\n m = Mechanize.new { |agent|\n agent.user_agent_alias = 'Mac Safari'\n }\n page = m.get(url) \n rescue => e \n puts \"[Error] retrieving #{url} \"\n puts e.message\n puts e.backtrace\n # $ACCUMULATED_DELAY += 1\n #puts \"[WARNING] Compulsory put programme into sleep due to page retrieval error. Back to work in #{$ACCUMULATED_DELAY} minute(s)\"\n # sleep $ACCUMULATED_DELAY\n \n # just return an empty Mechanize::Page\n page = nil\n ensure\n #$TOTAL_PAGE_REQUEST += 1\n #puts page.inspect\n #puts page.content\n return page\n end\nend",
"def get_da_detail_page(page, da_container)\n\n tds = da_container.search('td')\n\n href = tds[0].at('a')['href']\n\n detail_page = page.link_with(:href => \"#{href}\").click\n\n \n\n return detail_page\n\nend",
"def get_da_detail_page(page, da_container)\n\n tds = da_container.search('td')\n\n href = tds[0].at('a')['href']\n\n detail_page = page.link_with(:href => \"#{href}\").click\n\n \n\n return detail_page\n\nend",
"def call(context, page)\n raise NotImplementedError\n end",
"def login_and_get_initial_page(user_name, password)\n login_page = retrieve_url(\"https://my.idc.ac.il/my.policy\")\n # Check if moved to error page already, and return to main page.\n if login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\" || login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\"\n @scrape_logger.info(\"#{__method__} - arrived session TO page on login. Clicking link to return...\")\n puts \"#{__method__} - arrived session TO page on login. Clicking link to return...\" # to do remove\n login_page = login_page.link_with(:text=>\"click here.\").click\n end\n if login_page.uri.to_s != \"https://my.idc.ac.il/my.policy\"\n raise \"failed_to_reach_login_page_exception uri:#{login_page.uri.to_s}\"\n end\n login_form = login_page.form(\"e1\")\n if nil == login_form\n raise \"couldnt_find_login_form_exception #{}\"\n end\n \n login_form.username = user_name\n login_form.password = password\n user_home_page = agent.submit(login_form, login_form.buttons.first)\n # to do - make a better login check, like looking for the login error message\n # maybe look for some contents inside too\n if user_home_page.uri.to_s != \"http://my.idc.ac.il/idsocial/he/Pages/homepage.aspx\"\n raise \"couldnt_login_form_exception uri:#{user_home_page.uri.to_s}\"\n end\n \n return user_home_page\n end",
"def get_product_info url\n product_info = nil\n \n mech_agent = Mechanize.new { |agent|\n agent.log = Logger.new \"/Users/simon/a_syllabus/lang/ruby/scripts/z_data/mechanize/mechanize.log\"\n agent.history.clear\n agent.redirect_ok = true \n agent.follow_meta_refresh = true\n agent.keep_alive = true\n agent.open_timeout = 30\n agent.read_timeout = 30 \n # pp Mechanize::AGENT_ALIASES # show list of agents - no mac chrome!\n agent.user_agent_alias = 'Mac Safari'\n }\n \n mech_agent.get(url) # get page\n \n @product_page = mech_agent.page\n \n pp @product_page\n \n supplier_regex = [ \n /(sainsburys)/,\n /(morrisons)/,\n /(tesco)/,\n /(waitrose)/,\n /(coop)/,\n /(asda)/,\n /(ocado)/,\n /(booker)/,\n /(fatsecret)/\n ]\n \n \n match = nil\n \n supplier_regex.each{ |regex| \n url =~ regex\n \n match = $1\n \n break if $1 \n }\n \n \n # SAVE page for inspection\n local_copy_location = '/Users/simon/a_syllabus/lang/ruby/scripts/z_data/mechanize'\n \n retireved_page_name = \"retievd_page_from_#{match}.html\"\n \n File.open( File.join(local_copy_location,retireved_page_name ), 'w') { |file| file << @product_page.body }\n # file automatically closed by block\n \n \n case match\n \n when 'sainsburys'\n product_info = scrape_sainsburys\n \n when 'morrisons'\n product_info = scrape_morrisons\n \n when 'tesco'\n product_info = scrape_tesco\n \n when 'waitrose'\n product_info = scrape_waitrose\n \n when 'coop'\n product_info = scrape_coop\n \n when 'asda'\n product_info = scrape_asda\n \n when 'ocado'\n product_info = scrape_ocado\n \n when 'booker'\n product_info = scrape_booker\n \n when 'fatsecret'\n product_info = scrape_fatsecret\n \n when nil\n product_info = scrape_specialist\n \n end\n \n product_info\n end",
"def fetch_profile_page(url)\n url = \"#{url}?tab=repositories\"\n response = fetch(url)\n hubber = parse_profile_page(response)\n hubber\n end",
"def navigate_to(link)\n $driver.get link\nend",
"def load_item_page\n visit(ITEM_PAGE_URL)\n end",
"def page_source; end",
"def _get_html_page url:\n HTTParty.get(url).body\n rescue => e\n add_error __method__.to_sym, :failed, e.message\n raise ServiceError, e\n end",
"def page_url\n nil\n end",
"def check_page(page, page_name)\n Thread.new do\n threads = []\n results = []\n self.class.external_link_uri_strings(page).each do |uri_string|\n SEMAPHORE.synchronize { @links << page }\n wait_to_spawn_thread\n threads << Thread.new do\n begin\n uri = URI(uri_string)\n response = self.class.check_uri(uri)\n response.uri_string = uri_string\n SEMAPHORE.synchronize { results << response }\n rescue => error\n SEMAPHORE.synchronize { results <<\n Error.new( :error => error.to_s, :uri_string => uri_string) }\n end\n end\n end\n threads.each {|thread| thread.join }\n report_results(page_name, results)\n end\n end",
"def search_web_page(base_url,company)\n @agent.get(\"#{base_url}#{CGI::escape(company)}\")\n end"
] |
[
"0.632168",
"0.6285333",
"0.62334955",
"0.62241566",
"0.6136903",
"0.6113631",
"0.6098412",
"0.60975516",
"0.60646737",
"0.6013832",
"0.59873915",
"0.59845716",
"0.5981612",
"0.59722346",
"0.59388435",
"0.5897926",
"0.5897926",
"0.58719003",
"0.58719003",
"0.58649355",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5841208",
"0.5834498",
"0.5830971",
"0.58217365",
"0.5820711",
"0.5819178",
"0.5819168",
"0.5815762",
"0.5813021",
"0.58110833",
"0.57781386",
"0.5772291",
"0.5767834",
"0.5767834",
"0.57630414",
"0.576006",
"0.576006",
"0.5754871",
"0.5753727",
"0.5741272",
"0.57357",
"0.57357",
"0.5735293",
"0.5735293",
"0.5713212",
"0.5700329",
"0.56984514",
"0.56980014",
"0.5695022",
"0.5693874",
"0.5678763",
"0.5669822",
"0.56696147",
"0.5666075",
"0.56649995",
"0.5663626",
"0.5663059",
"0.5662141",
"0.56381184",
"0.56299096",
"0.56299096",
"0.56232613",
"0.56189144",
"0.5617577",
"0.5614968",
"0.5614968",
"0.5590775",
"0.5589942",
"0.5589942",
"0.5589942",
"0.5589942",
"0.5589469",
"0.5587969",
"0.5586916",
"0.55842096",
"0.55806816",
"0.5579614",
"0.5579614",
"0.5565548",
"0.5563302",
"0.55513316",
"0.5548389",
"0.55467457",
"0.55428606",
"0.55312",
"0.5527547",
"0.5527274",
"0.5526678",
"0.55209965"
] |
0.55188453
|
100
|
stub helper to strip html from text
|
def strip_html( html )
html.gsub(/<\/?[^>]*>/, '')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strip_html(text)\n @name =\n # Remove HTML from the text\n Sanitize.clean(text).\n # Replace newlines with a space\n gsub(/\\n|\\r/, ' ').\n # Replaces runs of spaces by a single space\n squeeze(' ').\n # Remove leading and trailing whitespace\n strip\nend",
"def strip_html(text)\n unless text.nil?\n strip_tags(text)\n end\n end",
"def strip_html(text)\n Nokogiri::HTML.fragment(text).content\n end",
"def strip_tags(html); end",
"def strip_tags(html); end",
"def strip_tags(html); end",
"def strip_html_tags(text)\n return text.gsub!(/(<[^>]*>)|\\n|\\t/s) {\" \"}\n end",
"def htmlClean(html)\n html\nend",
"def text_only(html)\n Nokogiri::HTML.parse(html).text.gsub(/\\A\\p{Space}+|\\p{Space}+\\z/, '')\n .strip\n end",
"def plain_text\n text ? text.gsub(/<[^>]+>/,' ').squeeze(' ').strip : nil\n end",
"def text\n html.gsub(REGEX_TAGS, \"\")\n end",
"def plain_text(text)\n strip_tags(markdown.render(text.to_s)).strip\n end",
"def clean_up_text\n text.gsub!(/<br/, \"\\n<br\")\n text.gsub!(/<p/, \"\\n<p\")\n text.gsub!(/<\\/?span(.*?)?>/, '')\n text.gsub!(/<\\/?div(.*?)?>/, '')\n end",
"def sanitize_text(text)\n doc = Nokogiri::HTML.fragment(text)\n UNSUPPORTED_HTML_TAGS.each do |tag|\n doc.search(tag).each(&:remove)\n end\n doc.inner_html\n end",
"def strip_html\n gsub(HTML_TAG_PATTERN, \"\")\n end",
"def strip_html_tags!\n @raw.gsub!(/<[^>]+?>/, ' ')\n end",
"def as_text\n return self if self.blank?\n mytext = self.gsub(/<p>(.*?)<\\/p>/mi,'\\1'+\"\\n\\n\")\n mytext = mytext.gsub(/<br(.*?)>/mi,\"\\n\") \n mytext = mytext.gsub(/<p(.*?)>/mi,\"\\n\\n\") \n mytext = mytext.gsub(/<\\/p>/mi,\"\") \n mytext = mytext.gsub(/<div(.*?)>/mi, \"\")\n mytext = mytext.gsub(/<\\/div>/mi,\"\") \n # Go ahead and strip all the other html tags as well\n mytext = mytext.gsub(/<\\/?[^>]*>/, \"\")\n CGI.unescapeHTML(mytext).strip\n end",
"def strip_html (s)\ns.gsub(/<[^>]*(>+|\\s*\\z)/m, '');\nend",
"def html_text( text_node )\n self.remove_leading_and_trailing_whitespace( text_node )\n end",
"def strip_html(string=\"\")\n begin\n string = strip_tags(string)\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end",
"def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end",
"def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end",
"def stripped_content\n\t\treturn self.content.gsub( /<.*?>/, '' ).tr( \"\\n\\t \", ' ' ).strip\n\tend",
"def parse_text(text)\n ## Strip html\n Sanitize::clean!(text, :remove_contents => ['script','style'])\n text.gsub!(/[\\n\\t]+/, ' ')\n text\n end",
"def strip_html(str)\n str.gsub HTML_TAG, \"\" if str\n end",
"def stripped\n @stripped ||= strip @text\n end",
"def strip_links(html); end",
"def strip_links(html); end",
"def strip_links(html); end",
"def clean_text(text)\n text = strip_html_quote_entities(text)\n text = Helper::Text.strip_html_tags(text)\n text = strip_copyright_text(text)\n text.strip!\n text = Helper::Text.clean_verse_start(text)\n text = Helper::Text.clean_verse_end(text)\n end",
"def strip_tags(html)\n return html if html.blank?\n if html.index(\"<\")\n text = \"\"\n tokenizer = ::HTML::Tokenizer.new(html)\n while token = tokenizer.next\n node = ::HTML::Node.parse(nil, 0, 0, token, false)\n # result is only the content of any Text nodes\n text << node.to_s if node.class == ::HTML::Text\n end\n # strip any comments, and if they have a newline at the end (ie. line with\n # only a comment) strip that too\n text.gsub(/<!--(.*?)-->[\\n]?/m, \"\")\n else\n html # already plain text\n end\n end",
"def strip_tags(html)\n Sanitize.clean(html.strip).strip\n end",
"def strip_tags(html)\n Sanitize.clean(html.strip).strip\n end",
"def html_markup_text(text); end",
"def html_to_text(text)\n return nil if text.nil? || text.empty?\n text.gsub! /<br( \\/)?>/i, \"\\n\"\n\n string = Nokogiri::HTML.parse(text.to_s).css('body').text\n string.gsub! /[[:blank:]]/, ' '\n string = string.split(\"\\n\").collect{ |line| line.strip }.join(\"\\n\")\n string.gsub! /(\\n{1,})\\n/ do |match|; $1; end # convert x\\n to (x-1)\\n\n string.strip!\n string\n end",
"def lstrip_html\n return if self.blank?\n\n m = self.match(/\\A(\\s*?[^<]|(.*?)>\\s*[^<])/) #Find first printing character\n return self unless m\n \n ldr = m[0]\n ldr_last = ldr.slice(ldr.size-1, ldr.size)\n ldr = ldr.slice(0,ldr.size-1) # portion up to the first printing character\n bdy = ldr_last + m.post_match # portion following the first printing character\n \n cln_ldr = ldr.gsub(/<p/mi, \"<span\")\n cln_ldr = cln_ldr.gsub(/<\\/p/mi, \"</span\")\n cln_ldr = cln_ldr.gsub(/<br(.*?)>/mi, \"\")\n \n m = bdy.match(/(\\A.*?)<p/mi)\n if !m\n bdy = bdy.sub(/<\\/p/mi, \"</span\") # change first closing </p> from an open <p> remaining from ldr\n else\n l = m.post_match\n f_cln = m[0].gsub(/<\\/p/mi, \"</span\") # change any closing </p> from and open <p> remaining from ldr\n bdy = f_cln + l \n end\n return cln_ldr + bdy \n end",
"def clean text\n text.gsub(/(\\n|\\t|\\r)/, ' ').gsub(/>\\s*</, '><').squeeze(' ')\n end",
"def get_text_contents(html_string)\n\t# Remove HTML and scripts\n\thtml_regex = /<head>.*?<\\/head>|<script>.*?<\\/script>|<noscript>.*?<\\/noscript>/m\n\ttext_string = html_string.gsub(html_regex,\"\")\n\n\t# Remove tags\n\ttag_regex = /<[^<>]*?>/m\n\ttext_string.gsub!(tag_regex,\"\")\n\n\t# Replace multiple spaces with one\n\ttext_string.gsub!(/\\s{2,}/m,\" \")\n\n\t# Remove STX\n\ttext_string.gsub!(/\\^B/,\"\")\n\n\treturn text_string\nend",
"def strip() end",
"def strip_html(string)\n # FIXME will need something more sophisticated than this, because it sucks\n string.gsub(/<[^>]*(>+|\\s*\\z)/m, '').strip\n end",
"def nice_html_to_text(html_text)\n doc = Hpricot(html_text)\n doc.search(\"//text()\").text\n end",
"def strip_html(str,allow=['dm','dl'])\n str = str.strip || ''\n allow_arr = allow.join('|') << '|\\/'\n str.gsub(/<(\\/|\\s)*[^(#{allow_arr})][^>]*>/,'').strip\n end",
"def strip_html_from_description\n self.description = ActionView::Base.full_sanitizer.sanitize(description)\n end",
"def clean_html_string(string)\n string.\n inner_text.\n gsub(/\\s+/, \" \").\n strip\n end",
"def html_markup_html(text); end",
"def mark_text(str)\n\t str = clean_html(str)\n\t \n\t return str\n end",
"def safe_text text\n return \"\" if text.nil?\n \n markdown_content_type = \"# Content-Type: text/markdown\"\n starts_with_markdown = text.strip.start_with? markdown_content_type\n if (not /<(a |img |ol|ul|li|h[1-6]|p|div|span)[^<]*>/.match(text)) && !starts_with_markdown\n return \"<blockquote>\" + CGI::escape_html(text).gsub(\"\\n\",\"<br />\\n\") + \"</blockquote>\"\n end\n\n if BMF::Settings.instance.display_sanitized_html != 'yes'\n return \"<blockquote>\" + CGI::escape_html(text).gsub(\"\\n\", \"<br />\\n\") + \"</blockqoute>\"\n end\n\n if text.strip.start_with? markdown_content_type\n text = RDiscount.new(text.sub(markdown_content_type, \"\")).to_html\n end\n\n safe_html(text)\n \n end",
"def clean_content\n self.content = content.gsub('<p> </p>', '') if content\n end",
"def strip_html(allow)\n str = self.strip || ''\n allow_arr = allow.join('|')\n str = str.gsub(/<\\s*/,'<')\n str = str.gsub(/<\\/\\s*/,'</')\n # First part of | prevents matches of </allowed. Second case prevents matches of <allowed\n # and keeps the / chacter from matching the ?! allowed.\n str.gsub(/<(\\/(?!(#{allow_arr}))|(?!(\\/|#{allow_arr})))[^>]*?>/mi,'')\n end",
"def cleanText(txt)\r\n clean = txt.gsub(\"<\", \"<\")\r\n clean.gsub!(\">\", \">\")\r\n\r\n puts \"cleaned text: #{txt} -> #{clean}\" if $DEBUG\r\n clean\r\n\r\n end",
"def plain_html\n self.class.to_html.to_html(text.dup)\n end",
"def sanitize(text)\n text.gsub('<', '<').gsub('>', '>')\n end",
"def html2text\n doc = self.scrape.hdoc\n text = node_to_text(doc)\n# text.gsub!(NamedCharRegex){|s| \"#{lookup_named_char(s)}\"}\n # clean up white space\n text.gsub!(\"\\r\",\" \")\n text.squeeze!(\" \")\n text.strip!\n ret = ''\n text.split(/\\n/).each do |l|\n l.strip!\n next if l == ''\n next if l =~ /^\\?+$/\n ret += \"#{l}\\n\"\n end\n return ret\n end",
"def normalize_text(content)\n replaced_content = content.gsub(/\\n|<br>| /) do |match|\n case match\n when \"\\n\", \" \"\n \"\"\n when \"<br>\"\n \"\\n\"\n end\n end.sub(/\\s*(---|‐‐‐|―――)\\s*\\z/, \"\")\n strip_html(replaced_content)\n end",
"def html_remove\n gsub(/<\\/?[^>]+>/, '')\n end",
"def clean_html(html)\n Sanitize.clean(html) rescue html\n end",
"def untag(txt)\n Sanitize.clean(txt).strip.gsub(/\\s+/, \" \")\n end",
"def strip_html_quote_entities(text)\n text.gsub(/&.dquo;/, '')\n end",
"def just_text\r\n return $1 if text =~ /^<p>(.*)<\\/p>$/\r\n text\r\n end",
"def removeTag(text,tag)\n return 0 unless text\n text=text.to_s\n text=text.gsub(\"<\"+tag+\">\", \"\")\n text=text.gsub(\"</\"+tag+\">\", \"\")\n \n return text.to_s\nend",
"def html_markup_textile_strict(text); end",
"def strip_tags(html)\n strip(Sanitize.clean(html, :elements => [], :attributes => []))\n end",
"def strip_tags string\n string.gsub(/<\\/?[^>]*>/, \"\")\nend",
"def strip_tags(html)\n # First we need to get rid of any embedded code.\n html = strip_embedded(html)\n\n # Remove comments\n html = html.gsub(/<!--.*?--\\s*>/m, \"\\xEF\\xBF\\xBC\")\n\n # SGML Declarations\n html = html.gsub(/<!.*?>/m, \"\\xEF\\xBF\\xBC\")\n\n # Remove script and css blocks\n html = html.gsub(/<script.*?>.*?<\\/script>/m, \"\\xEF\\xBF\\xBC\")\n html = html.gsub(/<style.*?>.*?<\\/style>/m, \"\\xEF\\xBF\\xBC\")\n\n # Strip html tags\n html = html.gsub(/<\\/? # opening tag with optional slash\n (\n [^<>\"'] | # match anything unquoted\n \".*?\" | # match double quotes…\n '.*?' # and single ones\n )* # any combination of the three\n > # close tag\n /xm, \"\\xEF\\xBF\\xBC\") # placeholder\n\n # Handle placeholders\n html = html.gsub(/^[ \\t]*\\xEF\\xBF\\xBC[ \\t]*(\\n|\\r|\\r\\n)/xm, '') # Remove lines with only tags\n html = html.gsub(/\\xEF\\xBF\\xBC/xm, '') # Remove other placeholders\n return html\nend",
"def text_wikimedia_html page\n html = @client.text_wikimedia_html page\n # normalize html by removing <!-- html comments -->\n doc = Nokogiri.HTML html\n (doc.xpath '//comment()').remove\n doc.inner_html\n end",
"def strip_bbcode(string); end",
"def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s.gsub(\"\\n\", \"\")\n end",
"def clean_text(text)\n text.gsub!(/\\r\\n/, '')\n text.gsub!(/\\r/, '')\n text\n end",
"def strip_tags(html)\n html.gsub(/<\\/?[^>]*>/, \"\") if html\n end",
"def sanitize_html\n self.data = self.class.clean_html(self.data) unless self.data.nil?\n end",
"def stextilize(text)\n if text.blank?\n \"\"\n else\n if ENV['RAILS_ENV'] == 'test'\n # For some reason, the call to :sanitize_html causes problems in tests. Weird.\n textilized = RedCloth.new(text, [ :hard_breaks, :filter_styles ])\n else\n textilized = RedCloth.new(text, [ :hard_breaks, :sanitize_html, :filter_styles ])\n end\n textilized.to_html\n end\n end",
"def as_html_deprecated #use TextEncoder.convert_to_html instead.\n return self if self.blank?\n mytext = self\n #mytext = CGI.escapeHTML(mytext)\n mytext.gsub!(NpbConstants::URL_DETECTION){|web_link| %{ <a href=\"#{web_link.strip}\">#{web_link.strip}</a> }}\n #mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{\\1<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{#{$1}<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(/\\A +/) {|l_spaces| (\" \"*l_spaces.size)} \n mytext.gsub!(/\\n +/) {|l_spaces| (\"\\n\" + (\" \"*(l_spaces.size-1)))}\n mytext.gsub!(/\\n{2,}/,'</p><p>')\n mytext.gsub!(/(\\n)([^\\n])/, '<br/>\\2')\n mytext\n end",
"def clean_body(text)\n text = strip_bad_chars(text)\n text.gsub!(/(\\r)?\\n/, \"\");\n text.gsub!(/\\s+/, ' ');\n\n # clean start and end whitespace\n text = text.strip;\n return text\nend",
"def stripsub(text)\n return (text.strip).gsub(\"'\",\"''\").gsub(\"’\", \"''\")\n end",
"def html2text(html)\n\n result = ''\n begin\n web_doc = Hpricot(html)\n web_doc.search(\"//comment()\").remove\n web_doc.search(\"script\").remove\n web_doc.search(\"style\").remove\n web_doc.search(\"noscript\").remove\n web_doc.search(\"object\").remove\n web_doc.search(\"embed\").remove\n web_doc.search(\"head\").remove\n\n web_doc.traverse_text do |e| \n\n begin\n if e.content\n result += e.content+\"\\n\"\n end\n rescue\n # ignore errors\n end\n end\n rescue Exception => e\n # ignore errors\n warn \"html2text() - Exception '#{e.message}' trying to parse '#{html}'\"\n end\n\n if result == ''\n # Use a simple regular-expression approach to remove all tags\n result = html.gsub(/<[^>]*>/, '')\n end\n\n coder = HTMLEntities.new\n result = coder.decode(result)\n\n result.gsub!(/\\n[\\r\\n \\t]*/, \"\\n\")\n\n result\nend",
"def sanitize(text)\n return nil if text.nil? || text.empty?\n string = text.to_s # ensure we have a string\n\n doc = Nokogiri::HTML.parse(text)\n\n doc.xpath('//@style').remove\n doc.xpath('//@class').remove\n doc.xpath('//@id').remove\n doc.xpath('//@font-size').remove\n doc.xpath('//@color').remove\n doc.xpath('//@size').remove\n doc.xpath('//@face').remove\n doc.xpath('//@bgcolor').remove\n doc.xpath('//comment()').remove\n\n # remove \"bad\" elements\n doc.css('script, link, img, style').each { |node| node.remove }\n\n # convert all <div>s to <p>s\n doc.css('div').each do |div|\n node = doc.create_element 'p'\n node.inner_html = div.inner_html\n div.replace(node)\n end\n\n # remove <font> and <span> tags, but preserve their content\n doc.css('font, span').each do |node|\n node.swap(node.children)\n end\n\n # removing tags leaves dangling text nodes that should really be merged, so let's\n # re-build the document\n doc = Nokogiri::HTML.parse(doc.to_s)\n\n # wrap orphaned text nodes in <p> tags\n doc.css('html body').children.each do |orphan|\n if orphan.class == Nokogiri::XML::Text && !orphan.text.strip.gsub(Envelope::Message::ALL_SPACES, '').empty?\n node = doc.create_element 'p'\n node.inner_html = orphan.text\n orphan.replace(node)\n end\n end\n\n # remove all <p><br><p>\n doc.css('p br').each do |node|\n node.remove\n end\n\n # convert all new lines to br and trim content\n doc.css('p').each do |node|\n node.inner_html = node.inner_html.gsub(\"\\n\", '<br>').strip\n end\n\n # remove empty tags\n doc.css('html body > *').each do |node|\n unless %w(br p).include?(node.name)\n node.remove if node.inner_html.gsub(Envelope::Message::ALL_SPACES, '').empty?\n end\n end\n\n doc.css('html body > *').to_s.gsub(/[\\n\\t]+?/, '')\n end",
"def process_full_text(text)\n frag = Nokogiri::HTML::DocumentFragment.parse text.to_html\n clean_text = Nokogiri::HTML::DocumentFragment.parse \"\"\n\n frag.traverse do |node|\n # skip empty <br> elements\n next if node.nil? || node.name == \"br\"\n\n # Construct a new <p> with extracted text\n if node.text?\n new_p = Nokogiri::XML::Node.new(\"p\", clean_text)\n new_p.content = node.text.strip\n clean_text << new_p\n end\n end\n clean_text.to_html\n end",
"def gs(text)\n text.gsub(/<\\/?p>/, '').strip\nend",
"def html_markup_org(text); end",
"def sanitize text\n [' ', '\\r\\n', \"\\r\\n\", \"\\n\", \"\\r\", \"\\t\", / ^/, / $+/, /^ /, /^ /].each { |text_to_remove|\n text.gsub!(text_to_remove,'')\n }\n return text\n end",
"def strip!() end",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def simple_format_no_tags(text, html_options = {}, options = {})\n\t\ttext = '' if text.nil?\n\t\ttext = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n\t\ttext = sanitize(text) unless options[:sanitize] == false\n\t\ttext = text.to_str\n\t\ttext.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n#\t\ttext.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n\t\ttext.html_safe\n\tend",
"def smartify(text)\n return '' if text.nil? || text.empty?\n RubyPants.new(text).to_html\n end",
"def smartify(text)\n return '' if text.nil? || text.empty?\n RubyPants.new(text).to_html\n end",
"def strip_tags_nbsp(text)\n if text.present?\n strip_tags(text.gsub(' ', ' '))\n end\n end",
"def simple_format_no_tags(text, _html_options = {}, options = {})\n text = '' if text.nil?\n text = smart_truncate(text, options[:truncate]) if options[:truncate].present?\n text = sanitize(text) unless options[:sanitize] == false\n text = text.to_str\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n # text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.html_safe\n end",
"def as_displayed\n strip_html.unescape_html.strip_squeeze\n end",
"def get_tweet_text(text)\n return sanitize(strip_tags(strip_links(text))).split(\"\\r\\n\").join[0..99]\n end",
"def html_markup_textile(text); end",
"def convert_text(el, opts)\n if opts[:raw_text]\n el.value\n else\n el.value.gsub(/\\A\\n/) do\n opts[:prev] && opts[:prev].type == :br ? '' : \"\\n\"\n end#.gsub(/\\s+/, ' ').gsub(ESCAPED_CHAR_RE) { \"\\\\#{$1 || $2}\" }\n end\n end",
"def conv_html(txt)\n txt.\n gsub(/>/, '>').\n gsub(/</, '<').\n gsub(/"/, '\"').\n gsub(/&/, '&')\n \n end",
"def plain_text(html)\n HtmlToPlainText.plain_text(html)\n end",
"def strip_html(param_string)\n param_string.gsub!('<', '<')\n param_string.gsub!('>', '>')\n param_string.gsub(/\\\"/,\""\")\n return param_string\n end",
"def sanitize_as_html!\n Engine.clean!(self)\n end",
"def sanitize_as_html!\n Engine.clean!(self)\n end",
"def parse\n #use regex to split\n arr = @html_string.scan(TAGS_AND_TEXT).flatten\n\n #remove nil values and return\n arr.compact!\n\n #remove white spaces\n arr.map! { |s| s.strip}\n end",
"def element_text(element)\n element.text.strip\n end"
] |
[
"0.79107726",
"0.77517855",
"0.75825197",
"0.75083774",
"0.75083774",
"0.75083774",
"0.73941725",
"0.73231",
"0.7279591",
"0.72652704",
"0.7216221",
"0.7193634",
"0.7149507",
"0.71289575",
"0.7125986",
"0.7121022",
"0.7020071",
"0.69571745",
"0.694305",
"0.6919113",
"0.6918247",
"0.6918247",
"0.690429",
"0.68997866",
"0.68946797",
"0.68709886",
"0.68547416",
"0.68547416",
"0.68547416",
"0.6834453",
"0.6801728",
"0.6792988",
"0.6792988",
"0.678046",
"0.67797786",
"0.67586964",
"0.6715103",
"0.6681543",
"0.6603383",
"0.66022235",
"0.6522784",
"0.65106094",
"0.6499798",
"0.64952725",
"0.6487375",
"0.64867526",
"0.6478661",
"0.64606375",
"0.6433524",
"0.6430897",
"0.6427715",
"0.6425218",
"0.6391371",
"0.63894844",
"0.63721216",
"0.6370507",
"0.63580954",
"0.6350434",
"0.63459474",
"0.6337639",
"0.63343626",
"0.6316096",
"0.629981",
"0.6298029",
"0.62977505",
"0.62922007",
"0.6286791",
"0.6274593",
"0.6270937",
"0.6261017",
"0.6252524",
"0.6241462",
"0.6229785",
"0.62280583",
"0.6216731",
"0.6211589",
"0.6183427",
"0.617922",
"0.61773545",
"0.6168513",
"0.6155412",
"0.61485964",
"0.61485964",
"0.61485964",
"0.61485964",
"0.6144492",
"0.6144492",
"0.61376774",
"0.6129206",
"0.6120017",
"0.6113355",
"0.61025447",
"0.6097626",
"0.6096553",
"0.60913914",
"0.6091124",
"0.60726446",
"0.60726446",
"0.60717326",
"0.6066314"
] |
0.6822878
|
30
|
Present the user's avatar, optionally with a form for uploading the image (if they're the viewer)
|
def card_avatar options={}
(is_viewer? && !@decorator.imgdata(false).present?) ?
super + collectible_editpic_button(@decorator, 'lg', label: 'Get a Picture', class: 'upload-button') :
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render_answer_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url, class: 'media-object tiny-thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '30px', width: '30px', class: 'media-object tiny-thumbnail').html_safe\n end\n end",
"def edit\n \n @user.avatar.attach(params[:avatar])\n authorize @user\n end",
"def profile_avatar\n if current_user.update(params.require(:user).permit(:avatar))\n render :profile_avatar\n else\n render(json: { errors: current_user.errors.full_messages }, status: :unprocessable_entity) && return\n end\n end",
"def profile\n current_user.update(user_params)\n current_user.avatar.attach(params[:user][:avatar]) if params[:user][:avatar].present?\n end",
"def show\n if @user_profile.image.attachment \n @profile_image = @user_profile.image\n else\n @profile_image = \"https://api.adorable.io/avatars/200/#{current_user.username}\" \n end\n end",
"def show_avatar\n\n end",
"def show_avatar\n\n end",
"def upload\n\t\t@musician = User.find_by_id(current_user)\n\t\tif !params[:user].nil?\n\t\t\t@musician.avatar = params[:user][:avatar]\n\t\t\t@musician.uploaded = true\n\t\tend\n\n\t\tif @musician.save\n\t\t\tredirect_to musician_path(@musician)\n\t\telse\n\t\t\t@musician.uploaded = false if params[:user][:avatar]\n\t\t\trender 'show'\n\t\tend\n\tend",
"def avatar_photo (person)\n if person.image.attached?\n image_tag person.image\n else\n image_tag \"static/placeholder.jpg\"\n end\n end",
"def upload\n @avatar = Avatar.new params[:avatar]\n if @avatar.valid?\n if !@me.avatar.blank?\n @me.avatar.update_attribute('selected_avatar', false)\n end\n @avatar.user_id = @me.id\n @avatar.selected_avatar = true\n @avatar.save\n redirect_to avatar_url\n flash[:notice] = 'Persoonlijke afbeelding geplaatst.'\n else\n @avatar.errors.clear\n @avatar.errors.add_to_base('Foutieve avatar geupload. De file kan niet van het juiste type zijn (zorg voor een jpeg/png/gif afbeelding) of kan te groot zijn (probeer de file onder de 300 kb te houden).')\n end\n end",
"def render_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.url, class: \"media-object thumbnail\").html_safe\n else\n image_tag('fallback/default.gif', height: '150px', width: '150px', class: 'media-object thumbnail').html_safe\n end\n end",
"def avatar\n respond_with(@user)\n end",
"def render_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px').html_safe\n end\n end",
"def avatar\n @user = current_user\n @user.avatar.attach(params[:avatar][:avatar])\n respond_to do |format|\n format.js\n end\n end",
"def save_new_avatar\n @user.attributes = params[:user]\n \n return render(:action => :picture) unless @user.avatar && @user.avatar.valid? && @user.save\n \n flash[:notice] = \"Saved new avatar.\"\n redirect_to picture_settings_url\n end",
"def render_avatar(request)\n if !request.after_photo_url.blank?\n render partial: \"avatar\", locals: { link: request.after_photo_url_url(:thumb) }\n else\n if current_user && current_user.id == request.requestor_id && request.current_status >= 10\n render partial: \"upload_photo\", locals: { request: request }\n else\n if !request.before_photo_url.blank?\n render partial: \"avatar\", locals: { link: request.before_photo_url_url(:thumb) }\n else\n render partial: \"avatar\", locals: { link: \"profile.png\" }\n end\n end\n end\n end",
"def render_tiny_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe\n end\n end",
"def author_avatar\n anonymous? ? Avatar.default.url : user.profile.avatar.url\n end",
"def render_super_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.small.url, class: 'media-object thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px', class: 'media-object thumbnail').html_safe\n end\n end",
"def attachprofilepicture\n current_user.avatar.attach(params[:avatar])\n redirect_to profilepage_path\n end",
"def avatar_image_tag(user=nil, options = {})\n user ||= current_user\n avatar = user.avatar\n empty = options.delete(:empty) || false\n if avatar\n \"<img src='#{image_path avatar.public_filename}' class='avatar' style='width: #{avatar.width}px; height: #{avatar.height}px' />\"\n elsif empty\n case empty\n when :blank, 'blank'\n image_tag 'noavatar.gif', :class => 'avatar'\n end\n end\n end",
"def create\n @avatar = @user.avatar.new(avatar_params)\n\n respond_to do |format|\n if @avatar.save\n format.html { redirect_to new_user_avatar_path(current_user), notice: 'Avatar was successfully created.' }\n format.json { render action: 'show', status: :created, location: @avatar }\n else\n format.html { render action: 'new' }\n format.json { render json: @avatar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def avatar(user, options={})\n return unless user\n options.reverse_merge!(:url => \"/\", :width => 24)\n image_tag avatar_url(user, options), :class => 'avatar', :width => options[:width]\n end",
"def artist_avatar\n if self.avatar.attached?\n image_tag artist.avatar\n else\n image_tag 'default_avatar.jpg'\n end\n end",
"def avatar_for(user, size = nil)\n avatar_tag user.avatar, size, user.name if user.is_a? User\n end",
"def upload_picture\n \n # Pass through the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Check that the current user is the specified user, or an\n # administrator\n unless @user == current_user or admin_logged_in?\n flash[:error] = 'You cannot upload a profile picture for another user.'\n redirect_to :controller => 'sessions', :action => 'new'\n else\n render :layout => 'dialog'\n end\n end",
"def avatar_for(model, args = {})\n args = {:class => 'avatar', :size => '48x48'}.merge(args)\n if model.avatar && model.avatar.has_image?\n image_tag(model.avatar.image.url(Avatar.styles[args[:size]]), args)\n elsif model.respond_to?(:email)\n gravatar_image_tag(model.email, {:gravatar => {:default => default_avatar_url}}.merge(args))\n else\n image_tag(\"avatar.jpg\", args)\n end\n end",
"def author_avatar\n is_anonymous ? Avatar.default.url : user.profile.avatar.url\n end",
"def fb_avatar(user, options = {})\n if user.class.name == 'User'\n if user.provider == \"facebook\"\n image_tag(\"https://graph.facebook.com/#{user.external_user_id}/picture?type=square\", { :alt => user_name(user), :class => 'fb-avatar' }.merge(options))\n else\n image_tag(\"no_avatar.jpg\", :size => '50x50')\n end\n else\n image_tag(\"no_avatar.jpg\", :size => '50x50')\n end\n # the code below turns the facebook avatar into a link, which we don't want.\n # link_to(image_tag(\"http://graph.facebook.com/#{user.external_user_id}/picture?type=square\", { :alt => user_name(user), :class => 'fb-avatar' }.merge(options)), \"http://www.facebook.com/profile.php?id=#{user.external_user_id}\", { :target => '_blank' })\n end",
"def user_profile_img(user)\n if user.avatar?\n return image_tag(user.avatar, alt: user.name, size: \"60x60\")\n else\n img_url = 'no_image.png'\n end\n image_tag(img_url, alt: user.name, size: \"60x60\")\n end",
"def image_avatar_tag(person, options={})\n options = {:size => '35x35', :anonymous => false}.merge(options).symbolize_keys\n anonymous = !!options.delete(:anonymous)\n image_tag(image_avatar_path(person, {:anonymous => anonymous}.merge(options)), \n {:alt => person ? (anonymous ? \"\" : h(person.username_or_name)) : \"\", \n :title => person ? (anonymous ? \"\" : h(person.username_or_name)) : \"\"}.merge(options))\n end",
"def user_avatar(user_id)\n user = User.find!(user_id)\n if user.avatar.attached?\n image_tag user.avatar\n else\n image_tag \"../images/Littlefinger_Main.jpg\"\n end\n end",
"def uploadavatar\n if @me.avatars.size > 9\n flash[:notice] = \"Je kunt niet meer dan 10 persoonlijke afbeeldingen hebben.\"\n redirect_to myprofile_url and return\n end\n @avatar = Avatar.new\n end",
"def create\n @user = current_user\n if @user.avatar.nil?\n @avatar = @user.create_avatar(avatar_params)\n\n respond_to do |format|\n if @avatar.save\n format.json { render :show, status: :created, location: @avatar }\n else\n format.json { render json: @avatar.errors, status: :unprocessable_entity }\n end\n end\n else\n return render json: { error: 'У пользователя уже существует аватар' }, status: 403\n end\n end",
"def user_avatar(user)\n user.avatar ? user.avatar.photo.url(:thumb) : \"default-avatar.jpg\"\n end",
"def avatar_for(user, size=80)\n user.avatar.attached? ? image_tag(url_for(user.set_avatar(size)), class: \"avatar\") : gravatar_for(user, size)\n end",
"def profile_picture_for(user)\n if user.picture?\n image_tag(user.picture.url, alt: user.name, class: \"profile_picture\")\n else\n image_tag(random_default_image, alt: user.name, class: \"profile_picture\")\n end\n end",
"def find_avatar\n @avatar = @user.avatar || @user.build_avatar\n authorize @avatar\n end",
"def user_avatar(user_id, size)\n user = User.find(user_id)\n if user.avatar.attached?\n image_tag user.avatar.variant(resize: \"#{size}x#{size}\"), height: \"#{size}px\", width: \"#{size}px\"\n else\n image_tag 'default-avatar.png', height: \"#{size}px\", width: \"#{size}px\"\n end\n end",
"def avatar_param\n nil\n end",
"def set_avatar\n @user = current_user\n @avatar = Avatar.find(@user.avatar)\n end",
"def avatar(html_options: {}, options: {})\n html_options = {\n alt: object.name\n }.merge(html_options)\n\n helpers.image_tag(avatar_url(options), html_options)\n end",
"def user_avatar\n params.permit(:avatar)[:avatar]\n end",
"def set_avatar\n @avatar = Avatar.find(params[:user_id])\n end",
"def user_avatar(user, size=40)\n if user.avatar.attached?\n user.avatar.variant(resize: \"#{size}x#{size}!\")\n else\n gravatar_image_url(user&.email, size: size)\n end\n end",
"def create\n @custom_avatar = CustomAvatar.new(custom_avatar_params)\n\n uploaded_file = params[:custom_avatar][:uploaded_file]\n if uploaded_file.nil?\n flash[:alert] = \"Please specify a file to upload.\" \n render action: 'new'\n return\n elsif Dimensions.width(uploaded_file.tempfile) > 48 || Dimensions.width(uploaded_file.tempfile) > 48\n flash[:alert] = \"Avatar images cannot be larger than 48px x 48px\"\n render action: 'new'\n return\n end\n\n @custom_avatar.uploader ||= current_user.id\n\n respond_to do |format|\n if @custom_avatar.save\n @custom_avatar.set_image(uploaded_file)\n format.html { redirect_to @custom_avatar, notice: 'Custom avatar was successfully created.' }\n format.json { render action: 'show', status: :created, location: @custom_avatar}\n else\n format.html { render action: 'new' }\n format.json { render json: @custom_avatar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def avatar_for(user, size=32)\n image_location = if user.avatar.nil? || user.avatar.empty?\n \"http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&rating=PG&size=#{size}\"\n else\n sanitize(user.avatar)\n end\n image_tag image_location, :size => \"#{size}x#{size}\", :class => 'photo'\n end",
"def render_comment_avatar_for(comment_user)\n if comment_user.avatar?\n image_tag(comment_user.avatar.profile.url, class: \"media-object thumbnail\").html_safe\n else\n image_tag('fallback/default.gif', height: '55px', width: '55px', class: 'media-object thumbnail').html_safe\n end\n end",
"def linked_in_avatar(user)\n image_tag(user.user_info[\"linked_in\"][\"image\"])\n end",
"def avatar\n @user = User.find_by_id(params[:user_no])\n if (current_user && current_user.roles != \"admin\" && current_user.idUser != params[:user_no])\n return render_json_response({:error => \"You are not authorize to update this user.\"}, :ok)\n else\n if (params[:avatar] == nil)\n return render_json_response({:error => \"Please send all require attributes.\"}, :ok)\n else\n if @user.update(avatar: params[:avatar])\n return render_json_response({:message => \"User state has changed.\"}, :ok)\n else\n return render_json_response({:message => \"User not found.\"}, :ok)\n end\n end\n end\n end",
"def avatar_url\n uploaded ? avatar.url : \"/assets/no_avatar.png\"\n end",
"def create\n @user_avatar = UserAvatar.new(user_avatar_params)\n\n respond_to do |format|\n if @user_avatar.save\n format.html { redirect_to @user_avatar, notice: 'User avatar was successfully created.' }\n format.json { render :show, status: :created, location: @user_avatar }\n else\n format.html { render :new }\n format.json { render json: @user_avatar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @avatar = Avatar.new(avatar_params)\n @user = User.find(params[:user_id])\n @user.avatar.attach(params[:avatar])\n\n\n if @avatar.save\n flash[:success] = \"Avatar was successfully created.\" \n redirect_to '/'\n else\n flash.now[:danger] = \"Error attemprint to attend an event\"\n render :action => 'new'\n end\n end",
"def update\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\tpicture = params[:photo]\n\n \tif picture != nil\n \t\tfile = File.new(Rails.root.join('app', 'assets', 'images', picture.original_filename), 'wb')\n \t\tfile.write(picture.read)\n \t\tsubmission_hash = {\"email\" => params[:email],\n \"bio\" => params[:bio],\n \"photo\" => picture.original_filename}\n @current_user.update_attributes(submission_hash)\n render :action => 'crop'\n \telse\n \t\tsubmission_hash = {\"email\" => params[:email],\n \"bio\" => params[:bio]}\n @current_user.update_attributes(submission_hash)\n redirect_to :controller => :user, :action => :profile\n \tend\n\n\tend",
"def create\n if params[:user] && params[:user][:avatar_data]\n if params[:user][:avatar_data].size <= 0\n flash[:error] = \"Please choose an image to upload.\"\n elsif !Technoweenie::ActsAsAttachment.content_types.include?(file_type = params[:user][:avatar_data].content_type.strip)\n flash[:error] = \"Sorry, we only support jpg, png, and gif files for ID Images.\"\n elsif current_user.update_attributes(params[:user])\n flash[:notice] = \"Your ID Image was uploaded successfully\"\n else\n flash[:error] = \"Your ID Image was not uploaded.\"\n end\n end\n redirect_to :controller => 'account', :action => 'congratulations'\n end",
"def update\n if @user.update(user_params)\n if params[:user][:avatar].present?\n render :crop\n else\n redirect_to @user\n end\n else\n flash.now[:alert]=\"Something went wrong Please try again\"\n render :edit\nend\nend",
"def picture\n if self.avatar?\n self.avatar.url\n elsif self.image_url != nil\n self.image_url\n else\n 'generic_avatar'\n end\n end",
"def user_params\n params.permit(:name, :avatar)\n end",
"def create\n @avatar = Avatar.new(params[:avatar])\n\n respond_to do |format|\n if @avatar.save\n flash[:notice] = 'Avatar was successfully created.'\n format.html { render :action => \"crop\" }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def effective_avatar(ob, user, query)\n\n picture = ob.profile.picture\n\n if picture\n result = rest_reference(picture, query, true)\n result.name = \"avatar\"\n result\n else\n result = LibXML::XML::Node.new('avatar')\n result['resource'] = Conf.base_uri + '/images/avatar.png'\n result\n end\nend",
"def update\n super\n if account_update_params[:avatar].present?\n resource.avatar.attach(account_update_params[:avatar])\n end\n end",
"def avatar\n if object.dp.present?\n k = object.dp.url.gsub('upload','upload/g_face,c_thumb,w_150,h_150')\n else\n k = object.avatar\n end\n end",
"def show()\n @authentication = Authentication.find(params[:id])\n\n if @authentication.provider == \"facebook\"\n me = FbGraph::User.me(@authentication.token).fetch\n current_user.fname = me.name.split.first\n current_user.lname = me.name.split.last\n current_user.email = me.email\n current_user.gender = me.gender\n birthday = me.birthday\n current_user.birthday = Chronic.parse(birthday) if birthday\n\n location = me.location\n current_user.location = location if location and location.is_a? String\n current_user.location = location.try(:[], :name) if location and location.is_a? Hash\n pictureurl = me.picture+'?type=large'\n begin\n tempfile = Tempfile.new(['', '.jpg'])\n open(tempfile.path, 'wb') do |file|\n file << open(URI.parse(pictureurl)).read\n end\n current_user.avatar = tempfile\n rescue\n end\n end\n\n current_user.save\n redirect_to edit_user_path\n end",
"def create\n @user = User.new(user_params)\n\n if params[:avatar_url] == \"\"\n @user.avatar_url = \"fct.gif\"\n end\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @current_user.avatar = params[:file]\n @current_user.save!\n json_response({ message: Message.media_created })\n end",
"def update_picture\n \n # Get the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Check that the current user is the specified user, or an\n # administrator\n unless @user == current_user or admin_logged_in?\n flash[:error] = 'You cannot upload a profile picture for another user.'\n redirect_to :controller => 'sessions', :action => 'new'\n else\n \n if !params[:picture].blank?\n # Destroy any profile pictures currently associated with the \n # specified user\n destroy_user_profile_pics(@user) \n \n # Create a new profile picture and populate it with data\n @picture = ProfilePicture.new\n @picture.user = @user\n @picture.uploaded_data = params[:picture]\n @picture.content_type = 'image/jpeg'\n \n # Save new profile picture and redirect back to upload picture action\n @picture.save!\n flash.now[:just_submitted] = true\n end\n\n render :template => 'users/upload_picture', :layout => 'dialog'\n end\n end",
"def user_image(user = nil, variant:)\n _user_image(user, url: user_avatar_url(user, variant: variant))\n end",
"def set_user_avatar\n @user_avatar = UserAvatar.find(params[:id])\n end",
"def avatar_params\n params.require(:avatar).permit(:avatar, :user_id)\n end",
"def avatar_filename\n if avatar_content_type == 'image/jpeg'\n self.avatar_file_name = 'avatar.jpg' if avatar.present?\n end\n end",
"def display_profile_image\n if self.picture.present? && self.picture.url(:small).present?\n self.picture.url(:small)\n else\n ActionController::Base.helpers.asset_path('user.png')\n end\n end",
"def create\n # set flag to mark that avatar set up\n if params[:user][:avatar].present?\n params[:user][:progress_status] = 0b00000001\n end\n super\n end",
"def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)\n alternative = \"\"\n if show_tooltip\n tooltip_text = (alt.nil? ? h(object.name) : alt)\n else\n alternative = (alt.nil? ? h(object.name) : alt) \n end\n \n case object.class.name.downcase\n when \"person\", \"institution\", \"project\"\n if object.avatar_selected?\n img = image_tag avatar_url(object, object.avatar_id, size), :alt=> alternative, :class => 'framed'\n else\n img = null_avatar(object.class.name, size, alternative)\n end\n end\n \n # if the image of the avatar needs to be linked not to the url of the object, return only the image tag\n if return_image_tag_only\n return img\n else \n unless url\n url = eval(\"#{object.class.name.downcase}_url(#{object.id})\")\n end\n return link_to(img, url, :title => tooltip_text)\n # return link_to(img, url, :title => tooltip_title_attrib(tooltip_text))\n end\n end",
"def avatar\n \t\t# get the email from URL-parameters or what have you and make lowercase\n\t\temail_address = self.email.downcase\n\t\t \n\t\t# create the md5 hash\n\t\thash = Digest::MD5.hexdigest(email_address)\n\t\t \n\t\t# compile URL which can be used in <img src=\"RIGHT_HERE\"...\n\t\timage_src = \"http://www.gravatar.com/avatar/#{hash}\"\n \tend",
"def current_avatar\n logged_in? ? \n image_tag(\"/avatar/show?secret_code=#{session[:secret_code]}&\", :alt => current_user.login) : # The '&' is a hack to prevent the appended .png from spoiling the call\n image_tag('id_image.gif', :alt => \"ID Image\", :size => '70x70')\n end",
"def user_avatar_tag(user, options={})\n options = options.symbolize_keys\n options[:alt] ||= user.username\n options[:class] = Array.wrap(options[:class]) # ensure array\n options[:class] << 'user-avatar' # append 'user-avatar' CSS class\n\n image_tag(user_avatar_url(user, options[:size]), options)\n end",
"def user_avatar_params\n params.require(:user_avatar).permit(:user_id, :avatar)\n end",
"def avatar_for(user, size=32)\n options = {}\n if user.admin == 1\n options[:class] = \"teacher-avatar\" \n end\n case(user.language)\n when 'en'\n flag(\"us\",options)\n when 'es'\n flag(\"cr\",options)\n end\n end",
"def profile_image_tag(person, options = {})\n source = profile_image_source(person, options)\n options[:link_uri] = person_path(person) if add_image_link?(options)\n options[:alt_text] = \"Current photo of #{person}\"\n profile_or_team_image_div source, options\n end",
"def upload_avatar\n @user = User.find(params[:id])\n @file = params[:avatar]\n\n # return render_error :avatar unless @file && @file.try(:content_type)\n if @file.content_type =~ /^image\\/jpeg|png|jpg/\n if @user.update_attributes(avatar: params[:avatar])\n redirect_to user_pa_organization_user_path\n end\n else \n flash[:alert] = \"Your file's type is invalid. Please try another one!\"\n redirect_to user_pa_organization_user_path\n # render_error :content_type, :type => @file.content_type\n end\n\n end",
"def show\n format.html { redirect_to user_path(@image.user), notice: \"Profile picture was successfully created.\" }\n end",
"def user_avatar(user)\n if user.avatar.attached?\n return user.avatar\n elsif user.gender == \"Male\"\n return \"jimmy.png\"\n elsif user.gender == \"Female\"\n return \"sue.svg\"\n elsif user.gender == \"Non-Binary\"\n return \"yanny.svg\"\n else\n return \"blank-avatar.svg\"\n end\n end",
"def user_params\n params.require(:user).permit(:avatar)\n end",
"def user_params\n params.require(:user).permit(:avatar)\n end",
"def profile_photo\n\tend",
"def fb_profile_pic(user, options = {})\n validate_fb_profile_pic_size(options)\n options.merge!(:uid => cast_to_facebook_id(user))\n self_closing_tag(\"fb:profile-pic\", options)\n end",
"def set_avatar_name\n self.display_name ||= self.username\n end",
"def sign_up_params\n if params[:user][:avatar] != nil\n params[:user][:avatar] = User.resize_avatar(params[:user][:avatar])\n else\n path = \"#{Rails.root}/app/assets/images/member.jpg\"\n params[:user][:avatar] = Rack::Test::UploadedFile.new(path)\n end\n params.require(:user).permit(:firstname,:lastname ,:gender,:email,:password,:phone,:address,:avatar,:password_confirmation)\nend",
"def atest_ID_25836_edit_profile_pic_03\n login_as_user1\n go_to_edit_profile_page\n verify_user_able_to_close_photo_upload_dialog\n end",
"def set_main_image\n @user = User.find(params[:id])\n @user.avatar_id = params[:image_id]\n @user.save!\n redirect_to user_path(@user), notice: \"You successfully se the main profile as your avatar!\"\n end",
"def pic_field form, options={}\n # We work with a decorator, whether provided or not\n decorator = options[:decorator] || form.object\n # The form may be working with an object, not its decorator\n decorator = decorator.decorate unless decorator.is_a?(Draper::Decorator)\n\n pic_area = image_with_error_recovery decorator,\n id: pic_preview_img_id(decorator),\n fill_mode: 'fixed-width',\n fallback_img: options[:fallback_img] || true\n\n form_field = form.hidden_field decorator.picable_attribute,\n {\n rel: 'jpg,png,gif',\n class: 'hidden_text',\n onchange: ('RP.submit.enclosing_form' if options[:submit_on_change])\n }.compact\n content_tag :div, pic_area+form_field, class: 'pic_preview'\n end",
"def find_avatar!\n @avatar = @user.avatar!\n authorize @avatar\n end",
"def user_pic user\n \"<a href='#{site(user)}' title='#{user.city} #{user.jobs} #{user.maxim} #{user.memo}' target='_blank'><img width='48' height='48' src='#{user.avatar.thumb.url}' width='#{USER_THUMB_SIZE}' height='#{USER_THUMB_SIZE}'></a>\"\n end",
"def update_avatar_from_provider!(auth)\n avatar_image_url = auth[\"info\"][\"image\"] || auth[\"extra\"][\"raw_info\"][\"profile_image_url_https\"] rescue nil\n person.update_attribute(:avatar_image_url, avatar_image_url) if avatar_image_url && person\n end",
"def user_params\n params.require(:user).permit(:avatar)\n end",
"def user_params\n params.require(:user).permit(:avatar)\n end",
"def user_params\n params.require(:user).permit(:avatar)\n end",
"def user_params\n params.require(:user).permit(:avatar)\n end",
"def create\n @standard_avatar = StandardAvatar.new(standard_avatar_params)\n\n uploaded_file = params[:standard_avatar][:uploaded_file]\n if uploaded_file.nil?\n flash[:alert] = \"Please specify a file to upload.\" \n render action: 'new'\n return\n elsif Dimensions.width(uploaded_file.tempfile) > 48 || Dimensions.width(uploaded_file.tempfile) > 48\n flash[:alert] = \"Avatar images cannot be larger than 48px x 48px\"\n render action: 'new'\n return\n end\n\n respond_to do |format|\n if @standard_avatar.save\n @standard_avatar.set_image(uploaded_file)\n format.html { redirect_to @standard_avatar, notice: 'Standard avatar was successfully created.' }\n format.json { render action: 'show', status: :created, location: @standard_avatar }\n else\n format.html { render action: 'new' }\n format.json { render json: @standard_avatar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.require(:user).permit(:avatar)\nend"
] |
[
"0.7003281",
"0.6941493",
"0.6914989",
"0.69111794",
"0.6824141",
"0.67765796",
"0.67765796",
"0.67720795",
"0.6666585",
"0.6658455",
"0.6604734",
"0.6593839",
"0.658528",
"0.6575731",
"0.64567816",
"0.6438632",
"0.6438575",
"0.64325213",
"0.64291936",
"0.6423737",
"0.6418343",
"0.63919514",
"0.63886964",
"0.6383065",
"0.6382482",
"0.6370138",
"0.6358147",
"0.6349414",
"0.6337119",
"0.6327368",
"0.63272375",
"0.63071537",
"0.6299817",
"0.6283305",
"0.6281233",
"0.6257638",
"0.6256817",
"0.62429583",
"0.62170863",
"0.62135583",
"0.62031996",
"0.6184886",
"0.61839855",
"0.6165666",
"0.6164894",
"0.6158053",
"0.61524284",
"0.612105",
"0.60956687",
"0.6085717",
"0.6068656",
"0.6064546",
"0.6059942",
"0.6059338",
"0.605781",
"0.60509145",
"0.6045769",
"0.60450596",
"0.60435975",
"0.60303843",
"0.6016694",
"0.60063124",
"0.6004296",
"0.6001139",
"0.5998115",
"0.598243",
"0.59803647",
"0.5967373",
"0.59600097",
"0.5959975",
"0.59538877",
"0.5948181",
"0.59458643",
"0.5938814",
"0.5923732",
"0.5916976",
"0.5912956",
"0.59047276",
"0.59010315",
"0.58964145",
"0.58824486",
"0.58803314",
"0.58789235",
"0.58789235",
"0.5878653",
"0.58752066",
"0.58634263",
"0.58612365",
"0.5859554",
"0.5859508",
"0.58577585",
"0.58432764",
"0.58390945",
"0.5836508",
"0.5831459",
"0.5831459",
"0.5831459",
"0.5831459",
"0.5830977",
"0.582259"
] |
0.68886626
|
4
|
Users don't have a ribbon on their card
|
def ribbon
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ribbon_got?(id)\n return @ribbons.include?(id)\n end",
"def test_inactiveBorder\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 500, 300, 50, @elements, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2, nil,\n 1, Color.normal_color)\n uc.active = false\n uc.draw()\n }\n return true\n end",
"def show_draft_button?\n current_c100_application.try(:child_protection_cases)\n end",
"def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end",
"def donator?\n @badges.key? 'bits'\n end",
"def has_badge?\n !!self.badge\n end",
"def test_inactive\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(0, 24, 24, 24), 1)\n uc.active = false\n uc.draw()\n }\n return true\n end",
"def remove_donation_button_if_no_accounts\n unless has_an_approved_account_set?\n self.show_donation_basket = false\n end\n true\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(100, 24, 24, 24), 1)\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def bits_leader?\n @badges.key? 'bits-leader'\n end",
"def rank_officer?\n !rank_id.nil? && rank.rate > 2\n end",
"def test_inactive\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 300, 300, 50, @elements, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.active = false\n uc.draw()\n }\n return true\n end",
"def can_be_colored?\n self.user_id.nil?\n end",
"def brew_button_status; end",
"def card_image\n false\n end",
"def on_hold?\n status == :inactive\n end",
"def bubbles?\n false\n end",
"def has_bridge?\r\n not @bridges.empty?\r\n end",
"def gift_card_for_business_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.id(\"/blueLinkUnderline/\"), __method__, self)\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 500, 300, 50, @elements, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def no_cards_image \n scryfall.card_code_number('sok', 84)['image_uris']['large']\n end",
"def needs_redraw?\n\t\t@swimming || @party_horn.needs_redraw?\n\tend",
"def offers_reward?\n !self.rewards.visible.empty?\n end",
"def other_user_profile?\n !is_owner\n end",
"def editable_from_card?\n true\n end",
"def won?\n !@grid.flatten.any? do |card|\n !card.face_up\n end\n end",
"def is_border?(); @type == GRT_BORDER; end",
"def test_inactive\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(0, 40, 40, 40), $data_actors[1])\n uc.active = false\n uc.draw()\n }\n return true\n end",
"def buttonNOOMeGusta\n if object.repost_id != nil #post compartido\n if (Post.find(object.repost_id)).already_dislikes?(h.current_user) == false\n return (dislikesDecorator + (h.botonesPostNoMegusta post.repost_id)).html_safe #no click\n else\n return (dislikesDecorator + (h.botonesPostYaNoMegusta post.repost_id)).html_safe #YA click\n\n end\n end\n\n\n if object.already_dislikes?(h.current_user) == false #post original\n return (dislikesDecorator + (h.botonesPostNoMegusta post.id)).html_safe #no click\n else\n return (dislikesDecorator + (h.botonesPostYaNoMegusta post.id)).html_safe #YA click\n\n end\n \n end",
"def should_collect_functioning_bikes?(container)\n !self.full? && container.functioning_bikes.count >= 1\n end",
"def create_account_displayed\n $tracer.trace(format_method(__method__))\n return @tag.call(\"style.marginLeft\").to_i < 0 ? true : false\n end",
"def badge_level_up\n\t return if recipe.ratings.where(user_id: user.id).first.score == 0 \n\t\tbadge_level_up_aux(\"Critic\",\"critic\",\"ratings\")\n\tend",
"def not_account_owner\n not_account_owner_in_signup && !is_account_owner? \n end",
"def can_disable_affiliate_branding?\n !self.invitation.nil? && \n !self.affiliate.nil? && \n (!self.subscription.trial? || !self.invitation_subscription?)\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(100, 40, 40, 40), $data_actors[1])\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def is_crop?\r\n self.rels_ext.content.include? \"isCropOf\"\r\n end",
"def show_explore_button?\n current_user.permissions == User::Permissions::NONE\n end",
"def active?\n points_awarded.present?\n end",
"def show_top_card\n self.discard(draw)\n end",
"def bureaucrat?\n (status =~ /bureaucrat/) != nil\n end",
"def sub_gift_leader?\n @badges.key? 'sub-gift-leader'\n end",
"def allows_reward?\n false\n end",
"def can_close_signup?\n @signup_closecross.visible?\n end",
"def entirely_unshipped?\n line_items_uncancelled.empty?.not && line_items_uncancelled.detect {|li| ! li.shipment.nil? }.nil?\n end",
"def dangling?\n shares.count < 1 && invitations.active.count < 1\n end",
"def show_item_gold?(targets) #don't show item/gold gained during battle\n end",
"def has_oranges?\n self.oranges.count > 0\n end",
"def opponent_exhausted_winnings_and_base_cards?\n @opponent.no_base_cards_remaining?\n end",
"def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end",
"def ribbon_html\n if !source_url.nil? && !wiki.settings.ribbon.nil?\n name, pos = *wiki.settings.ribbon.split(' ')\n pos ||= 'right'\n \n html = \"<a href=\\\"#{source_url}\\\">\"\n html << \"<img style=\\\"position:absolute; top:0; #{pos}:0; border:0;\\\" src=\\\"#{ribbon_url(name, pos)}\\\" alt=\\\"Fork me on GitHub\\\"/>\"\n html << \"</a>\"\n end\n end",
"def can_use_ill?\n !virginia_borrower?\n end",
"def has_autohighlight?\n patron?(tier: 1, before: STRIPE_MIGRATION_DATE) || patron?(tier: 4) || subscriptions.tier1.active.any? || admin? || self.class.stay_insideathon?\n end",
"def ui_under_corr?(in_element)\n ui_corr.under_corr?(in_element)\n end",
"def disclosure_of_interests\n # blank\n end",
"def pre_bill_reading_not_billed?(pre_bill)\n pre_bill.reading_2.bill_id.blank?\n end",
"def on_hold?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review On-Hold'\").id\n end",
"def liked_css\n liked? == true ? 'active' : nil\n end",
"def abandoned?\n status == Game::ABANDONED && abandoned_at.present?\n end",
"def card\n false\n end",
"def test_inactive\n [@window, @sprite, @bitmap].each{|container|\n uc = UCNumericUpDown.new(container, Rect.new(100, 48, 100, 24), 5)\n uc.active = false\n uc.draw()\n }\n return true\n end",
"def test_defaultIcon\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(100, 0, 24, 24), 1)\n uc.draw()\n }\n return true\n end",
"def assigned_to_card?\n self.card_id != 0\n end",
"def can_be_retagged_by?(editor, tier=nil)\n self.alive? && (editor == self.person || Reputation::Threshold.valid?(:retag_kase, editor, :tier => tier))\n end",
"def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end",
"def any_herbivores?\n @carnivores.count < current_occupancy\n end",
"def should_collect_broken_bikes?(container)\n !self.full? && container.broken_bikes.count >= 1 \n end",
"def icon\n return 'ban' if cancelled?\n return 'pencil' if incomplete?\n return nil if concluded?\n return 'question-circle' if current?\n fully_shipped? && 'exclamation-circle' || 'truck'\n end",
"def can_put_in_foundation?\n (@pile_beneath.empty? && @card_to_drop.rank.ace?) ||\n (@card_beneath && foundation_conditions?(@card_beneath))\n end",
"def check_absorptance?()\n \n @construction.check_keyword?(\"ABSORPTANCE\") \n \n end",
"def add_ribbon(id)\n return unless id.between?(0, 50)\n\n @ribbons << id unless @ribbons.include?(id)\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCNumericUpDown.new(container, Rect.new(200, 48, 100, 24), 5)\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def has_own_bed?\n false\n end",
"def under_review?(item)\n state_group(item) == :review\n end",
"def fabrication_drawing?\n self.eco_types.detect { |et| et.name == \"Fabrication Drawing\" } != nil\n end",
"def has_hiding?\n patron?(tier: 1, before: STRIPE_MIGRATION_DATE) || patron?(tier: 4) || subscriptions.tier1.active.any? || admin? || self.class.stay_insideathon?\n end",
"def user_may_view_item?\n @pcp_item.pcp_step.released? || @pcp_item.pcp_step.in_commenting_group?\n end",
"def isOver?\n @deck.cardsRemaining < MIN_CARDS\n end",
"def owner_retain_canceled?\n self.abnormal_close_type.present? && self.abnormal_close_type.owner_retain_canceled?\n end",
"def has_activate_gold_status_link?\n has_css? @activate_gold_status_link\n end",
"def any_oranges?\n @oranges >= 1\n end",
"def over?\n self.draw? || self.won? != false\n end",
"def blue_magic_learn_by_allies?(user)\n if user.actor?\n return Bubs::BlueMagic::LEARN_BY_ALLIES\n else\n return true\n end\n end",
"def challenge_card_image?\n parent_type == \"User\" && parent == User.challenge_bot && scope == SCOPE_PUBLIC\n end",
"def has_oranges?\n @oranges.size > 0\n end",
"def active_reward_from?(person)\n !self.rewards.active.find(:all, :conditions => {:sender_id => person.id}).empty?\n end",
"def is_unclaimed?(cell)\n\t\terror = \"Tile already claimed. Please choose again.\"\n\n\t\tcheck(cell.to_s, error)\n\tend",
"def comp_noncomp_past_step_1?\n !spectator? && status_is_active?(\"base_details\")\n end",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def previewable?\n if self.root.assigned_theme_ids.include?(0)\n return !self.assigned_theme_ids.include?(0)\n else\n return true \n end\n end",
"def skip_pledge_modal?\n org_details[:skip_pledge_modal]\n end",
"def recurring_but_no_owner\n self.recurrence.present? && self.recurrence.owner != self\n end",
"def receives_shadows?\n end",
"def ribbon_url(name, pos)\n if hexcolor = HEXCOLORS[name]\n \"http://s3.amazonaws.com/github/ribbons/forkme_#{pos}_#{name}_#{hexcolor}.png\"\n else\n name\n end\n end",
"def is_top?\n !top_picture.blank? \n end",
"def is_deletable\n not is_default_cash_gift\n end",
"def online_special_ballot\n end",
"def owned?() end",
"def nocirc_loan?\n @type.present? && @type['id'] == '2e48e713-17f3-4c13-a9f8-23845bb210a4'\n end",
"def card_exists?(user)\n all_cards = user.cards.all.count\n all_cards >= 0\n end",
"def is_triage_frame(widget)\n return widget[\"type\"] == \"frame\" && widget[\"title\"] =~ /TRIAGE ?(.*)/\nend"
] |
[
"0.58256733",
"0.5720923",
"0.55818325",
"0.5578039",
"0.5519928",
"0.54263926",
"0.54055727",
"0.5401377",
"0.53399915",
"0.53319687",
"0.53024626",
"0.5271457",
"0.52713186",
"0.5212148",
"0.5177438",
"0.51756066",
"0.51498866",
"0.5136888",
"0.5133197",
"0.51257825",
"0.5122984",
"0.51192474",
"0.51123285",
"0.51091707",
"0.51076275",
"0.5102872",
"0.50861734",
"0.5085394",
"0.5081583",
"0.5080396",
"0.50766",
"0.507286",
"0.50713235",
"0.50694644",
"0.5054051",
"0.50498015",
"0.5049599",
"0.5043918",
"0.5033663",
"0.5027915",
"0.50244987",
"0.5021186",
"0.5017092",
"0.5012583",
"0.50078964",
"0.5004119",
"0.5003989",
"0.4998234",
"0.4996908",
"0.49967295",
"0.49948502",
"0.49940273",
"0.49920464",
"0.49886328",
"0.4984448",
"0.49828056",
"0.49820673",
"0.49801862",
"0.49763453",
"0.49732295",
"0.49701372",
"0.49653643",
"0.4961177",
"0.4960356",
"0.49585718",
"0.49562144",
"0.4954354",
"0.49337694",
"0.49337065",
"0.49332452",
"0.49313265",
"0.4924282",
"0.49196932",
"0.49191713",
"0.49166635",
"0.4915964",
"0.49130496",
"0.49071297",
"0.4906638",
"0.490294",
"0.4897937",
"0.48945504",
"0.4892393",
"0.48912743",
"0.488667",
"0.48825312",
"0.48796067",
"0.48763025",
"0.4871371",
"0.4869612",
"0.48684686",
"0.4859142",
"0.4857277",
"0.4852054",
"0.4850794",
"0.48494524",
"0.4845875",
"0.484581",
"0.4843897",
"0.4838976"
] |
0.6370088
|
0
|
Users don't have a tab on their card
|
def card_label
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def other_tabs_remaining?\n course.video_tabs.count > 1\n end",
"def other_tabs_remaining?\n category.tabs.count > 1\n end",
"def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end",
"def viewing_players_tab?\n ! viewing_scouts_tab?\n end",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def show_tabs\n false\n end",
"def show_tabs\n false\n end",
"def card_page?\n current_act = params[:action]\n current_ctrl = params[:controller]\n dashboard_ctrl = (current_ctrl == 'dashboard')\n professional_card_act = (current_ctrl == 'professionals' && current_act != 'index')\n !(dashboard_ctrl || professional_card_act)\n end",
"def other_user_profile?\n !is_owner\n end",
"def card\n false\n end",
"def have_account?\n false\n end",
"def show_explore_button?\n current_user.permissions == User::Permissions::NONE\n end",
"def does_guest_have_tab(supplied_guest)\n if @bar_tabs[supplied_guest] != nil\n return true\n else\n return false\n end\n end",
"def deletable?\n is_regular_page?\n end",
"def tab_errored?(tab)\n\n case tab\n when \"user_addressing_link\"\n return false\n when \"user_taxes_link\"\n return true if @profile.errors[:tax_1_name]\n return true if @profile.errors[:tax_2_name]\n return true if @profile.errors[:tax_1_rate]\n return true if @profile.errors[:tax_2_rate]\n return false\n when \"user_logo_link\"\n return true if @profile.logo && (@profile.logo.errors.size > 0)\n return false\n when \"user_communications_link\"\n return false\n when \"user_payments_link\"\n return true if @user_gateway && !@user_gateway.valid?\n return false\n end\n return false\n end",
"def appears_in_tab\n @container = 'tab'\n end",
"def card_exists?(user)\n all_cards = user.cards.all.count\n all_cards >= 0\n end",
"def not_account_owner\n not_account_owner_in_signup && !is_account_owner? \n end",
"def erased?\n !@profile\n end",
"def assigned_to_card?\n self.card_id != 0\n end",
"def editable_from_card?\n true\n end",
"def preview_only?(user)\n !listed && !author?(user)\n end",
"def cannot_edit(_offer)\n !session[:is_administrator] && _offer.unbilled_balance <= 0\n end",
"def user_may_view_item?\n @pcp_item.pcp_step.released? || @pcp_item.pcp_step.in_commenting_group?\n end",
"def r_tabs?(accion)\n\t\tRecurso::TAB_ACTIONS.include?(accion)\n\tend",
"def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end",
"def onalg_player_cardsnot_allowed(player, cards)\r\n lbl_card = cards[0]\r\n log \"#{player.name} ha giocato una carta non valida [#{nome_carta_ita(lbl_card)}]\\n\"\r\n @player_on_gui[:can_play] = true\r\n end",
"def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end",
"def check_user_for_cardgroup(cardgroup)\n cardgroup_owner_id = cardgroup.owner_id\n current_user_not_cardgroup_owner = (cardgroup_owner_id != session[:user_id])\n\n if (accountant? && ((cardgroup_owner_id != 0) || (session[:acc_callingcard_manage].to_i == 0))) ||\n (reseller? && (current_user_not_cardgroup_owner || (session[:res_calling_cards].to_i != 2))) ||\n (admin? && current_user_not_cardgroup_owner)\n dont_be_so_smart\n redirect_to(:root) && (return false)\n end\n\n true\n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend",
"def check_active_user\n if !current_user.active?\n current_user.plan = nil\n end\n end",
"def is_deletable\n not is_default_cash_gift\n end",
"def show_draft_button?\n current_c100_application.try(:child_protection_cases)\n end",
"def cards_left_to_collect\n card_ids = UserCard.select {|card| card[\"user_id\"] == self.id}\n remaining = Card.all.count - card_ids.map { |card| card[\"card_id\"] }.uniq.count\n if remaining == 0\n puts \"=====================================================================\"\n puts \"Congratulations, you have completed the Superhero card album!!\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"You still have #{remaining} cards left to collect...\"\n puts \"=====================================================================\"\n end\n end",
"def show?\n @current_user.permission('Commodity', :guest)\n end",
"def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end",
"def check_if_user\n render text: \"Fuck you user\", status: 403 unless current_user.id == @book.user_id || current_user.rank_id == 2\n end",
"def inactive_access?(count = 7)\n !active_access?(count)\n end",
"def am_member?(card)\n # this works because I'm the only possible member.\n # if this changes, this method will have to search the members list instead\n card.members.first == me \n end",
"def faab?\n free_agent? && !waiver_bid.nil?\n end",
"def has_no_admin_link?\n find('.navigation-toggle').click\n all('.navigation-item', text: 'ADMIN').empty?\n end",
"def can_accept_showing?\n profile.valid? && valid_bank_token? && !blocked?\n end",
"def unscrape?\n @user.is_admin?\n end",
"def deletable?\n self.deletable && self.link_url.blank? and self.menu_match.blank?\n end",
"def can_put_in_tableau?\n (@pile_beneath.empty? && @card_to_drop.rank.king?) ||\n (@card_beneath && @card_to_drop.rank.not.ace? &&\n @pile_beneath.last_card?(@card_beneath) &&\n tableau_conditions?(@card_beneath))\n end",
"def is_active?(dept)\n not permission_list.include?(dept.deactivated_permission)\n end",
"def remove_donation_button_if_no_accounts\n unless has_an_approved_account_set?\n self.show_donation_basket = false\n end\n true\n end",
"def deletable?\n deletable && link_url.blank? && menu_match.blank?\n end",
"def only_your_profile_page\n @admin = Admin.find(params[:admin_id])\n\n if current_admin != @admin\n redirect_to sectors_path, notice: \"Access denied! You can only view your own profile page.\"\n end\n end",
"def game_unactive?\n !@game_active\n end",
"def personal_page?\n return false unless current_user\n return true if params[:owner_id].to_i == current_user.id\n return true if @user && current_user == @user\n return true if @quest && current_user.owns?(@quest)\n return true if @offer && current_user.owns?(@offer)\n \n false\n end",
"def skip_user_details?\n org_details[:skip_user_details]\n end",
"def must_be_current_users_page_to_destroy_post\n\n unless (Post.find_by(id: params[:post_id]).user.id == current_user.id)\n flash[:danger] = \"This is not your profile page. Please log in if this is your account\"\n redirect_to home_path\n end\nend",
"def check_has_no_game\r\n @game = @user.game\r\n redirect_to action: :start_game if @game.present?\r\n end",
"def tab?(s)\n @window.tab?(s)\n end",
"def viewable?(user)\n !deleted && !hidden?\n end",
"def is_owner?(account)\n attachable == account.profile\n end",
"def show_top_card\n self.discard(draw)\n end",
"def lost?\n @deck.cards.length == 0\n end",
"def check_for_active_game\n # TODO\n end",
"def opponent_exhausted_winnings_and_base_cards?\n @opponent.no_base_cards_remaining?\n end",
"def in_tab_room_of?(u)\n tournaments_not_past = u.get_tournaments(:present) + u.get_tournaments(:future);\n\n tournaments_not_past.each { |t|\n if self.in_tab_room?(t)\n return true;\n end\n }\n return false;\n end",
"def shadow_user?\n return !session[:shadow_user_id].blank?\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end",
"def destroy?\n @current_user.permission('Bid', :clerk)\n end",
"def customer_tab?\n ((self.class.customer_actions || []) & [action_name.to_sym, :all]).any?\n end",
"def deletable_by?(user)\n false\n end",
"def manage?\n false\n end",
"def tabs\n if params[:tab_name] != 'links' && params[:tab_name] != 'gallery'\n @current_objects = params[:tab_name].classify.constantize.matching_user_with_permission_in_containers(@current_user, 'show', [current_container.id], current_container_type)\n end\n if params[:tab_name] == 'gallery'\n @current_objects = Image.matching_user_with_permission_in_containers(@current_user, 'show', [current_container.id], current_container_type)\n end\n render :partial => \"/admin/ck_specifics/ck_#{params[:tab_name]}\", :locals => {:current_objects => @current_objects}\n end",
"def show?\n user.active?\n end",
"def show?\n @current_user.permission('Bid', :guest)\n end",
"def destroy?\n @current_user.permission('Commodity', :clerk)\n end",
"def account_has_no_service?\n account = Account.find(current_user)\n account.no_services?\n end",
"def soft?\n self.cards.each do |card|\n return card if card.soft_ace?\n end\n nil\n end",
"def deletable?\n\t\tself.deletable && self.link_url.blank? and self.menu_match.blank?\n\tend",
"def card_fields_class\n \"hidden\" if current_user.card_last4?\n end",
"def incomplete_profile?\n dob == nil\n end",
"def incomplete_profile?\n dob == nil\n end",
"def can_see_ads?(user)\n !user.is_gold?\n end",
"def two_up?\n self.page.css('img[id$=\"cardImage\"]').count > 1\n end",
"def can_deal?\n size() >= 6\n end",
"def disabled?\n user.nil?\n end",
"def restrict_access\n render :\"/home/http_404\" unless @profile && @profile.user == current_user\n end",
"def check_card\n @card = Card.where(uid: params[:card], user_id: nil).first\n if @card\n head :ok\n else\n head :forbidden\n end\n end",
"def peutRetourAvant?()\n return @indiceCoup < @tabCoup.size\n end",
"def is_unclaimed?(cell)\n\t\terror = \"Tile already claimed. Please choose again.\"\n\n\t\tcheck(cell.to_s, error)\n\tend",
"def nfuse?\n @user.shouts.count > 0\n end",
"def no_cards_image \n scryfall.card_code_number('sok', 84)['image_uris']['large']\n end",
"def allow_mode_switching?\n submissions.count == 0 || autograded?\n end",
"def user_item_is_not_current_item(record)\n User.find(record.user.id).send(item_plural(record)).find_by(name: record.name).id != record.id\n end",
"def noId?\n self.id == 'notinavail'\n end",
"def identification_required?\n !(controller_name == \"championships\" && action_name == \"show\")\n end",
"def is_request_for_transfer_profile_board_member?\n errors.add(:profile, \"Name: #{self.sadhak_profile.full_name.titleize} SYID: #{self.sadhak_profile_id} is board member of #{self.transfer_out_club.name.titleize} forum.\") if self.transfer_out_club.is_board_member?(self.sadhak_profile_id)\n errors.empty?\n end",
"def aDesActivites?\n self.activites.each do | a |\n if !a.gratuite\n return true\n end\n end\n false\n end",
"def user_is_not_owner\n unless @likeable_obj.present? && @likeable_obj.user_id != current_user.id\n redirect_to @likeable_obj, notice: \"You cannot like your own dog... How sad...\"\n end\n end",
"def is_ace?(card)\n\t\tcard == \"A\" ? true : false\n\tend",
"def own_game?\n return unless @game.black_player_id\n return if @game.white_player_id == current_user.id || @game.black_player_id == current_user.id\n\n flash[:alert] = \"Sorry, you're not a player in that game\"\n redirect_to games_path\n end",
"def check_visibility\n raise Helpedia::ItemNotVisible unless @user.visible_for?(current_user)\n end",
"def deletable_by?(user)\n resource.orders_count.zero? && (user.is_admin? || is_mill?(user))\n end"
] |
[
"0.68477327",
"0.67271996",
"0.6591237",
"0.6455473",
"0.6184761",
"0.6144346",
"0.6144346",
"0.6135221",
"0.6089786",
"0.607783",
"0.60750663",
"0.606441",
"0.6056164",
"0.5927033",
"0.591795",
"0.591648",
"0.58741695",
"0.5868547",
"0.58681786",
"0.58278805",
"0.5803471",
"0.5795463",
"0.57722867",
"0.5767981",
"0.5757967",
"0.5745461",
"0.57432544",
"0.57142496",
"0.56619155",
"0.5649748",
"0.56422156",
"0.5636791",
"0.5625435",
"0.5620635",
"0.5600761",
"0.5568214",
"0.5567482",
"0.5565849",
"0.55656564",
"0.55618006",
"0.5556759",
"0.55450594",
"0.5541443",
"0.5528011",
"0.5525352",
"0.5522563",
"0.55224407",
"0.5513863",
"0.55031776",
"0.550138",
"0.5498315",
"0.54981107",
"0.5485919",
"0.54834366",
"0.5482816",
"0.54804754",
"0.5469505",
"0.54642993",
"0.5463336",
"0.5463253",
"0.54572856",
"0.5449587",
"0.5443276",
"0.54381955",
"0.54381955",
"0.54381955",
"0.5438165",
"0.5435511",
"0.5431443",
"0.5422603",
"0.54192954",
"0.5417396",
"0.5412226",
"0.54086286",
"0.54066604",
"0.54030603",
"0.5402567",
"0.53925204",
"0.53877836",
"0.53877836",
"0.5384823",
"0.5381683",
"0.53807676",
"0.5379078",
"0.5373672",
"0.5356269",
"0.5352986",
"0.53515935",
"0.5347765",
"0.5347171",
"0.5345228",
"0.53452116",
"0.53379947",
"0.53379846",
"0.5335029",
"0.5333418",
"0.5331186",
"0.5322068",
"0.53189856",
"0.53181994",
"0.5313729"
] |
0.0
|
-1
|
The path used after sign up.
|
def after_sign_up_path_for(resource)
values = {
business: "business.brilliancetech@gmail.com",
upload: 1,
no_shipping: 1,
# return: "#{Rails.application.secrets.app_host}/payments",
return: "http://familypedigree.herokuapp.com/payments",
# notify_url: "#{Rails.application.secrets.app_host}/payments",
notify_url: "http://familypedigree.herokuapp.com/payments",
invoice: resource.id,
item_name: "Membership",
cmd: "_xclick-subscriptions",
a3: resource.membership.fee_amount,
p3: 1, # For 1 Month
t3: "M", # Monthly
src: 1, # To Recurring
sra: 1 # Reattempt When fails
}
# return "#{Rails.application.secrets.paypal_host}/cgi-bin/webscr?" + values.to_query
return "https://www.sandbox.paypal.com/cgi-bin/webscr?" + values.to_query
# super(resource)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def path\n root? ? boot_path : user_path\n end",
"def path\n root? ? boot_path : user_path\n end",
"def client_signed_up_path\n path_from_cookie(:after_account_signed_up_path) || path_from_cookie(:after_client_signed_up_path) || edit_user_client_path(current_user)\n end",
"def after_sign_up_path_for(_resource)\n return new_user_session_path\n end",
"def after_sign_up_path_for(user)\n return root_url\n end",
"def after_sign_up_path_for(_resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n user_path(resource)\n end",
"def after_sign_up_path_for(resource)\n user_path(resource)\n end",
"def after_sign_up_path_for(resource)\n\t root_path + \"home\"\n end",
"def after_sign_up_path_for(resource)\n profile_path\n end",
"def after_sign_up_path_for(resource)\r\n root_path\r\n end",
"def after_sign_up_path_for(resource)\n stored_location_for(resource) || edit_user_registration_path\n end",
"def path\n \"users/#{@login}\"\n end",
"def after_sign_up_path_for(resource)\n \"/\"\n end",
"def after_sign_up_path_for(resource)\n users_repo_init_path\n end",
"def after_sign_up_path_for(resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n user_path(resource)\n end",
"def login_path\n ::File.join *[@login_path.to_s, name_unless_default].compact\n end",
"def signed_in_root_path(_)\n current_tribunal_case ? users_login_save_confirmation_path : users_cases_path\n end",
"def after_sign_up_path_for(resource)\n home_user_path(resource)\n end",
"def after_sign_up_path_for(resource)\n user_path(current_user)\n end",
"def after_sign_up_path_for(resource)\n\n end",
"def after_sign_up_path_for(user)\n after_sign_in_path_for(user)\n end",
"def after_sign_up_path_for(resource)\n new_user_session_path\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n super\n end",
"def after_sign_up_path_for(_resource)\n new_participant_session_path\n end",
"def after_sign_up_path_for(resource)\n after_register_path\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n :pre_created\n end",
"def user_root_path\n users_root_path\n end",
"def after_sign_up_path_for(resource)\n get_started_path\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n '/carrier/sign_up_complete'\n end",
"def after_sign_up_path_for(resource)\n complete_user_registration_path\n end",
"def storage_path\n File.join(\n SystemConfiguration.first.storage_path, 'users', email)\n end",
"def file_path\n PATH_USER_DEFAULTS\n end",
"def after_sign_up_path_for(resource)\n users_path\n end",
"def after_sign_up_path_for(resource)\n users_path\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def path\n ensure_valid\n @path\n end",
"def after_sign_up_path_for(_resource)\n edit_user_registration_path\n end",
"def after_sign_up_path_for(resource)\n user_steps_path\n end",
"def after_sign_up_path_for(resource)\n # super(resource)\n account_path(resource)\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource)\n end",
"def after_sign_up_path_for(resource)\n session[:user_return_to] || root_path\n end",
"def after_sign_up_path_for(resource)\n usermgmt_path\n end",
"def after_sign_in_path_for(_resource)\n user_path(current_user.id) # ログイン後に遷移するpathを設定\n end",
"def after_sign_up_path_for(resource_or_scope)\n new_user_session_path\n end",
"def after_sign_up_path_for(resource)\n :new_reparation\nend",
"def template_path()\n 'auth/signup.erb'\n end",
"def web_users_path\n verify_path WEB_USERS_PATH\n File.join @tar_contents_path, WEB_USERS_PATH\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource) if is_navigational_format?\n end",
"def after_sign_up_path_for(resource)\n after_sign_in_path_for(resource) if is_navigational_format?\n end",
"def after_sign_up_path_for(resource)\n session[:orga_id] = resource.organisation_id\n user_steps_path(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n welcome_path\n end",
"def after_inactive_sign_up_path_for(resource)\n root_path\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_up_path_for(resource)\n super(resource)\n end",
"def after_sign_in_path_for(resource)\n stored_location_for(resource) || account_url\n end",
"def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n end",
"def after_sign_up_path_for(resource)\n edit_user_path(resource.id)\n end",
"def after_sign_up_path_for(resource)\n :new_profile # Or :prefix_to_your_route\n end",
"def spree_signup_path\n main_app.login_path\n end",
"def after_sign_up_path_for(resource)\n company_path(current_user.company_id )\n end",
"def after_sign_up_path_for(resource)\n new_political_party_path\n end"
] |
[
"0.74486095",
"0.74486095",
"0.7348926",
"0.72428125",
"0.71978325",
"0.7191859",
"0.71229225",
"0.71229225",
"0.7114739",
"0.7110063",
"0.71050537",
"0.70890594",
"0.7078605",
"0.70710707",
"0.7039824",
"0.69836",
"0.69836",
"0.69836",
"0.69836",
"0.69687116",
"0.69687116",
"0.69687116",
"0.695565",
"0.6952114",
"0.69462943",
"0.69291764",
"0.692384",
"0.6923245",
"0.6908656",
"0.6892842",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68918073",
"0.68619215",
"0.6849449",
"0.6848581",
"0.68387353",
"0.68329126",
"0.6826204",
"0.6825744",
"0.6811003",
"0.6811003",
"0.6811003",
"0.6805664",
"0.6790916",
"0.67705876",
"0.6764743",
"0.67595524",
"0.67595524",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67457646",
"0.67446005",
"0.6742484",
"0.673662",
"0.67358214",
"0.67320126",
"0.6713388",
"0.66983753",
"0.66732067",
"0.6667262",
"0.6660478",
"0.6656764",
"0.66527593",
"0.6648839",
"0.6648839",
"0.6642064",
"0.6639703",
"0.6632311",
"0.66255736",
"0.66065633",
"0.66065633",
"0.660423",
"0.65959823",
"0.6594243",
"0.6587384",
"0.65813607",
"0.65472794",
"0.65358824"
] |
0.0
|
-1
|
=begin INPUT: Obtain two collections of values If both collections are empty THEN return the empty collection else add collection one + collection two THEN return the combined collections END IF OUTPUT: Combine the two collections of words into one =end I worked on this challenge [by myself]. Your Solution Below =begin def array_concat(array_1, array_2) if (array_1 == nil ) && (array_2 == nil) return nil else combined_array = array_1 + array_2 return combined_array end end =end
|
def array_concat(array_1, array_2)
combined_array = array_1 + array_2
return combined_array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def array_concat(array_1, array_2)\n if array_1.empty? && array_2.empty?\n \tfinal_array = []\n else\n \tcount = 0\n \twhile count < array_2.length\n \t\tfinal_array = array_1.push array_2[count]\n \t\tcount += 1\n \tend\n end\n return final_array\nend",
"def array_concat(array_1, array_2)\n # Your code here\n if ((array_1 == []) && (array_2 == []))\n \treturn []\n else\n \tarray_2.each do |element_2|\n \t\tarray_1.push(element_2)\n \tend\n end\n return array_1\nend",
"def array_concat(array_1, array_2)\n\tif array_1.length == 0 && array_2.length == 0\n\t\treturn []\n\tend\n\ti = 0\n\twhile i < array_2.length\n\t\tarray_1.push(array_2[i])\n\t\ti+=1\n\tend\n return array_1\nend",
"def array_concat(array_1, array_2)\n # Your code here\n # Initial solution\n=begin\n array_3 = []\n array_1.each do |n| \n array_3.push n\n end\n array_2.each do |m|\n array_3.push m\n end\n return array_3\nend\n=end\n # Refactored solution\n return array_1.concat array_2\nend",
"def array_concat(array_1, array_2)\n\treturn [] if both_empty?(array_1, array_2)\n\treturn array_1 if two_empty?(array_1, array_2)\n\treturn array_2 if one_empty?(array_1, array_2)\n\tfor x in array_2[0..-1]\n\t\tarray_1 << x\n\tend\n\treturn array_1\nend",
"def array_concat(array_1, array_2)\n # PSEUDO\n # Start new empty array (we'll call it answer array)\n # FOR each element in first array\n # add it to answer array\n # FOR each element in second array\n # add it to answer array\n # return answer array\n\n #initial\n# answer_arr = []\n#\n# array_1.each do |el|\n# answer_arr << el\n# end\n#\n# array_2.each do |el|\n# answer_arr << el\n# end\n#\n# return answer_arr\n\n #final with built-in\n\n return array_1.concat(array_2)\n\nend",
"def array_concat(array_1, array_2)\n # Your code here\n \n new_array = Array.new\n array_1.each do |entry|\n if array_1.empty? == false\n new_array.push(entry)\n end\n end\n \n array_2.each do |entry|\n if array_2.empty? == false\n new_array.push(entry)\n end\n end\n \n new_array\nend",
"def array_concat(array_1, array_2)\n # Your code here\n if (array_1.length == 0) || (array_2.length == 0) then return []\n end\n\n array_1.concat(array_2)\n return array_1\nend",
"def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend",
"def array_concat(array_1, array_2)\n if array_1.length == 0 && array_2.length == 0\n return []\n else\n x = 1\n while x <= array_2.length\n array_2.each do |new_item|\n array_1.push(new_item)\n x += 1\n end\n end\n return array_1 \n end\nend",
"def array_concat(array_1, array_2)\n concat_array = []\n array_1.each {|value| concat_array << value}\n array_2.each {|value| concat_array << value}\n concat_array\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each do |var|\n new_array.push(var)\nend\n array_2.each do |var|\n new_array.push(var)\nend\n return new_array\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each do |item|\n \tnew_array.push(item)\n end\n array_2.each do |item|\n \tnew_array.push(item)\n end\n new_array\nend",
"def using_concat(array_1,array_2)\n array_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each { |value| new_array << value }\n array_2.each { |value| new_array << value }\n return new_array\nend",
"def using_concat(array1,array2)\n array1.concat(array2)\n end",
"def using_concat(array1,array2)\n array1.concat(array2)\nend",
"def using_concat(array1,array2)\n array1.concat(array2)\nend",
"def using_concat(array1, array2)\n \n array1.concat(array2)\n\nend",
"def array_concat(array_1, array_2)\n\n array_2.each do |a2_element|\n array_1.push(a2_element)\n end\n\n return array_1\n\nend",
"def array_concat(array_1, array_2)\n concat_arrays = []\n array_1.each do |x|\n \tconcat_arrays << x\n end\n array_2.each do |x|\n \tconcat_arrays << x\n end\n concat_arrays\nend",
"def array_concat(array_1, array_2)\n\treturn (array_1 << array_2).flatten\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each {|val| new_array.push (val)}\n array_2.each {|val| new_array.push (val)}\n new_array\nend",
"def using_concat(array0, array1)\n array0.concat(array1)\nend",
"def using_concat (first_arr, second_arr)\n return first_arr.concat(second_arr)\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_2.each do |val|\n \tarray_1 << val\n end\n array_1\nend",
"def array_concat(array_1, array_2) \nreturn array_1.concat array_2\nend",
"def array_concat(array_1, array_2)\n\n\tarray_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n\tarray_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n\tarray_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n concat = array_1\n i=0\n while array_2.length > i\n array_1.push(array_2[i])\n i+=1\n end\n return concat\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_3=[]\n array_1.each{|element| array_3<<element}\n array_2.each{|element| array_3<<element}\n return array_3\nend",
"def using_concat(array1, array2)\n array1.concat(array2)\nend",
"def array_concat(array_1, array_2)\n array_2.each {|x| array_1.push(x).to_a}\n return array_1\n \nend",
"def array_concat(array_1, array_2)\n array_2.each { |x| array_1.push(x) }\n return array_1\nend",
"def using_concat(array1, array2)\n array1.concat(array2)\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1.push x\n end\n return array_1\nend",
"def array_concat(array_1, array_2)\n # Your code here\n for element in array_2\n \tarray_1.push(element)\n end\n return array_1\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_2.each do |element|\n array_1 << element\n end\n array_1\nend",
"def array_concat(array_1, array_2)\n\tcombined_array=Array.new\n\tcombined_array.push(array_1, array_2)\n\treturn combined_array.flatten\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1.push(x)\n end\n return array_1\nend",
"def array_concat(array_1, array_2)\n # return array_1 + array_2 would work\n array = array_1\n array_2.each do |item|\n array.push item\n end\n return array\nend",
"def array_concat(array1, array2)\n\tarray1 + array2\nend",
"def array_concat(array_1, array_2)\n combined_array = array_1 + array_2\n return combined_array\nend",
"def using_concat(arr_1, arr_2)\n arr_1.concat(arr_2)\nend",
"def array_concat(array_1, array_2)\n # Your code here\n #Iterate over the length of array\n array_2.each do |section|\n #add each section of the array to the other\n array_1.push(section)\n end\n # Output the combination of both the array\n return array_1\nend",
"def array_concat(array_1, array_2)\n # Your code here\n combined_array = []\n\n array_1.each { |i| \n combined_array.push(i)\n }\n\n array_2.each do |j| \n combined_array.push(j)\n end\n\n return combined_array\nend",
"def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"def using_concat(array, array2)\n array.concat(array2)\nend",
"def array_concat(array_1, array_2)\n\tour_array = array_1\n\tarray_2.each do |newguy|\n\t\tour_array.push(newguy)\n\tend\n return our_array\nend",
"def concat(array,array2)\n array << array2\n return array\nend",
"def array_concat(array_1, array_2)\n\n while array_2.length > 1\n array_1.push {array_2.each do |array_2.length| }\n\n return array_1\n end\n\nend",
"def using_concat(array1, array2)\n array1 = array1.concat(array2)\nend",
"def array_concat(array_1, array_2)\n array_1+array_2\nend",
"def array_concat(array_1, array_2)\n array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n array_1 + array_2\nend",
"def concat_array(array1, array2)\n\t\tarray1.concat (array2)\n\tend",
"def concat(array1, array2)\n return array1 + array2\nend",
"def combine_two_lists(array1, array2)\n combined_array = []\n index = 0\n\n loop do\n combined_array << array1[index]\n combined_array << array2[index]\n index += 1\n break if index == array1.size\n \n end\n combined_array\nend",
"def concat(array1, array2)\n if !array1.is_a?(Array) || !array2.is_a?(Array)\n return nil\n else \n return array1 + array2\n end\nend",
"def array_concat(array_1, array_2)\n # Your code here\n return array_1.concat(array_2)\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n \tarray_1 << x\n \t\n end\n p array_1\nend",
"def array_concat(array_1, array_2)\n cnct_array = array_1\n for i in 0...array_2.length\n cnct_array[cnct_array.length+i] = array_2[i]\n end\n return cnct_array\nend",
"def array_concat(array_1, array_2)\n\tnew_array = []\n\ti = 0\n\twhile i < array_1.length\n\t\tnew_array[i] = array_1[i]\n\t\ti += 1\n\tend\n\tj = 0\n\twhile j < array_2.length\n\t\tnew_array[i+j] = array_2[j]\n\t\tj += 1\n\tend\n\treturn new_array\nend",
"def combine(str1, str2)\n # Create an array which we will read the final outputs from\n output = []\n\n # Run processor for word 1 and push result to output\n output.push(processor(str1, 1))\n\n # Run processor for word 2 and push result to output\n output.push(processor(str2, 2))\n\n # Join the partial words together to form the wombinations\n wombination1 = (output[0][0] + output [1][0])\n wombination2 = (output[0][1] + output [1][1])\n\n # If the words are the same, then just return one of them...\n if wombination1 == wombination2\n puts wombination1\n\n # otherwise return both as an array\n else\n puts [wombination1, wombination2]\n\n end\nend",
"def merge(array1, array2)\n # (array1 + array2).uniq\n array1 | array2\nend",
"def concat(array,array2)\n while array2.length > 0\n array << array2.delete_at(0)\n end\n return array\nend",
"def custom_union(arr1, arr2)\n final = []\n arr1.each { |item| final << item unless final.include?(item) }\n arr2.each { |item| final << item unless final.include?(item) }\n final\nend",
"def using_concat(array, arr2)\n array.concat(arr2)\nend",
"def concat(array, array2)\n return array + array2\nend",
"def concat(array1, array2)\n i = 0\n output = array1\n while i < array2.length\n output << array2[i]\n i += 1\n end\n return output\nend",
"def array_concat(array_1, array_2)\n # Your code here\n new_array = array_1.concat(array_2)\n return new_array\nend",
"def merge(arr1, arr2)\n arrays = (arr1 + arr2).flatten\n one_array = []\n arrays.each { |n| one_array << n unless one_array.include?(n) }\n one_array\nend",
"def merge(array_1, array_2)\n (array_1 + array_2).uniq\nend",
"def merge(array_1, array_2)\n (array_1 + array_2).uniq\nend",
"def array_concat(array_1, array_2)\n\tnew_arr = array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n p array_1.concat array_2\nend",
"def array_concat(array_1, array_2)\n\tarray_1 += array_2\nend",
"def custom_concat(arr1,arr2)\narr1 + arr2\nend",
"def combinations(arr1,arr2)\n combination_array = []\n arr1.each_with_index do |word|\n (0..arr2.size - 1).each do |idx|\n combination_array << word + arr2[idx]\n end\n end\n combination_array\nend",
"def array_concat(array_1, array_2)\n new_array = []\n new_index = 0\n index = 0\n\n while index < array_1.length\n \tnew_array[new_index] = array_1[index]\n \tindex += 1\n \tnew_index += 1\n end\n\n index = 0\n\n while index < array_2.length\n \tnew_array[new_index] = array_2[index]\n \tindex += 1\n \tnew_index += 1\n end\n return new_array\nend",
"def custConcat(arr1, arr2)\n # return arr1 with all of the elements from arr2 \n # added to the end of it\n arr1.concat(arr2)\nend",
"def join_arrays(arr1,arr2)\n arr1.concat(arr2)\nend",
"def merge(array1, array2)\n array2.each { |element| array1 << element unless array1.include?(element)}\n array1\nend",
"def array_concat(array_1, array_2)\n \tawesome_array = array_1 + array_2\n \tawesome_array\nend",
"def combinations(array_1, array_2)\n\tresult = []\n\tarray_1.each do |string_1|\n\t\tarray_2.each do |string_2|\n\t\t\tresult << string_1 + string_2\n\t\tend\n\tend\n\tresult\nend",
"def array_concat(my_array1, my_array2)\n my_array1 + my_array2\nend",
"def array_concat(array_1, array_2)\n z = array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n newarray = Array.new\n for i in 0..(array_1.length-1)\n newarray[i] = array_1[i]\n end\n for j in 0..(array_2.length-1)\n newarray[array_1.length+j] = array_2[j]\n end\n return newarray\nend",
"def merge(array1, array2)\n (array1 + array2).uniq\nend",
"def concat(arr, arr2)\n return arr + arr2\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_1.concat(array_2) # trying out implicit return\nend",
"def concat(arr1, arr2)\n output = arr1\n i = 0\n while i < arr2.length\n output << arr2[i]\n i += 1\n end\n return output\nend",
"def merge_array(input_array1, input_array2)\n\toutput_array = []\n\toutput_array = input_array1 + input_array2\n\treturn output_array.uniq\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_3 = []\n\n array_1.each do |x|\n array_3.push(x)\n end\n array_2.each do |y|\n array_3.push(y)\n end\n return array_3\nend",
"def custom_union(arr1, arr2)\n arr1.concat(arr2).uniq\nend",
"def combine(list1, list2)\n combined = []\n list1_length = list1.length\n list2_length = list2.length\n until list1.empty? and list2.empty?\n list1_element = list1.shift\n combined << list1_element if list1_element\n list2_element = list2.shift\n combined << list2_element if list2_element\n end\n combined\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1[array_1.length] = x\n end\n return array_1\nend",
"def merge(arr1, arr2)\n new_array = []\n arr2.each { |e| arr1 << e} \n arr1.each { |e| new_array << e unless new_array.include?(e)}\n new_array\nend"
] |
[
"0.7615307",
"0.75549287",
"0.7515556",
"0.75001305",
"0.749192",
"0.74563",
"0.74402696",
"0.74317396",
"0.74136806",
"0.74061644",
"0.7345057",
"0.73222965",
"0.7307473",
"0.7302662",
"0.73019147",
"0.7297929",
"0.727484",
"0.727484",
"0.7265757",
"0.72461057",
"0.7235194",
"0.7233584",
"0.72223514",
"0.7199216",
"0.71974653",
"0.71844375",
"0.7182983",
"0.7176929",
"0.7174307",
"0.7174307",
"0.71733147",
"0.717025",
"0.7162653",
"0.7159809",
"0.71532816",
"0.7146921",
"0.7140086",
"0.71384937",
"0.71149284",
"0.7104838",
"0.710246",
"0.70847005",
"0.7079852",
"0.70648485",
"0.70646834",
"0.70578676",
"0.703971",
"0.7037724",
"0.7037724",
"0.7035367",
"0.70204365",
"0.70158935",
"0.69998705",
"0.698944",
"0.6986298",
"0.6979096",
"0.696312",
"0.6960893",
"0.6960729",
"0.6959411",
"0.6952056",
"0.69431037",
"0.69182974",
"0.6909299",
"0.68947965",
"0.6893768",
"0.688764",
"0.6881492",
"0.68599147",
"0.68536973",
"0.6838861",
"0.6838265",
"0.68308926",
"0.682077",
"0.68178374",
"0.68178374",
"0.6806067",
"0.6796743",
"0.67873424",
"0.6780602",
"0.6777343",
"0.6776282",
"0.6754025",
"0.674767",
"0.67472047",
"0.67412233",
"0.67387074",
"0.6730383",
"0.6726146",
"0.6718311",
"0.6705497",
"0.6696498",
"0.6693376",
"0.6678963",
"0.6665526",
"0.6656836",
"0.66464263",
"0.6644802",
"0.6637553",
"0.66127735"
] |
0.71166575
|
38
|
Public: Initializes the API Client class
|
def initialize
# Note: Suds logging is disabled
@soap_client = Suds.client(endpoint: ENDPOINT, namespace: NAMESPACE,
soap_version: 1, wsdl: WSDL, log: false)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n @api_user = \"\"\n @api_key = \"\"\n end",
"def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end",
"def initialize(api_key, username, password)\n @api_key, @username, @password = api_key, username, password\n setup_client\n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end",
"def initialize(client_api_key, user_api_key, host)\n endpoint_uri = \"https://#{host}/api/v1\"\n self.class.base_uri(endpoint_uri)\n\n auth_string = \"Rev #{client_api_key}:#{user_api_key}\"\n @default_headers = {\n 'Authorization' => auth_string,\n 'User-Agent' => USER_AGENT # to track usage of SDK\n }\n end",
"def initialize\n @client_sdk_id = ''\n @key_file_path = ''\n @key = ''\n @sdk_identifier = 'Ruby'\n @api_url = 'https://api.yoti.com'\n @api_port = 443\n @api_version = 'v1'\n end",
"def initialize(api_key)\n @client = Juicer::Client.new(api_key)\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def init_client; end",
"def initialize\n begin\n @api_methods = Api_methods\n @api_version = Api_version\n rescue StandardError => e\n $log.error(sprintf(\"%s: %s\", __method__, e.message))\n raise\n end\n end",
"def initialize(api)\n @api = api\n end",
"def initialize(key, client=nil)\n @api_key = key\n @client = client\n end",
"def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end",
"def initialize( api_key )\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key \n end",
"def initialize\r\n @apiKey = API_KEY\r\n @secret = SECRET\r\n end",
"def initialize(options = {})\n @api_key = options[:api_key]\n @language = options[:language] || Fotolia::Language.new(DEFAULT_LANGUAGE)\n @api_uri = options[:api_uri] || DEFAULT_API_URI\n @xmlrpc_client = XMLRPC::Client.new2(@api_uri)\n\n raise ApiKeyRequiredError unless(@api_key)\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key, resource_url)\n @rest_client = RestClient.new(resource_url, api_key)\n end",
"def initialize(api_key, region = 'na')\n @api_key = api_key\n @region = region\n @http = Hurley::Client.new\n @http.header[:content_type] = 'application/json'\n @http.query['api_key'] = api_key\n end",
"def initialize_api_client(options = {})\n require 'right_api_client'\n\n options = {\n rl10: true,\n timeout: 20 * 60\n }.merge options\n\n client = RightApi::Client.new(options)\n client.log(Chef::Log.logger)\n client\n end",
"def initialize(options = {})\n opts = {\n oauth_site: 'https://user.gini.net/',\n oauth_redirect: 'http://localhost',\n api_uri: 'https://api.gini.net',\n api_version: 'v1',\n api_type: 'json',\n upload_timeout: 90,\n processing_timeout: 180,\n log: Logger.new(STDOUT),\n user_agent: \"gini-api-ruby/#{VERSION} (Faraday v#{Faraday::VERSION})\"\n }.merge(options)\n\n # Ensure mandatory keys are set\n [:client_id, :client_secret].each do |k|\n raise Gini::Api::Error.new(\"Mandatory option key is missing: #{k}\") unless opts.key?(k)\n end\n\n # Populate instance variables from merged opts\n opts.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n self.class.send(:attr_reader, k)\n end\n\n # Ensure STDOUT is flushed\n STDOUT.sync = true\n\n # Sanitize api_uri\n @api_uri.sub!(/(\\/)+$/, '')\n\n # Register parser (json+xml) based on API version\n register_parser\n\n @log.info('Gini API client initialized')\n @log.info(\"Target: #{@api_uri}\")\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(apikey)\n @apikey = apikey\n end",
"def initialize(api_key:)\n @api_key = api_key\n end",
"def initialize(**options)\n @config = Configuration.new(**options)\n @client = Client.new(config)\n end",
"def initialize(server, api_version, api_key)\n self.class.base_uri \"http://#{server}/api/#{api_version}\"\n self.class.headers 'Accept' => 'application/json', \"X-CCApiKey\" => api_key\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(opts)\n if opts[:api_key].nil?\n raise ArgumentError, \"Required option missing. Please pass ':api_key'.\"\n end\n\n client(opts)\n self\n end",
"def initialize(api_key, options = {})\n @api_key = api_key\n @api_endpoint = DEFAULT_API_ENDPOINT\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n end",
"def initialize (api_key)\n\t\t@params = {\n\t\t\t\"key\" => api_key,\n\t\t\t\"wrapper\" => \"cleverbotrb\"\n\t\t}\n\t\t@endpoint = ENDPOINT\n\tend",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def initialize(client_secret = nil, client_id = nil, base_url = 'api-qa.aspose.cloud', api_version = 'v3.0', debug = false)\n @api_client = ApiClient.new(client_secret, client_id, base_url, api_version, debug)\n end",
"def initialize username, apikey\n\t\t@username = username\n\t\t@apikey = apikey\n\tend",
"def initialize\n get_enterprise_token\n initialize_client\n end",
"def initialize(apikey='f47a72ab00afe64aab78b9919ee3d427')\n\t\t@api_key = apikey\n\t\t@headers = {\"Accept\" => \"application/JSON\", \"user-key\" => @api_key}\n\t\t@base_uri = \"https://developers.zomato.com/api/v2.1/\"\n\tend",
"def initialize(base_url: BASE_URL, api_version: API_VERSION, api_key: API_KEY)\n @base_url = base_url\n @api_version = api_version\n @api_key = api_key\n end",
"def initialize api_key: nil, namespace: nil\n unless api_key && namespace\n raise ArgumentError.new(\"You must include both an api_key and namespace, e.g. Unloq::Client.new(api_key: 'foo', namespace: 'bar')\")\n end\n\n @api_key = api_key\n @namespace = namespace\n end",
"def initialize(*args)\n raise ArgumentError, \"Requires at least the api_key and secret_key when instatiating\" if args.size == 0\n\n base_url = 'https://api.att.com'\n\n if args.size == 1 && args[0].instance_of?(Hash)\n args = args.shift\n @api_key = args[:api_key]\n @secret_key = args[:secret_key]\n @base_url = args[:base_url] || base_url\n set_ssl_verify args[:ssl_verify]\n else\n @api_key = args.shift\n @secret_key = args.shift\n @base_url = args.shift || base_url\n set_ssl_verify args.shift\n end\n\n @grant_type = 'client_credentials'\n @access_token = ''\n @refresh_token = ''\n\n create_connection 'application/json'\n\n get_tokens\n\n Actor.current\n end",
"def initialize(api_key:, read_timeout: 60, open_timeout: 30, api_base: 'https://api.easypost.com',\n custom_client_exec: nil)\n raise EasyPost::Errors::MissingParameterError.new('api_key') if api_key.nil?\n\n @api_key = api_key\n @api_base = api_base\n @api_version = 'v2'\n @read_timeout = read_timeout\n @open_timeout = open_timeout\n @lib_version = File.open(File.expand_path('../../VERSION', __dir__)).read.strip\n\n # Make an HTTP client once, reuse it for all requests made by this client\n # Configuration is immutable, so this is safe\n @http_client = EasyPost::HttpClient.new(api_base, http_config, custom_client_exec)\n end",
"def initialize(api_key, secret, format_options={})\n @auth = { :api_key => api_key }\n @secret = secret\n end",
"def initialize\n options ||= QuadrigaCX.configuration\n unless options.client_id && options.api_key && options.api_secret\n raise ArgumentError, \"Options required\"\n end\n\n @client_id = options.client_id\n @api_key = options.api_key\n @api_secret = options.api_secret\n end",
"def initialize(api_obj)\n @api_obj = api_obj\n end",
"def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.imagga.com:443'\n @base_path = '/v2'\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n @inject_format = false\n @force_ending_format = false\n @camelize_params = false\n # for API key/token authentication\n @api_key = '';\n @api_key_type = '';\n @api_key_name = '';\n @api_key_prefix = '';\n # for http basic authentication\n @username = ''\n @password = ''\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n end",
"def initialize(api_key, api_secet, options={})\n @api_key, @api_secret = api_key, api_secet\n @consumer_options = options.merge(ApiOptions)\n end",
"def initialize()\n self.apikey = Rails.application.credentials.alpha_api_key\n end",
"def initialize(username, password)\n @username = username\n @password = password\n @api_key = \"\"\n end",
"def setup_api_client\n # see http://rubydoc.info/github/heroku/databasedotcom/master/Databasedotcom/Client:initialize\n # add :debugging => true to constructor hash to log API request/responses\n #u = current_user\n #debugger\n @client = Databasedotcom::Client.new({})\n @client.version = API_VERSION\n @client.authenticate :token => @current_user.access_token,\n :refresh_token => @current_user.refresh_token,\n :instance_url => @current_user.instance_url\n @client.materialize(\"Account\")\n end",
"def initialize(args)\n raise 'This API client is only compatible with Ruby 1.8.7 and upwards.' if (RUBY_VERSION < '1.8.7')\n\n @api_url, @api_version = DEFAULT_API_URL, API_VERSION\n @open_timeout, @timeout, @max_attempts = DEFAULT_OPEN_TIMEOUT, DEFAULT_TIMEOUT, DEFAULT_MAX_ATTEMPTS\n @ssl_version = DEFAULT_SSL_VERSION\n @enable_retry = false\n\n # Initializing all instance variables from hash\n args.each { |key,value|\n instance_variable_set(\"@#{key}\", value) if AUTH_PARAMS.include?(key.to_s)\n } if args.is_a? Hash\n\n raise 'This API client is only compatible with the RightScale API 1.5 and upwards.' if (Float(@api_version) < 1.5)\n\n # If rl10 parameter was passed true, read secrets file to set @local_token, and @api_url\n if @rl10\n case RbConfig::CONFIG['host_os']\n when /mswin|mingw|cygwin/\n local_secret_file = File.join(ENV['ProgramData'] || 'C:/ProgramData', 'RightScale/RightLink/secret')\n else\n local_secret_file = '/var/run/rightlink/secret'\n end\n local_auth_info = Hash[File.readlines(local_secret_file).map{ |line| line.chomp.split('=', 2) }]\n @local_token = local_auth_info['RS_RLL_SECRET']\n @api_url = \"http://localhost:#{local_auth_info['RS_RLL_PORT']}\"\n end\n\n # allow a custom resource-style REST client (for special logging, etc.)\n @rest_client_class ||= ::RestClient::Resource\n @rest_client = @rest_client_class.new(@api_url, :open_timeout => @open_timeout, :timeout => @timeout, :ssl_version => @ssl_version)\n @last_request = {}\n\n # There are five options for login:\n # - user email/password (using plaintext or base64-obfuscated password)\n # - user OAuth refresh token\n # - instance API token\n # - existing user-supplied cookies\n # - existing user-supplied OAuth access token\n #\n # The latter two options are not really login; they imply that the user logged in out of band.\n # See config/login.yml.example for more info.\n login() if need_login?\n\n timestamp_cookies\n\n # Add the top level links for instance_facing_calls\n if @instance_token || @local_token\n resource_type, path, data = self.do_get(ROOT_INSTANCE_RESOURCE)\n instance_href = get_href_from_links(data['links'])\n cloud_href = instance_href.split('/instances')[0]\n\n define_instance_method(:get_instance) do |*params|\n type, instance_path, instance_data = self.do_get(ROOT_INSTANCE_RESOURCE)\n RightApi::ResourceDetail.new(self, type, instance_path, instance_data)\n end\n\n Helper::INSTANCE_FACING_RESOURCES.each do |meth|\n define_instance_method(meth) do |*args|\n obj_path = cloud_href + '/' + meth.to_s\n # Following are special cases that need to over-ride the obj_path\n obj_path = '/api/backups' if meth == :backups\n obj_path = instance_href + '/live/tasks' if meth == :live_tasks\n obj_path = '/api/tags' if meth == :tags\n if has_id(*args)\n obj_path = add_id_and_params_to_path(obj_path, *args)\n RightApi::Resource.process(self, get_singular(meth), obj_path)\n else\n RightApi::Resources.new(self, obj_path, meth.to_s)\n end\n end\n end\n else\n # Session is the root resource that has links to all the base resources\n define_instance_method(:session) do |*params|\n RightApi::Resources.new(self, ROOT_RESOURCE, 'session')\n end\n # Allow the base resources to be accessed directly\n get_associated_resources(self, session.index.links, nil)\n end\n end",
"def initialize\n @response_format = 'json'\n @scheme = 'http'\n @host = 'api.wordnik.com'\n @hosts = []\n @load_balancer = nil\n @base_path = '/v4'\n @user_agent = \"ruby-#{Wordnik::VERSION}\"\n # Build the default set of resource names from the filenames of the API documentation\n begin\n api_docs_path = File.join(File.dirname(__FILE__), '../../api_docs')\n @resource_names = Dir.glob(File.join(api_docs_path, '*.json')).map {|f| f.split('/').last.sub('.json', '') }.sort\n true\n rescue\n raise 'Problem loading the resource files in ./api_docs/'\n end\n end",
"def initialize(api_key: nil)\r\n Configuration.api_key = api_key\r\n end",
"def initialize(api_key)\n @api_key = api_key\n @conn = Faraday.new\n end",
"def initialize(api_key, api_secret)\n @api_key = api_key\n @api_secret = api_secret\n @api_base_url = 'https://pepocampaigns.com'\n end",
"def initialize(client)\n configuration = Configuration.new\n\n uri = URI.parse(client.options[:url])\n # base URL\n configuration.scheme = uri.scheme\n configuration.host = uri.to_s\n # SSL\n configuration.verify_ssl = client.options[:use_ssl].nil? ? true : client.options[:use_ssl]\n # Token\n configuration.api_key_prefix['api_key'] = 'Token'\n configuration.api_key['api_key'] = client.options[:token]\n # Debugging\n configuration.debugging = client.options[:debugging]\n configuration.logger = client.options[:logger]\n\n @api_client = ApiClient.new(configuration)\n # User Agent\n @api_client.user_agent = \"influxdb-client-ruby/#{InfluxDB2::VERSION}\"\n end",
"def initialize(client)\n super(client, 'core')\n end",
"def initialize(api_key, secret, api_uri)\n @api_key = api_key\n @secret = secret\n @api_uri = api_uri\n end",
"def initialize(api_key, secret_key, base_url='https://api.att.com')\n\t\t@api_key \t\t = api_key\n\t\t@secret_key = secret_key\n\t\t@base_url = base_url\n\t\t@grant_type = 'client_credentials'\n\t\t@scope = 'SPEECH'\n\t\t@access_token = ''\n\t\t@refresh_token = ''\n\t\t\n\t\tcreate_connection\n\t\tget_tokens\n\t\t\n\t\tself\n\tend",
"def initialize(client, api_model, query_params = {})\n @client = client\n @api_model = api_model\n @uri = \"#{Lexile.api_version}/#{api_model.api_path}\"\n @query_params = query_params\n end",
"def initialize(config, client = nil)\n @host = config[:host]\n\n raise ArgumentError, 'No API host is provided.' if @host.nil?\n\n if client.nil? # rubocop:disable Style/ConditionalAssignment\n @client = ArkEcosystem::Client::HTTP::Client.new(config)\n else\n @client = client.new(config)\n end\n end",
"def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end",
"def initialize(c)\n @client = c\n end",
"def initialize()\n RMeetup::Client.api_key = \"7d6585e3e2a111983b3177711467\"\n end",
"def initialize(api_key)\n @api_key = api_key\n self.class.headers({\n \"X-API-Key\" => @api_key,\n \"Accept\" => \"application/json\"\n })\n end",
"def initialize(headers = nil, cookies = nil) # Particular Ruby API version\n @headers = headers\n @cookies = cookies\n @settings = Settings.new\n @called_servers = []\n\tend",
"def initialize(client)\n @client = client\n end",
"def client\r\n @client ||= APIController.new config\r\n end",
"def initialize(options = {})\n @services = { }\n\n settings = Config.client_settings(options)\n\n # pick up the username from the options, the global, or assume no username\n @username = settings[:username]\n\n # do a similar thing for the api key\n @api_key = settings[:api_key]\n\n # grab token pair\n @userId = settings[:userId]\n @authToken = settings[:authToken]\n\n # and the endpoint url\n @endpoint_url = settings[:endpoint_url] || API_PUBLIC_ENDPOINT\n\n # set the user agent to the one provided, or set it to a default one\n @user_agent = settings[:user_agent] || \"softlayer_api gem/#{SoftLayer::VERSION} (Ruby #{RUBY_PLATFORM}/#{RUBY_VERSION})\"\n\n # and assign a time out if the settings offer one\n @network_timeout = settings[:timeout] if settings.has_key?(:timeout)\n\n raise \"A SoftLayer Client requires an endpoint URL\" if !@endpoint_url || @endpoint_url.empty?\n end",
"def initialize(api_key = Payable.api_key, path = Payable.current_rest_api_path, timeout = API_TIMEOUT, company_id = Payable.company_id)\n raise(\"api_key must be a non-empty string\") if !api_key.is_a?(String) || api_key.empty?\n raise(\"path must be a non-empty string\") if !path.is_a?(String) || path.empty?\n @api_key = api_key\n @path = path\n @timeout = timeout\n @company_id = company_id\n end",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend",
"def initialize(api_key)\n @api_key = api_key\n @client = Hurley::Client.new 'http://api.rottentomatoes.com/api/public/v1.0'\n self\n end",
"def api_client\n @api_client ||= ::Lokalise.client LokaliseRails.api_token, {enable_compression: true}.merge(LokaliseRails.timeouts)\n end",
"def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = ::Google::Cloud::Retail::V2::ModelService::Rest::Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @model_service_stub = ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"def initialize\n # API support utilizes excon, if it isn't found an error will be raised\n require 'excon'\n\n # rXg production environments should ALWAYS have a valid certificate\n # If no valid certificate for device uncomment line below\n # Excon.defaults[:ssl_verify_peer] = false\n\n # Configure a static device address and API key here\n # Device address format example: https://google.com\n @device_address = set_device_address\n @device_api_key = set_api_key(@device_address)\n end",
"def initialize(username, password, api_key) \n @username = username\n @password = password\n @api_key = api_key\n @client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :debug, pretty_print_xml: true)\n #@client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :warn, pretty_print_xml: true)\n end",
"def initialize(api_key)\n @options = { headers: { 'Authorization' => \"token #{api_key}\" } }\n end",
"def initialize\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.access_token = ENV['ACCESS_TOKEN']\n config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n end\n end",
"def initialize(api_client_id = nil, api_secret = nil, tenancy_code = nil, api_root: nil, api_root_auth: nil,\n api_version: nil, logger: nil, tenancy_root: nil, timeout: nil)\n\n self.api_root = api_root || 'https://rl.talis.com'\n self.api_root_auth = api_root_auth || 'https://users.talis.com/1/oauth/tokens'\n self.api_version = api_version || 2\n self.logger = logger\n self.rate_limit = nil\n self.rate_remaining = nil\n self.rate_reset = nil\n self.tenancy_code = tenancy_code\n self.tenancy_root = tenancy_root\n self.timeout = timeout.to_i\n\n @api_client_id = api_client_id\n @api_secret = api_secret\n @api_token = nil\n\n RestClient.log = self.logger if self.logger\n\n end",
"def initialize(client_key_path, client_cert_path, api_key, api_endpoint, options = {})\n @obh_client = OBH::Client.new do |conf|\n conf.credentials(client_key_path: client_key_path, client_cert_path: client_cert_path, api_key: api_key)\n conf.api_endpoint = api_endpoint\n conf.proxy_host = options[:proxy_host]\n conf.proxy_port = options[:proxy_port]\n conf.locale = options[:locale]\n conf.logger = options[:logger]\n end\n @message_from = options[:message_from] || false\n end",
"def initialize(api_key)\n @api_key = api_key\n check_api_key!\n end",
"def initialize(options = {})\n options = DEFAULT_ARGS.merge(options)\n\n @client = Faraday.new(\n faraday_options(options),\n ) do |conn|\n conn.response(:json)\n conn.adapter(Faraday.default_adapter)\n end\n end",
"def initialize\n self.client = Octokit::Client.new(\n login: \"tamouse\",\n password: WatchMyStuff::Configuration.two_fa\n )\n self.client.auto_paginate = true\n end",
"def initialize\n\t\t@zomato = Zomato::Base.new(@@api_key)\n\tend",
"def initialize(api_key)\n raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty?\n @api_key = api_key\n\t\tend",
"def initialize\n self.api_root = BASE_URL\n end",
"def initialize(api_key = nil, shared_secret = nil, options = nil)\n @api_key = api_key || @@default_api_key\n @shared_secret = shared_secret || @@default_shared_secret\n @options = options || @@default_options\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n end",
"def initialize(client)\n\t self.client=client\n end",
"def initialize(api_key = nil)\n @api_key = api_key\n @api_key ||= Songkickr.api_key\n \n self.class.default_params :apikey => @api_key\n end",
"def initialize(client)\n self.client=client\n\n\tend",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/partner/aistreams/v1alpha1/aistreams_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @ai_streams_stub = ::Gapic::ServiceStub.new(\n ::Google::Partner::Aistreams::V1alpha1::AIStreams::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(right_api_client)\n @right_api_client = right_api_client\n end",
"def setup_client\n @client = Viddler::Client.new(@api_key)\n @client.authenticate!(@username, @password)\n end",
"def initialize api_key=ENV['b2w_api_key'], api_url=\"http://api.born2win.local/v2/events\"\n @api_url = api_url\n @api_key = api_key\n end",
"def initialize(key)\n raise ArgumentError, 'An API key must be provided' if key.nil?\n @key = key\n end"
] |
[
"0.80325025",
"0.8010681",
"0.79503894",
"0.78721565",
"0.7803325",
"0.7789924",
"0.7745938",
"0.77344364",
"0.7718492",
"0.76793236",
"0.76279014",
"0.75967866",
"0.7588033",
"0.7564818",
"0.7562702",
"0.7555987",
"0.75242597",
"0.7506471",
"0.74999183",
"0.74901783",
"0.74529684",
"0.7448417",
"0.74473816",
"0.7434404",
"0.7434404",
"0.7434404",
"0.7423191",
"0.74172765",
"0.7415631",
"0.74150187",
"0.7392727",
"0.7392727",
"0.7384285",
"0.7368531",
"0.7360183",
"0.7360183",
"0.7346331",
"0.7336644",
"0.7297559",
"0.729529",
"0.7292098",
"0.7265464",
"0.72613204",
"0.72475624",
"0.7246877",
"0.72318643",
"0.7227621",
"0.7226547",
"0.72253376",
"0.7224511",
"0.7219261",
"0.72162473",
"0.7215552",
"0.71903396",
"0.71855575",
"0.7162241",
"0.7135326",
"0.7134706",
"0.7133496",
"0.7115823",
"0.7113825",
"0.7106356",
"0.71016395",
"0.7100112",
"0.70941836",
"0.70939",
"0.7086926",
"0.70862395",
"0.70745033",
"0.70655876",
"0.70578414",
"0.7040284",
"0.70353824",
"0.7031868",
"0.7019185",
"0.7019185",
"0.70188516",
"0.70183635",
"0.7016746",
"0.70164484",
"0.7008961",
"0.7007025",
"0.70032054",
"0.7002791",
"0.7002443",
"0.6998821",
"0.699688",
"0.69709784",
"0.6965506",
"0.6962536",
"0.6952293",
"0.6947041",
"0.69416",
"0.6939989",
"0.6938117",
"0.6933592",
"0.69307953",
"0.6928109",
"0.6923719",
"0.6916823",
"0.69131327"
] |
0.0
|
-1
|
Public: Initializes a session on the API server and stores the expiry time and the session_id in instance variables Returns the session_id GUID
|
def initialize_session
response = @soap_client.call :initialize_session
# Without ActiveSupport
# 1.hour.from_now is 3600 seconds from Time.now
@session_expiry_time = Time.now + 3600
@session_id = response.body[:initialize_session_response][:initialize_session_result]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize_session\n response = @savon.call :initialize_session\n # Without ActiveSupport\n # 1.hour.from_now is 3600 seconds from Time.now\n @session_expiry_time = Time.now + 3600\n @session_id = response.body[:initialize_session_response][:initialize_session_result]\n end",
"def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def init\n @session_id = SecureRandom.uuid\n request(:init, '{\"init\":\"none\"}')\n end",
"def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\n end",
"def session_id\n @session_id ||= initiate_xmlrpc_session\n end",
"def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def session_api_key\n api_keys.active.session.create\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 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 start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def init\n if @read_session\n @session_id = self[:session_id]\n @author_id = self[:author_id]\n @visits = self[:visits]\n @updated_at = self[:updated_at]\n @created_at = self[:created_at]\n @id = self[:id]\n else\n self[:session_id] = SessionCredential.generate_id\n self[:author_id] = SessionCredential.generate_id\n @session_id = self[:session_id]\n @author_id = self[:author_id]\n @visits = self[:visits]\n @updated_at = self[:updated_at]\n @created_at = self[:created_at]\n @id = self[:id]\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 set_session_uuid\n if session[:session_uuid].blank?\n session[:session_uuid] = SecureRandom.uuid\n end\n end",
"def initialize_session\n query_data = {\n \"IsHacked\" => @is_hacked,\n \"DeviceGenerationInfo\" => @device_generation_info,\n \"PublisherSDKVersion\" => @publisher_sdk_version,\n \"IsUsingSdk\" => @is_using_sdk,\n \"PublisherUserId\" => @publisher_user_id,\n \"OSVersion\" => @os_version,\n \"ClientIp\" => @client_ip,\n \"UDIDs\" => parse_udids, \n \"AppId\" => @app_id,\n \"IsOnCellular\" => @is_on_cellular\n }\n \n @raw_data = post_request(@api_url, query_data.to_json)\n @session = W3i::SessionData.new(@raw_data)\n\n true\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 initialize(id)\n @id = id\n @sess_hash = {}\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\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 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 setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end",
"def session_id\n @session_id ||= (bytes = [SecureRandom.uuid.gsub(DASH_REGEX, '')].pack(UUID_PACK)\n BSON::Document.new(id: BSON::Binary.new(bytes, :uuid)))\n end",
"def create value=nil\n # TODO: only certain keys are recognised in a session create request,\n # should raise an error on others.\n raw = @conn.put do |req|\n req.url \"/v1/session/create\"\n req.body = (if value.kind_of?(String) then value else JSON.generate(value) end) unless value.nil?\n end\n body = JSON.parse(raw.body)\n return body[\"ID\"]\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def session_id_key\n @session_id_key\n end",
"def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end",
"def create_session(session_id, data)\n session_id = escape(session_id)\n new_session = new(session_id, data)\n new_session\n end",
"def get_session_id\n p \"==>cookie: #{cookies.inspect}\"\n p \"===>session id=#{session[:sid]} session uid = #{session[:uid]}\"\n p \"cookies[:_wh_session] = #{cookies[:_wh_session] }\"\n\n if cookies[:_wh_session] \n session[:uid] = nil if session[:sid] != session[:sid]\n session[:sid] = cookies[:_wh_session] \n end\n # \n # after uesr first register, the _wh_session will be set in user's cookie\n # which will send by all afteraward quest\n #\n if (params[:sid])\n # reset_session\n\n # p request.host\n # p \"====>>>>dda29\"\n # set cookie first, because this is used to generate sid when write memcached\n if cookies[:_wh_session] == nil or cookies[:_wh_session] != params[:sid] # first time, or manually change session to other session\n\n cookies[:_wh_session] = {\n :value => params[:sid],\n :expires => 1.year.from_now,\n :domain => request.host\n }\n session[:uid] = nil\n end\n # p \"====>>>>dda69\"+params[:sid]\n # p \"====>>>>dda79\"+session[:sid]\n if (session[:sid] == nil || params[:sid] != session[:sid] )\n session[:sid] = params[:sid]\n session[:uid] = nil\n end\n\n # @sid = params[:sid]\n\n # cookies[:_wh_session] = params[:sid]\n # p \"====>>>>dda39\"\n else\n # p \"====>>>>dda19\"\n if !session[:sid]\n sid = cookies[:_wh_session]\n if sid ==nil\n sid = params[:sid] # for dev\n if !sid\n # error(\"session not exist, please restart app\")\n return nil\n end\n end \n session[:sid] = sid\n session[:uid] = nil\n end\n end\n # p \"====>>>>dda9\"\n return session[:sid]\n end",
"def initialize(session_id = nil, auth_token = nil)\n @session_id, @auth_token = session_id, auth_token\n end",
"def session(session_id)\n @session_id = session_id\n end",
"def initialize_session\n Session.create(sc: @sc, msisdn: @msisdn, session_id: @session_id, req_no: @req_no)\n @response = Registration.subscription_selection(@screen_id)\n end",
"def new\n @session = Session.new('')\n end",
"def start_session\n self.update_attributes(session_expires_in: 30.days.from_now)\n end",
"def initialize(session_key, uid)\n @session_key = session_key\n @uid = uid\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 id\n response_hash[:session_id]\n end",
"def session(nonce, encrypted_session_key)\n sid = 0 # TODO(costan): FPGA session allocation\n nonce_hmac = @fpga.establish_session sid, nonce, encrypted_session_key\n server_session = Session.new @fpga, @disk, sid, @data_start,\n @tree, @tree_driver\n { :nonce_hmac => nonce_hmac, :session => server_session }\n end",
"def initSession\r\n \t@session, id = PaypalSession.initSession(response.session)\r\n\r\n \tresponse.session[:paypal_session] = id\r\n \t@session\r\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 ||= []\n if @@session[self.id].nil?\n session = GData::Client::Calendar.new\n token = session.clientlogin(username,password)\n @@session[self.id] = session\n end\n @@session[self.id]\n end",
"def session_id\n @options[:session_id]\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def create_session\n @connection.create_session(@config || {})\n end",
"def setup_req_id_and_session_id\n random_string = \"#{Time.now.to_i}#{Kernel.rand(10000)}\"\n self.req_id ||= Utils::Crypth.uniq_token(\"#{random_string}#{(0..2000).to_a.sample}\") \n self.session_id ||= Utils::Crypth.uniq_token(\"#{random_string}#{(0..2000).to_a.sample}\") \n end",
"def ensure_session_token\n self.session_token ||= generate_session_token\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 new\n @session = Session.new\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= OpenStruct.new\n end",
"def ensure_session_token\n self.session_token ||= SecureRandom.urlsafe_base64(16)\n end",
"def session_id\n request.session_options[:id]\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 new\n @session = Session.new\n end",
"def id\n @id ||= scgi.session_id\n end",
"def set_session\n @session = session[:user_id]\n end",
"def set_session\n \n end",
"def initialize_session\n puts 'initializing session with client'\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(email, password)\n response = self.class.post(api_url(\"sessions\"), body: { email: email, password: password })\n raise 'Invalid email or password' if response.code == 404\n @auth_token = response[\"auth_token\"]\n\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new( req )\n end",
"def ensure_session_token \n self.session_token ||= SecureRandom::urlsafe_base64\n end",
"def session_id\n super\n end",
"def session_id\n super\n end",
"def initialize(params)\n @params = params\n @sessions = {}\n end",
"def session\n @session ||= {}\n end",
"def initialize(session, request_id)\n @session = session\n @request_id = request_id\n\n session[SESSION_KEY] ||= {}\n session[SESSION_KEY][request_id] ||= {}\n end",
"def set_session\n ses = Session.find_or_create_by(\n account: self,\n )\n ses.update(expires_at: 10.minutes.from_now)\n end",
"def generate_session_id money, currency, transaction_type, redirect_url,\n error_url\n\n xml = build_session_request money, currency, transaction_type, redirect_url, error_url\n\n return_xml = do_soap_request 'createSession', xml\n\n data = REXML::Document.new(return_xml)\n session_element = REXML::XPath.first( data, \"//sessionId\")\n if session_element.nil?\n fault_code = REXML::XPath.first( data, \"//faultcode\").text\n fault_msg = REXML::XPath.first( data, \"//faultstring\").text\n raise StandardError, 'unable to generate ipayment session id ' + fault_code + ' ' +fault_msg\n else\n session_element.text\n end\n end",
"def session_expiry\n @session_expiry ||= 30 * 24 * 60 * 60\n end",
"def set_session\n @session = Session.find(params[:session_id])\n end",
"def initialize(session_id = nil, map_state = nil)\n if session_id.blank?\n create_session\n else\n @session_id = session_id\n end\n \n if map_state\n @map_state = map_state\n end\n end",
"def create_new_id\n require 'securerandom'\n begin\n # by OpenSSL, or system provided entropy pool\n session_id = SecureRandom.hex(16)\n rescue NotImplementedError\n # never happens on modern systems\n require 'digest'\n d = Digest('SHA512').new\n now = Time::now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('foobar')\n session_id = d.hexdigest[0, 32]\n end\n session_id\n end",
"def ensure_session_token\n self.session_token ||= SecureRandom::urlsafe_base64\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end"
] |
[
"0.8205549",
"0.7366066",
"0.72173154",
"0.7182002",
"0.71672076",
"0.716702",
"0.7028304",
"0.69900715",
"0.6919015",
"0.69127214",
"0.6877575",
"0.6820005",
"0.6818361",
"0.6818361",
"0.6818361",
"0.67341465",
"0.6719797",
"0.66984504",
"0.6683915",
"0.6667034",
"0.66528183",
"0.6642597",
"0.6637337",
"0.6632545",
"0.66315544",
"0.65984786",
"0.6580901",
"0.6578953",
"0.65714943",
"0.65294677",
"0.6519687",
"0.6514593",
"0.64815134",
"0.64811975",
"0.64766866",
"0.6464202",
"0.64589834",
"0.64569205",
"0.6445443",
"0.6408857",
"0.6399348",
"0.63965714",
"0.6377103",
"0.6377103",
"0.6377103",
"0.63706684",
"0.63683754",
"0.63355374",
"0.63355374",
"0.63355374",
"0.63355374",
"0.63355374",
"0.63353693",
"0.6329155",
"0.6327402",
"0.6326345",
"0.6295677",
"0.62953913",
"0.62953913",
"0.6292783",
"0.6288149",
"0.6273653",
"0.6269751",
"0.62683773",
"0.6260865",
"0.6258593",
"0.625225",
"0.6252128",
"0.6251795",
"0.6248451",
"0.624433",
"0.62430066",
"0.6239924",
"0.62386024",
"0.62386024",
"0.6216046",
"0.621385",
"0.62095785",
"0.6203554",
"0.6200588",
"0.6197361",
"0.61764354",
"0.61728",
"0.6168669",
"0.6167906",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878",
"0.6166878"
] |
0.793872
|
1
|
Public: Calls the 'SignIn' SOAP action username a String which corresponds to a TranscribeMe Portal account username which can be any valid email address password a String which is the portal account password Returns a GUID of the Customer ID
|
def sign_in(username, password)
# If #login_with is called before we have a session_id instance variable
# then call initialize_session
initialize_session unless session_valid?
# Use Suds to call the 'SignIn' SOAP action
response = @soap_client.call :sign_in,
message: { 'wsdl:sessionID' => @session_id,
'wsdl:username' => username,
'wsdl:password' => password }
# Assign the customer_login_id variable to the string in the SOAP response
@customer_login_id = response.body[:sign_in_response][:sign_in_result]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sign_in(username, password)\n \n # If #login_with is called before we have a session_id instance variable\n # then call initialize_session\n initialize_session unless session_valid?\n\n # Use Savon to call the 'SignIn' SOAP action\n response = @savon.call :sign_in, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:username' => username, \n 'wsdl:password' => password }\n\n error_message = response.body[:sign_in_response][:error_message]\n\n raise error_message if error_message\n\n # Assign the customer_login_id variable to the string in the SOAP response\n @customer_login_id = response.body[:sign_in_response][:sign_in_result]\n end",
"def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end",
"def authenticate_with(identity, next_service, username); end",
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end",
"def register\n @response = client.request :user, :register3 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :user_profile => credentials.profile_hash,\n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:register3_response][:register3_return][:user_context]\n parse_response(context)\n end",
"def sign_in\n SAML::User::AUTHN_CONTEXTS.fetch(authn_context)\n .fetch(:sign_in)\n .merge(account_type:)\n rescue\n { service_name: 'unknown', account_type: 'N/A' }\n end",
"def login\n #this assumes we can get to signin from here\n login = @agent.get('http://www.xanga.com/signin.aspx')\n form = login.form('frmSigninRegister')\n \n #this assumes default domain is xanga\n form.txtSigninUsername = @user\n form.txtSigninPassword = @pw\n \n #this assumes first button will be the submit button\n page = @agent.submit(form, form.buttons.first)\n end",
"def azure_principal_login(system_config)\n cmdline = Schott::AzureCLI::Commandlines.service_login(system_config.app_id, system_config.app_key, system_config.tenant_id)\n cmd = run_command(\"Azure login\", cmdline, system_config)\n end",
"def login_customer(email, password)\n token_result, success = post_wrapper('/V1/integration/customer/token',\n { \"username\" => email, \"password\" => password }.to_json,\n default_headers)\n @customer_token = token_result if success\n default_headers[:authorization] = \"Bearer #{customer_token}\" if success\n return token_result, success\n end",
"def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end",
"def authentication_string\n pwd = escape(@account.password)\n user = escape(@account.username)\n sig = escape(@account.signature) \n \"PWD=#{pwd}&USER=#{user}&SIGNATURE=#{sig}\"\n end",
"def authenticate_with(identity, next_service, username, key_manager); end",
"def login_from_client\n return nil unless params[:auth_client] && \n params[:auth_client] == \"iphone\" &&\n params[:auth_id] &&\n params[:auth_secret] \n\n auth_secret_index = request.url =~ /&auth_secret/\n signature = Digest::MD5.hexdigest \"--#{CONFIG[:iphone_salt]}\"\\\n \"--#{request.url.slice(0,auth_secret_index)}\"\n\n return nil unless signature == params[:auth_secret].downcase || /\\/auth/ === request.url\n\n User.find Cryptography.deobfuscate(params[:auth_id])\n rescue\n nil\n end",
"def sign_in(*args); end",
"def login\n response = client.call :login, :message => { :username => username, :password => password }\n response.body[:login_response][:result]\n end",
"def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end",
"def azureactivedirectory\n auth = request.env[\"omniauth.auth\"]\n user = User.create_with_omniauth(auth)\n if user.present?\n session[:user_id] = user.id\n sign_in user\n redirect_to root_path, notice: 'User created with outlook'\n else\n redirect_to new_user_registration_path, notice: 'Invalid email or password'\n end\n end",
"def thelper_sign_in( u = User.find_by_identity_url( 'http://openid.pond.org.uk' ) )\n visit signin_path\n fill_in :sign_in_identity_url, :with => u.identity_url\n thelper_submit_with_named_button()\n assert_equal home_path, current_path\n return u\n end",
"def sign_in_name_field\n $tracer.trace(__method__) \n return ToolTag.new(input.id(\"/ctl00_content_ctl00_fragment_4504_ctl01_ctl00_ctl02_ctl17_username/\"), __method__)\n end",
"def sign_in\n puts \"Enter your '#{Wow::Config.remote}' credentials.\"\n puts \"Don't have an account yet? Create one at #{Wow::Config.remote}/users/sign_up\"\n email = Wow::ApiClient::Config.username || shell.ask(\"\\tEmail: \")\n password = Wow::ApiClient::Config.password || shell.password(\"\\tPassword: \")\n begin\n result = post('users/sign_in', email: email, password: password)\n data = result.data\n @current_user = { id: data[:id], token: data[:authentication_token] }\n rescue RestClient::Unauthorized => e\n raise Wow::Error, e.response.data[:error]\n end\n end",
"def adm_signin_name_field\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_ctl00_ctl00_OuterTaskRegion_TaskRegion_TaskRegion_TaskRegion_username/\"), __method__)\n end",
"def wsu_id\n \"UsernameToken-#{count}\"\n end",
"def authenticate_request\n service_response = UserManagement::VerifyCookie.new(\n client: params[:client],\n cookie_value: cookies[GlobalConstant::Cookie.user_cookie_name.to_sym],\n browser_user_agent: http_user_agent\n ).perform\n\n if service_response.success?\n # Update Cookie, if required\n extended_cookie_value = service_response.data[:extended_cookie_value]\n set_cookie(\n GlobalConstant::Cookie.user_cookie_name,\n extended_cookie_value,\n GlobalConstant::Cookie.user_expiry.from_now\n ) if extended_cookie_value.present?\n\n # Set user id\n params[:user_id] = service_response.data[:user_id]\n\n # Remove sensitive data\n service_response.data = {}\n else\n # Clear cookie\n delete_cookie(GlobalConstant::Cookie.user_cookie_name)\n render_api_response(service_response)\n end\n end",
"def login\n response = @client.call(:login,\n cookies: @auth_cookie,\n message: {\n username: @username, \n password: decrypt(@password)\n })\n\n @auth_cookie = response.http.cookies if @auth_cookie.nil?\n @login_token = response.hash[:envelope][:body][:login_response][:login_result]\n response\n end",
"def login\n @response = client.request :log, :login2 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:login2_response][:login2_return][:user_context]\n parse_response(context)\n end",
"def authenticate_account(client, options)\n if options[:application].nil? or options[:username].nil? or options[:password].nil? \n puts \"Missing arguments\"\n return\n end\n\n application = client.applications.get options[:application]\n request = Stormpath::Authentication::UsernamePasswordRequest.new options[:username], options[:password]\n begin\n result = application.authenticate_account request\n puts \"Authentication: SUCCESS\"\n puts \"Account Href: \" + result.account.href\n \n rescue Stormpath::Error => e\n puts \"Authentication: FAILURE\"\n print_error(e)\n end\nend",
"def call\n user = User.find_by_username(username)\n return user if user && user.authenticate(password_digest)\n \n errors.add :customer_authentication, 'invalid credentials'\n nil\n end",
"def create_sandbox_user\n body = { \"providerCallbackHost\": @host }\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser'\n response = Faraday.post(@url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['X-Reference-Id'] = @uuid\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n req.body = body.to_json\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n generate_api_key\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def sign_in(username, password, api_key, platform)\n session.username = username\n session.password = password\n session.api_key = api_key\n session.platform = platform\n\n session.sign_in\n end",
"def join_signin_name_field\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_content_ctl00_fragment_17442_ctl01_ctl00_ctl00_ctl05_Username/\"), __method__)\n end",
"def signup\n client.signup(\n params[:user],\n params[:password]\n )\n end",
"def sign_the_customer_in\n transaction = ::Refinery::Transactions::Transaction.find_by_unique_guid(params['REFERENCE'])\n sign_in(:customer, ::Refinery::Customers::Customer.find(transaction.order.customer_id))\n @current_cart = get_cart # get the cart again now that the customer is signed in.\n\n #@order = Order.find(params[:order_id])\n #if params['CUSTOMER_ID'].present? and @order.customer.id.to_s == params['CUSTOMER_ID'].to_s\n # sign_in(:customer, ::Refinery::Customers::Customer.find(params['CUSTOMER_ID']))\n # @current_cart = get_cart # get the cart again now that the customer is signed in.\n #else\n # flash[:alert] = \"You are not authorised to view that order's details\"\n # redirect_to refinery.root_path\n #end\n end",
"def account\n params[\"MerchantCode\"]\n end",
"def sign_in(user_data)\n fill_in 'Email:', :with => user_data['email']\n fill_in 'Password:', :with => user_data['password']\n click_button 'Sign In'\n end",
"def login\n debug 'Trying to login'\n _response = self.signed_request '/api/v1/login', 'POST', {\n user: $config.get_username,\n password: $config.get_password\n }\n\n if _response['status'] != 'success'\n puts 'Unable to login!'\n exit 1\n else\n debug 'Signed in successfully'\n end\n\n @auth_token = _response['data']['authToken']\n @user_id = _response['data']['userId']\n end",
"def auth(tenant)\n\t\t\n\t\tauth = {\"auth\" => {\"passwordCredentials\" => {\"username\" => @user_name, \"password\" => @password}, \"tenantName\" => tenant}}\n\t\t\n\t\tjson_string = JSON.generate(auth)\n\t\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_1}/v2.0/tokens\", json_string\n\t\t)do |curl| curl.headers['Content-Type'] = 'application/json' end\n\t\t\n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t@token = parsed_json[\"access\"][\"token\"][\"id\"]\n\t\t\n\t\treturn @token\n\tend",
"def user_id\n payload = authenticate!(via: :jwt)\n return payload[\"user\"]\n end",
"def wsse_authenticate(req, url, params = {})\n user, pass = username_and_password_for_realm(url, params[\"realm\"])\n\n nonce = rand(16**32).to_s(16)\n nonce_enc = [nonce].pack('m').chomp\n now = Time.now.gmtime.iso8601\n\n digest = [Digest::SHA1.digest(nonce + now + pass)].pack(\"m\").chomp\n\n req['X-WSSE'] = %Q<UsernameToken Username=\"#{user}\", PasswordDigest=\"#{digest}\", Nonce=\"#{nonce_enc}\", Created=\"#{now}\">\n req[\"Authorization\"] = 'WSSE profile=\"UsernameToken\"'\n end",
"def login (login = nil, password = nil, account_id=nil, external_auth=nil, domain=nil)\n\n if (login != nil && password == nil)\n # user given --> use generic user password\n # TODO: generate password (see https://forge.switch.ch/redmine/issues/2355)\n password = @pointconfig[\"generic_user_password\"]\n elsif (login == nil) && (password == nil)\n login = @pointconfig[\"username\"]\n password = @pointconfig[\"password\"]\n end\n\n res = query(\"login\",\n \"login\" => login,\n \"password\" => password,\n \"account-id\" => account_id,\n \"external-auth\" => external_auth,\n \"domain\" => domain)\n\n cookies = res.response[\"set-cookie\"]\n puts cookies.inspect\n cookies.split(\";\").each{|s|\n array = s.split(\"=\")\n if array[0] == \"BREEZESESSION\"\n @sessionid = array[1]\n end\n }\n puts \"ACS: Logged in\"\n return res.body\n end",
"def api_sign_in\n user = users(:one)\n post '/auth/sign_in', params: { email: user.uid, password: \"secret123\" }\n\n return { \n \"uid\" => response.headers[\"uid\"],\n \"access-token\" => response.headers[\"access-token\"],\n \"client\" => response.headers[\"client\"] }\n end",
"def login\n page = agent.get login_url\n page.form.field_with(name: \"username\").value = user\n page.form.field_with(name: \"password\").value = password\n page.form.submit\n unless agent.page.title.match(/Subscription Content/)\n raise \"Could not log in\"\n end\n agent\n end",
"def login\n \t\t response = @client.request :login do\n soap.body = { username: self.zconfig.user_name, password: self.zconfig.password}\n \t\t end\n \t\t response.to_hash\n \t \t self.session = response.to_hash[:login_response][:result][:session]\n end",
"def digimag_signin_name_field\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_content_digimagSignin_fragment_14992_ctl01_ctl00_ctl02_ctl17_username/\"), __method__)\n end",
"def user_auth(email, pass, id = nil, cui = nil)\n send_req({\n act: :user_auth,\n cloudflare_email: email,\n cloudflare_pass: pass,\n unique_id: id,\n clobber_unique_id: cui\n })\n end",
"def authenticate(username, password)\n\n @username = username\n @password = password\n\n auth_request = if on_premise?\n build_on_premise_request(username, password, region, login_url)\n else\n build_ocp_request(username, password, region, login_url)\n end\n\n soap_response = post(login_url, auth_request)\n\n document = REXML::Document.new(soap_response)\n # Check for Fault\n fault_xml = document.get_elements(\"//[local-name() = 'Fault']\")\n raise XML::Fault.new(fault_xml) if fault_xml.any?\n\n if on_premise?\n @security_token0 = document.get_elements(\"//e:CipherValue\").first.text.to_s\n @security_token1 = document.get_elements(\"//xenc:CipherValue\").last.text.to_s\n @key_identifier = document.get_elements(\"//o:KeyIdentifier\").first.text\n @cert_issuer_name = document.get_elements(\"//X509IssuerName\").first.text\n @cert_serial_number = document.get_elements(\"//X509SerialNumber\").first.text\n @server_secret = document.get_elements(\"//trust:BinarySecret\").first.text\n\n @header_current_time = get_current_time\n @header_expires_time = get_current_time_plus_hour\n @timestamp = '<u:Timestamp xmlns:u=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" u:Id=\"_0\"><u:Created>' + @header_current_time + '</u:Created><u:Expires>' + @header_expires_time + '</u:Expires></u:Timestamp>'\n @digest_value = Digest::SHA1.base64digest @timestamp\n @signature = '<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></CanonicalizationMethod><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#hmac-sha1\"></SignatureMethod><Reference URI=\"#_0\"><Transforms><Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod><DigestValue>' + @digest_value + '</DigestValue></Reference></SignedInfo>'\n @signature_value = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Base64.decode64(@server_secret), @signature)).chomp\n else\n cipher_values = document.get_elements(\"//CipherValue\")\n\n if cipher_values && cipher_values.length > 0\n @security_token0 = cipher_values[0].text\n @security_token1 = cipher_values[1].text\n # Use local-name() to ignore namespace.\n @key_identifier = document.get_elements(\"//[local-name() = 'KeyIdentifier']\").first.text\n else\n raise RuntimeError.new(soap_response)\n end\n end\n\n\n true\n end",
"def Authenticate(username, password, domain)\n client = Savon.client(wsdl: @@wsdl, ssl_verify_mode: :none, ssl_version: :TLSv1)\n\n response = client.call(:authenticate, message: {\n username: username,\n password: password,\n organization: \"\",\n domain: domain \n })\n\n @@token = response.to_hash[:authenticate_response][:authenticate_result][:token]\n getSecretTemplates()\n return @@token\n end",
"def perform_authorization_and_return_owner_id(session_id, user_name = nil, user_password = \"\", version)\n $tracer.trace(\"GameStopAccountServiceDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n authorize_rsp = perform_authorization_and_return_message(session_id, user_name, user_password, version)\n\n # verify we receive a 200\n authorize_rsp.code.should == 200\n\n # find \"authorization_result\" in the response messsage received, and verify user is authorized\n authorize_result = authorize_rsp.http_body.find_tag(\"authorization_result\").at(0)\n authorize_result.status.content.should == \"Authorized\"\n # return owner_id (user_id).. this will be used to add products to cart, etc.\n\n return authorize_result.user_id.content\n end",
"def authentication(params)\n Cognito::AuthUser.call(\n username: params[:username],\n password: params[:password],\n login_ip: params[:login_ip]\n )\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{login_name}:#{password}\")\n end",
"def login(email, password, partner_id=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'email', email);\n\t\t\tclient.add_param(kparams, 'password', password);\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id);\n\t\t\tclient.queue_service_action_call('adminuser', 'login', 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 call\n ap \"Llamando a Authentica User\"\n JsonWebToken.encode(usuario_id: usuario.id) if usuario\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def mobile_login(email, password)\n user = authenticate(email, password)\n\t xml = \"<user>\"\n \n if user\n mobile_token = MobileToken.new\n mobile_token.user_id = user.id\n mobile_token.token = Digest::SHA2.hexdigest(user.id.to_s + Time.now().to_s)\n mobile_token.save\n \n xml += generate_mobile_xml(user, mobile_token)\n end\n\n xml += \"</user>\"\n\t\t\n xml\n end",
"def login(mail, passwd)\n request_body = '&Email='+CGI.escape(mail)+'&Passwd='+CGI.escape(passwd)+'&accountType=HOSTED&service=apps'\n res = request({:method => 'POST', :path => '/accounts/ClientLogin' }, nil, request_body, {'Content-Type'=>'application/x-www-form-urlencoded'})\n return /^Auth=(.+)$/.match(res.to_s)[1]\n # res.to_s needed, because res.class is REXML::Document\n end",
"def authenticate_signin(email, password)\n Credentials::Password.authenticate_email email, password\n end",
"def create\n #create local variables which store the user_email and user_password entered as in the parameters for the /login API call\n user_email = params[:user_email]\n user_password = params[:password]\n\n #check to see if the user is authenticated via their entered email and password\n is_user_authenticated = User.authenticate(user_email, user_password)\n #if the user is authenticated, then return the token. The merchant will need this token as a parameter to view his/her campaigns\n if(is_user_authenticated)\n user = User.find_by_email(user_email)\n user_id = user.id\n user_hash = user.hash\n token = Digest::SHA2.hexdigest(user.hash)\n retIDandToken = {\"user_id\"=> user_id ,\"token\" => token}\n render json: retIDandToken\n\n else\n render json: password_auth_error, :status => 400\n end\n end",
"def unique_identifier\n\t\tDigest::SHA1.hexdigest(\"#{email}:#{password}\")\n\tend",
"def login_user(options = {})\n options[:email] = options[:email] || $settings.customer_service_email\n options[:password] = options[:password] || 'foobar'\n\n json = post_api '/api/session/login', {\n 'username' => options[:email] || options[:phone],\n 'password' => options[:password]\n }\n assert_equal 200, json['status'], json['message']\n json['meta']\n end",
"def login!\n params = { email: email, password: pass }\n response = Faraday.get(\"#{ACCOUNT_BASE}/login\", params)\n attributes = JSON.parse(response.body)\n @token = attributes[\"adminToken\"]\n end",
"def customer_log_in_as(customer, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post customer_login_path, session: { email: customer.email,\n password: password,\n remember_me: remember_me }\n else\n session[:customer_id] = customer.id\n end\n end",
"def account\n\t\t@email = params[:vitalsource][:email]\n\t\t@password = params[:vitalsource][:password]\n\t\tdoc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent =>2)\n\t\t#----------user login request body------------------------------------------------------------------------\n\t\tdoc.credentials{\n\t\t\tdoc.credential(\"email\" => @email, \"password\" => @password)\n\t\t}\n\t\t#user login request url\n\t\trequest_url = \"/v3/credentials.xml\"\n\t\t# #return: \n\t\t# #{\"credentials\"=>{\"credential\"=>{\"access_token\"=>\"4e2503801317d29a915895b17d560c54\", \"reference\"=>\"\", \"guid\"=>\"B2EY7AGYKNNMER76H56M\", \"email\"=>\"lemon_victor@hotmail.com\", \"__content__\"=>\"\\n \"}}}\n\t\t@request = out_string\n\t\turi = URI.parse(\"https://api.vitalsource.com\")\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\trequest = Net::HTTP::Post.new(request_url)\t\t\n\t\trequest.add_field('X-VitalSource-API-Key', 'YNBWZXTN743PWCZG')\n\t\trequest.body = out_string\n\t\tresponse = http.request(request)\n\t\tbody = Hash.from_xml(response.body)\n\t\tif(!body.has_key?(\"error\"))\n\t\t\t@err = body[\"credentials\"][\"error\"]\n\t\tend\n\t\tif(!body.has_key?(\"credential\"))\n\t\t\t@user = body[\"credentials\"][\"credential\"]\n\t\tend\n\tend",
"def sign_in(user = {})\n if @api_host.present? && user.present?\n begin\n request_url = @api_host + \"/api/v1/authenticate\"\n payload = user\n request_headers = { \"Content-Type\" => \"application/json\" }\n response = RestClient.post(request_url, payload.to_json, request_headers)\n result = JSON.parse(response.body)\n Rails.logger.info \"===== sign in result ===== #{result} =====\"\n result\n rescue RestClient::ExceptionWithResponse => e\n error = JSON.parse(e.response)\n Rails.logger.warn \"===== sign in errors ===== #{error} =====\"\n error\n end\n end\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{email}:#{password}\")\n end",
"def login(partner_id, username=KalturaNotImplemented, password=KalturaNotImplemented, extra_params=KalturaNotImplemented, udid=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partnerId', partner_id)\n\t\t\tclient.add_param(kparams, 'username', username)\n\t\t\tclient.add_param(kparams, 'password', password)\n\t\t\tclient.add_param(kparams, 'extraParams', extra_params)\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('ottuser', 'login', 'KalturaLoginResponse', 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 authenticate username, api_key, account: Conjur.configuration.account\n account ||= Conjur.configuration.account\n if Conjur.log\n Conjur.log << \"Authenticating #{username} to account #{account}\\n\"\n end\n JSON.parse url_for(:authn_authenticate, account, username).post(api_key, content_type: 'text/plain')\n end",
"def sign_in(user:, password:)\n post user_session_path \\\n \"user[email]\" => user.email,\n \"user[password]\" => password\n end",
"def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end",
"def login_info_request(tlid)\n xml = Requests::LoginInfoRequest.new(:tlid => tlid).render\n sendToTrufina(xml)\n end",
"def attempt_signin(user_params)\n current_account.user_sessions.create(user_params)\n end",
"def sign_in_as(name)\n post login_url, params: { email: name, password: 'testpassword' }\n end",
"def sign_in_real\n user = FactoryBot.create :user\n\n post login_url, params: {name: user.name, \n password: user.password}\n end",
"def sign_up(resource_name, resource)\r\n sign_in(resource_name, resource)\r\n end",
"def merchant_guid\n hash[\"MerchantGUID\"]\n end",
"def sign_in(resource_or_scope, *args); end",
"def sign_in(user)\n post sessions_path, params: { email: user.email, password: 'mypass' }\n end",
"def whoIsSignedIn\n if params[:i_am_client]\n username = authenticateClient\n elsif session[:username]\n username = session[:username]\n end\n \n if username == nil\n return nil\n end\n \n user = User.find_by_username(username)\n if user == nil\n return nil\n end\n return user\n end",
"def login\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:phone_number], auth_params[:password]).call\n response = { message: Message.successful_login, auth_token: auth_token }\n json_response(response)\n end",
"def login(params = {})\n begin\n params.merge!(common_params)\n document = MagentoApiWrapper::Requests::Login.new(params)\n request = MagentoApiWrapper::Request.new(magento_url: params[:magento_url], call_name: :login)\n request.body = document.body\n login = MagentoApiWrapper::Login.new(request.connect!)\n @session_id = login.key\n login.key\n rescue MagentoApiWrapper::AuthenticationError => e\n raise e\n end\n end",
"def sign_in_user(username:, password:, client_id:, client_secret:, scope: 'openid')\n client(issuer).post do |req|\n req.url \"/oauth2/#{auth_server_id}/v1/token\"\n req.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n req.headers['Authorization'] = 'Basic: ' + Base64.strict_encode64(\"#{client_id}:#{client_secret}\")\n req.body = URI.encode_www_form username: username, password: password, scope: scope, grant_type: 'password'\n end\n end",
"def authenticate(username, password)\n perform_request({:action => 'client-authenticate', :username => username, :password => password})\n end",
"def authenticate(username, password, token = nil, tenant = nil)\n data = {\n \"auth\" => { \n \"passwordCredentials\" => { \n \"username\" => username, \n \"password\" => password \n } \n } \n }\n unless tenant.nil?\n data[\"auth\"][\"tenantName\"] = tenant\n end\n @data = post_request(address(\"/tokens\"), data, token)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def login(email, key)\n raise 'email is Invalid, must be instance of String' if email.nil? || !email.instance_of?(String)\n raise 'key is Invalid, must be instance of String' if key.nil? || !email.instance_of?(String)\n\n path = '/v3/account/login/api'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n payload = { email: email, key: key }\n\n request = Net::HTTP::Post.new(path, headers)\n request.body = payload.to_json\n\n res_data = handle_response(@id_client.request(request), 'login')\n\n CopyleaksAuthToken.new(res_data['.expires'], res_data['access_token'], res_data['.issued'])\n end",
"def login(identity, password, &blk)\n @cb = blk\n\n name = OpenSSL::X509::Name.parse \"CN=#{identity}\"\n\n csr = OpenSSL::X509::Request.new\n csr.version = 0\n csr.subject = name\n csr.public_key = key.public_key\n\n csr.sign key, OpenSSL::Digest::SHA1.new\n\n send_data ['login', [csr.to_pem]].to_msgpack\n end",
"def sign_up\n service_response = UserManagement::SignUp.new(\n params.merge({\n is_client_manager: 1,\n client_creation_needed: 1,\n browser_user_agent: http_user_agent\n })\n ).perform\n\n if service_response.success?\n # NOTE: delete cookie value from data\n cookie_value = service_response.data.delete(:cookie_value)\n set_cookie(\n GlobalConstant::Cookie.user_cookie_name,\n cookie_value,\n GlobalConstant::Cookie.user_expiry.from_now\n )\n end\n\n render_api_response(service_response)\n end",
"def sign_in_password_field\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"/ctl00_content_ctl00_fragment_4504_ctl01_ctl00_ctl02_ctl17_password/\"), __method__)\n end",
"def sign_in\n conditions = user_params.dup\n password = conditions.delete(:password)\n @user = User.find_first_by_auth_conditions(conditions)\n\n if @user.valid_password?(password)\n @user.generate_auth_token\n @user.update_attributes! sign_in_count: @user.sign_in_count + 1\n respond_with @user\n else\n render nothing: true, status: :unauthorized\n end\n end",
"def identity()\n return MicrosoftGraph::Identity::IdentityRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def login_account(username, password)\n login_form.email_txt.set username\n login_form.password_txt.set password\n login_form.login_btn.click\n end",
"def auth_id\n params['TxAuthNo']\n end",
"def sign_in identifier\n User.find_by(login: identifier) || User.find_by(email: identifier)\n end",
"def find_mind_customer_id_by_email(email)\n\tsite_ids = { 'int' => @SITEID }\n\thttp_client = Savon.client(\"https://api.mindbodyonline.com/0_5/ClientService.asmx?WSDL\")\n\tsource_credentials = { 'SourceName' => 'CryoZone', 'Password' => '@PASSWORD', 'SiteIDs' => site_ids }\n\tuser_credentials = { 'Username' => '@USERNAME', 'Password' => '@PASSWORD2', 'SiteIDs' => site_ids }\n\thttp_request = { 'SourceCredentials' => source_credentials, 'UserCredentials' => user_credentials,\n\t'SearchText' => email}\n\tparams = { 'Request' => http_request }\n\t\n\tresult = http_client.request(:get_clients) do\n\t\tsoap.body = params\n\tend\n\t\n\t@list_clients_now = result[:get_clients_response][:get_clients_result]\n\tputs @list_clients_now.inspect\n\tunique_id = @list_clients_now[:clients][:client].first[:unique_id]\nend",
"def call(username,password)\n auths = @chain.clone\n identity = {}\n until auths.empty?\n auth = auths.shift\n new_ident = auth.call(username,password)\n if new_ident.nil? && auth.respond_to?(:required) && auth.required\n #Authentication failed for a required authenticator\n return nil\n end\n identity = merge_identities(identity, new_ident)\n if identity && auth.respond_to?(:sufficient) && auth.sufficient\n #This authenticator is sufficient; do not continue down auth chain.\n break\n end\n end\n return nil if identity.empty?\n identity\n end",
"def sign_in(user)\n user.create_new_auth_token\n end",
"def create\n\t\tclient = Client.find_by_email(params[:email])\n\t\t\tif client && client.authenticate(params[:password])\n\t\t\t\tsession[:client_id] = client.id\n \t\t\t\tredirect_to root_path \n \t\t\telse\n \t\t\t\trender \"new\" , alert: \"User Id And or Password Invalid\"\n \t\t\tend\n \tend",
"def get_user_id(username)\n # .........\n end",
"def authenticate_user(username, password)\n api(\"AuthenticateUser\", username, password)\n end",
"def enter_login_credentials(username, password)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n login_email_field.value = username\n login_password_field.value = password\n end",
"def sign_up(resource_name, resource)\n # sign_in(resource_name, resource)\n end"
] |
[
"0.6435891",
"0.5484796",
"0.54348046",
"0.5424278",
"0.53663397",
"0.5348663",
"0.53032714",
"0.5277281",
"0.5253606",
"0.52351665",
"0.5195412",
"0.5171193",
"0.51522857",
"0.5135205",
"0.5123581",
"0.51164925",
"0.5088182",
"0.5087551",
"0.50824624",
"0.50808567",
"0.5068609",
"0.5048585",
"0.5045182",
"0.5042579",
"0.5040266",
"0.5029821",
"0.502673",
"0.50084776",
"0.4997071",
"0.49819347",
"0.49789768",
"0.49737462",
"0.49723193",
"0.49643034",
"0.49562472",
"0.4950468",
"0.49463028",
"0.49422625",
"0.49422035",
"0.4934585",
"0.4934534",
"0.49290785",
"0.4915272",
"0.49096507",
"0.48968637",
"0.48833418",
"0.48801494",
"0.48701385",
"0.48688862",
"0.48641124",
"0.48607144",
"0.4859941",
"0.4857433",
"0.4850285",
"0.48475266",
"0.48447514",
"0.48419622",
"0.48413315",
"0.4828407",
"0.4827451",
"0.4825625",
"0.4823996",
"0.48186642",
"0.4816609",
"0.4815341",
"0.4805779",
"0.48041385",
"0.48006475",
"0.47994",
"0.4797742",
"0.47968373",
"0.47889152",
"0.4787259",
"0.4784338",
"0.47818595",
"0.47798347",
"0.47743315",
"0.47671103",
"0.47656497",
"0.47646424",
"0.4763859",
"0.47614837",
"0.4753899",
"0.47512344",
"0.47506577",
"0.47490728",
"0.47425088",
"0.47392935",
"0.4730761",
"0.47294715",
"0.47261816",
"0.47255364",
"0.47253725",
"0.47239536",
"0.47206205",
"0.4716738",
"0.47160456",
"0.47149977",
"0.47147152",
"0.47118148"
] |
0.69385266
|
0
|
Public: Calls the 'GetCustomerRecordings' SOAP Action requires the user to be logged in Returns an Array of Hashes of with the properties of recording objects
|
def get_recordings
# raise 'Login first!' unless @customer_login_id
response = @soap_client.call :get_customer_recordings,
message: { 'wsdl:sessionID' => session_id }
@recordings = response.body[:get_customer_recordings_response][:get_customer_recordings_result][:recording_info]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_recordings\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_customer_recordings, \n message: { 'wsdl:sessionID' => session_id }\n\n # Returns an array of instances of the Recording class\n @recordings = TranscribeMe::Recording.new_from_soap response.body[:get_customer_recordings_response][:get_customer_recordings_result][:recording_info]\n end",
"def get_recordings()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/recordings\"))[0]\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"def getRecordJSON()\n return @sObjectRecords\nend",
"def get_cname_records\n Terminal.get_cname_records(@user_token, @access_token)\n end",
"def get_recordings(options = {})\n prepare\n @api.get_recordings(options)\n end",
"def get_records\n return error_response unless is_get_records_request?\n as_json\n end",
"def customers\n Easybill::Api::Customers\n end",
"def all\n @customer_objects\n end",
"def all_customers\n if @customer_records_file.nil? || !File.exist?(@customer_records_file)\n raise ArgumentError, 'Customer records file must be provided'\n end\n\n File.open(@customer_records_file, 'r') do |f|\n f.each_line.map do |line|\n JSON.parse(line)\n end\n end\n end",
"def get_userrecordings(opts = {})\n data, _status_code, _headers = get_userrecordings_with_http_info(opts)\n return data\n end",
"def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end",
"def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.add_param(kparams, 'pager', pager)\n\t\t\tclient.queue_service_action_call('recording', 'list', 'KalturaRecordingListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get_customers\n return ShopifyAPI::Customer.all\n end",
"def recordings_list_stored\n get \"recordings/stored\"\n end",
"def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end",
"def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end",
"def get_recording_info(recording_id)\n @soap_client.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n end",
"def customers()\n sql = \"SELECT DISTINCT customers.* FROM customers\n INNER JOIN tickets\n ON customers.id = tickets.customer_id\n WHERE tickets.screening_id = $1;\"\n values = [@id]\n customers_array = SqlRunner.run(sql, values)\n return Customer.map_to_objects(customers_array)\n end",
"def all_recordings\n self.recordings\n end",
"def all_recordings\n self.recordings\n end",
"def get_userrecordings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserRecordingsApi.get_userrecordings ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/userrecordings\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UserRecordingEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserRecordingsApi#get_userrecordings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def customers\n ShopifyAPI::Customer.all\n end",
"def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"def customers()\n sql = \"SELECT DISTINCT customers.* FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n INNER JOIN screenings ON tickets.screening_id = screenings.id\n WHERE screenings.film_id = $1;\"\n values = [@id]\n customers_array = SqlRunner.run(sql, values)\n return Customer.map_to_objects(customers_array)\n end",
"def index\n puts \"index params = #{params}\"\n if params[:user_id]\n @recordings = current_user.recordings\n else\n flash[:notice] = \"You can only view recordings from your account.\"\n redirect_to user_path(current_user)\n end\n end",
"def get_customers\n \n # Go to the Customers tool\n goto_tool 'redetrack/bin/manager'\n \n # Extract the table as a RubyExcel::Sheet\n s = RubyExcel::Workbook.new.load( Nokogiri::HTML( agent.page.body ).css( 'tr' ).map { |row| row.css('th,td').map { |cell| cell.nil? ? nil : cell.text.gsub( /\\s+/, ' ' ).strip } } )\n \n # Remove the buttons and blank rows\n s.row(2).delete\n s.compact!\n \n # Store the account details in a Hash by :name and :customer\n h = Hash.new({})\n s.rows(2) do |row|\n name = ( row['D'].empty? ? 'Other' : row['D'] )\n customer = ( row['E'].empty? ? 'Other' : row['E'] )\n h[ row['C'].upcase ] = { name: name, customer: customer }\n end\n h\n end",
"def records\n doc = @session.request(:get, @records_url)\n return doc.css(\"entry\").map(){ |e| Record.new(@session, e) }\n end",
"def customers()\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id INNER JOIN screenings ON screenings.id = tickets.screening_id INNER JOIN films ON films.id = screenings.film_id WHERE tickets.customer_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n return Customer.map_customers(customers)\n end",
"def customerList(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :from, :count)\n execute(:customerList, options)\n end",
"def recordings_list_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recordings_list ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling CloudRecordingApi.recordings_list\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling CloudRecordingApi.recordings_list, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/users/{userId}/recordings'.sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].nil?\n query_params[:'mc'] = opts[:'mc'] if !opts[:'mc'].nil?\n query_params[:'trash'] = opts[:'trash'] if !opts[:'trash'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'trash_type'] = opts[:'trash_type'] if !opts[:'trash_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recordings_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def single_customer_reports\n @id = params[:id] # stores customer id\n @user = User.find(@id)\n start_date = params[:start_date]\n if (start_date.nil?)\n @date_arr = @user.orders.all\n else\n end_date = params[:end_date]\n @date_arr = []\n @user.orders.each do |order|\n if (order.date.strftime(\"%Y-%m-%d\").to_date >= start_date.to_date && order.date.strftime(\"%Y-%m-%d\").to_date <= end_date.to_date)\n @date_arr.push(order)\n end\n end\n end\n end",
"def active_recordings\n @recordings = current_user.active_recordings\n end",
"def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end",
"def records\n @records ||= []\n end",
"def show_customers\n sql = \"SELECT customers.* FROM films INNER JOIN screenings ON films.id = screenings.film_id INNER JOIN tickets ON screenings.id = tickets.screening_id INNER JOIN customers on tickets.customer_id = customers.id WHERE films.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return result.map {|customer| Customer.new(customer)}\n end",
"def customers\n sql = \"SELECT customers.* FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE tickets.film_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n array_of_customer_objects = result.map {|row_hash| Customer.new(row_hash)}\n return array_of_customer_objects\n end",
"def list_customer(custid = nil, email = nil)\r\n\r\n raise ArgumentError.new('Customer Id and email are nil.') if custid.nil? && email.nil?\r\n \r\n suburl = \"&action=list_customer&nodocs=1\" \r\n \r\n if !custid.nil? && email.nil?\r\n suburl << \"&custid=\" + custid.to_s\r\n elsif custid.nil? && !email.nil? \r\n suburl << \"&email=\" + email\r\n elsif !custid.nil? && !email.nil?\r\n suburl << \"&custid=\" + custid.to_s + \"&email=\" + email\r\n end\r\n\t \r\n call_target_url(suburl) # call private method\r\n\r\n end",
"def retrieve_current_records(stdout = $stdout)\n session.list_records(@zone_name).body.map do |record|\n record_body = record.fetch('record')\n\n begin\n build_from_api(record_body)\n rescue StandardError\n stdout.puts \"Cannot build record: #{record_body}\"\n raise\n end\n end.select(&:present?)\n end",
"def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end",
"def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end",
"def recordings\n recording_ids = self.instrument_tags.where(instrument_tagable_type: 'Recording').pluck(:instrument_tagable_id)\n Recording.where(id: recording_ids)\n end",
"def build_customer_list\n @customer = []\n customer = []\n tempcustomer = []\n calllist = Calllist.all\n calllist.each do |c|\n if c.custcode && !tempcustomer.include?(c.custcode)\n tempcustomer.push(c.custcode)\n end\n end\n\n customer = tempcustomer.sort\n if !session[:called_customer] || session[:called_customer == '']\n # session customer not set\n session[:called_customer] = customer[0]\n end\n\n i = 1\n @selected_customer = 0\n customer.each do |c|\n select_item = []\n select_item.push(c)\n select_item.push(i)\n @customer.push(select_item)\n if c == session[:called_customer]\n @selected_customer = i\n end\n i += 1\n end\n $calllist_customers = @customer\n\n @customer_calllists = []\n calllist.each do |c|\n if c.custcode\n if c.custcode == session[:called_customer]\n # include call list records that are a direct match for customer\n @customer_calllists.push(c)\n end\n end\n end\n end",
"def customers()\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id WHERE film_id = $1\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end",
"def service_response_data\n\n {\n customer: @customer.get_hash,\n gateway_customer_associations: @gateway_customer_associations.map{|x| x.get_hash}\n }\n\n end",
"def fetch_billing_results\n previous_response = nil\n begin\n page = get_page_number\n\n response = Select.fetch_billing_results(@start_timestamp, @end_timestamp,\n page, @page_size)\n unless !response.is_a?(Array)\n process_response(response)\n previous_response = response\n end\n end until !response.is_a?(Array)\n reset_page_number\n\n set_empty_last_fetch_soap_id(response, previous_response)\n end",
"def list(filter=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('seriesrecording', 'list', 'KalturaSeriesRecordingListResponse', 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 records(opts = {})\n opts = opts.merge(@opts)\n client.list_records(opts).full.lazy.flat_map do |rec|\n @record_class.build(mint_id(rec.header.identifier),\n record_xml(rec))\n\n end\n end",
"def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end",
"def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @customers[:recordset] }\n\t\tend\n\tend",
"def inspect\n \"TranscribeMe::API::Recordings count=#{list.count} list=[...] \"\n end",
"def fetch_recordings\n server = self.server(:get_recordings)\n if server.present?\n states = BigbluebuttonRecording::STATES.values\n scope = BigbluebuttonRecording.where(room: self, state: states)\n server.fetch_recordings({ meetingID: self.meetingid, state: states }, scope)\n true\n else\n false\n end\n end",
"def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end",
"def index\n @customersessions = Customersession.all\n end",
"def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end",
"def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end",
"def get_user_campaigns username, password\n do_request 'get_user_campaigns', username: username, password: password\n end",
"def all_customers()\n sql = \"SELECT customers.* FROM customers\n INNER JOIN tickets on customers.id = tickets.customer_id\n WHERE tickets.film_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values) #array of hashes\n booked_customers = result.map { |customer| Customer.new(customer)}\n return booked_customers\n end",
"def recordings_list(user_id, opts = {})\n data, _status_code, _headers = recordings_list_with_http_info(user_id, opts)\n data\n end",
"def customers()\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.cust_id WHERE tickets.film_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n return customers.map{|cust| Customer.new(cust)}\n end",
"def list_customers(opts = {})\n operation('ListCustomers')\n .add(opts)\n\n run\n end",
"def new_from_soap(recordings)\n # Reset the list array to be blank\n @@list = []\n recordings.map do |recording|\n @@list << self.new(recording)\n end\n self\n end",
"def index\n @customer_apps = CustomerApp.for_account(active_account)\n end",
"def records\n [gogovan_order, contact.try(:address), contact, schedule, self].compact\n end",
"def customers()\n sql = \"SELECT DISTINCT customers.*\n FROM customers\n INNER JOIN tickets\n ON tickets.customer_id = customers.id\n WHERE film_id = $1\"\n values = [@id]\n customer_hash = SqlRunner.run(sql, values)\n result = customer_hash.map {|customer| Customer.new(customer) }\n return result\n end",
"def all_customers() # RETURN film1.all_customers (returns all customers attending that film)\n sql = \"SELECT customers.* FROM customers INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE tickets.film_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n result = customers.map { |customer| Customer.new(customer) }\n return result\n end",
"def retrieve_records(limits)\n limit = (limits[:limit].presence || 10).to_i\n offset = limits[:offset].presence.to_i\n account_id = limits[:account_id]\n\n records = account_id.present? ? where(AccountId: account_id) : all\n\n records.offset(offset).limit(limit)\n end",
"def get_transcriptions()\n @client.make_request(:get, @client.concat_user_path(\"#{RECORDING_PATH}/#{id}/transcriptions\"))[0]\n end",
"def index\n setup_search_filters(:customers, :page_size => ::AppConfig.pagination.customers.page_size)\n @customers = Customer.filtered_customers(current_user.customers, @filters)\n @all_customers = current_user.customers\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @customers.to_xml }\n format.csv do\n stream_csv do |csv|\n csv << [\"customer_name\", \"customer_address1\", \"customer_address2\", \"customer_city\", \"customer_province_state\", \"customer_postalcode_zip\", \"customer_country\", \"customer_website\", \"customer_phone\", \"customer_language\", \"customer_fax\", \"contact_first_name\", \"contact_last_name\", \"contact_email\", \"contact_phone\"]\n @all_customers.each do |c|\n customer = [c.name, c.address1, c.address2, c.city, c.province_state, c.postalcode_zip, c.country, c.website, c.phone, c.fax]\n c.contacts.each do |contact|\n csv << customer + [contact.first_name, contact.last_name, contact.email]\n end\n end\n end\n end\n end\n end",
"def customers()\n sql = \"SELECT customers.* FROM customers\n INNER JOIN tickets\n ON tickets.customer_id = customers.id\n WHERE tickets.screening_id = $1\"\n values = [@id]\n customers = SqlRunner.run(sql, values)\n return customers.map{|customer| Customer.new(customer)}\nend",
"def index\n @customers = @user.customers.all\n render json: @customers\n end",
"def get_customer(opts = {})\n data, _status_code, _headers = get_customer_with_http_info(opts)\n data\n end",
"def retrieve_current_records(zone:, stdout: $stdout)\n records_for_zone(zone)\n .flat_map { |short_record| build_from_api(short_record) }\n .compact\n end",
"def index\n\t\t@customer_users = CustomerUser.all\n\tend",
"def list_customer_full(custid = nil, email = nil)\r\n\r\n raise ArgumentError.new('Customer Id and email are nil.') if custid.nil? && email.nil?\r\n \r\n suburl = \"&action=list_customer\" \r\n \r\n if !custid.nil? && email.nil?\r\n suburl << \"&custid=\" + custid.to_s\r\n elsif custid.nil? && !email.nil? \r\n suburl << \"&email=\" + email\r\n elsif !custid.nil? && !email.nil?\r\n suburl << \"&custid=\" + custid.to_s + \"&email=\" + email\r\n end\r\n\t \r\n call_target_url(suburl) # call private method\r\n\r\n end",
"def list\n display_customers\n end",
"def get(id)\n response = Network.get(['Recordings', id])\n Recording.new(response)\n end",
"def index\n @record_set = RecordSet.find_by_id(params[:record_set_id].to_i)\n can? :read, @record_set\n @records = Record.find_all_by_record_set_id(@record_set.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @records.collect {|r| r.to_jq_record }.to_json }\n end\n end",
"def collect_record_data(serializer, abilities)\n return unless serialize_record_data?\n record = serializer.object\n return if record.blank?\n keys = collect_only_keys.present? ? collect_only_keys : collect_keys\n collect_record_data_for_keys(serializer, keys, record, abilities)\n end",
"def get_customer_all_using_get(opts = {})\n data, _status_code, _headers = get_customer_all_using_get_with_http_info(opts)\n data\n end",
"def records\n live_lookup_service.new(@ids).records\n end",
"def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end",
"def records(_options = {})\n if defined?(_resource_klass.records)\n _resource_klass.records(_options)\n else\n _resource_klass._model_class.all\n end\n end",
"def get_userrecording_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserRecordingsApi.get_userrecording ...\"\n end\n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling UserRecordingsApi.get_userrecording\" if recording_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/userrecordings/{recordingId}\".sub('{format}','json').sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UserRecording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserRecordingsApi#get_userrecording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n start_time, end_time = normalize_start_and_end_time(params[:start_time], params[:end_time])\n authorize! :read, PaymentInvoice\n if !set_customer\n return #Already rendered errors json\n end\n @payment_invoices = @customer.payment_invoices.where(receipt_date: start_time..end_time)\n render json: @payment_invoices\n end",
"def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end",
"def wcrs(name)\n wepay_checkout_records(name)\n end",
"def get_all_records_for_zone zone\n # not cached, we need to retrieve it\n records = []\n offset = 0\n has_more = true\n while has_more\n response = rec_load_all zone, offset\n has_more = response['response']['recs']['has_more']\n offset += response['response']['recs']['count']\n records.concat(response['response']['recs']['objs'])\n end\n records\n end",
"def get_records(params, columns)\n []\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end",
"def get_recording_info(recording_id)\n response = @savon.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n response.body[:get_recording_info_response][:get_recording_info_result]\n end",
"def list_customers(authorization, opts = {})\n data, _status_code, _headers = list_customers_with_http_info(authorization, opts)\n return data\n end",
"def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end",
"def customers(data_keys = nil)\n data_keys ||= ::LoremIpsumNearby.config.result_data_keys\n @customers.map { |customer| customer.slice(*data_keys) }\n end",
"def index\n @recordings = Recording.where(is_recorded: false).order(:start_datetime).reverse_order.page(params[:page]).per(20)\n end",
"def get_calls()\n @client.make_request(:get, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/calls\"))[0].map do |item|\n Call.new(item, @client)\n end\n end",
"def show\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @appointments = Appointment.where(:company_id => current_user.company.id, :customer_id => @customer.id).order('starts_at DESC').paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end"
] |
[
"0.8393711",
"0.74418026",
"0.6205894",
"0.59192604",
"0.58930606",
"0.5873243",
"0.5866161",
"0.5863246",
"0.5837155",
"0.58055586",
"0.5798558",
"0.57962966",
"0.5773887",
"0.5742582",
"0.5711987",
"0.57072693",
"0.57055783",
"0.57048357",
"0.5550881",
"0.55396473",
"0.55396473",
"0.55304027",
"0.55272216",
"0.5489036",
"0.5481964",
"0.54637235",
"0.54360265",
"0.5423695",
"0.53832734",
"0.53701544",
"0.5356035",
"0.53546995",
"0.5333572",
"0.53327054",
"0.5279421",
"0.52790815",
"0.52780074",
"0.52499235",
"0.52457917",
"0.52385443",
"0.52324617",
"0.5228158",
"0.5225422",
"0.522441",
"0.5206905",
"0.52066755",
"0.52048445",
"0.5180343",
"0.5173228",
"0.5170508",
"0.51689035",
"0.516449",
"0.51618224",
"0.51552105",
"0.5150318",
"0.5146687",
"0.51441747",
"0.5141294",
"0.51317567",
"0.5099929",
"0.50922704",
"0.508545",
"0.5068666",
"0.50675875",
"0.5061939",
"0.50610536",
"0.50602096",
"0.5053357",
"0.504833",
"0.5048091",
"0.50435805",
"0.50352484",
"0.50314945",
"0.5013623",
"0.5009001",
"0.5007328",
"0.49974045",
"0.4985746",
"0.49820295",
"0.4976727",
"0.49726292",
"0.49717212",
"0.4969417",
"0.49631503",
"0.49589217",
"0.49585566",
"0.4954156",
"0.49481472",
"0.49475586",
"0.49435443",
"0.49435443",
"0.49435443",
"0.49429667",
"0.49388164",
"0.49386057",
"0.49379143",
"0.49344373",
"0.49263975",
"0.49184528",
"0.49178264"
] |
0.8729316
|
0
|
Public: Calls the 'GetUploadUrl' SOAP Action Returns the upload url as a String
|
def get_upload_url
# raise 'Login first!' unless @customer_login_id
response = @soap_client.call :get_upload_url,
message: { 'wsdl:sessionID' => @session_id }
@upload_url = response.body[:get_upload_url_response][:get_upload_url_result]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_upload_url\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_upload_url, \n message: { 'wsdl:sessionID' => @session_id }\n \n @upload_url = response.body[:get_upload_url_response][:get_upload_url_result] \n end",
"def upload_url\n return @upload_url\n end",
"def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end",
"def upload_file_url\n \"file://#{upload_full_path}\"\n end",
"def upload_url=(value)\n @upload_url = value\n end",
"def url(**options)\n if uploaded_file = get\n uploaded_file.url(**options)\n else\n default_url(**options)\n end\n end",
"def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end",
"def get_upload_url\n url_service = UploadUrlFetcher.new(@context, unsafe_params[:id])\n\n result = url_service.fetch_url(unsafe_params)\n\n render json: result\n end",
"def getUploadfile\r\n\t\t\t\t\treturn @uploadfile\r\n\t\t\t\tend",
"def url\n return nil unless @uploader.upyun_bucket_host\n\n [@uploader.upyun_bucket_host, @path].join(\"/\")\n end",
"def url\n if @uploader.upyun_bucket_domain\n \"http://\" + @uploader.upyun_bucket_domain + '/' + @path\n else\n nil\n end\n end",
"def uploaded_file_path\n FileServices::Uploader.perform(@file, upload_path)\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 getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def upload_location\n object[\"upload_location\"]\n end",
"def get_upload_urls(mime_type)\n\tputs \"Getting upload urls\"\n\tresponse = request_get_with_param('/api/file/getpreupload', mime_type)\n\tputs response.body\nend",
"def get_upload_urls(mime_type)\n\tputs \"Getting aws urls for MIME type: \" + mime_type\n\tresponse = request_get_with_param('/api/partner/file/uploadurls', mime_type)\n\tputs response.body\nend",
"def url\n host = @uploader.ucloud_cdn_host || @uploader.ucloud_bucket_host\n return nil unless host\n [host, @path].join(\"/\")\n end",
"def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end",
"def geturl() \n\t\treturn self.response.geturl()\n end",
"def url\n # HACK: Revisit and make configurable separate from the connection options.\n \"http://#{@uploader.sftp_host}/#{path}\"\n end",
"def url()\n\t\t\turi = URI.parse(@service_end_point)\n\t\t\tsignature = Amazon::FPS::SignatureUtils.sign_parameters({parameters: @params, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taws_secret_key: @secret_key,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thost: uri.host,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tverb: @http_method,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turi: uri.path })\n\t\t\t@params[Amazon::FPS::SignatureUtils::SIGNATURE_KEYNAME] = signature\n\n\t\t\treturn get_url(@service_end_point, @params)\n\tend",
"def wp_get_upload_dir\n wp_upload_dir(nil, false)\n end",
"def aws_bucket_url\n UploadHelper.aws_bucket_url\n end",
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def url\n @parser.request_url\n end",
"def b2_get_upload_url()\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n bucket_id = ENV['bucket_id']\n\n uri = URI(\"#{api_url}/b2api/v1/b2_get_upload_url\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"bucketId\\\":\\\"#{bucket_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend",
"def url\n connection.build_url(url_chunk, params).to_s\n end",
"def file_url\n end",
"def upload(upload_to = nil)\n upload_task(upload_to).invoke\n end",
"def upload_full_path\n @upload_full_path ||= File.join(@upload_file_path, name)\n end",
"def target_url\n \"#{self.transfer.target_url}/people.xml\"\n end",
"def get_url\n @url\n end",
"def url()\n set_signature\n\n url = service_end_point + \"?\"\n\n param_string = @params.map do |key,value|\n [key,value].map { |string| Amazon::FPS::SignatureUtils.urlencode(string) }.join '='\n end.join '&'\n\n url + param_string\n end",
"def parse_upload\n expected_params[:upload] ||= ParameterDeclaration.new(:upload, :upload, {})\n params[:upload]\n end",
"def path\n \"/#{UPLOAD_DIR}/#{filename}\"\n end",
"def upload_get_upload_progress(upload_key)\n options = {:appToken => app_token, :upload_key => upload_key}\n response = get(\"/upload/getUploadProgress\", options)\n process_response(response, [])\n end",
"def server_image_url(filename)\n uri = \"#{@api_url}/#{@project_id}/images/get_upload_url?filename=#{filename}&access_token=#{@access_token}\"\n get uri\n end",
"def upload_params\n params[:upload]\n end",
"def upload_params\n params[:upload]\n end",
"def url\n URI.join(request.url, @picture.image.url)\n end",
"def bot_urlroot\n return '/user-upload/dll/'\n end",
"def target_url\n \"#{self.transfer.target_url}/kases.xml\"\n end",
"def upload\n do_upload(self.class.upload_class)\n end",
"def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end",
"def url\n @url.to_s\n end",
"def pickup_url\n @pickup_url\n end",
"def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end",
"def attachment_path\n return unless attachment.attached?\n\n attachment.service_url\n end",
"def aws_url_for(path, expires=nil)\n UploadHelper.aws_url_for(path, expires)\n end",
"def upload_paths\r\n %w[\r\n /server/php/index.php\r\n /server/php/upload.class.php\r\n /server/php/UploadHandler.php\r\n /example/upload.php\r\n /php/index.php\r\n ].map { |u| normalize_uri(target_uri.path, u) }\r\n end",
"def web_endpoint\n File.join(@web_endpoint, \"\")\n end",
"def web_endpoint\n File.join(@web_endpoint, \"\")\n end",
"def web_endpoint\n File.join(@web_endpoint, \"\")\n end",
"def upload(file)\n # Upload the given file\n AWS::S3::S3Object.store( file,\n open( file ),\n BUCKET,\n :access => :public_read )\n\n # display the URL of the file just uploaded\n puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]\nend",
"def upload_simple\r\n \r\n end",
"def upload_path picture\n entity = picture.class.name.sub('Picture','').upcase\n \"PICTURE_#{entity}_PATH\".constantize\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js\n end\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js\n end\n end",
"def photo_url\r\n infoxml = get_info\r\n return infoxml.at('photosurl').inner_text\r\n end",
"def download_uri\n return @download_uri\n end",
"def request_uri\n calculate_uri(@http_request.url)\n end",
"def url\n @client.get_download_link(@path)\n end",
"def url(options = {})\n file.path\n end",
"def upload_file\n #TODO\n end",
"def upload\n end",
"def upload\n end",
"def basename\n File.basename(self.upload.url).split(/\\?/)[0]\n end",
"def url\n @url || API_ENDPOINT\n end",
"def url\n @url\n end",
"def url\n @url\n end",
"def url\n response = ::RestClient.post(Pxpay::Base.pxpay_request_url, post )\n response_text = ::Nokogiri::XML(response)\n puts \"**PXPAY post**\"\n puts post.to_s\n puts \"**PXPAY response**\"\n puts response_text.to_s\n if response_text.at_css(\"Request\").attributes[\"valid\"].value == \"1\"\n url = response_text.at_css(\"URI\").inner_html\n else\n if Pxpay::Base.pxpay_user_id && Pxpay::Base.pxpay_key\n raise Pxpay::Error, response_text.at_css(\"Request\").inner_html\n else\n raise Pxpay::MissingKey, \"Your Pxpay config is not set up properly, run rails generate pxpay:install\"\n end\n end\n return URI::extract(url).first.gsub(\"&\", \"&\")\n end",
"def path\n file.url\n end",
"def path\n URI.parse(@url).path\n end",
"def file_name\n uploaded_file_file_name\n end",
"def url\n uri.to_s\n end",
"def url\n @url\n end",
"def to_s; @url; end",
"def target_url\n \"#{self.transfer.target_url}/companies.xml\"\n end",
"def url_content\n\t file.url\n\tend",
"def original_url\n url\n end",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def get_uploads_entry_url( subscription_url )\n upload_feed_urls = []\n\n # get xml of subscription channel\n xml = get_channnel_xml( subscription_url )\n channel_doc = REXML::Document.new( xml )\n upload_counts = channel_doc.elements[\"/feed/openSearch:totalResults\"].text\n upload_index = channel_doc.elements[\"/feed/openSearch:startIndex\"].text\n item_counts_per_page = channel_doc.elements[\"/feed/openSearch:itemsPerPage\"].text\n\n channel_doc.elements.each(\"/feed/entry/id\") do |upload_url_element|\n #raise upload_url_element.text\n # http://gdata.youtube.com/feeds/api/videos/fI3av1fRiYE\n upload_feed_urls << upload_url_element.text\n end\n\n return upload_counts.to_i,upload_index.to_i,item_counts_per_page.to_i,upload_feed_urls\n end",
"def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end",
"def get_url endpoint\n url = @url\n if !url.end_with? \"/\"\n url = \"#{url}/\"\n end\n\n \"#{url}wc-api/#{@version}/#{endpoint}\"\n end",
"def bucket_location\n self.remote_location.blank? ? self.upload_file_name : self.remote_location\n end",
"def url\n @url ||= s3_bucket.object(key_path).presigned_url(:get,\n expires_in: 7.days.to_i,\n response_content_disposition: ApplicationHelper.encoding_safe_content_disposition(\n ImageServiceHelper.download_name(@model.work_presenter, suffix: @suffix)\n )\n )\n end",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def url\n uri.to_s\n end",
"def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\n end",
"def response_uri(file)\n file.base_uri\n end",
"def external_download_url\n @file.external_bytestream_uri.to_s\n end",
"def path\n @uri.request_uri\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 to_s\n url\n end"
] |
[
"0.7910738",
"0.7738141",
"0.7604398",
"0.6668465",
"0.653069",
"0.63836884",
"0.6358183",
"0.6320675",
"0.6280919",
"0.6180335",
"0.615021",
"0.61252236",
"0.6000212",
"0.57817954",
"0.57817954",
"0.57817954",
"0.57817954",
"0.57817954",
"0.57347214",
"0.57201344",
"0.56949246",
"0.5692138",
"0.5618001",
"0.5592589",
"0.5584851",
"0.5575226",
"0.5559175",
"0.55239207",
"0.55044585",
"0.5482338",
"0.54036844",
"0.53773856",
"0.53715134",
"0.53375834",
"0.53232324",
"0.5322257",
"0.5321038",
"0.5319436",
"0.5306932",
"0.53069115",
"0.5306551",
"0.5304115",
"0.5286414",
"0.5286414",
"0.5243198",
"0.5235498",
"0.520681",
"0.5205367",
"0.520485",
"0.5193045",
"0.51897997",
"0.51745415",
"0.51606125",
"0.5159196",
"0.5138878",
"0.513649",
"0.513649",
"0.513649",
"0.51334244",
"0.5130667",
"0.51289535",
"0.5123399",
"0.5123399",
"0.511676",
"0.51071894",
"0.51019895",
"0.50991875",
"0.50766724",
"0.50699246",
"0.5069728",
"0.5069728",
"0.5066732",
"0.5057995",
"0.5057302",
"0.5057302",
"0.50549793",
"0.5051843",
"0.50518245",
"0.50439364",
"0.5043693",
"0.5037413",
"0.5036728",
"0.5028499",
"0.5026093",
"0.50095624",
"0.5003972",
"0.50033313",
"0.4994684",
"0.498877",
"0.49882227",
"0.4986839",
"0.49846742",
"0.49823028",
"0.49792182",
"0.4977938",
"0.496957",
"0.49596643",
"0.49578458",
"0.49556574",
"0.4945475"
] |
0.8321389
|
0
|
Public: Calls the 'TranscribeRecording' SOAP Action recording_id a String in GUID format Returns the SOAP response Hash
|
def transcribe_recording(recording_id)
# initialize_session unless @session.try :valid?
response = @soap_client.call :transcribe_recording,
message: { 'wsdl:sessionID' => @session_id,
'wsdl:recordingId' => recording_id }
response.body[:transcribe_recording_response][:transcribe_recording_result]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transcribe_recording(recording_id)\n # initialize_session unless @session.try :valid?\n\n response = @savon.call :transcribe_recording, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id }\n\n response.body[:transcribe_recording_response][:transcribe_recording_result]\n end",
"def get_recording_transcription(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: TranscriptionResponse.from_hash(decoded)\r\n )\r\n end",
"def create_transcribe_recording(account_id,\r\n call_id,\r\n recording_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 410\r\n raise ApiErrorResponseException.new(\r\n 'The media for this recording has been deleted, so we can\\'t' \\\r\n ' transcribe it',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def transcribe_recording_using_promocode(recording_id, promocode)\n # initialize_session unless @session.try :valid?\n \n response = @soap_client.call :transcribe_recording_using_promocode, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id,\n 'wsdl:promoCode' => promocode }\n\n response.body[:transcribe_recording_using_promocode_response][:transcribe_recording_using_promocode_result]\n end",
"def delete_recording_transcription(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def get_recording_info(recording_id)\n @soap_client.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n end",
"def transcribe\n @call = Call.find(params[:id])\n @call.update_attribute :transcription_text, params[:TranscriptionText] || @call.transcription_text\n @call.update_attribute :transcription_status, params[:TranscriptionStatus] || @call.transcription_status\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end",
"def transcribe_recording_using_promocode(recording_id, promocode)\n # initialize_session unless @session.try :valid?\n \n response = @savon.call :transcribe_using_promo_code, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id,\n 'wsdl:promoCode' => promocode }\n\n response.body[:transcribe_using_promo_code_response][:transcribe_using_promo_code_result]\n end",
"def create_transcriptions_recordingtranscription(recording_sid)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/transcriptions/recordingtranscription.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'recordingSid' => recording_sid\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def delete_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def get_metadata_for_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: RecordingMetadataResponse.from_hash(decoded)\r\n )\r\n end",
"def get_metadata_for_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(_response,\r\n data: RecordingMetadataResponse.from_hash(decoded))\r\n end",
"def delete_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def transcribe(id, optional_params = {})\n response = Network.post(['Recordings', id, 'Transcriptions'], optional_params)\n Transcription.new(response)\n end",
"def get_transcription(recording_id, format = :text)\n format_type = case format\n when :text\n \"Text\"\n else\n format.to_s.upcase\n end\n\n response = @savon.call :get_transcription, message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recId' => recording_id, \n 'wsdl:formattingType' => format_type }\n\n error_message = response.body[:get_transcription_response][:error_message]\n raise error_message if error_message\n\n transcription = response.body[:get_transcription_response][:get_transcription_result]\n\n raise \"Transcription unable to be downloaded\" if transcription.nil?\n\n Base64.decode64(transcription)\n end",
"def recording\n @call = Call.find(params[:id])\n @call.update_attribute :recording_url, params[:RecordingUrl] || @call.recording_url\n @call.update_attribute :recording_duration, params[:RecordingDuration] || @call.recording_duration\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end",
"def get_recording_info(recording_id)\n response = @savon.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n response.body[:get_recording_info_response][:get_recording_info_result]\n end",
"def re_record_prompt\n active_recording = active_call.recordings.create!(duration: params['RecordingDuration'], recording_url: params['RecordingUrl'])\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Thank you.'\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n r.Gather(\n action: ivr_recordings_new_recording_url,\n method: 'get',\n 'numDigits' => 1,\n 'finishOnKey' => ''\n ) do |gather|\n r.Play(active_recording.recording_url)\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n end\n play_audio(r, 'goodbye')\n r.Hangup\n end\n\n render_twiml response\n end",
"def create_recording_viewrecording(recordingsid)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/recording/viewrecording.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'recordingsid' => recordingsid\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def callback\n twilio_id = params[:CallSid]\n call = Call.where('twilio_id = ?', twilio_id).first\n call.get_recording_info(twilio_id, params[:CallDuration], params[:AnsweredBy])\n render :json => 'callback success'\n end",
"def new_recording\n response = Twilio::TwiML::Response.new do |r|\n play_audio(r, 'recording_begin_at_beep')\n r.Record(action: ivr_recordings_re_record_prompt_url, method: 'post', 'finishOnKey' => '7')\n end\n\n render_twiml response\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('recording', 'get', 'KalturaRecording', 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 to_recording(session_id)\n { recording: {\n session_id: session_id,\n duration: '',\n start_time: @rf['recording']['start_time'],\n end_time: @rf['recording']['end_time'],\n basename: base_filename,\n location: destination_path,\n location_key: ''\n } }\n end",
"def get_conversation_recording_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recording ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recording\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recording\" if recording_id.nil?\n \n \n \n \n \n \n \n \n if opts[:'format_id'] && !['WAV', 'WEBM', 'WAV_ULAW', 'OGG_VORBIS', 'OGG_OPUS', 'MP3', 'NONE'].include?(opts[:'format_id'])\n fail ArgumentError, 'invalid value for \"format_id\", must be one of WAV, WEBM, WAV_ULAW, OGG_VORBIS, OGG_OPUS, MP3, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'email_format_id'] && !['EML', 'NONE'].include?(opts[:'email_format_id'])\n fail ArgumentError, 'invalid value for \"email_format_id\", must be one of EML, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'chat_format_id'] && !['ZIP', 'NONE'].include?(opts[:'chat_format_id'])\n fail ArgumentError, 'invalid value for \"chat_format_id\", must be one of ZIP, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'message_format_id'] && !['ZIP', 'NONE'].include?(opts[:'message_format_id'])\n fail ArgumentError, 'invalid value for \"message_format_id\", must be one of ZIP, NONE'\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id']\n query_params[:'emailFormatId'] = opts[:'email_format_id'] if opts[:'email_format_id']\n query_params[:'chatFormatId'] = opts[:'chat_format_id'] if opts[:'chat_format_id']\n query_params[:'messageFormatId'] = opts[:'message_format_id'] if opts[:'message_format_id']\n query_params[:'download'] = opts[:'download'] if opts[:'download']\n query_params[:'fileName'] = opts[:'file_name'] if opts[:'file_name']\n query_params[:'locale'] = opts[:'locale'] if opts[:'locale']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Recording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def modify_call_recording_state(account_id,\r\n call_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def capture(account, merchant, transaction_id)\n url = \"/#{CGI::escape(account)}/transactions/#{transaction_id}/capture\"\n post_json url, {capture_request: {merchant: merchant}}\n expect_status! 'CAPTURED'\n # puts @response.inspect\n end",
"def get_stream_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request, binary: true)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response, data: _response.raw_body)\r\n end",
"def get_stream_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request, binary: true)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(\r\n _response, data: _response.raw_body\r\n )\r\n end",
"def delete_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def record_response(response)\n response[2] = create_recording_response(response[2])\n response\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Trunking.V1.RecordingInstance #{values}>\"\n end",
"def get_conversation_recordingmetadata_recording_id_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordingmetadata_recording_id ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordingmetadata_recording_id\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recordingmetadata_recording_id\" if recording_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordingmetadata/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingMetadata')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordingmetadata_recording_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def capture_request(tid, total = nil)\n capture_request = Cielo::CaptureRequest.new\n response = send_request(capture_request.serialize(tid, total = nil, @affiliation, @affiliation_key))\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('recording', 'delete', 'KalturaRecording', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get(id)\n response = Network.get(['Recordings', id])\n Recording.new(response)\n end",
"def get_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConferencesApi.get_conference_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ConferencesApi.get_conference_recording\"\n end\n # verify the required parameter 'conference_id' is set\n if @api_client.config.client_side_validation && conference_id.nil?\n fail ArgumentError, \"Missing the required parameter 'conference_id' when calling ConferencesApi.get_conference_recording\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling ConferencesApi.get_conference_recording\"\n end\n # resource path\n local_var_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CallRecordingMetadata'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"ConferencesApi.get_conference_recording\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConferencesApi#get_conference_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def capture(unique_id)\n request('payment/capture', :capture => {:unique_id => unique_id} )\n end",
"def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Trunking.V1.RecordingContext #{context}>\"\n end",
"def modify_call_recording_state(account_id,\r\n call_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise APIException.new(\r\n 'The call can\\'t be modified in its current state',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The call never existed, no longer exists, or is inaccessible to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def add(recording)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'recording', recording)\n\t\t\tclient.queue_service_action_call('recording', 'add', 'KalturaRecording', 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 set_recording\n @recording = Recording.find(params[:id])\n end",
"def put_conversation_recording_with_http_info(conversation_id, recording_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.put_conversation_recording ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.put_conversation_recording\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.put_conversation_recording\" if recording_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.put_conversation_recording\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Recording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#put_conversation_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_transcription()\n headers = @client.make_request(:post, @client.concat_user_path(\"#{RECORDING_PATH}/#{id}/transcriptions\"), {})[1]\n id = Client.get_id_from_location_header(headers[:location])\n get_transcription(id)\n end",
"def get_conversation_recordingmetadata_with_http_info(conversation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordingmetadata ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordingmetadata\" if conversation_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordingmetadata\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<RecordingMetadata>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordingmetadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConferencesApi.download_conference_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ConferencesApi.download_conference_recording\"\n end\n # verify the required parameter 'conference_id' is set\n if @api_client.config.client_side_validation && conference_id.nil?\n fail ArgumentError, \"Missing the required parameter 'conference_id' when calling ConferencesApi.download_conference_recording\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling ConferencesApi.download_conference_recording\"\n end\n # resource path\n local_var_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/vnd.wave', 'audio/mpeg', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"ConferencesApi.download_conference_recording\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConferencesApi#download_conference_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def to_s\n '<Twilio.Trunking.V1.RecordingPage>'\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('seriesrecording', 'delete', 'KalturaSeriesRecording', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get_conversation_recordings_with_http_info(conversation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordings ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordings\" if conversation_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'format_id'] && !['WAV', 'WEBM', 'WAV_ULAW', 'OGG_VORBIS', 'OGG_OPUS', 'MP3', 'NONE'].include?(opts[:'format_id'])\n fail ArgumentError, 'invalid value for \"format_id\", must be one of WAV, WEBM, WAV_ULAW, OGG_VORBIS, OGG_OPUS, MP3, NONE'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'maxWaitMs'] = opts[:'max_wait_ms'] if opts[:'max_wait_ms']\n query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Recording>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transcription(transcription_id)\n @client.make_request(:get, @client.concat_user_path(\"#{RECORDING_PATH}/#{id}/transcriptions/#{transcription_id}\"))[0]\n end",
"def get_query_metadata_for_account(account_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/recordings'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: decoded.map { |element| RecordingMetadataResponse.from_hash(element) }\r\n )\r\n end",
"def create\n @recording = Recording.new(params[:recording])\n\n respond_to do |format|\n if @recording.save\n flash[:notice] = 'Recording was successfully created.'\n format.html { redirect_to(@recording) }\n format.xml { render :xml => @recording, :status => :created, :location => @recording }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recording.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_recording_info(twilio_id, call_duration, answered_by)\n self.duration = call_duration\n client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN\n recordings_info = client.account.calls.get(twilio_id).recordings\n self.recording_url = recordings_info.list.first.mp3\n self.recording = recordings_info.list.first.sid\n self.answered_by = answered_by\n self.save\n end",
"def create_recording_listrecording(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/recording/listrecording.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'Datecreated' => options['datecreated'],\r\n 'callsid' => options['callsid']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def transcribe_speech(wavfile)\n\tapiurl = \"https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=#{GOOGLEKEY}\"\n\tcommand = \"curl -X POST --data-binary @'#{wavfile}' --header 'Content-Type: audio/l16; rate=8000;' '#{apiurl}'\"\n\tresponse = `#{command}`\n\tif response \n\t\ttranscript = parse_google_speech(response)\n\t\tif transcript \n\t\t\treturn transcript\n\t\tend\n\tend\n\treturn false\nend",
"def voicemail\n @call.update! voicemail: params[:RecordFile],\n duration: params[:RecordingDuration]\n render nothing: true\n end",
"def add(recording)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'recording', recording)\n\t\t\tclient.queue_service_action_call('seriesrecording', 'add', 'KalturaSeriesRecording', 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 recording_delete_one_with_http_info(meeting_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_delete_one ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_delete_one\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling CloudRecordingApi.recording_delete_one\"\n end\n if @api_client.config.client_side_validation && opts[:'action'] && !['trash', 'delete'].include?(opts[:'action'])\n fail ArgumentError, 'invalid value for \"action\", must be one of trash, delete'\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings/{recordingId}'.sub('{' + 'meetingId' + '}', meeting_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_delete_one\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download_a_recording_file(recording_id, opts = {})\n data, _status_code, _headers = download_a_recording_file_with_http_info(recording_id, opts)\n data\n end",
"def create\n @recording = Recording.new(recording_params)\n respond_to do |format|\n if @recording.save\n format.html { redirect_to @recording, notice: 'Recording was successfully created.' }\n format.json { render :show, status: :created, location: @recording }\n else\n format.html { render :new }\n format.json { render json: @recording.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stream_a_recording_file_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stream_a_recording_file ...'\n end\n\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling DefaultApi.stream_a_recording_file\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Recordings/{recordingId}/Stream'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/x-wav'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.stream_a_recording_file\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stream_a_recording_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_recording(record_id)\n bbb_server.delete_recordings(record_id)\n end",
"def auth_capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_CAPTURE\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def cancel(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('recording', 'cancel', 'KalturaRecording', 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 transcriptions(id, optional_params = {})\n response = Network.get(['Recordings', id, 'Transcriptions'], optional_params)\n ResourceCollection.new(response, 'transcriptions', Transcription)\n end",
"def set_audio_recording\n @audio_recording = AudioRecording.find(params[:id])\n end",
"def update_recording(record_id, meta)\n meta[:recordID] = record_id\n bbb_server.send_api_request(\"updateRecordings\", meta)\n end",
"def capture(_, transaction_id, __)\n Response.parse self, api.payment.capture(transaction_id)\n end",
"def retrieve_webhook_subscription(subscription_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/webhooks/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def stream_a_recording_file(recording_id, opts = {})\n data, _status_code, _headers = stream_a_recording_file_with_http_info(recording_id, opts)\n data\n end",
"def to_s\n '#<Twilio.Trunking.V1.RecordingList>'\n end",
"def recording_get(meeting_id, opts = {})\n data, _status_code, _headers = recording_get_with_http_info(meeting_id, opts)\n data\n end",
"def get_userrecording_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserRecordingsApi.get_userrecording ...\"\n end\n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling UserRecordingsApi.get_userrecording\" if recording_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/userrecordings/{recordingId}\".sub('{format}','json').sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UserRecording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserRecordingsApi#get_userrecording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_account_cloud_recording_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.get_account_cloud_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling CloudRecordingApi.get_account_cloud_recording\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling CloudRecordingApi.get_account_cloud_recording, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/accounts/{accountId}/recordings'.sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20073')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#get_account_cloud_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Trunking.V1.RecordingContext #{context}>\"\n end",
"def recording_delete_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_delete ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_delete\"\n end\n if @api_client.config.client_side_validation && opts[:'action'] && !['trash', 'delete'].include?(opts[:'action'])\n fail ArgumentError, 'invalid value for \"action\", must be one of trash, delete'\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @recording = Recording.new(recording_params)\n @recording.update_attribute(:is_recorded, false)\n\n respond_to do |format|\n if @recording.save\n format.html { redirect_to @recording, notice: 'Recording was successfully created.' }\n format.json { render :show, status: :created, location: @recording }\n job_id = RecordingWorker.perform_at(@recording.start_datetime, @recording.id)\n @recording.update_attribute(:job_id, job_id)\n else\n format.html { render :new }\n format.json { render json: @recording.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cancel(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('seriesrecording', 'cancel', 'KalturaSeriesRecording', 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 recording_get_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_get ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_get\"\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @audio_recording = AudioRecording.new(audio_recording_params)\n\n respond_to do |format|\n if @audio_recording.save\n format.html { redirect_to @audio_recording, notice: 'Audio recording was successfully created.' }\n format.json { render :show, status: :created, location: @audio_recording }\n else\n format.html { render :new }\n format.json { render json: @audio_recording.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_recording\n @recording = Recording.includes(recording_contributor_people: [:person]).find(params[:id])\n end",
"def query_recorder(recorder_id, sub_command, options = [])\n # place the recorder_id and sub_command strings on the front of options\n # and join with the FIELD_SEPARATOR. This forms the QUERY_RECORDER command\n cmd_string = options.unshift(recorder_id, sub_command)\n send(\"QUERY_RECORDER #{options.join(FIELD_SEPARATOR)}\")\n end",
"def analyze\n logger.info \"sending recording to worker\"\n RecordingWorker.async_analyze(:id => self.id)\n end",
"def capture(id, capture_request, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: CapturesApi#capture ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling capture\" if id.nil?\n \n # verify the required parameter 'capture_request' is set\n fail \"Missing the required parameter 'capture_request' when calling capture\" if capture_request.nil?\n \n # resource path\n path = \"/payments/v1/authorizations/{id}/captures\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(capture_request)\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 => 'CapturePostResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: CapturesApi#capture. Result: #{result.inspect}\"\n end\n return result\n end",
"def play_recording\n @page_title = \"\"\n @rec = Recording.where(:id => params[:id]).first\n unless @rec\n flash[:notice] = _('Recording_was_not_found')\n redirect_to :controller => \"callc\", :action => 'main' and return false\n end\n @recording = \"\"\n if @rec\n server_path = get_server_path(@rec.local)\n a=check_user_for_recording(@rec)\n return false if !a\n\n @title = Confline.get_value(\"Admin_Browser_Title\")\n @call = @rec.call\n\n @recording = server_path.to_s + @rec.mp3\n end\n render(:layout => \"play_rec\")\n end",
"def capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_auth_code' => approval_code,\n 'x_type' => \"CAPTURE_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def get_recording_job_with_http_info(job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_job ...\"\n end\n \n \n # verify the required parameter 'job_id' is set\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling RecordingApi.get_recording_job\" if job_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/jobs/{jobId}\".sub('{format}','json').sub('{' + 'jobId' + '}', job_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingJob')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_job\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_transcriptions_audiourltranscription(audiourl)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/transcriptions/audiourltranscription.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'audiourl' => audiourl\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def order_transcript(api_key, job_id, turnaround_level_id, order_transcript_file)\n order_transcript_commad = \"curl -X POST \\\"https://api.3playmedia.com/v3/transcripts/order/transcription?api_key=#{api_key}&media_file_id=#{job_id}&turnaround_level_id=#{turnaround_level_id}\\\" >#{order_transcript_file}\"\n system(order_transcript_commad)\n file = File.open(order_transcript_file, 'r')\n response = JSON.load file\n transcript_id = response['data']['id']\n transcript_id\nend",
"def capture_transaction(location_id:,\n transaction_id:)\n warn 'Endpoint capture_transaction in TransactionsApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/locations/{location_id}/transactions/{transaction_id}/capture',\n 'default')\n .template_param(new_parameter(location_id, key: 'location_id')\n .should_encode(true))\n .template_param(new_parameter(transaction_id, key: 'transaction_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def conference_record_start(params)\n path = @version + '/Conference/Record/Start/'\n method = 'POST'\n return request(path, method, params)\n end",
"def capture(transaction_id)\n post_data acquirer_url(:status), build_status_request_body(:transaction_id => transaction_id), IdealStatusResponse\n end",
"def record(\n action: nil,\n method: nil,\n timeout: nil,\n finish_on_key: nil,\n max_length: nil,\n play_beep: nil,\n trim: nil,\n recording_status_callback: nil,\n recording_status_callback_method: nil,\n transcribe: nil,\n transcribe_callback: nil,\n **keyword_args\n )\n append(Record.new(\n action: action,\n method: method,\n timeout: timeout,\n finish_on_key: finish_on_key,\n max_length: max_length,\n play_beep: play_beep,\n trim: trim,\n recording_status_callback: recording_status_callback,\n recording_status_callback_method: recording_status_callback_method,\n transcribe: transcribe,\n transcribe_callback: transcribe_callback,\n **keyword_args\n ))\n end",
"def transcribe_response=(http_response)\n # Example response: #<HTTParty::Response:0x7fc75526f240 @parsed_response={\"credits_used\"=>2, \"transcript_ids\"=>[\"TnXuza158n\"], \"status_code\"=>201, \"message\"=>\"Transcription jobs created.\", \"balance\"=>2}, @response=#<Net::HTTPCreated 201 Created readbody=true>, @headers={\"cache-control\"=>[\"no-cache\"], \"content-type\"=>[\"application/json; charset=utf-8\"], \"date\"=>[\"Thu, 20 Sep 2012 06:49:31 GMT\"], \"server\"=>[\"nginx/0.7.67\"], \"status\"=>[\"201 Created\"], \"x-runtime\"=>[\"1.150827\"], \"x-ua-compatible\"=>[\"IE=Edge,chrome=1\"], \"content-length\"=>[\"120\"], \"connection\"=>[\"Close\"]}> \n @transcribe_response = http_response\n case http_response.code\n when 201 # Created\n raise 'No transcipt ids were returned' unless http_response.parsed_response[\"transcript_ids\"]\n self.transcript_id = http_response.parsed_response[\"transcript_ids\"].first\n when 400 # Bad Request\n raise 'HTTP 400: Bad Request'\n when 401 # Unauthorized\n raise 'HTTP 401: Unauthorized'\n when 402 # Payment Required\n raise 'HTTP 402: Payment Required'\n when 500 # Internal Server Error\n raise 'HTTP 500: An unknown server error occurred'\n else\n raise 'Unrecognized response: ' + http_response.inspect\n end\n end",
"def create_transcribe_job\n\t\tresp = client.start_transcription_job({\n\t\t transcription_job_name: transcription_job_name,\n\t\t language_code: \"en-US\", # required, accepts en-US, es-US, en-AU, fr-CA, en-GB, de-DE, pt-BR, fr-FR, it-IT, ko-KR, es-ES, en-IN, hi-IN, ar-SA\n\t\t # media_sample_rate_hertz: 1,\n\t\t media_format: file_type, # required, accepts mp3, mp4, wav, flac\n\t\t media: { # required\n\t\t media_file_uri: public_url,\n\t\t },\n\t\t # output_bucket_name: \"OutputBucketName\",\n\t\t # settings: {\n\t\t # vocabulary_name: \"VocabularyName\",\n\t\t # show_speaker_labels: false,\n\t\t # max_speaker_labels: 1,\n\t\t # channel_identification: false,\n\t\t # },\n\t\t})\n\n\t\tresp\n\tend",
"def download_a_recording_file_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.download_a_recording_file ...'\n end\n\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling DefaultApi.download_a_recording_file\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Recordings/{recordingId}/Download'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/x-wav'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.download_a_recording_file\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#download_a_recording_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def build_recording(session_key)\n # Destroy last recording & associated content object if redoing\n if params[:redo]\n Recording.destroy(session[session_key]) rescue nil\n session[session_key] = nil\n end\n\n @recording = if session[session_key]\n begin \n Recording.find(session[session_key])\n rescue\n session[session_key] = nil\n end\n end\n @recording ||= Recording.new\n end",
"def get_conversation_recording_annotations_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recording_annotations ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recording_annotations\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recording_annotations\" if recording_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}/annotations\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Annotation>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recording_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_conversation_recording(conversation_id, recording_id, opts = {})\n data, _status_code, _headers = get_conversation_recording_with_http_info(conversation_id, recording_id, opts)\n return data\n end",
"def capture(transaction_id, amount)\n params = {\n :query => {\n :amount => amount,\n :transactionId => transaction_id,\n :operation => \"CAPTURE\",\n }\n }\n \n Responses::CaptureResponse.new(self.class.get(\"/Netaxept/Process.aspx\", params).parsed_response)\n end",
"def capture(transaction_id, amount)\n params = {\n :transaction_amount => amount,\n :transaction_id => transaction_id,\n :operation => 'CAPTURE',\n }\n\n process_response params\n end"
] |
[
"0.785164",
"0.7162867",
"0.70631206",
"0.6783896",
"0.6631659",
"0.65345085",
"0.6409304",
"0.63984877",
"0.6378945",
"0.6236247",
"0.6235441",
"0.61924756",
"0.61735684",
"0.6157637",
"0.61524",
"0.61193633",
"0.6020989",
"0.5894645",
"0.58299625",
"0.57763284",
"0.57245725",
"0.5645297",
"0.55447876",
"0.5533089",
"0.5492416",
"0.5395729",
"0.5394743",
"0.53526795",
"0.5320429",
"0.5302212",
"0.53017336",
"0.52810043",
"0.5270219",
"0.5240692",
"0.5216495",
"0.52146715",
"0.5193194",
"0.51927644",
"0.5186339",
"0.51531035",
"0.5116707",
"0.51113343",
"0.50993025",
"0.50713587",
"0.5066999",
"0.50436246",
"0.5025132",
"0.49787384",
"0.49772787",
"0.49763775",
"0.49757218",
"0.49728575",
"0.4960867",
"0.49566856",
"0.4953535",
"0.49111727",
"0.49094185",
"0.4907174",
"0.48946536",
"0.48807514",
"0.48770404",
"0.48716986",
"0.48637772",
"0.48497677",
"0.48467565",
"0.48458156",
"0.4840148",
"0.48367956",
"0.4819892",
"0.4811927",
"0.47965184",
"0.47862732",
"0.47632912",
"0.47418875",
"0.47294673",
"0.47261307",
"0.47143924",
"0.47125575",
"0.46970353",
"0.46788812",
"0.46711332",
"0.46591994",
"0.4646294",
"0.46378356",
"0.46349588",
"0.46302623",
"0.46229976",
"0.46162754",
"0.46149638",
"0.46143487",
"0.46116692",
"0.46012825",
"0.45992827",
"0.4597815",
"0.45768997",
"0.45698962",
"0.4562505",
"0.45623744",
"0.45614085",
"0.45600975"
] |
0.81536764
|
0
|
Public: Calls the 'TranscribeRecordingWithPromoCode' SOAP Action recording_id a String in GUID format promocode a String Returns the SOAP response Hash
|
def transcribe_recording_using_promocode(recording_id, promocode)
# initialize_session unless @session.try :valid?
response = @soap_client.call :transcribe_recording_using_promocode,
message: { 'wsdl:sessionID' => @session_id,
'wsdl:recordingId' => recording_id,
'wsdl:promoCode' => promocode }
response.body[:transcribe_recording_using_promocode_response][:transcribe_recording_using_promocode_result]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transcribe_recording_using_promocode(recording_id, promocode)\n # initialize_session unless @session.try :valid?\n \n response = @savon.call :transcribe_using_promo_code, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id,\n 'wsdl:promoCode' => promocode }\n\n response.body[:transcribe_using_promo_code_response][:transcribe_using_promo_code_result]\n end",
"def transcribe_recording(recording_id)\n # initialize_session unless @session.try :valid?\n\n response = @soap_client.call :transcribe_recording, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id }\n\n response.body[:transcribe_recording_response][:transcribe_recording_result]\n end",
"def transcribe_recording(recording_id)\n # initialize_session unless @session.try :valid?\n\n response = @savon.call :transcribe_recording, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id }\n\n response.body[:transcribe_recording_response][:transcribe_recording_result]\n end",
"def create_transcribe_recording(account_id,\r\n call_id,\r\n recording_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 410\r\n raise ApiErrorResponseException.new(\r\n 'The media for this recording has been deleted, so we can\\'t' \\\r\n ' transcribe it',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def get_recording_transcription(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: TranscriptionResponse.from_hash(decoded)\r\n )\r\n end",
"def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end",
"def successful_purchase_response\n 'response=1&responsetext=SUCCESS&authcode=123456&transactionid=1869031575&avsresponse=N&cvvresponse=N&orderid=1&type=auth&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end",
"def get_recording_info(recording_id)\n @soap_client.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n end",
"def receipt\n @auth_code = params[:x_auth_code]\n end",
"def receipt\n @auth_code = params[:x_auth_code]\n end",
"def delete_recording_transcription(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def sms_send_code\n # <?xml version=\"1.0\" encoding=\"utf-8\"?>\n # <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n # <soap:Header>\n # <Header xmlns=\"http://www.twinfield.com/\">\n # <SessionID>string</SessionID>\n # </Header>\n # </soap:Header>\n # <soap:Body>\n # <SmsSendCode xmlns=\"http://www.twinfield.com/\" />\n # </soap:Body>\n # </soap:Envelope>\n raise NotImplementedError\n end",
"def re_record_prompt\n active_recording = active_call.recordings.create!(duration: params['RecordingDuration'], recording_url: params['RecordingUrl'])\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Thank you.'\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n r.Gather(\n action: ivr_recordings_new_recording_url,\n method: 'get',\n 'numDigits' => 1,\n 'finishOnKey' => ''\n ) do |gather|\n r.Play(active_recording.recording_url)\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n end\n play_audio(r, 'goodbye')\n r.Hangup\n end\n\n render_twiml response\n end",
"def get_metadata_for_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: RecordingMetadataResponse.from_hash(decoded)\r\n )\r\n end",
"def get_metadata_for_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(_response,\r\n data: RecordingMetadataResponse.from_hash(decoded))\r\n end",
"def capture(account, merchant, transaction_id)\n url = \"/#{CGI::escape(account)}/transactions/#{transaction_id}/capture\"\n post_json url, {capture_request: {merchant: merchant}}\n expect_status! 'CAPTURED'\n # puts @response.inspect\n end",
"def to_s\n '<Twilio.Trunking.V1.RecordingPage>'\n end",
"def get_recording_info(recording_id)\n response = @savon.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n response.body[:get_recording_info_response][:get_recording_info_result]\n end",
"def transcribe\n @call = Call.find(params[:id])\n @call.update_attribute :transcription_text, params[:TranscriptionText] || @call.transcription_text\n @call.update_attribute :transcription_status, params[:TranscriptionStatus] || @call.transcription_status\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end",
"def capture(unique_id)\n request('payment/capture', :capture => {:unique_id => unique_id} )\n end",
"def successful_preapproval_details_response_json\n <<-RESPONSE\n {\"responseEnvelope\":{\"timestamp\":\"2009-08-19T20:06:37.422-07:00\",\"ack\":\"Success\",\"correlationId\":\"4831666d56952\",\"build\":\"1011828\"},\"preapprovalKey\":\"PA-13R096665X681474E\", \"status\":\"ACTIVE\"}\n RESPONSE\n end",
"def callback\n twilio_id = params[:CallSid]\n call = Call.where('twilio_id = ?', twilio_id).first\n call.get_recording_info(twilio_id, params[:CallDuration], params[:AnsweredBy])\n render :json => 'callback success'\n end",
"def get_transcription(recording_id, format = :text)\n format_type = case format\n when :text\n \"Text\"\n else\n format.to_s.upcase\n end\n\n response = @savon.call :get_transcription, message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recId' => recording_id, \n 'wsdl:formattingType' => format_type }\n\n error_message = response.body[:get_transcription_response][:error_message]\n raise error_message if error_message\n\n transcription = response.body[:get_transcription_response][:get_transcription_result]\n\n raise \"Transcription unable to be downloaded\" if transcription.nil?\n\n Base64.decode64(transcription)\n end",
"def new_recording\n response = Twilio::TwiML::Response.new do |r|\n play_audio(r, 'recording_begin_at_beep')\n r.Record(action: ivr_recordings_re_record_prompt_url, method: 'post', 'finishOnKey' => '7')\n end\n\n render_twiml response\n end",
"def capture(money, response_code, payment_method_options = {})\n Spree::PAYONE::Logger.info \"Capture process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.capture_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, payment_method_options)\n set_amount_request_parameters(request, money, payment_method_options)\n set_payment_process_parameters(request, response_code)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end",
"def capture(_amount, response_code, _gateway_options)\n transaction = Cielo::Transaction.new\n ret = transaction.catch!(response_code)\n\n ActiveMerchant::Billing::Response.new(true, Spree.t('cielo.messages.capture_success'), {}, authorization: ret[:transacao][:tid])\n rescue\n verify_error 'capture', ret\n end",
"def parse(action, data)\n h = recursively_symbolize_keys(Hash.from_xml(data))\n results = {}\n\n case action\n when 'session_ticket'\n if results[:raw] = h[:QBMSXML][:SignonMsgsRs][:SignonAppCertRs]\n results[:session_ticket] = results[:raw][:SessionTicket]\n end\n \n when 'authonly'\n if results[:raw] = h[:CustomerCreditCardAuthRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:authorization_code] = results[:raw][:AuthorizationCode]\n results[:card_code] = results[:raw][:CardSecurityCodeMatch]\n end\n \n when 'capture'\n if results[:raw] = h[:CustomerCreditCardCaptureRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:authorization_code] = results[:raw][:AuthorizationCode]\n end\n\n when 'purchase'\n if results[:raw] = h[:QBMSXML][:QBMSXMLMsgsRs][:CustomerCreditCardChargeRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:authorization_code] = results[:raw][:AuthorizationCode]\n end\n\n when 'void'\n if results[:raw] = h[:QBMSXML][:QBMSXMLMsgsRs][:CustomerCreditCardTxnVoidOrRefundRs]\n results[:transaction_id] = results[:raw][:CreditCardTransID]\n results[:void_type] = results[:raw][:VoidOrRefundTxnType]\n end\n end\n\n results[:response_code] = results[:raw][:statusCode].to_i\n results[:response_reason_code] = results[:raw][:statusSeverity]\n results[:response_reason_text] = results[:raw][:statusMessage]\n \n results\n end",
"def successful_capture_response\n '?({\"Status\":\"EmAnalise\",\"Codigo\":0,\"CodigoRetorno\":\"\",\"TaxaMoIP\":\"0.46\",\"StatusPagamento\":\"Sucesso\",\"Classificacao\":{\"Codigo\":999,\"Descricao\":\"Nao suportado no ambiente Sandbox\"},\"CodigoMoIP\":207695,\"Mensagem\":\"Requisicao processada com sucesso\",\"TotalPago\":\"1.00\"})'\n end",
"def delete_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def response_subcode\n params['x_response_subcode']\n end",
"def qsi_response\r\n code = digital_reciept_info('DigitalReceipt.QSIResponseCode')\r\n return @no_error ? QSI_RESPONSE_CODE_MESSAGES[code.chomp!] : code\r\n end",
"def response_subcode\n params['x_response_subcode']\n end",
"def delete_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def create_transcriptions_recordingtranscription(recording_sid)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/transcriptions/recordingtranscription.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'recordingSid' => recording_sid\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_auth_code' => approval_code,\n 'x_type' => \"CAPTURE_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def transcribe_speech(wavfile)\n\tapiurl = \"https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=#{GOOGLEKEY}\"\n\tcommand = \"curl -X POST --data-binary @'#{wavfile}' --header 'Content-Type: audio/l16; rate=8000;' '#{apiurl}'\"\n\tresponse = `#{command}`\n\tif response \n\t\ttranscript = parse_google_speech(response)\n\t\tif transcript \n\t\t\treturn transcript\n\t\tend\n\tend\n\treturn false\nend",
"def voice(phone_number, **params)\n\n self.post(VERIFY_VOICE_RESOURCE,\n phone_number: phone_number,\n **params)\n end",
"def auth_capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_CAPTURE\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def successful_purchase_response\n \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\r\\n<string xmlns=\\\"https://ws101.pelecard.biz/\\\">0000000532610035128471011000409153300000100 000000001011 150 0000000000000000000000000073001062 \\xC6\\x92\\xCB\\x9C\\xE2\\x80\\x94\\xCB\\x9C\\xCB\\x86\\xE2\\x80\\x98\\xC2\\x8E/\\xE2\\x80\\x9E\\xC2\\x90\\xE2\\x80\\xB0\\xCB\\x86\\xC2\\x8C\\xE2\\x80\\x9D0 \\r\\n</string>\"\n end",
"def get_conversation_recordingmetadata_recording_id_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordingmetadata_recording_id ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordingmetadata_recording_id\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recordingmetadata_recording_id\" if recording_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordingmetadata/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingMetadata')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordingmetadata_recording_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_stream_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request, binary: true)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response, data: _response.raw_body)\r\n end",
"def capture(_, transaction_id, __)\n Response.parse self, api.payment.capture(transaction_id)\n end",
"def request_proofing_results(unique_id, enrollment_code)\n url = \"#{root_url}/ivs-ippaas-api/IPPRest/resources/rest/getProofingResults\"\n body = {\n sponsorID: sponsor_id,\n uniqueID: unique_id,\n enrollmentCode: enrollment_code,\n }\n\n faraday.post(url, body, dynamic_headers) do |req|\n req.options.context = { service_name: 'usps_proofing_results' }\n end.body\n end",
"def to_s\n '<Twilio.Media.V1.PlaybackGrantPage>'\n end",
"def record_response(response)\n response[2] = create_recording_response(response[2])\n response\n end",
"def capture_request(tid, total = nil)\n capture_request = Cielo::CaptureRequest.new\n response = send_request(capture_request.serialize(tid, total = nil, @affiliation, @affiliation_key))\n end",
"def get_stream_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request, binary: true)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(\r\n _response, data: _response.raw_body\r\n )\r\n end",
"def identifier_code\n 'QuestionnaireResponseID'\n end",
"def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend",
"def request_enrollment_code(unique_id)\n url = \"#{root_url}/ivs-ippaas-api/IPPRest/resources/rest/requestEnrollmentCode\"\n body = {\n sponsorID: sponsor_id,\n uniqueID: unique_id,\n }\n\n faraday.post(url, body, dynamic_headers) do |req|\n req.options.context = { service_name: 'usps_enrollment_code' }\n end.body\n end",
"def transaction_id\n response_code\n end",
"def get_trans_id()\n return @RESPONSE_HASH['RRNO']\n end",
"def delete_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def relay_response\n sim_response = AuthorizeNet::SIM::Response.new(params)\n if sim_response.success?(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['merchant_hash_value'])\n render :text => sim_response.direct_post_reply(\n url_for(:controller => self.controller_name, :action => 'receipt', :only_path => false, \n :gateway => OPTIONS[:gateways][:authorize_net]), \n :include => true)\n else\n # return back to purchase page - will display error message there\n render :text => sim_response.direct_post_reply(\n url_for(:controller => self.controller_name, :action => 'purchase', :only_path => false, \n :order_id => params[:x_invoice_num], :failure => true), \n :include => true)\n end\n end",
"def to_recording(session_id)\n { recording: {\n session_id: session_id,\n duration: '',\n start_time: @rf['recording']['start_time'],\n end_time: @rf['recording']['end_time'],\n basename: base_filename,\n location: destination_path,\n location_key: ''\n } }\n end",
"def get_token_code(relationship_hash)\n\n\n response = rest_post_call($INTRODUCTIONS_DOMAIN + '/relationship', nil, relationship_hash.to_json)\n\n #uri = URI.parse($INTRODUCTIONS_DOMAIN)\n #http = Net::HTTP.new(uri.host, uri.port)\n #request = Net::HTTP::Post.new('/relationship', initheader = {'Content-Type' =>'application/json'})\n #request.basic_auth $http_auth_name, $http_auth_password\n #request.body = relationship_hash.to_json\n #response = http.request(request)\n\n #response = rest_post_call($INTRODUCTIONS_DOMAIN + '/relationship', relationship_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed creating relationship: \" + response.body\n end\n\n return JSON.parse(response.body)['token']\n\nend",
"def generate_subscription_payload(amount, category, desc, merch_trans_id, \n merch_prod_id, merch_sub_id, \n sub_recurrances, redirect_uri, opts={})\n sub_period_amount = (opts[:sub_period_amount] || 1) \n sub_period = (opts[:sub_period] || 'MONTHLY')\n is_purchase_on_no_active_sub = (opts[:iponas] || false)\n channel = (opts[:channel] || \"MOBILE_WEB\")\n\n payload = {\n :Amount => amount,\n :Category => category,\n :Description => desc,\n :MerchantTransactionId => merch_trans_id,\n :MerchantProductId => merch_prod_id,\n :MerchantSubscriptionIdList => merch_sub_id,\n :SubscriptionRecurrences => sub_recurrances,\n :MerchantPaymentRedirectUrl => redirect_uri,\n :SubscriptionPeriodAmount => sub_period_amount,\n :SubscriptionPeriod => sub_period,\n :IsPurchaseOnNoActiveSubscription => is_purchase_on_no_active_sub,\n :Channel => channel,\n }.to_json\nend",
"def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Trunking.V1.RecordingContext #{context}>\"\n end",
"def test_purchase_successful\n response = @gateway.setup_purchase(100, @options)\n\n assert_success response\n\n assert_equal '1234567890123456', response.transaction['purchaseID']\n assert_equal '0020', response.params['AcquirerTrxRes']['Acquirer']['acquirerID']\n assert_not_nil response.service_url, \"Response should contain a service url for payment\"\n\n # now authorize the payment, issuer simulator has completed the payment\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_success response\n assert_equal 'Success', response.transaction['status']\n assert_equal 'DEN HAAG', response.transaction['consumerCity']\n assert_equal \"Hr J A T Verf\\303\\274rth en/of Mw T V Chet\", response.transaction['consumerName']\n end",
"def successful_purchase_response(refunded = false)\n <<~RESPONSE\n {\n \"id\": \"ch_test_charge\",\n \"object\": \"charge\",\n \"livemode\": false,\n \"currency\": \"jpy\",\n \"description\": \"ActiveMerchant Test Purchase\",\n \"amount\": 400,\n \"amount_refunded\": 0,\n \"customer\": null,\n \"recursion\": null,\n \"created\": 1408585273,\n \"paid\": true,\n \"refunded\": false,\n \"failure_message\": null,\n \"card\": {\n \"object\": \"card\",\n \"exp_year\": #{Time.now.year + 1},\n \"exp_month\": 11,\n \"fingerprint\": \"215b5b2fe460809b8bb90bae6eeac0e0e0987bd7\",\n \"name\": \"LONGBOB LONGSEN\",\n \"country\": \"JP\",\n \"type\": \"Visa\",\n \"cvc_check\": \"pass\",\n \"last4\": \"4242\"\n },\n \"captured\": true,\n \"expire_time\": null,\n \"fees\": [\n {\n \"object\": \"fee\",\n \"transaction_type\": \"payment\",\n \"transaction_fee\": 0,\n \"rate\": 3.25,\n \"amount\": 1300,\n \"created\": 1408585273\n }\n ]\n }\n RESPONSE\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Media.V1.PlaybackGrantInstance #{values}>\"\n end",
"def signon_app_cert_rq()\n xml = Builder::XmlMarkup.new(:indent => 2)\n create_xml_header(xml, options)\n\n xml.tag!('QBMSXML') do\n xml.tag!('SignonMsgsRq') do\n xml.tag!('SignonAppCertRq') do\n xml.tag!('ClientDateTime', Time.now)\n xml.tag!('ApplicationLogin', @options[:applogin])\n xml.tag!('ConnectionTicket', @options[:conntkt])\n end\n end\n end\n xml.target!\n end",
"def get_voice_receipts\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # validate response against endpoint and global error codes\r\n if _context.response.status_code == 404\r\n return nil\r\n end\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n return _context.response.raw_body\r\n end",
"def primary_response_code\r\n params['prc']\r\n end",
"def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end",
"def void(response_code, gateway_options = {})\n response = provider.cancel_payment(response_code)\n\n if response.success?\n def response.authorization; psp_reference; end\n else\n # TODO confirm the error response will always have these two methods\n def response.to_s\n \"#{result_code} - #{refusal_reason}\"\n end\n end\n response\n end",
"def code\n if !@values.has_key? 'RESPONSE'\n if has_errors? \n raise PayTrace::Exceptions::ValidationError, get_error_response\n else\n raise PayTrace::Exceptions::ValidationError, \"missing response field\"\n end\n end\n code = parse_code(@values[\"RESPONSE\"])\n code.first\n end",
"def get_encoded_response(request_id:, encoding:, quality: nil, size_only: nil)\n {\n method: \"Audits.getEncodedResponse\",\n params: { requestId: request_id, encoding: encoding, quality: quality, sizeOnly: size_only }.compact\n }\n end",
"def transcribe(id, optional_params = {})\n response = Network.post(['Recordings', id, 'Transcriptions'], optional_params)\n Transcription.new(response)\n end",
"def recording\n @call = Call.find(params[:id])\n @call.update_attribute :recording_url, params[:RecordingUrl] || @call.recording_url\n @call.update_attribute :recording_duration, params[:RecordingDuration] || @call.recording_duration\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end",
"def r_key_auth_code\n \"auth_code:#{telephone}\"\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Trunking.V1.RecordingInstance #{values}>\"\n end",
"def wrapperresult(response)\n\t\tif response.class == String\n\t\t\treturn response\n\t\telse\n\t\t\tresult = Hash.new\n\t\t\t#set header value\n\t\t\theader = response.getAuthenticationResponse\n\t\t\tresult['sessionId'] = header.getSessionId\n\t\t\tresult['timeStamp'] = header.getTimeStamp\n\t\t\tresult['messageCode'] = header.getMessageCode\n\t\t\tresult['message'] = header.getMessage\n\t\t\t\n\t\t\t#set body value\n\t\t\tif (response.getResponseBody.value != nil)\n\t\t\t\tbody = response.getResponseBody.value.getClearingRefused\n\t\t\t\tabody = response.getResponseBody.value.getClearingAcknowledgement\n\t\t\t\tif ( body != nil)\n\t\t\t\t\tresult['messageId'] = body.getHeader().getMessageId().getValue()\n\t\t\t\t\tresult['inReplyTo'] = body.getHeader().getInReplyTo().getValue()\n\t\t\t\t\tresult['sentBy'] = body.getHeader().getSentBy().getValue()\n\t\t\t\t\tresult['correlationId'] = body.getCorrelationId().getCorrelationIdScheme()\n\t\t\t\t\tresult['correlationIdValue'] = body.getCorrelationId().getValue()\n\t\t\t\t\treason = body.getReason\n\t\t\t\t\tresult['reasonCode'] = reason.get( 0 ).getReasonCode().getValue() \n\t\t\t\t\tresult['description'] = reason.get( 0 ).getDescription()\n\t\t\t\tend\n\t\t\t\tif ( abody != nil)\n\t\t\t\t\tresult['hashToken reference'] = response.getResponseBody.value.getHashToken().getReference()\n\t\t\t\t\tresult['hashToken value'] = response.getResponseBody.value.getHashToken().getValue()\n\t\t\t\t\tresult['messageId'] = abody.getHeader().getMessageId().getMessageIdScheme()\n\t\t\t\t\tresult['messageIdValue'] = abody.getHeader().getMessageId().getValue()\n\t\t\t\t\tresult['inReplyTo'] = abody.getHeader().getInReplyTo().getMessageIdScheme()\n\t\t\t\t\tresult['inReplyToValue'] = abody.getHeader().getInReplyTo().getValue()\n\t\t\t\t\tresult['sentBy'] = abody.getHeader().getSentBy().getMessageAddressScheme()\n\t\t\t\t\tresult['sentByValue'] = abody.getHeader().getSentBy().getValue()\n\t\t\t\t\tresult['correlationId'] = abody.getCorrelationId().getCorrelationIdScheme()\n\t\t\t\t\tresult['correlationIdValue'] = abody.getCorrelationId().getValue()\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn result\n\t\tend\n\tend",
"def phone_playback(number,\r\n audio_url)\r\n # Prepare query url.\r\n _path_url = '/phone-playback'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'output-case' => 'camel',\r\n 'number' => number,\r\n 'audio-url' => audio_url\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: _parameters\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n PhonePlaybackResponse.from_hash(decoded)\r\n end",
"def voicemail\n @call.update! voicemail: params[:RecordFile],\n duration: params[:RecordingDuration]\n render nothing: true\n end",
"def challenge_response(challenge_code)\n {\n :body => challenge_code,\n :status => 200\n }\n end",
"def lookup(cpr)\n xml_doc = post_auto_login(stamp_body(digits(cpr)))\n case receipt_code(xml_doc)\n when 0\n Record.new(xml_doc)\n when 172, 52\n nil\n else\n raise ClientError, \"Unexpected STAMP resp: #{xml_doc}\"\n end\n end",
"def send_dtmf(code, cookie)\n dtmf_uri = Liverpie.config['webapp_dtmf_uri']\n return nil, cookie if dtmf_uri.to_s.empty?\n \n Liverpie.log \"Sending DTMF #{code} to webapp...\"\n \n hdrs = {}\n hdrs['Cookie'] = cookie if cookie\n \n begin\n resp = @http.post(dtmf_uri, \"dtmf_code=#{code}\", hdrs)\n rescue Exception => e\n Liverpie.log \"Error - could not reach the webapp: #{e.message}\"\n return [nil, nil]\n end\n \n case resp.code.to_i\n when 200, 302\n received_cookie = resp['Set-Cookie']\n Liverpie.log \"Got webapp response for dtmf method, with cookie: #{received_cookie}\"\n else\n Liverpie.log \"Error - code(#{resp.code}) - #{resp.msg}\"\n end\n \n return [(resp.code.to_i == 200 ? resp.body : nil), received_cookie]\n end",
"def getAppRetCode\n \"appid=#{appid}\"\n end",
"def transaction_response(hash)\n @direct_pay = @response.body\n @transaction = CGI::parse(@direct_pay)\n if @transaction['ACK'].to_sentence == \"Failure\" and @transaction['L_LONGMESSAGE0'].to_sentence.present? and @transaction['L_ERRORCODE0'].present?\n message = @transaction['L_LONGMESSAGE0'].to_sentence\n return true, message\n elsif @transaction['ACK'].to_sentence == \"Success\"\n @amount = @transaction['AMT'].to_sentence.to_i\n # @event_order_id =\n @transaction_id = @transaction['TRANSACTIONID'].to_sentence\n @status = 'success'\n @currency_code = 'USD'#, payment_params[:currency_code]\n @pg_sy_paypal_payment = create_paypal_payment(amount: @amount, event_order_id: @event_order_id, transaction_id: @transaction_id, status: @status, currency_code: @currency_code)\n return @pg_sy_paypal_payment\n else\n message = 'Error in payment'\n return true, message\n end\n end",
"def get_capture_details(\n amazon_capture_id,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'GetCaptureDetails',\n 'SellerId' => merchant_id,\n 'AmazonCaptureId' => amazon_capture_id\n }\n\n optional = {\n 'MWSAuthToken' => mws_auth_token\n }\n\n operation(parameters, optional)\n end",
"def get_recording_mediaretentionpolicy_with_http_info(policy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_mediaretentionpolicy ...\"\n end\n \n \n # verify the required parameter 'policy_id' is set\n fail ArgumentError, \"Missing the required parameter 'policy_id' when calling RecordingApi.get_recording_mediaretentionpolicy\" if policy_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/mediaretentionpolicies/{policyId}\".sub('{format}','json').sub('{' + 'policyId' + '}', policy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Policy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_mediaretentionpolicy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def successful_purchase_response\n end",
"def get_conversation_recordingmetadata_with_http_info(conversation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordingmetadata ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordingmetadata\" if conversation_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordingmetadata\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<RecordingMetadata>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordingmetadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def capture_a_payment(id, opts = {})\n data, _status_code, _headers = capture_a_payment_with_http_info(id, opts)\n data\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('recording', 'get', 'KalturaRecording', 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 api_response\n {\n payment_nonce_uuid: @gateway_nonce_record.uuid,\n gateway_type: @gateway_type\n }\n end",
"def customer_credit_card_capture_rq(amount, authorization, options)\n xml = Builder::XmlMarkup.new(:indent => 2)\n \n create_qbmsxml_msgs_rq(xml,options) {\n xml.tag!('CustomerCreditCardCaptureRq') do\n xml.tag!('TransRequestID', options[:order_id])\n xml.tag!('CreditCardTransID', authorization)\n xml.tag!('Amount', amount)\n end\n }\n \n xml.target!\n end",
"def detached_payload_stub(code)\r\n %Q^\r\n code = '#{ Rex::Text.encode_base64(code) }'.unpack(\"m0\").first\r\n if RUBY_PLATFORM =~ /mswin|mingw|win32/\r\n inp = IO.popen(\"ruby\", \"wb\") rescue nil\r\n if inp\r\n inp.write(code)\r\n inp.close\r\n end\r\n else\r\n Kernel.fork do\r\n eval(code)\r\n end\r\n end\r\n {}\r\n ^.strip.split(/\\n/).map{|line| line.strip}.join(\"\\n\")\r\n end",
"def beginRecordUI\n code=beginRecord\n case code\n when 0; return true\n when 256+66\n Kernel.pbMessage(_INTL(\"All recording devices are in use. Recording is not possible now.\"))\n return false\n when 256+72\n Kernel.pbMessage(_INTL(\"No supported recording device was found. Recording is not possible.\"))\n return false\n else\n buffer=\"\\0\"*256\n MciErrorString.call(code,buffer,256)\n Kernel.pbMessage(_INTL(\"Recording failed: {1}\",buffer.gsub(/\\x00/,\"\")))\n return false \n end\nend",
"def query_recorder(recorder_id, sub_command, options = [])\n # place the recorder_id and sub_command strings on the front of options\n # and join with the FIELD_SEPARATOR. This forms the QUERY_RECORDER command\n cmd_string = options.unshift(recorder_id, sub_command)\n send(\"QUERY_RECORDER #{options.join(FIELD_SEPARATOR)}\")\n end",
"def void(response_code, source, gateway_options = {})\n response = provider.cancel_payment(response_code)\n\n if response.success?\n def response.authorization; psp_reference; end\n else\n # TODO confirm the error response will always have these two methods\n def response.to_s\n \"#{result_code} - #{refusal_reason}\"\n end\n end\n response\n end",
"def get_conversation_recording_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recording ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recording\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recording\" if recording_id.nil?\n \n \n \n \n \n \n \n \n if opts[:'format_id'] && !['WAV', 'WEBM', 'WAV_ULAW', 'OGG_VORBIS', 'OGG_OPUS', 'MP3', 'NONE'].include?(opts[:'format_id'])\n fail ArgumentError, 'invalid value for \"format_id\", must be one of WAV, WEBM, WAV_ULAW, OGG_VORBIS, OGG_OPUS, MP3, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'email_format_id'] && !['EML', 'NONE'].include?(opts[:'email_format_id'])\n fail ArgumentError, 'invalid value for \"email_format_id\", must be one of EML, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'chat_format_id'] && !['ZIP', 'NONE'].include?(opts[:'chat_format_id'])\n fail ArgumentError, 'invalid value for \"chat_format_id\", must be one of ZIP, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'message_format_id'] && !['ZIP', 'NONE'].include?(opts[:'message_format_id'])\n fail ArgumentError, 'invalid value for \"message_format_id\", must be one of ZIP, NONE'\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id']\n query_params[:'emailFormatId'] = opts[:'email_format_id'] if opts[:'email_format_id']\n query_params[:'chatFormatId'] = opts[:'chat_format_id'] if opts[:'chat_format_id']\n query_params[:'messageFormatId'] = opts[:'message_format_id'] if opts[:'message_format_id']\n query_params[:'download'] = opts[:'download'] if opts[:'download']\n query_params[:'fileName'] = opts[:'file_name'] if opts[:'file_name']\n query_params[:'locale'] = opts[:'locale'] if opts[:'locale']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Recording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def generate_result_code\n @type.to_s + '& ' + code_name\n end",
"def call(web_method, params) #:nodoc:\n @error = nil\n @savon.call(\n web_method,\n message: params,\n soap_header: { 'ns1:AuthenticationHeader' => @auth.signature }\n ).to_hash\n rescue Exception => e\n @error = e\n @logger.log(e) if @logger\n nil\n end",
"def acknowledge(authcode)\n return_authcode = [params[\"ORDER_NUMBER\"], params[\"TIMESTAMP\"], params[\"PAID\"], params[\"METHOD\"], authcode].join(\"|\")\n Digest::MD5.hexdigest(return_authcode).upcase == params[\"RETURN_AUTHCODE\"]\n end",
"def get_voice_receipts\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def to_s\n \"<Twilio.Oauth.V1.DeviceCodeInstance>\"\n end",
"def send_code\n return :blank_phone if self.phone.blank?\n self.generate_code\n SMS3.sendto self.phone, \"您的KickTempo手机验证码为:#{self.varified_code}。\"\n end",
"def final_sip_code_phrase\n return @final_sip_code_phrase\n end"
] |
[
"0.8100696",
"0.65467256",
"0.6287079",
"0.55218077",
"0.5475904",
"0.527069",
"0.5211421",
"0.51613057",
"0.51164204",
"0.51164204",
"0.50006616",
"0.49446142",
"0.49424493",
"0.4890779",
"0.4884488",
"0.4866192",
"0.48377487",
"0.48356754",
"0.4802964",
"0.48028165",
"0.47816983",
"0.47738767",
"0.47427145",
"0.468108",
"0.46779186",
"0.46690845",
"0.46516767",
"0.46376517",
"0.46318462",
"0.46020535",
"0.45916328",
"0.45805213",
"0.4566542",
"0.45397016",
"0.4533825",
"0.4529456",
"0.45258975",
"0.45215267",
"0.45058903",
"0.44851166",
"0.4466986",
"0.44669476",
"0.44597316",
"0.444927",
"0.44463944",
"0.44444814",
"0.44381395",
"0.4437138",
"0.44317165",
"0.44261158",
"0.44134384",
"0.4409439",
"0.44053066",
"0.43964368",
"0.43934909",
"0.43894717",
"0.4388868",
"0.43503034",
"0.43490797",
"0.43287793",
"0.43198338",
"0.43165973",
"0.4315868",
"0.43082592",
"0.43064272",
"0.43006262",
"0.42812455",
"0.427133",
"0.42712113",
"0.4264302",
"0.42601624",
"0.4252542",
"0.4249282",
"0.42488584",
"0.42460373",
"0.4245387",
"0.42414838",
"0.4230602",
"0.42297024",
"0.42135656",
"0.4213281",
"0.42087638",
"0.42054242",
"0.41978177",
"0.4189794",
"0.41835156",
"0.4178458",
"0.4177318",
"0.41757035",
"0.41724053",
"0.41510043",
"0.4144346",
"0.4143412",
"0.41417018",
"0.41384366",
"0.41361272",
"0.41348767",
"0.41347367",
"0.4128208",
"0.4120947"
] |
0.82682246
|
0
|
Public: Calls the 'GetRecordingInfo' SOAP Action recording_id a String in GUID format Returns the SOAP response Hash
|
def get_recording_info(recording_id)
@soap_client.call :get_recording_info,
message: { 'wsdl:sessionID' => @session_id,
'wsdl:recordingID' => recording_id }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_recording_info(recording_id)\n response = @savon.call :get_recording_info,\n message: { 'wsdl:sessionID' => @session_id,\n 'wsdl:recordingID' => recording_id }\n response.body[:get_recording_info_response][:get_recording_info_result]\n end",
"def get_metadata_for_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: RecordingMetadataResponse.from_hash(decoded)\r\n )\r\n end",
"def get_metadata_for_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(_response,\r\n data: RecordingMetadataResponse.from_hash(decoded))\r\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('recording', 'get', 'KalturaRecording', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get_conversation_recordingmetadata_recording_id_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordingmetadata_recording_id ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordingmetadata_recording_id\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recordingmetadata_recording_id\" if recording_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordingmetadata/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingMetadata')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordingmetadata_recording_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def recording_get(meeting_id, opts = {})\n data, _status_code, _headers = recording_get_with_http_info(meeting_id, opts)\n data\n end",
"def get_conversation_recording_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recording ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recording\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recording\" if recording_id.nil?\n \n \n \n \n \n \n \n \n if opts[:'format_id'] && !['WAV', 'WEBM', 'WAV_ULAW', 'OGG_VORBIS', 'OGG_OPUS', 'MP3', 'NONE'].include?(opts[:'format_id'])\n fail ArgumentError, 'invalid value for \"format_id\", must be one of WAV, WEBM, WAV_ULAW, OGG_VORBIS, OGG_OPUS, MP3, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'email_format_id'] && !['EML', 'NONE'].include?(opts[:'email_format_id'])\n fail ArgumentError, 'invalid value for \"email_format_id\", must be one of EML, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'chat_format_id'] && !['ZIP', 'NONE'].include?(opts[:'chat_format_id'])\n fail ArgumentError, 'invalid value for \"chat_format_id\", must be one of ZIP, NONE'\n end\n \n \n \n \n \n \n \n if opts[:'message_format_id'] && !['ZIP', 'NONE'].include?(opts[:'message_format_id'])\n fail ArgumentError, 'invalid value for \"message_format_id\", must be one of ZIP, NONE'\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id']\n query_params[:'emailFormatId'] = opts[:'email_format_id'] if opts[:'email_format_id']\n query_params[:'chatFormatId'] = opts[:'chat_format_id'] if opts[:'chat_format_id']\n query_params[:'messageFormatId'] = opts[:'message_format_id'] if opts[:'message_format_id']\n query_params[:'download'] = opts[:'download'] if opts[:'download']\n query_params[:'fileName'] = opts[:'file_name'] if opts[:'file_name']\n query_params[:'locale'] = opts[:'locale'] if opts[:'locale']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Recording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(id)\n response = Network.get(['Recordings', id])\n Recording.new(response)\n end",
"def recording_get_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_get ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_get\"\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_conversation_recordingmetadata_with_http_info(conversation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordingmetadata ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordingmetadata\" if conversation_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordingmetadata\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<RecordingMetadata>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordingmetadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConferencesApi.get_conference_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ConferencesApi.get_conference_recording\"\n end\n # verify the required parameter 'conference_id' is set\n if @api_client.config.client_side_validation && conference_id.nil?\n fail ArgumentError, \"Missing the required parameter 'conference_id' when calling ConferencesApi.get_conference_recording\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling ConferencesApi.get_conference_recording\"\n end\n # resource path\n local_var_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CallRecordingMetadata'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"ConferencesApi.get_conference_recording\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConferencesApi#get_conference_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_recording_transcription(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response, data: TranscriptionResponse.from_hash(decoded)\r\n )\r\n end",
"def transcribe_recording(recording_id)\n # initialize_session unless @session.try :valid?\n\n response = @soap_client.call :transcribe_recording, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id }\n\n response.body[:transcribe_recording_response][:transcribe_recording_result]\n end",
"def delete_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def delete_recording(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def get_userrecording_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserRecordingsApi.get_userrecording ...\"\n end\n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling UserRecordingsApi.get_userrecording\" if recording_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/userrecordings/{recordingId}\".sub('{format}','json').sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UserRecording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserRecordingsApi#get_userrecording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_recording_info(twilio_id, call_duration, answered_by)\n self.duration = call_duration\n client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN\n recordings_info = client.account.calls.get(twilio_id).recordings\n self.recording_url = recordings_info.list.first.mp3\n self.recording = recordings_info.list.first.sid\n self.answered_by = answered_by\n self.save\n end",
"def get_recording_job_with_http_info(job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_job ...\"\n end\n \n \n # verify the required parameter 'job_id' is set\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling RecordingApi.get_recording_job\" if job_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/jobs/{jobId}\".sub('{format}','json').sub('{' + 'jobId' + '}', job_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingJob')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_job\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def callback\n twilio_id = params[:CallSid]\n call = Call.where('twilio_id = ?', twilio_id).first\n call.get_recording_info(twilio_id, params[:CallDuration], params[:AnsweredBy])\n render :json => 'callback success'\n end",
"def create_recording_viewrecording(recordingsid)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/recording/viewrecording.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'recordingsid' => recordingsid\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def recording\n @call = Call.find(params[:id])\n @call.update_attribute :recording_url, params[:RecordingUrl] || @call.recording_url\n @call.update_attribute :recording_duration, params[:RecordingDuration] || @call.recording_duration\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end",
"def transcribe_recording(recording_id)\n # initialize_session unless @session.try :valid?\n\n response = @savon.call :transcribe_recording, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id }\n\n response.body[:transcribe_recording_response][:transcribe_recording_result]\n end",
"def get_stream_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id,\r\n 'recordingId' => recording_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request, binary: true)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The recording never existed, no longer exists, or is inaccessible' \\\r\n ' to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response, data: _response.raw_body)\r\n end",
"def download_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConferencesApi.download_conference_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ConferencesApi.download_conference_recording\"\n end\n # verify the required parameter 'conference_id' is set\n if @api_client.config.client_side_validation && conference_id.nil?\n fail ArgumentError, \"Missing the required parameter 'conference_id' when calling ConferencesApi.download_conference_recording\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling ConferencesApi.download_conference_recording\"\n end\n # resource path\n local_var_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/vnd.wave', 'audio/mpeg', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"ConferencesApi.download_conference_recording\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConferencesApi#download_conference_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_query_metadata_for_account(account_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/recordings'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: decoded.map { |element| RecordingMetadataResponse.from_hash(element) }\r\n )\r\n end",
"def get_conversation_recordingmetadata_recording_id(conversation_id, recording_id, opts = {})\n data, _status_code, _headers = get_conversation_recordingmetadata_recording_id_with_http_info(conversation_id, recording_id, opts)\n return data\n end",
"def get_stream_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request, binary: true)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(\r\n _response, data: _response.raw_body\r\n )\r\n end",
"def get_conversation_recordings_with_http_info(conversation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recordings ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recordings\" if conversation_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'format_id'] && !['WAV', 'WEBM', 'WAV_ULAW', 'OGG_VORBIS', 'OGG_OPUS', 'MP3', 'NONE'].include?(opts[:'format_id'])\n fail ArgumentError, 'invalid value for \"format_id\", must be one of WAV, WEBM, WAV_ULAW, OGG_VORBIS, OGG_OPUS, MP3, NONE'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'maxWaitMs'] = opts[:'max_wait_ms'] if opts[:'max_wait_ms']\n query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Recording>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recordings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_account_cloud_recording_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.get_account_cloud_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling CloudRecordingApi.get_account_cloud_recording\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling CloudRecordingApi.get_account_cloud_recording, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/accounts/{accountId}/recordings'.sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20073')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#get_account_cloud_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download_a_recording_file(recording_id, opts = {})\n data, _status_code, _headers = download_a_recording_file_with_http_info(recording_id, opts)\n data\n end",
"def get_recording_recordingkeys_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_recordingkeys ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/recordingkeys\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'EncryptionKeyEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_recordingkeys\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_recording_job(job_id, opts = {})\n data, _status_code, _headers = get_recording_job_with_http_info(job_id, opts)\n return data\n end",
"def get_recordings()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/recordings\"))[0]\n end",
"def get_userrecording(recording_id, opts = {})\n data, _status_code, _headers = get_userrecording_with_http_info(recording_id, opts)\n return data\n end",
"def download_a_recording_file_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.download_a_recording_file ...'\n end\n\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling DefaultApi.download_a_recording_file\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Recordings/{recordingId}/Download'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/x-wav'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.download_a_recording_file\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#download_a_recording_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('recording', 'delete', 'KalturaRecording', 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 recording_delete_one_with_http_info(meeting_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_delete_one ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_delete_one\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling CloudRecordingApi.recording_delete_one\"\n end\n if @api_client.config.client_side_validation && opts[:'action'] && !['trash', 'delete'].include?(opts[:'action'])\n fail ArgumentError, 'invalid value for \"action\", must be one of trash, delete'\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings/{recordingId}'.sub('{' + 'meetingId' + '}', meeting_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_delete_one\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_capture_details(\n amazon_capture_id,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'GetCaptureDetails',\n 'SellerId' => merchant_id,\n 'AmazonCaptureId' => amazon_capture_id\n }\n\n optional = {\n 'MWSAuthToken' => mws_auth_token\n }\n\n operation(parameters, optional)\n end",
"def get_recording_batchrequest_with_http_info(job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_batchrequest ...\"\n end\n \n \n # verify the required parameter 'job_id' is set\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling RecordingApi.get_recording_batchrequest\" if job_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/batchrequests/{jobId}\".sub('{format}','json').sub('{' + 'jobId' + '}', job_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BatchDownloadJobStatusResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_batchrequest\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stream_a_recording_file_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stream_a_recording_file ...'\n end\n\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling DefaultApi.stream_a_recording_file\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Recordings/{recordingId}/Stream'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/x-wav'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.stream_a_recording_file\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stream_a_recording_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def to_recording(session_id)\n { recording: {\n session_id: session_id,\n duration: '',\n start_time: @rf['recording']['start_time'],\n end_time: @rf['recording']['end_time'],\n basename: base_filename,\n location: destination_path,\n location_key: ''\n } }\n end",
"def get_conversation_recording_annotations_with_http_info(conversation_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_conversation_recording_annotations ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.get_conversation_recording_annotations\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.get_conversation_recording_annotations\" if recording_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}/annotations\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Annotation>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_conversation_recording_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def recording_delete_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_delete ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_delete\"\n end\n if @api_client.config.client_side_validation && opts[:'action'] && !['trash', 'delete'].include?(opts[:'action'])\n fail ArgumentError, 'invalid value for \"action\", must be one of trash, delete'\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transcription(recording_id, format = :text)\n format_type = case format\n when :text\n \"Text\"\n else\n format.to_s.upcase\n end\n\n response = @savon.call :get_transcription, message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recId' => recording_id, \n 'wsdl:formattingType' => format_type }\n\n error_message = response.body[:get_transcription_response][:error_message]\n raise error_message if error_message\n\n transcription = response.body[:get_transcription_response][:get_transcription_result]\n\n raise \"Transcription unable to be downloaded\" if transcription.nil?\n\n Base64.decode64(transcription)\n end",
"def delete_recording_transcription(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def new_recording\n response = Twilio::TwiML::Response.new do |r|\n play_audio(r, 'recording_begin_at_beep')\n r.Record(action: ivr_recordings_re_record_prompt_url, method: 'post', 'finishOnKey' => '7')\n end\n\n render_twiml response\n end",
"def get_conversation_recording(conversation_id, recording_id, opts = {})\n data, _status_code, _headers = get_conversation_recording_with_http_info(conversation_id, recording_id, opts)\n return data\n end",
"def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('seriesrecording', 'delete', 'KalturaSeriesRecording', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get_orphanrecording_with_http_info(orphan_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_orphanrecording ...\"\n end\n \n \n # verify the required parameter 'orphan_id' is set\n fail ArgumentError, \"Missing the required parameter 'orphan_id' when calling RecordingApi.get_orphanrecording\" if orphan_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/orphanrecordings/{orphanId}\".sub('{format}','json').sub('{' + 'orphanId' + '}', orphan_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OrphanRecording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_orphanrecording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_conversation_recordingmetadata(conversation_id, opts = {})\n data, _status_code, _headers = get_conversation_recordingmetadata_with_http_info(conversation_id, opts)\n return data\n end",
"def delete_recording_media(account_id,\r\n call_id,\r\n recording_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def re_record_prompt\n active_recording = active_call.recordings.create!(duration: params['RecordingDuration'], recording_url: params['RecordingUrl'])\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Thank you.'\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n r.Gather(\n action: ivr_recordings_new_recording_url,\n method: 'get',\n 'numDigits' => 1,\n 'finishOnKey' => ''\n ) do |gather|\n r.Play(active_recording.recording_url)\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n end\n play_audio(r, 'goodbye')\n r.Hangup\n end\n\n render_twiml response\n end",
"def set_recording\n @recording = Recording.find(params[:id])\n end",
"def update_recording(record_id, meta)\n meta[:recordID] = record_id\n bbb_server.send_api_request(\"updateRecordings\", meta)\n end",
"def get_recordings\n # raise 'Login first!' unless @customer_login_id\n\n response = @soap_client.call :get_customer_recordings, \n message: { 'wsdl:sessionID' => session_id }\n\n @recordings = response.body[:get_customer_recordings_response][:get_customer_recordings_result][:recording_info] \n end",
"def get_userrecording_media_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserRecordingsApi.get_userrecording_media ...\"\n end\n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling UserRecordingsApi.get_userrecording_media\" if recording_id.nil?\n \n \n \n \n \n \n \n \n if opts[:'format_id'] && !['WAV', 'WEBM', 'WAV_ULAW', 'OGG_VORBIS', 'OGG_OPUS', 'MP3', 'NONE'].include?(opts[:'format_id'])\n fail ArgumentError, 'invalid value for \"format_id\", must be one of WAV, WEBM, WAV_ULAW, OGG_VORBIS, OGG_OPUS, MP3, NONE'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/userrecordings/{recordingId}/media\".sub('{format}','json').sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DownloadResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserRecordingsApi#get_userrecording_media\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def record_response(response)\n response[2] = create_recording_response(response[2])\n response\n end",
"def get_recording_batchrequest(job_id, opts = {})\n data, _status_code, _headers = get_recording_batchrequest_with_http_info(job_id, opts)\n return data\n end",
"def record(record_id, params = {})\n Record.new(record_id, params).get\n end",
"def record(record_id, params = {})\n Record.new(record_id, params).get\n end",
"def create_recording_listrecording(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/recording/listrecording.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'Datecreated' => options['datecreated'],\r\n 'callsid' => options['callsid']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def recording_registrants_questions_get_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recording_registrants_questions_get ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.recording_registrants_questions_get\"\n end\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings/registrants/questions'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingRegistrantQuestions')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recording_registrants_questions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_message_lookup record_id\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/messages/{record_id}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"record_id\" => record_id,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute Messaging SDK 1.0\"\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers:headers, auth:{ :user => @username, :password => @password }\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def get_query_metadata_for_account_and_call(account_id,\r\n call_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ErrorResponseException.new(\r\n 'Something didn\\'t look right about that request. Please fix it' \\\r\n ' before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_response.raw_body)\r\n ApiResponse.new(\r\n _response,\r\n data: decoded.map { |element| RecordingMetadataResponse.from_hash(element) }\r\n )\r\n end",
"def put_conversation_recording_with_http_info(conversation_id, recording_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.put_conversation_recording ...\"\n end\n \n \n # verify the required parameter 'conversation_id' is set\n fail ArgumentError, \"Missing the required parameter 'conversation_id' when calling RecordingApi.put_conversation_recording\" if conversation_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling RecordingApi.put_conversation_recording\" if recording_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.put_conversation_recording\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/{conversationId}/recordings/{recordingId}\".sub('{format}','json').sub('{' + 'conversationId' + '}', conversation_id.to_s).sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Recording')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#put_conversation_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_record(identifier)\n doc = client.get!(CGI.escape(identifier)).body.to_json\n @record_class.build(mint_id(identifier), doc, 'application/json')\n end",
"def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Trunking.V1.RecordingInstance #{values}>\"\n end",
"def get_conference_recordings_with_http_info(account_id, conference_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConferencesApi.get_conference_recordings ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ConferencesApi.get_conference_recordings\"\n end\n # verify the required parameter 'conference_id' is set\n if @api_client.config.client_side_validation && conference_id.nil?\n fail ArgumentError, \"Missing the required parameter 'conference_id' when calling ConferencesApi.get_conference_recordings\"\n end\n # resource path\n local_var_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<ConferenceRecordingMetadata>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"ConferencesApi.get_conference_recordings\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConferencesApi#get_conference_recordings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_transcribe_recording(account_id,\r\n call_id,\r\n recording_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true },\r\n 'recordingId' => { 'value' => recording_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 410\r\n raise ApiErrorResponseException.new(\r\n 'The media for this recording has been deleted, so we can\\'t' \\\r\n ' transcribe it',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def delete_recording_job_with_http_info(job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.delete_recording_job ...\"\n end\n \n \n # verify the required parameter 'job_id' is set\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling RecordingApi.delete_recording_job\" if job_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/jobs/{jobId}\".sub('{format}','json').sub('{' + 'jobId' + '}', job_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#delete_recording_job\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def modify_call_recording_state(account_id,\r\n call_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => true },\r\n 'callId' => { 'value' => call_id, 'encode' => true }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise ApiErrorResponseException.new(\r\n 'Something\\'s not quite right... Your request is invalid. Please' \\\r\n ' fix it before trying again.',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Your credentials are invalid. Please use your Bandwidth dashboard' \\\r\n ' credentials to authenticate to the API.',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ApiErrorResponseException.new(\r\n 'User unauthorized to perform this action.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise ApiErrorResponseException.new(\r\n 'The resource specified cannot be found or does not belong to you.',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ApiErrorResponseException.new(\r\n 'We don\\'t support that media type. If a request body is required,' \\\r\n ' please send it to us as `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ApiErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ApiErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def stream_a_recording_file(recording_id, opts = {})\n data, _status_code, _headers = stream_a_recording_file_with_http_info(recording_id, opts)\n data\n end",
"def show\n @recording_event = RecordingEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recording_event }\n end\n end",
"def meeting_recording_registrants_with_http_info(meeting_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.meeting_recording_registrants ...'\n end\n # verify the required parameter 'meeting_id' is set\n if @api_client.config.client_side_validation && meeting_id.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_id' when calling CloudRecordingApi.meeting_recording_registrants\"\n end\n if @api_client.config.client_side_validation && opts[:'status'] && !['pending', 'approved', 'denied'].include?(opts[:'status'])\n fail ArgumentError, 'invalid value for \"status\", must be one of pending, approved, denied'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling CloudRecordingApi.meeting_recording_registrants, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/meetings/{meetingId}/recordings/registrants'.sub('{' + 'meetingId' + '}', meeting_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'page_number'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RegistrationList1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#meeting_recording_registrants\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete_userrecording_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserRecordingsApi.delete_userrecording ...\"\n end\n \n \n # verify the required parameter 'recording_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling UserRecordingsApi.delete_userrecording\" if recording_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/userrecordings/{recordingId}\".sub('{format}','json').sub('{' + 'recordingId' + '}', recording_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserRecordingsApi#delete_userrecording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transcribe_recording_using_promocode(recording_id, promocode)\n # initialize_session unless @session.try :valid?\n \n response = @soap_client.call :transcribe_recording_using_promocode, \n message: { 'wsdl:sessionID' => @session_id, \n 'wsdl:recordingId' => recording_id,\n 'wsdl:promoCode' => promocode }\n\n response.body[:transcribe_recording_using_promocode_response][:transcribe_recording_using_promocode_result]\n end",
"def recording_delete_one(meeting_id, recording_id, opts = {})\n recording_delete_one_with_http_info(meeting_id, recording_id, opts)\n nil\n end",
"def get_account_cloud_recording(account_id, opts = {})\n data, _status_code, _headers = get_account_cloud_recording_with_http_info(account_id, opts)\n data\n end",
"def get_recording_mediaretentionpolicy_with_http_info(policy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_mediaretentionpolicy ...\"\n end\n \n \n # verify the required parameter 'policy_id' is set\n fail ArgumentError, \"Missing the required parameter 'policy_id' when calling RecordingApi.get_recording_mediaretentionpolicy\" if policy_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/mediaretentionpolicies/{policyId}\".sub('{format}','json').sub('{' + 'policyId' + '}', policy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Policy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_mediaretentionpolicy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_capture(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: CapturesApi#get_capture ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_capture\" if id.nil?\n \n # resource path\n path = \"/payments/v1/captures/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CaptureGetResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: CapturesApi#get_capture. Result: #{result.inspect}\"\n end\n return result\n end",
"def get_rebill_id()\n return @RESPONSE_HASH['REBID']\n end",
"def get_record(identifier, opts = {})\n opts[:identifier] = identifier\n opts = opts.merge(@opts)\n @record_class.build(mint_id(identifier),\n record_xml(client.get_record(opts).record))\n end",
"def get_recording_recordingkeys(opts = {})\n data, _status_code, _headers = get_recording_recordingkeys_with_http_info(opts)\n return data\n end",
"def set_recording\n @recording = Recording.includes(recording_contributor_people: [:person]).find(params[:id])\n end",
"def add(recording)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'recording', recording)\n\t\t\tclient.queue_service_action_call('recording', 'add', 'KalturaRecording', 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 to_s\n '#<Twilio.Trunking.V1.RecordingList>'\n end",
"def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Trunking.V1.RecordingInstance #{values}>\"\n end",
"def set_recording\n @recording = Recording.cached_find(params[:recording_id])\n end",
"def recordings_list_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudRecordingApi.recordings_list ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling CloudRecordingApi.recordings_list\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling CloudRecordingApi.recordings_list, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/users/{userId}/recordings'.sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].nil?\n query_params[:'mc'] = opts[:'mc'] if !opts[:'mc'].nil?\n query_params[:'trash'] = opts[:'trash'] if !opts[:'trash'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'trash_type'] = opts[:'trash_type'] if !opts[:'trash_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudRecordingApi#recordings_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def recording_delete(meeting_id, opts = {})\n recording_delete_with_http_info(meeting_id, opts)\n nil\n end",
"def to_s\n '<Twilio.Trunking.V1.RecordingPage>'\n end",
"def modify_call_recording_state(account_id,\r\n call_id,\r\n body: nil)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::VOICEDEFAULT)\r\n _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => account_id,\r\n 'callId' => call_id\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n VoiceBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _response.status_code == 400\r\n raise APIException.new(\r\n 'The call can\\'t be modified in its current state',\r\n _response\r\n )\r\n elsif _response.status_code == 401\r\n raise APIException.new(\r\n 'Please authenticate yourself',\r\n _response\r\n )\r\n elsif _response.status_code == 403\r\n raise ErrorResponseException.new(\r\n 'Your credentials are invalid. Please use your API credentials for' \\\r\n ' the Bandwidth Dashboard.',\r\n _response\r\n )\r\n elsif _response.status_code == 404\r\n raise APIException.new(\r\n 'The call never existed, no longer exists, or is inaccessible to you',\r\n _response\r\n )\r\n elsif _response.status_code == 415\r\n raise ErrorResponseException.new(\r\n 'We don\\'t support that media type. Please send us' \\\r\n ' `application/json`.',\r\n _response\r\n )\r\n elsif _response.status_code == 429\r\n raise ErrorResponseException.new(\r\n 'You\\'re sending requests to this endpoint too frequently. Please' \\\r\n ' slow your request rate down and try again.',\r\n _response\r\n )\r\n elsif _response.status_code == 500\r\n raise ErrorResponseException.new(\r\n 'Something unexpected happened. Please try again.',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end",
"def delete_recording(record_id)\n bbb_server.delete_recordings(record_id)\n end",
"def recordings\n recording_ids = self.instrument_tags.where(instrument_tagable_type: 'Recording').pluck(:instrument_tagable_id)\n Recording.where(id: recording_ids)\n end",
"def get_recordings_screensessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recordings_screensessions ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recordings/screensessions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ScreenRecordingSessionListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recordings_screensessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Trunking.V1.RecordingContext #{context}>\"\n end",
"def get_recording_settings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.get_recording_settings ...\"\n end\n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/settings\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'createDefault'] = opts[:'create_default'] if opts[:'create_default']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RecordingSettings')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#get_recording_settings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Trunking.V1.RecordingContext #{context}>\"\n end",
"def get_recordings\n # raise 'Login first!' unless @customer_login_id\n\n response = @savon.call :get_customer_recordings, \n message: { 'wsdl:sessionID' => session_id }\n\n # Returns an array of instances of the Recording class\n @recordings = TranscribeMe::Recording.new_from_soap response.body[:get_customer_recordings_response][:get_customer_recordings_result][:recording_info]\n end",
"def set_audio_recording\n @audio_recording = AudioRecording.find(params[:id])\n end"
] |
[
"0.77321714",
"0.7124799",
"0.7103942",
"0.6680091",
"0.654284",
"0.6399653",
"0.6372261",
"0.6351654",
"0.6338941",
"0.6253416",
"0.62393284",
"0.6119873",
"0.61112463",
"0.6082434",
"0.59883547",
"0.59631765",
"0.5927142",
"0.5891637",
"0.5844049",
"0.5837947",
"0.58143103",
"0.5790108",
"0.5767006",
"0.5752412",
"0.5734174",
"0.57097673",
"0.5702891",
"0.5698513",
"0.56453574",
"0.5591189",
"0.5555078",
"0.5545989",
"0.5543895",
"0.55396956",
"0.552243",
"0.5515591",
"0.5462731",
"0.5438591",
"0.54371506",
"0.54359204",
"0.5430006",
"0.54145324",
"0.5361197",
"0.5314487",
"0.5310832",
"0.5309741",
"0.5306307",
"0.5300426",
"0.52890766",
"0.5286319",
"0.52778167",
"0.5273493",
"0.5259261",
"0.5255258",
"0.52365",
"0.5219149",
"0.5217159",
"0.52131486",
"0.519045",
"0.519045",
"0.5168322",
"0.5166028",
"0.5135973",
"0.5133258",
"0.5124843",
"0.5109575",
"0.510345",
"0.51003927",
"0.50906646",
"0.5083517",
"0.50823337",
"0.507019",
"0.5064022",
"0.5048539",
"0.50422853",
"0.50395983",
"0.50185966",
"0.50172615",
"0.49600363",
"0.49567562",
"0.49525836",
"0.49437222",
"0.4941053",
"0.49299416",
"0.49283051",
"0.4913494",
"0.49048617",
"0.48858157",
"0.48686147",
"0.4860888",
"0.48597118",
"0.4852566",
"0.48470882",
"0.4830744",
"0.4826918",
"0.48256025",
"0.48202968",
"0.48078808",
"0.48076952",
"0.48000452"
] |
0.7974899
|
0
|
Public: Calls the 'FinalizeSession' SOAP Action to close the session on the server Returns the SOAP response Hash
|
def finalize_session
@soap_client.call :finalize_session,
message: { 'wsdl:sessionID' => @session_id }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def finalize_session\n @savon.call :finalize_session, \n message: { 'wsdl:sessionID' => @session_id }\n end",
"def session_close\n begin\n auth.globals[:headers]['Cookie'] = \"SID=\\\"#{session_id}\\\"\"\n auth.call(:close_session)\n rescue Savon::SOAPFault => e\n # Savon::SOAPFault: (soap:Server) No matches returned for SessionID\n logger.warn(e.inspect)\n end\n session_reset\n end",
"def close\n if connected? && @soap_client\n @soap_client.EndSession(@ticket)\n @soap_client.CloseConnection\n @soap_client = nil\n @ticket = nil\n end \n end",
"def C_CloseSession()\n @pk.C_CloseSession(@sess)\n self\n end",
"def close\n if @session\n @session.update_session(marshalize(@data))\n @session = nil\n end\n end",
"def close\n @repo.request_http(:post, path('session/close'),\n :expected_status_code => 204)\n end",
"def end\n # todo: catch when there is no valid session?\n do_request(:post, path: @config[:end_session_url], payload: {:SessionToken => @session_token})\n connection.headers['x-sessionToken'] = ''\n @session_token = ''\n end",
"def finalize_session\n session_stores.each { |name, store| store.finalize(self) }\n end",
"def logout\n res = query(\"logout\")\n @sessionid = nil\n puts \"ACS: Logged out\"\n return res.body\n end",
"def logout\n \n # test if session is unauth'd\n (print_error \"invalid nonce\";return @body = \"{ success : true }\") if not @session.valid_nonce?(@request)\n (print_error \"invalid session\";return @body = \"{ success : true }\") if not @session.valid_session?(@request)\n \n @headers['Content-Type']='application/json; charset=UTF-8'\n \n # set the session to be log out\n @session.set_logged_out\n \n # clean up UA and expire the session cookie\n config = BeEF::Core::Configuration.instance\n session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name\n Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => \"\", :path => \"/\", :httponly => true, expires: Time.now})\n\n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has successfuly logged out.\")\n @body = \"{ success : true }\"\n \n end",
"def api_logout\n return if @session_id.nil?\n\n request_body = String.new\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n xml.Envelope do\n xml.Body do\n xml.Logout\n end\n end\n\n send_xml_api_request(request_body)\n self.session_id = nil\n end",
"def close\n @logger.debug(@host) { 'Closing session' }\n @transport.close\n @transport = nil\n end",
"def iress_session_end()\n\t\tresult = @iress.call(:iress_session_end, message: {})\n\t\tputs result\n\t\treturn result\n\tend",
"def session_destroy(input={}, raw=false)\n response = get('mw/Session.Destroy', input, raw)\n end",
"def close\r\n unbind\r\n # try to stop eventmachine loop\r\n EM.stop rescue\r\n @on_close.call if @on_close\r\n WinRM::Log.debug(\":session => :close\")\r\n end",
"def httpdigest_logout\n session.delete(SESSION_NONCE)\n session.delete(SESSION_OPAQUE)\n end",
"def close_session\n @session.close unless @session.nil?\n @session = nil\n end",
"def close\n @session.connection.close\n end",
"def close\n ensure_session!\n\n session.release!\n end",
"def logout\n response = send_method(:logout)\n debug response.to_html\n if response[:status] == SUCCESS\n @encoder.session_key = nil\n true\n else\n false\n end\n end",
"def close\n tagged_response(\"CLOSE\")\n end",
"def process_logout_response\n settings = Account.get_saml_settings(get_url_base)\n request_id = session[:transaction_id]\n logout_response = OneLogin::RubySaml::Logoutresponse.new(params[:SAMLResponse], settings, :matches_request_id => request_id, :get_params => params)\n logger.info \"LogoutResponse is: #{logout_response.response.to_s}\"\n\n # Validate the SAML Logout Response\n if not logout_response.validate\n error_msg = \"The SAML Logout Response is invalid. Errors: #{logout_response.errors}\"\n logger.error error_msg\n render :inline => error_msg\n else\n # Actually log out this session\n if logout_response.success?\n logger.info \"Delete session for '#{session[:nameid]}'\"\n reset_session\n end\n end\n end",
"def C_Logout()\n @pk.C_Logout(@sess)\n self\n end",
"def end()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('session', 'end', 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 end_session\n update_session(Time.now)\n end",
"def keep_alive\n response = @client.request :keep_alive do\n soap.header = {\n \"Header\" => {\n \"SessionID\" => session_id\n },\n :attributes! => {\n \"Header\" => {:xmlns => \"http://www.twinfield.com/\"}\n }\n }\n soap.body = \"<KeepAliveResponse xmlns='http://www.twinfield.com/' />\"\n end\n # TODO: Return real status\n # There is no message from twinfield if the action succeeded\n return \"Ok\"\n end",
"def logout\n session_delete\n @token = ''\n @seqid = 0\n auth_header\n end",
"def cleanup\n @session_id = nil\n end",
"def finish ; request.session.save ; @response.finish ; end",
"def end_session\n post \"account/end_session\", :post => {}\n end",
"def process_logout_response\n request_id = session[:transaction_id]\n logout_response = OneLogin::RubySaml::Logoutresponse.new(params[:SAMLResponse], settings, :matches_request_id => request_id, :get_params => params)\n logger.info \"LogoutResponse is: #{logout_response.response.to_s}\"\n\n # Validate the SAML Logout Response\n if not logout_response.validate\n error_msg = \"The SAML Logout Response is invalid. Errors: #{logout_response.errors}\"\n logger.error error_msg\n render :inline => error_msg\n else\n # Actually log out this session\n if logout_response.success?\n logger.info \"Delete session for '#{session[:nameid]}'\"\n reset_session\n end\n end\n end",
"def close_app\n if @session_id && @app\n @logger.info \"Disconnecting from #{@app}.#{@cube}\"\n @req.Logout do |xml|\n xml.sID @session_id\n end\n invoke\n @app = nil\n @cube = nil\n @dimensions = nil\n @default_pov = nil\n end\n end",
"def finalize()\n @ssl_client.close\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def logout\n @session.delete unless @session.nil? # Will close the existing session\n @session = nil\n @challenge = '' # no current session, so no challenge string\n clear_cgi_cookies\n end",
"def process_logout_response\n settings = saml_settings(url_base)\n request_id = session[:transaction_id]\n logout_response = OneLogin::RubySaml::Logoutresponse.new(\n params[:SAMLResponse], settings, matches_request_id: request_id, get_params: params\n )\n logger.info \"LogoutResponse is: #{logout_response.response}\"\n\n # Validate the SAML Logout Response\n if !logout_response.validate\n error_msg = \"The SAML Logout Response is invalid. Errors: #{logout_response.errors}\"\n logger.error error_msg\n render inline: error_msg\n elsif logout_response.success?\n # Actually log out this session\n logger.info \"Delete session for '#{session[:nameid]}'\"\n\n # Devise sign_out\n sign_out current_user\n end\n end",
"def close\n @registry[:transport][:session].close if @open\n @open = false\n end",
"def logout\n close_session\n end",
"def close(context)\n context.debug('Logout connection')\n @connection_info = nil\n @client.logout\n @client = nil\n @system = nil\n end",
"def close()\r\n _dprint(\"Closing Auth_WiKID connection ...\")\r\n unless $sslsocket.nil?\r\n unless $sslsocket.closed?\r\n $sslsocket.puts(\"QUIT\");\r\n $sslsocket.flush\r\n $sslsocket.close\r\n end\r\n $sslsocket = nil\r\n @socket.shutdown\r\n end\r\n @isConnected = false\r\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def close\n @client.session.close unless @client.session.closed?\n end",
"def close_session()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::CloseSession::CloseSessionRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def close\n return unless @session\n update\n @session = nil\n end",
"def initialize_session\n response = @soap_client.call :initialize_session\n # Without ActiveSupport\n # 1.hour.from_now is 3600 seconds from Time.now\n @session_expiry_time = Time.now + 3600\n @session_id = response.body[:initialize_session_response][:initialize_session_result]\n end",
"def close()\n # If we don't have one we don't do anything\n return if !@is_scproxy or !self.has_session?\n\n # Send the call to the master\n response = self.proxy_close :port => @port, :master => true\n\n # Did we close it?\n if response[\"status\"] == true\n # Clear our session\n @port = nil\n else\n # Show an error\n raise response[\"message\"]\n end\n end",
"def logout\n return true unless session_id.present? && auth_token.present?\n\n response = self.class.get('/logout.aspx', :headers => auth_header)\n xml = response.parsed_response\n\n response.success? && !xml['bbapi'].has_key?('error')\n end",
"def on_session_close(session)\n\tend",
"def destroy_session\n session = Authentication::Session.active_token_session(auth_token)\n session.logout unless session.nil?\n clear_cache(auth_token)\n return {'success' => true}\n end",
"def finalize_session\n new_session = request.session.read_cookie\n if @original_session != new_session\n options = {:expires => (Time.now + _session_expiry)}\n options[:domain] = _session_cookie_domain if _session_cookie_domain\n cookies.set_cookie(_session_id_key, new_session, options)\n end\n end",
"def quit\n session.connection.close\n end",
"def finalize(request)\n if @_destroy\n store.delete_session(self.session_id)\n request.destroy_session_cookie\n else\n if _fingerprint != Marshal.dump(data = self.to_hash).hash\n begin\n store.store_session(request.session(self.class.session_store_type).session_id, data)\n rescue => err\n Merb.logger.warn!(\"Could not persist session to #{self.class.name}: #{err.message}\")\n end\n end\n if needs_new_cookie || Merb::SessionMixin.needs_new_cookie?\n request.set_session_id_cookie(self.session_id)\n end\n end\n end",
"def finalize_state_machine\n binary = Binary.new\n success = Binding.mongocrypt_ctx_finalize(@ctx, binary.ref)\n raise_from_status unless success\n\n binary.to_string\n end",
"def closeSession\n FBSession.activeSession.closeAndClearTokenInformation\n end",
"def logout\n response = @session.delete\n @auth_token = nil\n @rest.default_headers = { 'Content-Type' => 'application/json' }\n response\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def close_and_shutdown\n handle_action_exceptions(__method__) do\n unload_toolshck\n shutdown\n unload_winrm_ps\n logger('debug', 'close') { 'done!' }\n @closed = true\n @json ? { 'result' => 'Success' } : true\n end\n end",
"def end_session\n if !@session.nil?\n connection.EndSession(@session)\n @session = nil\n true\n else\n false\n end\n end",
"def session_end!(destroy=true)\n if destroy\n session.clear\n else\n session['sinatra.session'] = false\n end\n end",
"def logout\n raise SocketError, \"Socket must be opened before logging out\" if !@socket or @socket.closed?\n\n xml = new_epp_request\n\n xml.root << command = Node.new(\"command\")\n\n command << login = Node.new(\"logout\")\n command << Node.new(\"clTRID\", SecureRandom.uuid)\n\n response = Hpricot::XML(send_request(xml.to_s))\n\n handle_response(response, 1500)\n end",
"def op_close_connection\n return 'Close error: invalid ticket' unless valid?\n\n @ticket.update!(state: 'Finished') unless ['ConnectionError', 'RequestError'].include?(@ticket.state)\n log \"Closed connection with QuickBooks\"\n\n 'OK'\n end",
"def logout\n raise \"Cannot logout without a user context.\" if user_context.nil?\n \n @response = client.request :user, :logout do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n\n soap.body = {\n :user_context => user_context \n }\n end\n\n @user_context = nil\n end",
"def finalize\n @service.context.post(@control_path, :action => 'finalize')\n self\n end",
"def finalize(request)\n if @_destroy\n request.destroy_session_cookie\n elsif _original_session_data != (new_session_data = self.to_cookie)\n request.set_session_cookie_value(new_session_data)\n end\n end",
"def user_logout\n res = http_delete(:uri=>\"/session\", :fields=>x_cookie)\n return res.code\n end",
"def logout\n # If we're given a logout request, handle it in the IdP logout initiated method\n if params[:SAMLRequest]\n return idp_logout_request\n\n # We've been given a response back from the IdP\n elsif params[:SAMLResponse]\n return process_logout_response\n elsif params[:slo]\n return sp_logout_request\n else\n reset_session\n end\n end",
"def logout\n # If we're given a logout request, handle it in the IdP logout initiated method\n if params[:SAMLRequest]\n return idp_logout_request\n\n # We've been given a response back from the IdP\n elsif params[:SAMLResponse]\n return process_logout_response\n elsif params[:slo]\n return sp_logout_request\n else\n reset_session\n end\n end",
"def closekeepalive\n response.headers['Connection'] = 'Close'\n render :text => ''\n end",
"def org_logout\n #dbgprint(\"calling org_logout\")\n perform_with_session_expire_retry {\n auth_login unless logged_in?\n http = @http\n path = BSAPI+\"mem/organization/logout?format=xml\"\n headers = get_default_headers\n resp = http.get(path, headers)\n handle_server_response(path, resp, resp.body)\n @active_oid = nil\n true\n }\n end",
"def end_session\n if !ended? && @client\n if within_states?(TRANSACTION_IN_PROGRESS_STATE)\n begin\n abort_transaction\n rescue Mongo::Error, Error::AuthError\n end\n end\n if @server_session\n @client.cluster.session_pool.checkin(@server_session)\n end\n end\n ensure\n @server_session = nil\n @ended = true\n end",
"def close\n @connection.close # Close the active mailbox\n @connection.logout # Send the logout command\n @connection.disconnect # Close the actual connection\n end",
"def process_reset_session(session, connection_initialize: false)\n # set active command sequence info\n session[:cmd_sequence] = connection_initialize ? :CMD_HELO : :CMD_RSET\n # drop any auth challenge\n session[:auth_challenge] = {}\n # test existing of :ctx hash\n session[:ctx] || session[:ctx] = {}\n # reset server values (only on connection start)\n if connection_initialize\n # create or rebuild :ctx hash\n # and mark strings as mutable\n session[:ctx].merge!(\n server: {\n local_host: +'',\n local_ip: +'',\n local_port: +'',\n local_response: +'',\n remote_host: +'',\n remote_ip: +'',\n remote_port: +'',\n helo: +'',\n helo_response: +'',\n connected: +'',\n exceptions: 0,\n errors: [],\n authorization_id: +'',\n authentication_id: +'',\n authenticated: +'',\n encrypted: +''\n }\n )\n end\n # reset envelope values\n session[:ctx].merge!(\n envelope: {\n from: +'',\n to: [],\n encoding_body: +'',\n encoding_utf8: +''\n }\n )\n # reset message data\n session[:ctx].merge!(\n message: {\n received: -1,\n delivered: -1,\n bytesize: -1,\n headers: +'',\n crlf: +\"\\r\\n\",\n data: +''\n }\n )\n end",
"def close()\n if isConnected()\n if @sentConnect\n @sentConnect = false # set in connect()\n @signedOn=false # set in signOn() inside connect()\n bye = VistaRPC.new(\"#BYE#\", RPCResponse::SINGLE_VALUE, true)\n retval = execute(bye)\n @socket.close()\n @socket = nil\n @duz = \"0\"\n @lastvistaerror = nil\n @currentContext = nil\n return retval\n end\n end\n end",
"def build_response(session_end = true)\n response_object = build_response_object(session_end)\n response = Hash.new\n response[:version] = @version\n response[:sessionAttributes] = @session_attributes unless @session_attributes.empty?\n response[:response] = response_object\n response.to_json\n end",
"def sp_logout_request\n # LogoutRequest accepts plain browser requests w/o paramters\n settings = Account.get_saml_settings(get_url_base)\n\n if settings.idp_slo_target_url.nil?\n logger.info \"SLO IdP Endpoint not found in settings, executing then a normal logout'\"\n reset_session\n else\n\n # Since we created a new SAML request, save the transaction_id\n # to compare it with the response we get back\n logout_request = OneLogin::RubySaml::Logoutrequest.new()\n session[:transaction_id] = logout_request.uuid\n logger.info \"New SP SLO for User ID: '#{session[:nameid]}', Transaction ID: '#{session[:transaction_id]}'\"\n\n if settings.name_identifier_value.nil?\n settings.name_identifier_value = session[:nameid]\n end\n\n relayState = url_for controller: 'saml', action: 'index'\n redirect_to(logout_request.create(settings, :RelayState => relayState))\n end\n end",
"def sp_logout_request\n # LogoutRequest accepts plain browser requests w/o paramters\n settings = saml_settings\n\n if settings.idp_slo_target_url.nil?\n logger.info \"SLO IdP Endpoint not found in settings, executing then a normal logout'\"\n delete_session\n else\n\n # Since we created a new SAML request, save the transaction_id\n # to compare it with the response we get back\n logout_request = OneLogin::RubySaml::Logoutrequest.new()\n session[:transaction_id] = logout_request.uuid\n logger.info \"New SP SLO for userid '#{session[:userid]}' transactionid '#{session[:transaction_id]}'\"\n\n if settings.name_identifier_value.nil?\n settings.name_identifier_value = session[:userid]\n end\n\n relay_state = url_for controller: 'saml', action: 'show'\n redirect_to(logout_request.create(settings, RelayState: relay_state))\n end\n end",
"def session\n refreshed = Requests::AuthSession.new(request)\n .fetch\n .as_model\n\n response.headers['Access-Control-Expose-Headers'] = Models::AuthToken::SESSION_HEADER_NAME\n response.headers[Models::AuthToken::SESSION_HEADER_NAME] = refreshed.session\n\n 204\n end",
"def sp_logout_request\n # LogoutRequest accepts plain browser requests w/o paramters\n\n if settings.idp_slo_target_url.nil?\n logger.info \"SLO IdP Endpoint not found in settings, executing then a normal logout'\"\n reset_session\n else\n\n # Since we created a new SAML request, save the transaction_id\n # to compare it with the response we get back\n logout_request = OneLogin::RubySaml::Logoutrequest.new()\n session[:transaction_id] = logout_request.uuid\n logger.info \"New SP SLO for User ID: '#{session[:nameid]}', Transaction ID: '#{session[:transaction_id]}'\"\n\n if settings.name_identifier_value.nil?\n settings.name_identifier_value = session[:nameid]\n end\n\n relayState = url_for controller: 'saml', action: 'index'\n redirect_to(logout_request.create(settings, :RelayState => relayState))\n end\n end",
"def close\n close_connection(CLOSED, true)\n end",
"def build_response_object(session_end = true)\n @response = Hash.new\n @response[:outputSpeech] = @speech unless @speech.nil?\n @response[:card] = @card unless @card.nil?\n @response[:reprompt] = @reprompt unless session_end && @reprompt.nil?\n @response[:shouldEndSession] = session_end\n @response\n end",
"def destroy_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.destroy_session ...'\n end\n # resource path\n local_var_path = '/v1/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#destroy_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def close_session(session_id)\n @allocator.release_id session_id\n end",
"def close_connection\n @connection.finish\n end",
"def close\n frame = Hash.new\n frame['command'] = 'close'\n @close_txnr=self.frame_write(@socket, frame)\n #TODO: ought to properly wait for a reply etc. The serverclose will make it work though\n sleep @retransmission_timeout\n return @buffer\n ensure\n @socket.close\n end",
"def end_session\n self.update_attributes(session_expires_in: Time.now)\n end",
"def close\n handle.finish if handle.started?\n self.cookies = {}\n end",
"def kill_session\n @authenticator.kill_session\n @session = ''\n end",
"def disconnect\n reset_session\n redirect = \"#{ENV['LOGOUT_ENDPOINT']}\"\\\n \"?post_logout_redirect_uri=#{ERB::Util.url_encode(root_url)}\"\n logger.info 'REDIRECT: ' + redirect\n redirect_to redirect\n end",
"def sso_logout\n # Logout of Bobcat first while we still have the PDS_HANDLE cookie\n bobcat_logout.logout!\n # Then clear all library.nyu.edu cookies\n cookies.clear(domain: ENV['LOGIN_COOKIE_DOMAIN'])\n # If a user logs into client application and then logs out of that application\n # and then tries to login to another SSO client application, passive shibboleth\n # will be called and log them in automatically, this stops that\n session[:_check_passive_shibboleth] = true\n end",
"def test_close\n @session.close\n\n refute @connection.closed?\n end",
"def exec_logout\n core_destroySession\n redirect_to lato_core.login_path\n end",
"def idp_logout_request\n settings = Account.get_saml_settings(get_url_base)\n logout_request = OneLogin::RubySaml::SloLogoutrequest.new(params[:SAMLRequest], :settings => settings)\n if not logout_request.is_valid?\n error_msg = \"IdP initiated LogoutRequest was not valid!. Errors: #{logout_request.errors}\"\n logger.error error_msg\n render :inline => error_msg\n end\n logger.info \"IdP initiated Logout for #{logout_request.nameid}\"\n\n # Actually log out this session\n reset_session\n\n logout_response = OneLogin::RubySaml::SloLogoutresponse.new.create(settings, logout_request.id, nil, :RelayState => params[:RelayState])\n redirect_to logout_response\n end",
"def close\n end_session\n if connected? && connection.CloseConnection.nil?\n @connected = false\n @connection = nil\n Connection.connections = Connection.connections - [self]\n end\n return !@connected # Returns false if CloseConnection failed.\n end",
"def idp_logout_request\n logout_request = OneLogin::RubySaml::SloLogoutrequest.new(params[:SAMLRequest], :settings => settings)\n if not logout_request.is_valid?\n error_msg = \"IdP initiated LogoutRequest was not valid!. Errors: #{logout_request.errors}\"\n logger.error error_msg\n render :inline => error_msg\n end\n logger.info \"IdP initiated Logout for #{logout_request.nameid}\"\n\n # Actually log out this session\n reset_session\n\n logout_response = OneLogin::RubySaml::SloLogoutresponse.new.create(settings, logout_request.id, nil, :RelayState => params[:RelayState])\n redirect_to logout_response\n end",
"def destroy( response )\n\t\tself.log.debug \"Destroying session %s\" % [ self.session_id ]\n\t\tself.class.delete_session_data( self.session_id )\n\n\t\tself.log.debug \"Adding expired session cookie to the response\"\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\t\tsession_cookie.expire!\n\n\t\tresponse.cookies << session_cookie\n\tend",
"def idp_logout_request\n logout_request = OneLogin::RubySaml::SloLogoutrequest.new(params[:SAMLRequest], settings: saml_settings)\n\n if !logout_request.is_valid?\n render_logout_failure(logout_request.errors)\n else\n session.destroy\n logout_response = OneLogin::RubySaml::SloLogoutresponse.new.create(saml_settings, logout_request.id, nil, RelayState: params[:RelayState])\n redirect_to logout_response\n end\n end",
"def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end",
"def finalize\n @server.close if @server\n end",
"def disconnect\n _logout\n @connection.close\n end"
] |
[
"0.7693333",
"0.66729575",
"0.63352805",
"0.6327183",
"0.6279471",
"0.6266235",
"0.60532063",
"0.60104865",
"0.5952604",
"0.59095734",
"0.59029317",
"0.58727735",
"0.58134305",
"0.5778133",
"0.5756415",
"0.5742522",
"0.5734387",
"0.5711704",
"0.5682101",
"0.5673438",
"0.56632555",
"0.56623906",
"0.56206346",
"0.5620542",
"0.5608071",
"0.56072915",
"0.56013536",
"0.55703115",
"0.5570164",
"0.5556235",
"0.554881",
"0.5547728",
"0.5538279",
"0.5536643",
"0.55275154",
"0.5523062",
"0.54998595",
"0.5489648",
"0.5487896",
"0.54661965",
"0.54556084",
"0.5441387",
"0.5424155",
"0.5416564",
"0.5412841",
"0.5399858",
"0.53989697",
"0.53717506",
"0.53641427",
"0.5342893",
"0.5339148",
"0.53359556",
"0.5334196",
"0.5276553",
"0.5265403",
"0.525839",
"0.5224966",
"0.5222246",
"0.5205439",
"0.5193173",
"0.51925015",
"0.5174218",
"0.51655364",
"0.51382643",
"0.51372653",
"0.5133894",
"0.5115197",
"0.5115197",
"0.51131827",
"0.51081765",
"0.5100923",
"0.50959134",
"0.5095546",
"0.5081645",
"0.50717866",
"0.5065201",
"0.5055334",
"0.503767",
"0.50170106",
"0.5015337",
"0.50136364",
"0.5005448",
"0.5001774",
"0.49998587",
"0.499896",
"0.4993741",
"0.49860114",
"0.49607873",
"0.49424523",
"0.493926",
"0.49339363",
"0.49320608",
"0.49213478",
"0.49140415",
"0.49125218",
"0.4906485",
"0.48975495",
"0.48973745",
"0.48914042",
"0.48913404"
] |
0.804677
|
0
|
Private: Checks if the session expiry time has passed Returns a Boolean
|
def session_valid?
@session_expiry_time > Time.now if @session_expiry_time
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def session_valid?\n @session_expiry_time > Time.now if @session_expiry_time\n end",
"def session_expired?\n ! (Time.now < session[:expire_at])\n end",
"def session_expiry\n reset_session if session[:expiry_time] and session[:expiry_time] < Time.now\n\n session[:expiry_time] = MAX_SESSION_PERIOD.seconds.from_now\n return true\n end",
"def session_expired?\n if session[:last_authenticated_action_at]\n session_expires_at = session[:last_authenticated_action_at] + (60 * 60 * SESSION_HOURS)\n session_expires_at < Time.now\n else\n false\n end\n end",
"def session_expired?\n return remote_user_name.nil? if remote_auth?\n return true if session[:timeout].nil?\n\n Time.zone.parse(session[:timeout]) < Time.current\n end",
"def expired_session?\n if session_info.nil?\n false\n else\n creds = session_info['credentials']\n creds['expires'] && creds['expires_at'] <= Time.now.to_i\n end\n end",
"def expiring?\n return true if expires - Time.now < 60\n return false\n end",
"def session_expired?\n return true unless !session[:timeout].nil?\n if MarkusConfigurator.markus_config_remote_user_auth\n return true if @markus_auth_remote_user.nil?\n # Expire session if remote user does not match the session's uid\n current_user = User.find_by_id(session[:uid])\n if !current_user.nil?\n return true if ( current_user.user_name != @markus_auth_remote_user )\n end\n end\n return session[:timeout] < Time.now\n end",
"def check_session_expiry\n manage_session_expiry(ReferenceData::SystemParameter.lookup('PWS', 'SYS', 'RSTU', safe_lookup: true))\n end",
"def expired?\n if expires?\n Time.now >= expires_at\n else\n false\n end\n end",
"def session_expired?\n return true if session[:timeout].nil?\n if Settings.remote_user_auth\n # expire session if there is not REMOTE_USER anymore.\n return true if @markus_auth_remote_user.nil?\n # If somebody switched role this state should be recorded\n # in the session. Expire only if session timed out.\n unless session[:real_uid].nil?\n # Roles have been switched, make sure that\n # real_user.user_name == @markus_auth_remote_user and\n # that the real user is in fact an admin.\n real_user = User.find_by_id(session[:real_uid])\n if real_user.user_name != @markus_auth_remote_user ||\n !real_user.admin?\n return true\n end\n # Otherwise, expire only if the session timed out.\n return Time.zone.parse(session[:timeout]) < Time.current\n end\n # Expire session if remote user does not match the session's uid.\n # We cannot have switched roles at this point.\n current_user = User.find_by_id(session[:uid])\n unless current_user.nil?\n return true if current_user.user_name != @markus_auth_remote_user\n end\n end\n # No REMOTE_USER is involed.\n Time.zone.parse(session[:timeout]) < Time.current\n end",
"def expired?\n Time.now > expiration if expiration\n end",
"def expired?\n can_expire? && @expiry < Time.now.to_i\n end",
"def expired?\n return true if expires - Time.now <= 0\n return false\n end",
"def session_expiry\n unless session[:expires_at].nil?\n @time_left = (session[:expires_at] - Time.now).to_i\n unless @time_left > 0\n logout_killing_session!\n flash[:error] = 'Your session expired. Please, login again.'\n redirect_to login_url\n end\n end\n end",
"def session_expiry\n unless session[:expires_at].nil?\n @time_left = (session[:expires_at] - Time.now).to_i\n unless @time_left > 0 \n logout_killing_session!\n gflash :notice => 'Your session expired. Please, login again.'\n redirect_to login_url\n end \n end \n end",
"def expired?\n return false if @expires_in.nil?\n @start_time + Rational(@expires_in - @refresh_timeout, 86400) < DateTime.now\n end",
"def expired?\n expires_at && Time.now > expires_at\n end",
"def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"def expired?\n age > ttl\n end",
"def expired?\n age > ttl\n end",
"def prepare_session\n if !session[:expiry_time].nil? and session[:expiry_time] < Time.now\n reset_session\n end\n\n session[:expiry_time] = MAX_SESSION_TIME.minutes.from_now\n return true\n end",
"def expired?\n expires_at && expires_at <= Time.now\n end",
"def expired?\n return false unless expires_at\n expires_at < Time.now\n end",
"def expired?\n Time.now > @expires\n end",
"def expired?\n Time.current >= expires_at\n end",
"def expired?\n exp < Time.now.to_i\n end",
"def expired?(expire_time)\n return false if expire_time.nil? # Assume that expire check is disabled.\n return true unless expire_time.respond_to?(:to_i) # Verify that expire_time can be converted into an integer.\n\n # Checks to see if the expire time will elapse in the next 10 seconds.\n # True if now is greater than expire time. False if now is less than expire time.\n Time.now.to_i >= (expire_time.to_i - 10)\n end",
"def time_expired?\n (Time.now - @duration) > @start_time\n end",
"def cached_daw_session_valid?\n login_time_set = rdaw_session.include?(:login_time)\n session_age = Time.now - Time.parse(rdaw_session[:login_time]) if login_time_set\n is_valid = login_time_set && session_age < session_timeout\n\n logger.debug('[rdaw] session expired or invalid') unless is_valid\n cookie_changed = hashcookie != rdaw_session[:hash]\n logger.debug(\"[rdaw] session invalidated because #{daw_cookie_name} cookie changed\") if cookie_changed\n\n is_valid && !cookie_changed\n end",
"def expired?\n @expiry_time < Time.now\n end",
"def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end",
"def check_validity\n if @expires_at == nil\n raise OAuthSessionError, \"Expiration not properly initialized.\"\n end\n if @expires_at < Time.new\n if not do_refresh\n raise OAuthSessionError, \"Token could not be refreshed.\"\n end\n end\n return true\n end",
"def expired?\n self.expires_at && Time.now > self.expires_at\n end",
"def expired?\n expires? && (expires_at < Time.now.to_i)\n end",
"def session_expiry\n @session_expiry ||= 30 * 24 * 60 * 60\n end",
"def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end",
"def expiry_time\n session[:expires_at] || 3.days.from_now\n end",
"def can_expire?\n return !!@expiry\n end",
"def expired?\n expires? && (Time.now > expires_at)\n end",
"def session_expiry\n get_session_time_left\n unless @session_time_left > 0\n # Commented this out as this was showing when the server comes up after being idle\n # If a user's session times out, the user is shown the message in sessions_helper.rb, deny_access method\n # flash.now[:error] = \"Your session has timed out or you haven't logged in. Please log in.\"\n sign_out\n \n end\n end",
"def expired?\n DateTime.now.utc >= self.expires_at\n end",
"def expired?\n return true if authentication.nil?\n\n authentication.expires_at < 2.days.from_now\n end",
"def access_expired? (time = Time.current)\n access_expires_at && time > access_expires_at\n end",
"def expired?\n DateTime.now > @expires\n end",
"def expired?\n @expires_at <= Time.now\n end",
"def expired?\n !expires_at.nil? && Time.now >= expires_at\n end",
"def expired?\n expires_at.to_time <= Time.now.utc\n end",
"def expired?\n expires_at.to_time <= Time.now.utc\n end",
"def session?\n !expires_at || discard\n end",
"def expired?\n Time.now > @expiration if @expiration\n end",
"def expired?\n can_expire? && (self.expires_in + self.time_created) < Time.now.to_i\n end",
"def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end",
"def expired?\n Time.now.in_time_zone > expires_at\n end",
"def expired_time? time\n time + self.class.ttl_in_seconds.to_i < Time.now\n end",
"def expired?\n expires && expires < Time.now\n end",
"def session_expiry\n @time_left = (expiry_time - Time.now).to_i\n do_flash = false\n unless @time_left > 0\n unless current_user_session.nil?\n current_user_session.destroy\n do_flash = true\n end\n reset_session\n store_location\n flash[:notice] = t('app.security.session_expired',\n :default => \"Your session has been expired by inactivity.\") if do_flash\n redirect_to new_session_url\n end\n end",
"def check_cert_expiring\n cert = certificate_get\n expire_date = cert.not_after\n\n now = Time.now\n # Calculate the difference in time (seconds) and convert to hours\n hours_until_expired = (expire_date - now) / 60 / 60\n\n if hours_until_expired < resource[:regenerate_ttl]\n true\n else\n false\n end\n end",
"def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end",
"def has_infinite_expiration?\n expiredate > Time.now+60*60\n end",
"def expires_within? sec\n !expires_at.nil? && Time.now >= (expires_at - sec)\n end",
"def refresh_expired?\n can_refresh_expire? && @refresh_expiry < Time.now.to_i\n end",
"def session_timeout\n #return if Rails.env.test?\n #check session last_seen\n if session[:last_seen] < SESSION_TIMEOUT_MINUTES.minutes.ago\n reset_session\n else\n session[:last_seen] = Time.now.utc\n end unless session[:last_seen].nil?\n #check when session created\n if Session.first.created_at < SESSION_WIPEOUT_HOURS.hours.ago\n Session.sweep\n end unless Session.first.nil?\n end",
"def expired?\n false\n end",
"def request_expired?\n parsed_timestamp < request_expires_at\n end",
"def is_expired?\n (!end_time.nil? and end_time < Clock.time)\n end",
"def expires?\n !!@expires_at\n end",
"def expired?\n self.expires_on? and self.expires_on < Time.now\n end",
"def expired?\n @expires_in && @created_at + @expires_in <= Time.now.to_f\n end",
"def expired?\n expiration_date <= Time.now\n end",
"def expires?\n !!expires_at\n end",
"def expired?\n if (self.last_retrieved == nil)\n return true\n elsif (self.time_to_live < 30.minutes)\n return (self.last_retrieved + 30.minutes) < Time.now.gmtime\n else\n return (self.last_retrieved + self.time_to_live) < Time.now.gmtime\n end\n end",
"def expired?\n Time.now - @created_time > @ttl\n end",
"def expired?\n Time.now > valid_until\n end",
"def is_valid?\n \tDateTime.now < self.expires_at\n end",
"def expires?\n !!@expires_at\n end",
"def expires? \n (Time.now.to_f*1000 - Trace.active_time) > @start_time\n end",
"def session_valid?(session_key)\n session = reviewer_access_sessions.by_session_key(session_key)\n session.present? ? !session.expired? : false\n end",
"def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end",
"def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end",
"def expired?\n Time.zone.today > expires_at\n end",
"def expires?\n self.duration.present?\n end",
"def is_valid?\n DateTime.now < self.expires_at\n end",
"def expired?\n Date.today > self.expires_on\n end",
"def expired?(now)\n @expires_at <= now\n end",
"def expired?\n end",
"def expired?\n return self.expires_on < Date.today if self.expires_on\n true\n end",
"def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end",
"def token_expired?\n self.expires < Time.zone.now.to_i\n end",
"def fresh?( ses_obj )\n return true if ses_obj['expire'] == 0\n now = Time.now\n ses_obj['expire'] >= now \n end",
"def expired?\n Time.now > self.to_be_expired_at\n end",
"def manage_session_expiry(sys_params)\n # initialise the session values using failover values if needed\n max_idle_mins = default_ttl_value(sys_params['MAX_IDLE_MINS'], 60)\n update_ttl(:SESSION_TTL_INDEX, max_idle_mins, false)\n update_ttl(:MAX_SESSION_EXPIRE_TIME_INDEX, default_ttl_value(sys_params['MAX_SESS_MINS'], 600), false)\n\n # check if it's expired and show session ended page\n redirect_to logout_session_expired_path if session_has_expired\n\n session_ttl_warning(max_idle_mins, sys_params['IDLE_WARN_MINS'])\n\n # user has done something so update session TTL\n update_ttl(:SESSION_TTL_INDEX, max_idle_mins, true)\n end",
"def check_session\n session.delete(\"accepted\") if session[:updated_at].present? && session[:updated_at].to_time <= 10.minutes.ago\n end",
"def expired?\n self.class.ttl_in_seconds && self.class.rates_expiration <= Time.now\n end",
"def can_expire?\n return !!self.expires_in && !!self.time_created\n end",
"def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end",
"def expired?\n return @expired\n end",
"def expired?\n timestamp.nil? || (Time.now.to_i - timestamp.to_i).abs > 300\n end",
"def expired?\r\n return Time.now > self.created_on + @@validity_time\r\n end"
] |
[
"0.86505353",
"0.85043937",
"0.8485214",
"0.8311907",
"0.82619697",
"0.8126619",
"0.8094892",
"0.79293305",
"0.7837234",
"0.76900136",
"0.7659409",
"0.7656007",
"0.7643836",
"0.76387304",
"0.7625968",
"0.7625725",
"0.76202387",
"0.7606185",
"0.7589389",
"0.7589389",
"0.75816417",
"0.75816417",
"0.7578755",
"0.75714535",
"0.7567401",
"0.7557254",
"0.7551556",
"0.75515544",
"0.7542815",
"0.7517561",
"0.7515589",
"0.751102",
"0.7508516",
"0.75065696",
"0.7500333",
"0.74922204",
"0.74685663",
"0.7467337",
"0.7460853",
"0.7440776",
"0.7440043",
"0.74381584",
"0.74349",
"0.7419951",
"0.7416663",
"0.7407673",
"0.7401529",
"0.73951536",
"0.73909163",
"0.73909163",
"0.7387373",
"0.73852444",
"0.73832476",
"0.73654246",
"0.73638487",
"0.73359174",
"0.7331387",
"0.7321228",
"0.729418",
"0.7283012",
"0.7278287",
"0.72779137",
"0.7273137",
"0.72696257",
"0.72609544",
"0.72606754",
"0.72542375",
"0.72307086",
"0.7229465",
"0.72275907",
"0.722404",
"0.7218412",
"0.7210653",
"0.7199732",
"0.7191553",
"0.71766514",
"0.7170462",
"0.7169367",
"0.7162467",
"0.71599007",
"0.71599007",
"0.7149063",
"0.7134661",
"0.71316576",
"0.71233886",
"0.71211207",
"0.7112065",
"0.7111622",
"0.71060675",
"0.7073122",
"0.7068134",
"0.70534205",
"0.7042937",
"0.70384496",
"0.70308685",
"0.70231825",
"0.7017456",
"0.70154107",
"0.7007661",
"0.70012826"
] |
0.87361157
|
0
|
POST Insert a recipe into database
|
def create
recipe = Recipe.new(recipe_params)
ingredients = params[:ingredients]
tags = params[:tags]
if recipe.save
if !ingredients.blank?
redirect_to api_v1_recipe_ingredients_url(recipe_id: recipe.id, ingredients: ingredients, tags: tags)
end
else
render json: {status: 'ERROR', message: 'Recipe not saved', data: recipe.errors}, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_to_database(recipe)\n\t\t# Parsing the recipe line\n\t\trecipe_db = Recipe.new(\n\t\t\ttitle: recipe[\"recipe\"][\"label\"].to_s,\n\t\t\timage: recipe[\"recipe\"][\"image\"].to_s,\n\t\t\tdescription: recipe[\"recipe\"][\"source\"].to_s,\n\t\t\tuser_id: 1\n\t\t\t)\n\t\trecipe_db.save\n\t\tputs recipe_db.errors.messages\n\t\tputs \"ID: #{recipe_db.id}\"\n\t\tputs \"TITLE: #{recipe_db.title}\"\n\t\tputs \"IMAGE: #{recipe_db.image}\"\n\t\t# Parsing the ingredients line\n\t\trecipe[\"recipe\"][\"ingredientLines\"].each do |ingredient|\n\t\t\t# Retrieving the ingredient\n\t\t\tingredient_db = Ingredient.create(\n\t\t\t\tname: ingredient,\n\t\t\t\trecipe_id: recipe_db.id\n\t\t\t\t)\n\t\t\trecipe_db.ingredients << ingredient_db\n\t\tend\n\n\t\trecipe_db\n\tend",
"def create_recipe(db,name,description,length,difficulty)\n q = \"INSERT INTO recipes (name,description,length,difficulty) VALUES ('#{name}','#{description}',#{length},#{difficulty});\"\n return db.execute(q)\nend",
"def create\n @recipe = Recipe.new(recipe_params)\n\n \n end",
"def create\n begin\n ActiveRecord::Base.transaction do\n @recipe = Recipe.find_or_create_by!(trusted_params)\n @ingredient = Ingredient.find_or_create_by!(ingredient: params[:recipe][:ingredient])\n\n new_ingredient_recipe = IngredientRecipe.new(\n ingredient_id: @ingredient.id,\n recipe_id: @recipe.id,\n )\n new_ingredient_recipe.save!\n \n redirect_to @recipe, notice: \"Recipe was successfully created.\"\n end\n rescue\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to recipes_path, notice: 'Recipe successfully created!!' }\n format.json { render json: @recipe }\n else\n format.html { render action: :new }\n format.json { render json: @recipe.errors }\n end\n end\n end",
"def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end",
"def add_recipe(recipe)\n @recipes.push(recipe)\n save\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save \n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n # if params[:add_ingredient]\n # @recipe.ingredients.build\n # end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n if @recipe.save\n redirect_to recipes_path\n else\n render :new\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n Instruction.multi_save(params[:instructions], @recipe)\n Ingredient.multi_save(params[:ingredients], @recipe)\n current_user.recipes << @recipe\n current_user.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to edit_recipe_path(@recipe), notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def create\n # @recipe = Recipe.new(params[:recipe])\n #\n create! do |success, failure|\n # if @recipe.save # Not needed!\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n # success.json { render json: @recipe, status: :created, location: @recipe }\n # else\n # failure.html { render action: \"new\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: \"Recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: \"Recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingredient_recipe = IngredientRecipe.new(ingredient_recipe_params)\n\n respond_to do |format|\n if @ingredient_recipe.save\n format.html { redirect_to @ingredient_recipe, notice: 'Ingredient recipe was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient_recipe }\n else\n format.html { render :new }\n format.json { render json: @ingredient_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n \n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.save_recipe_to_db(aws_params)\n msg = {:notice => \"Recipe created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(data)\n recipe = Beerinhand::Recipe.new(data)\n if recipe.valid?\n recipe.save!\n print \"#{recipe.name} \"\n else\n puts \"#{recipe.name}: #{recipe.errors.messages.to_s}\"\n end\nend",
"def create\n new_recipe = Recipe.create(recipe_params)\n redirect_to user_recipes_path(new_recipe.user)\n end",
"def create\n @food_recipe = FoodRecipe.new(params[:food_recipe])\n\n respond_to do |format|\n if @food_recipe.save\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully created.' }\n format.json { render json: @food_recipe, status: :created, location: @food_recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tset_tag_list\n\n @recipe = @current_user.recipes.build(params[:recipe])\n @recipe.status = @recipe.get_status\n item_client_ip(@recipe)\n # @recipe.is_draft = params[:is_draft]\n # @recipe.is_draft = @recipe.get_is_draft\n # @recipe.published_at = @recipe.get_published_at\n \n ActiveRecord::Base.transaction do \n\t\t\tif @recipe.save\n\t\t\t\t# @recipe.tag_list = params[:tags].strip if params[:tags] && !params[:tags].strip.blank?\n\t\t\t\treg_homepage(@recipe)\n\t\t\t\tafter_create_ok\n\t\t\telse\n\t\t\t\tafter_create_error\n\t\t\tend\n\t\tend\n end",
"def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.chef = Chef.find(2)\n \n if @recipe.save\n # shows a message when saved \n flash[:success] = \"Your recipe was created successfully!\"\n # redirect - index page\n redirect_to recipes_path\n else\n render :new\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n \n respond_to do |format|\n if @recipe.save\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to(@recipe) }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@recipe = Recipe.new(recipe_params)\n\n\t\t@user = User.find(session[:user_id])\n\t\t@recipe.user_id = @user.id\n\t\t@recipe.save\n\t\t# if @recipe.valid?\n\t\t# \t@recipe.save\n\t\t# \tredirect_to recipe_path(@recipe)\n\n\t\tif @recipe.save\n\t\t\tredirect_to recipe_path(@recipe)\n\t\telse\n\t\t\tredirect_to recipes_path\n\t\tend\t\t\n\tend",
"def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts recipe_params[:ingredients], recipe_params[:recipe], recipe_params[:user_id]\n recipe = Recipe.create(recipe_params[:recipe])\n if(recipe.valid?)\n Ingredient.create_and_assign(recipe_params[:ingredients], recipe.id)\n newUR = UserRecipe.create(recipe_id: recipe.id, user_id: recipe_params[:user_id])\n render json: UserRecipeSerializer.new(newUR).to_serialized_json\n else\n render json: recipe.errors.full_messages\n end\n end",
"def create\n @recipe_ingredient = RecipeIngredient.new(params[:recipe_ingredient])\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully created.' }\n format.json { render json: @recipe_ingredient, status: :created, location: @recipe_ingredient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n recipe = Recipe.create(recipe_params)\n render json: recipe\n end",
"def create\n @recipe_item = RecipeItem.new(recipe_item_params)\n\n respond_to do |format|\n if @recipe_item.save\n format.html { redirect_to @recipe_item.recipe, notice: 'Recipe item was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_item }\n else\n format.html { render :new }\n format.json { render json: @recipe_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe_ingredient = Recipe_ingredient.new(params[:recipe_ingredient])\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe_ingredient was successfully created.' }\n format.json { render json: @recipe_ingredient, status: :created, location: @recipe_ingredient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_recipe(db,name,description,length,difficulty)\n # your code here\nend",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to recipes_path, notice: 'Ingredient was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @recipe_ingredient = RecipeIngredient.new(recipe_ingredient_params)\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_ingredient }\n else\n format.html { render :new }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n @errors = process_ingredient_inputs(params, @recipe)\n @errors = [\"You must include at least one ingredient in your recipe\"] if @recipe.recipe_ingredients.empty?\n if(! @errors.empty?) then\n\t\t# reshow\n\t\t@errors.each{ |msg| @recipe.errors[:base] << msg } \n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\tend\n\t\treturn\n\tend\n\t@recipe.entered_by_id = @current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to(@recipe, :notice => 'Recipe was successfully created.') }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = current_user.recipes.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n if params[:lista].present?\n params[:lista].each do |(c,ingrediente)|\n Ingredient.create(name: ingrediente, recipe_id:@recipe.id) if ingrediente != \"\"\n end\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n format.js {flash.now[:notice] = 'La receta se ha creado de forma exitosa.'} #ajax\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al crear la receta.'} #ajax\n end\n end\n end",
"def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end",
"def test_insert_new_recipe\n @bakery.insert_new_recipe(@new_recipe)\n assert_equal(\"batch loaf\", @bakery.get_recipe_by_name(\"batch loaf\")[:name])\n end",
"def create_new_recipe3 user, params\n recipe = Recipe.new(name: params[\"recipe_name\"], create_time: Time.now.to_i, user_id: user.id, user_name: user.name)\n recipe.picture = params[\"recipe_url\"] if params[\"recipe_url\"] != nil\n raise Error::RecipeError, recipe.errors.messages.values[0][0] unless recipe.save\n\n ingredients = params[\"ingredients\"]\n ingredients.each { |ingredient| Ingredient.create(name: ingredient[\"name\"], amount: ingredient[\"amount\"], recipe_id: recipe.id)}\n\n steps = params[\"steps\"]\n steps.length.times { |i| Step.create(index: i+1, content: steps[i], recipe_id: recipe.id)}\n\n recipe\n end",
"def command_newRecipe(name, ingredients)\n bool = @database.add_recipe(name, ingredients)\n if bool == false\n puts \"Recipe already in database or ingredients not in database\"\n end\n @dbChanged = true\n end",
"def create\n @recipeingredient = Recipeingredient.new(recipeingredient_params)\n\n respond_to do |format|\n if @recipeingredient.save\n format.html { redirect_to @recipeingredient, notice: 'Recipeingredient was successfully created.' }\n format.json { render :show, status: :created, location: @recipeingredient }\n else\n format.html { render :new }\n format.json { render json: @recipeingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id = current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'レシピが登録されました。' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.uuid = SecureRandom.uuid\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe.objective}\n format.json { render :show, status: :created, location: @recipe.objective }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = new_recipe\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n @render_final_form = true\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n \n if @recipe.save\n redirect_to @recipe, notice: \"Successfully created new recipe\"\n else\n render 'new'\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :ingredients, :instructions, :category_id, :image)\n end",
"def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end",
"def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end",
"def recipe_params\n\n params.require(:recipe).permit(:title, :description)\n\n end",
"def create\n @one_recipe_for_category = Recipe.new(recipe_params)\n if Category.exists?(@one_recipe_for_category.category_id)\n if @one_recipe_for_category.save\n render :json => {\n :response => \"Success! Created your new recipe.\",\n :data => @one_recipe_for_category\n }\n else\n render :json => {\n :error => \"Cannot save data.\"\n }\n end\n end\n end",
"def add_recipe(recipe)\n if database.has_key? recipe[0]\n puts('Recipe already in Database.')\n else\n ingredients_list = []\n recipe[1..-1].each do |ingredient|\n if database.has_key? ingredient\n temp = database[ingredient]\n ingredients_list.push(temp)\n else\n puts('Missing ingredient(s)')\n break\n end\n end\n temp = Recipe.new(recipe[0], ingredients_list)\n database[temp.name] = temp\n end\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @btnText = \"Create Recipe\"\n @obj = @recipe\n if(@recipe.save)\n redirect_to current_user\n else\n flash.now.alert = \"Form Error\"\n render 'shared/form'\n end\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @btnText = \"Create Recipe\"\n @obj = @recipe\n if(@recipe.save)\n redirect_to current_user\n else\n flash.now.alert = \"Form Error\"\n render 'shared/form'\n end\n end",
"def create\n \n if params[\"donor\"]\n @recipe = Recipe.find(params[\"donor\"]).clone_with_ingredients(params[\"recipe\"])\n @recipe.user = current_user\n\n else\n @recipe = Recipe.new(params[\"recipe\"])\n end\n\n @recipe.user = current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id = current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @current_user.recipes << @recipe\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to recipe_url(@recipe) }\n format.xml { head :created, :location => recipe_url(@recipe) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors.to_xml }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @current_user.recipes << @recipe\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to edit_recipe_url(@recipe) }\n format.xml { head :created, :location => recipe_url(@recipe) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors.to_xml }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :description)\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :servings, :description, :instructions, :url, :tags => [])\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :description)\n end",
"def create\n @recipes_food = RecipesFood.new(recipes_food_params)\n\n respond_to do |format|\n if @recipes_food.save\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully created.' }\n format.json { render :show, status: :created, location: @recipes_food }\n else\n format.html { render :new }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_ingredient = @post.post_ingredients.build(post_ingredient_params)\n\n respond_to do |format|\n if @post_ingredient.save\n format.html { redirect_to post_post_ingredients_path(@post), notice: \"Post ingredient was successfully created.\" }\n format.json { render :show, status: :created, location: @post_ingredient }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :summary, :instructions)\n end",
"def create\n\t\tif Recipe.find_by({api_id: params[:api_id]})\n\t\t\tflash[:error] = \"Recipe '#{params[:name]}' already exists in your saved recipes.\"\n\t\telse\n\t\t\t@recipe = Recipe.new(recipe_params)\n\t\t\tif @recipe.save\n\t\t\t\tids = params[:inventories].split(\",\")\n\t\t\t\tfor index in 0...ids.length\n\t\t\t\t\t@recipe.inventories << Inventory.where({id: ids[index].to_i})\n\t\t\t\tend\n\n\t\t\t\trender json: @recipe\n\t\t\telse\n\t\t\t\trender status: 400, nothing: true\n\t\t\tend\n\t\tend\n\tend",
"def create\n recipeIngredient = rRcipeIngredient.create(recipeIngredient_params)\n render json: recipeIngredient\n end",
"def create\n @recipe = Recipe.new(recipe_params) #see method recipe_params\n\n if @recipe.save\n redirect_to @recipe #takes user back to the show recipe page after they have created a new recipe\n else\n flash[:recipe] = @recipe\n flash[:errors] = @recipe.errors.messages\n redirect_to new_recipe_path #new_recipe prefix from resources\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:content, :quantity_upstairs, :quantity_downstairs, :food_type, :ann_safe, :checkbox_value, :id)\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @recipe.directions = complete_directions\n params[\"ingredients\"].each_with_index do |ingredient, index|\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n end\n Userrecipe.create({:contribution_id => @recipe.id, :user_id => current_user.id})\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n @tag = Tag.find_by_name(tag)\n Recipetag.create({:recipe_id => @recipe.id,:tag_id => @tag.id})\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @recipe = current_user.recipes.new(params[:recipe])\n @user = current_user\n @dish = Dish.find(@recipe.dish_id)\n @winner = Recipe.where(\"dish_id = ? AND king = ?\", @recipe.dish_id, true).first\n\n respond_to do |format|\n if @recipe.save\n RecipeMailer.create_recipe(@user, @recipe, @winner, @dish).deliver\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :author, :ingredients, :instructions, :image)\n end",
"def create\n @recipe = Recipe.find params[:recipe_id]\n review = Review.new review_params\n review.recipe = @recipe\n review.user = current_user\n if review.save\n render json:{id: review.id}\n else \n render(json: {status: 422},\n status: 422 )\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.chef = current_user #must log in to be able to create a recipe\n \n if @recipe.save\n flash[:success] = \"Your recipe was created successfully!\"\n redirect_to recipes_path\n else\n render :new\n end\n \n end",
"def create\n @recipe = create_recipes\n\n respond_to do |format|\n if @recipe.present? && @recipe.persisted?\n send_new_recipe_email(@recipe)\n format.html { redirect_to redirect_path, notice: I18n.t(:'recipes.create.successful') }\n format.json { render :show, status: :created }\n else\n format.html {\n if @recipe.present?\n flash[:error] = @recipe.errors.full_messages.to_sentence\n else\n flash[:error] = I18n.t(:'recipes.create.failed')\n end\n redirect_to new_recipe_path\n }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n recipe_id = ingredient_params[:recipe_id]\n authorize Recipe.find(recipe_id), :update?\n parent_id = params[:parent_id]\n piece_type = params[:ingredient][:piece_type]\n piece_id = case piece_type\n when 'Loadout'\n loadout_kind = params[:ingredient][:loadout_kind]\n params[:ingredient][loadout_kind.downcase + '_id']\n when 'Character'\n params[:ingredient][:character_id]\n when 'Respawn'\n params[:ingredient][:respawn_id]\n end\n ingredient = Ingredient.create(recipe_id: recipe_id,\n piece_id: piece_id,\n piece_type: piece_type,\n parent_id: parent_id)\n redirect_back fallback_location: root_path\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :instructions, :prep_time, :meal_type)\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :description)\nend",
"def recipe_params\n params.require(:recipe).permit(:name, :instructions, :image, :user_id)\n end",
"def create\n @cooking_recipe = CookingRecipe.new(params[:cooking_recipe])\n\n respond_to do |format|\n if @cooking_recipe.save\n format.html { redirect_to(@cooking_recipe, :notice => 'CookingRecipe was successfully created.') }\n format.xml { render :xml => @cooking_recipe, :status => :created, :location => @cooking_recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cooking_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def insert\n DATABASE.execute(\"INSERT INTO terms (term, definition, phonetic) VALUES \n ('#{@term}', '#{@definition}', '#{@phonetic}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.user_id=current_user.id\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :instructions, :recipe_image)\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :serves, :cooking_time, :difficulty, :ingredients, :procedure, :food_preference_id, :food_type_id, :cuisine_id, :photo)\n end",
"def create\n @recipe = Recipe.find(params[:recipe_id])\n @step = @recipe.steps.new(step_params)\n\n if @step.save\n redirect_to @recipe, notice: 'Step was successfully created.'\n else\n render :new\n end\n end"
] |
[
"0.7185456",
"0.7101061",
"0.6979252",
"0.69508606",
"0.6928764",
"0.6927354",
"0.6881012",
"0.6867003",
"0.6865066",
"0.6865066",
"0.68584985",
"0.68214303",
"0.6821267",
"0.6809772",
"0.6805596",
"0.68010354",
"0.6773487",
"0.6770138",
"0.6770138",
"0.6766609",
"0.6766609",
"0.6766609",
"0.6766609",
"0.6766609",
"0.6759813",
"0.6751286",
"0.67316",
"0.67285544",
"0.67085516",
"0.6704523",
"0.66783494",
"0.6630668",
"0.66202027",
"0.661381",
"0.66090876",
"0.6602973",
"0.6586465",
"0.65838146",
"0.65804523",
"0.6577514",
"0.6542462",
"0.6538085",
"0.65316606",
"0.65215945",
"0.6509526",
"0.64990944",
"0.64940417",
"0.6471301",
"0.64681953",
"0.64621806",
"0.6461023",
"0.6453444",
"0.64405686",
"0.6423989",
"0.64168197",
"0.6415344",
"0.64044964",
"0.6396297",
"0.63931507",
"0.63852286",
"0.638423",
"0.6379625",
"0.6363604",
"0.63567954",
"0.6353906",
"0.6336097",
"0.6330722",
"0.6330722",
"0.63173527",
"0.6314867",
"0.6308421",
"0.63038385",
"0.6303505",
"0.6297138",
"0.6294174",
"0.62925875",
"0.6290129",
"0.62899053",
"0.62843835",
"0.62800956",
"0.6277554",
"0.62698156",
"0.6265818",
"0.62462544",
"0.6243239",
"0.62422097",
"0.6235212",
"0.6234338",
"0.6234145",
"0.6226583",
"0.62217224",
"0.6220668",
"0.6218946",
"0.62183076",
"0.6214817",
"0.6212853",
"0.6212289",
"0.6196024",
"0.6181646",
"0.61755055"
] |
0.6868256
|
7
|
PUT Update a recipe
|
def update
recipe = Recipe.find(params[:id])
ingredients = params[:ingredients]
tags = params[:tags]
if recipe.update_attributes(recipe_params)
if !ingredients.blank?
create_ingredient(recipe.id, ingredients)
end
if !tags.blank?
create_tag(recipe.id, tags)
end
render json: {status: 'SUCCESS', message: 'Updated recipe', data: get_recipe_by_id(recipe.id)}, status: :ok
else
render json: {status: 'ERROR', message: 'Recipe not updated', data: recipe.errors}, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n begin\n recipe = Recipe.find(params[:id])\n\n if recipe.update_attributes(recipe_params)\n render json: { status: 'SUCCESS', message: 'Recipe updated!', data: recipe }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Error updating recipe', data: recipe.errors }, status: :unprocessable_entity\n end\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n @recipe.update(recipe_params)\n redirect_to new_ingredient_path\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to edit_recipe_path(@recipe), notice: 'Recipe was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n request(:put, \"/recipes/#{id}.json\", default_params(options))\n end",
"def update\n @recipe = Recipe.find(params[:id])\n \n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n flash[:notice] = 'Recipe was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @recipe.update(recipe_params)\n redirect_to @recipe, notice: \"Recipe was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update\n\t\t@recipe = Recipe.find(params[:id])\n\n \tif @recipe.update(recipe_params)\n \t\tredirect_to recipe_path\n\t end\t\t\n\tend",
"def update\n @recipe = Recipe.find(params[:id])\n if @recipe.update(recipe_params)\n redirect_to recipe_url(@recipe)\n else\n render 'edit'\n end\n end",
"def update\n #@recipe = Recipe.find(params[:id])\n \n if @recipe.update(recipe_params)\n flash[:success] = \"Your recipe was updated successfully!\"\n redirect_to recipe_path(@recipe)\n \n else\n render :edit\n \n end\n \n end",
"def update\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n if @food_recipe.update_attributes(params[:food_recipe])\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(recipe)\n return false unless recipe.valid?\n\n @service.update(recipe)\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @recipe.update(recipe_params)\n redirect_to @recipe, notice: \"Successfully updated recipe\"\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_path, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: \"Recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: \"Recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: \"Recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n save_relations\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cooking_recipe = CookingRecipe.find(params[:id])\n\n respond_to do |format|\n if @cooking_recipe.update_attributes(params[:cooking_recipe])\n format.html { redirect_to(@cooking_recipe, :notice => 'CookingRecipe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cooking_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n\n respond_to do |format|\n if @recipe_ingredient.update_attributes(params[:recipe_ingredient])\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n\n respond_to do |format|\n if @recipe_ingredient.update_attributes(params[:recipe_ingredient])\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe_ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n update_recipe_line_items\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end",
"def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = current_user.recipes.find(params[:id])\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n \n unless params[:instructions].nil?\n @recipe.instructions.delete_all\n Instruction.multi_save(params[:instructions], @recipe)\n end\n \n unless params[:ingredients].nil?\n @recipe.ingredients.delete_all\n Ingredient.multi_save(params[:ingredients], @recipe)\n end\n\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render json: {:recipe => @recipe, :tags => @recipe.tag_list} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @recipe\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @recipe = current_user.recipes.find(params[:id])\n @obj = @recipe\n if(@recipe.update(recipe_params))\n flash.alert = \"Recipe updated\"\n redirect_to current_user\n else\n flash.now.alert = \"Error\"\n render 'shared/form'\n end\n end",
"def update\n p = recipe_params\n @recipe.properties = RecipeProperties.new(p.delete(:properties))\n respond_to do |format|\n if @recipe.update(p)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n rid = params['id']\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'recipe_id' => rid,\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.update_recipe(aws_params)\n msg = {:notice => \"Recipe updated!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end",
"def update\n respond_to do |format|\n if @ingredient_recipe.update(ingredient_recipe_params)\n format.html { redirect_to @ingredient_recipe, notice: 'Ingredient recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient_recipe }\n else\n format.html { render :edit }\n format.json { render json: @ingredient_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @ingredient.recipe\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient}\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @recipe\n \n @recipe.modifier = current_user\n \n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: t('.success') }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = current_user.recipes.find(params[:id])\n @obj = @recipe\n if(@recipe.update(recipe_params))\n flash.alert = \"Recipe updated\"\n redirect_to current_user\n return\n else\n flash.now.alert = \"Error\"\n render 'shared/form'\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(update_recipe_params)\n #if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'レシピが更新されました。' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe = Recipe.find(params[:id])\n\n if recipe.user == current_user\n recipe.update(recipe_params)\n render json: { recipe: params[:id], deleted: true }\n else\n render json: { recipe: params[:id], deleted: false }\n end\n end",
"def update\n authorize @recipe\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n if @recipe.update(recipe_params)\n #do something\n flash[:success] = \"Your recipe was updated successfully\"\n # redirect - show page - need the recipe object for the specific recipe\n redirect_to recipe_path(@recipe)\n else\n render :edit\n end\n end",
"def edit\n @recipe = Recipe.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @potluck_recipe.update(potluck_recipe_params)\n format.html { redirect_to @potluck_recipe, notice: 'Potluck recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @potluck_recipe }\n else\n format.html { render :edit }\n format.json { render json: @potluck_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to recipes_path, notice: 'Recipe successfully changed!!' }\n format.json { render json: @recipe }\n else\n #flash[:notice] = 'Recipe has not been changed!'\n format.html { render action: :edit }\n format.json { render json: @recipe.errors }\n end\n end\n end",
"def update(attributes: {})\n attributes = attributes.with_indifferent_access\n clean_attributes(attributes)\n titleize(attributes)\n sync_tags(attributes)\n parse_ingredients(attributes)\n recipe.update(attributes)\n recipe_response\n rescue StandardError => e\n error_response(e)\n end",
"def edit\n\t\t@recipe = Recipe.find(params[:id])\n\tend",
"def update\n respond_to do |format|\n if @recipeingredient.update(recipeingredient_params)\n format.html { redirect_to @recipeingredient, notice: 'Recipeingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipeingredient }\n else\n format.html { render :edit }\n format.json { render json: @recipeingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_ingredient.update(recipe_ingredient_params)\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #before action\n #Also in update we need to include the whitelisted fields\n if @recipe.update(recipe_params)\n flash[:success] = \"Your recipe was updated successfully\"\n #We want to redirect the user to the updated recipe. So we have to provide the object @recipe in the path method\n redirect_to recipe_path(@recipe)\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'La recette a été mise à jour.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipes_food.update(recipes_food_params)\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipes_food }\n else\n format.html { render :edit }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n calculate_nutrients \n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end",
"def update\n @recipe.ingredients.clear\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n\n @recipe.update(recipe_params)\n redirect_to @recipe\n end",
"def update\n @recipe = Recipe.find(params[:id])\n @recipe.ingrediences = Ingredience.find(params[:ingredience_ids]) if params[:ingredience_ids] \n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n flash[:notice] = 'Recipe was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n @categories=RecipeCategory.all\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @recipe = Recipe.find(params[:id])\nend",
"def set_recipe\n @recipe = Recipe.find params[:id]\n end",
"def update\n respond_to do |format|\n save_relations\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #if you query the Recipe db by the id, and the id is present then...\n if (@single_recipe_to_update = Recipe.find_by_id(params[:id])).present?\n # ... run the recipe_params function within the update function. it takes the input values from recipe_params and\n # updates that information the db\n @single_recipe_to_update.update(recipe_params)\n render :json => {\n :response => \"Successfully updated recipe.\",\n :data => @single_recipe_to_update # return the recipe with updated info\n }\n else\n render :json => {\n :response => \"Cannot find this record.\"\n }\n end\n end",
"def update\n\n if @recipe.update(recipe_params)\n redirect_to @recipe\n\n else\n\n render 'edit'\n end\n\nend",
"def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_recipe\n @recipe = RecipeApi.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @recipe_input.update(recipe_input_params)\n format.html { redirect_to @recipe_input, notice: 'Recipe input was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_input }\n else\n format.html { render :edit }\n format.json { render json: @recipe_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @cooking_ingredient.update_attributes(params[:cooking_ingredient])\n format.xml { head :ok }\n format.html {\n if @cooking_recipe\n redirect_to(edit_cooking_recipe_path(@cooking_recipe))\n else\n redirect_to(@cooking_ingredient, :notice => 'CookingIngredient was successfully updated.')\n end\n }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cooking_ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end"
] |
[
"0.7986835",
"0.7787209",
"0.7759118",
"0.7708554",
"0.7708554",
"0.7708554",
"0.7708554",
"0.7666214",
"0.76061326",
"0.7593023",
"0.7512663",
"0.7501544",
"0.7500968",
"0.749247",
"0.74263895",
"0.73934853",
"0.73583627",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73563975",
"0.73254526",
"0.73246926",
"0.7307666",
"0.73068094",
"0.73068094",
"0.73068094",
"0.73057044",
"0.7298209",
"0.729255",
"0.7291236",
"0.72873497",
"0.7242899",
"0.7217049",
"0.7207502",
"0.7201628",
"0.7186014",
"0.7184015",
"0.71788704",
"0.71710396",
"0.7161285",
"0.713963",
"0.7120208",
"0.7111936",
"0.70901257",
"0.7066139",
"0.70642924",
"0.70302135",
"0.70183605",
"0.7013967",
"0.6999236",
"0.6989791",
"0.6984838",
"0.6908081",
"0.69070816",
"0.68808025",
"0.68688965",
"0.6862291",
"0.682566",
"0.68225485",
"0.6817415",
"0.67955446",
"0.6791703",
"0.67853034",
"0.6780201",
"0.67699724",
"0.67664695",
"0.67632186",
"0.6741408",
"0.67333853",
"0.672088",
"0.6706877",
"0.669611",
"0.668843",
"0.66611725",
"0.6653041",
"0.6628764",
"0.66270024",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782",
"0.6625782"
] |
0.7322927
|
31
|
DELETE Delete a recipe
|
def destroy
recipe = get_recipe_by_id(params[:id])
recipe.destroy
render json: {status: 'SUCCESS', message: 'Deleted recipe', data: recipe}, status: :ok
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end",
"def destroy\n @recipe.destroy\n \n end",
"def delete_recipe(db,id)\n q = \"DELETE FROM recipes WHERE id=#{id};\"\n return db.execute(q)\nend",
"def destroy\n @recipe.destroy\n head :no_content\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @recipe.destroy\n redirect_to root_path, notice: \"Successfully deleted recipe\"\n end",
"def destroy\n\t\t@recipe = Recipe.find(params[:id])\n\t @recipe.destroy\n\t redirect_to recipes_path\n\tend",
"def destroy\n recipe = Recipe.find(params[:id])\n recipe.destroy()\n render json: {message:\"Recipe deleted.\"}\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end",
"def destroy\n @recipe.destroy\n redirect_to recipes_path, notice: 'Recipe successfully deleted!!'\n end",
"def destroy\n begin\n recipe = Recipe.find(params[:id])\n\n recipe.destroy\n render json: { status: 'SUCCESS', message: 'Recipe deleted!', data: recipe }, status: :ok\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end",
"def delete_recipe(db,id)\n # your code here\nend",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n \n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n recipe_index = @view.index_delete\n @cookbook.remove_recipe(recipe_index)\n @view.listing\n end",
"def remove_recipe(recipe_index)\n @recipes.delete_at(recipe_index)\n save\n end",
"def destroy\n @recipe.destroy\n redirect_to recipes_url, notice: \"Recipe was successfully destroyed.\"\n end",
"def destroy\n current_user.recipes.find(params[:id]).destroy\n redirect_to current_user\n end",
"def destroy\n current_user.recipes.find(params[:id]).destroy\n redirect_to current_user\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n if (@single_recipe_delete = Recipe.find_by_id(params[:id])).present?\n @single_recipe_delete.destroy\n render :json => {\n :response => 'Successfully deleted record.'\n }\n else\n render :json => {\n :response => 'record not found'\n }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'レシピが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@recipe = Recipe.find(params[:id])\n\t\tif @recipe.destroy\n\t\t\trender json: {}\n\t\telse\n\t\t\trender status: 400, nothing: true\n\t\tend\n\tend",
"def destroy\n @ingredient.destroy\n redirect_to @recipe\n end",
"def destroy\n recipe = @ingredient.recipe\n @ingredient.destroy\n respond_to do |format|\n if recipe.save\n format.html { redirect_to recipe, notice: 'Ingredient was successfully removed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to recipe, notice: 'An error occured while removing the ingredient.' }\n format.json { head :no_content }\n end\n end\n end",
"def remove_recipe(recipe_index)\n @recipes.delete_at(recipe_index)\n save_csv\n end",
"def destroy\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @recipe = current_user.recipes.find(params[:id])\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @recipe.destroy\n redirect_to root_path, notice: \"Succesfully deleted Question\"\nend",
"def destroy\n @cooking_recipe = CookingRecipe.find(params[:id])\n @cooking_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(cooking_recipes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @recipe = Recipe.find(params[:id])\n # @recipe.destroy\n #\n destroy! do |format|\n # format.html { redirect_to recipes_url }\n # format.json { head :ok }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'La recette a été supprimée.' }\n end\n end",
"def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end",
"def remove_recipe(index)\n @recipes.delete_at(index)\n\n save_csv\n end",
"def destroy\n #1st you retrieve the product thanks to params[:product_id]\n product = Product.find(params[:product_id])\n #2nd you retrieve the recipe thanks to params[:id]\n @recipes = product.recipes.find(params[:id])\n @recipes.destroy\n \n respond_to do |format|\n #1st argument reference the path /posts/:post_id/comments/\n format.html { redirect_to action: \"index\", notice: 'Recipe step was successfully deleted.' }\n format.xml { head :ok }\n end\n end",
"def delete_all_recipes(db)\n q = \"DELETE FROM recipes;\"\n return db.execute(q)\nend",
"def destroy\n @recipe_comment.destroy\n redirect_to @recipe\n end",
"def delete\n \n end",
"def destroy\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: I18n.t(:'recipes.destroy.successful') }\n format.json { head :no_content }\n end\n end",
"def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end",
"def destroy\n @food_recipe = FoodRecipe.find(params[:id])\n @food_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to food_recipes_url }\n format.json { head :no_content }\n end\n end",
"def delete_saved_recipes\n File.open(\"recipes.txt\", 'w') {|f| f.puts \"\"}\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end",
"def destroy\n authorize! :destroy, @recipe\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_ingredient = Recipe_ingredient.find(params[:id])\n @recipe_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n @recipe_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_all_recipes(db)\n # your code here\nend",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: \"Recipe was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: \"Recipe was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url, notice: \"Recipe was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @potluck_recipe.destroy\n respond_to do |format|\n format.html { redirect_to potluck_recipes_url, notice: 'Potluck recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredient_recipe.destroy\n respond_to do |format|\n format.html { redirect_to ingredient_recipes_url, notice: 'Ingredient recipe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def delete!\n delete( nil, true ) \n end",
"def remove_recipe(index)\n @recipes.delete_at(index)\n write_csv\n end",
"def remove_recipe(index)\n @recipes.delete_at(index)\n write_csv\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def delete_make(db, id)\n db.execute(\"DELETE FROM makes WHERE id=?\", [id])\nend",
"def destroy\n # Display list with indices\n recipes = @cookbook.all\n # Ask user for index\n index = @view.ask_user_for_index(recipes)\n # Remove from cookbook\n @cookbook.remove_recipe(index - 1)\n end",
"def original_destroy\n @recipe = Recipe.find(params[:id])\n @recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize @recipe\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url}\n format.json { head :no_content }\n end\n end",
"def del\n delete\n end",
"def destroy\n authorize @ingredient.recipe\n @ingredient.destroy\n respond_to do |format|\n format.html { redirect_to @ingredient.recipe }\n format.json { head :no_content }\n end\n end",
"def delete(defer = false)\n delete_logic( defer )\n end"
] |
[
"0.7812475",
"0.7748599",
"0.76796347",
"0.7678332",
"0.76510775",
"0.75723743",
"0.7421934",
"0.73956734",
"0.7338554",
"0.73118776",
"0.7233323",
"0.7207767",
"0.71821624",
"0.7179116",
"0.71674055",
"0.70404935",
"0.70272976",
"0.70272976",
"0.70041955",
"0.70041955",
"0.6953643",
"0.6950624",
"0.6949926",
"0.69494116",
"0.69472706",
"0.6931577",
"0.6931577",
"0.6931577",
"0.6931577",
"0.6931577",
"0.6902242",
"0.6900059",
"0.6879735",
"0.6848982",
"0.6837124",
"0.6828952",
"0.6827577",
"0.68224716",
"0.6818425",
"0.68015814",
"0.68015814",
"0.68015814",
"0.68015814",
"0.68015814",
"0.67912877",
"0.6766944",
"0.6751669",
"0.6748896",
"0.67348826",
"0.67315865",
"0.6720006",
"0.6676137",
"0.6673937",
"0.6665191",
"0.6640176",
"0.66330594",
"0.6626804",
"0.66261876",
"0.662592",
"0.659341",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.65926933",
"0.6589317",
"0.6576863",
"0.6570732",
"0.6570732",
"0.6570732",
"0.65689504",
"0.65678996",
"0.6537565",
"0.6498052",
"0.6496183",
"0.6496183",
"0.6495181",
"0.6493455",
"0.64899075",
"0.6485709",
"0.6482314",
"0.6473701",
"0.64564115",
"0.643522"
] |
0.7586587
|
5
|
Create the ingredients for the recipe recipe_id: id of the recipe ingredients: list of ingredients for a recipe
|
def create_ingredient(recipe_id, ingredients)
destroy_ingredients = RecipeIngredient.where(recipe_id: recipe_id)
if !destroy_ingredients.blank?
destroy_ingredients.delete_all
end
ingredients.each do |recipe_ingredient|
ingredient = RecipeIngredient.new
ingredient.recipe_id = recipe_id
ingredient.ingredient = recipe_ingredient
ingredient.save!
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: recipe.id\n end\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def add_ingredients(arr_of_ingredient_ids)\n arr_of_ingredient_ids.each do |id|\n RecipeIngredient.find_or_create_by(\n recipe_id: self.id,\n ingredient_id: id\n )\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n # if params[:add_ingredient]\n # @recipe.ingredients.build\n # end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end",
"def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t\t\trecipe = Recipe.new(recipe_params)\n\t\t\t\tingredients = params[:ingredients]\n\t\t\t\ttags = params[:tags]\n\t\t\t\t\n\t\t\t\tif recipe.save\n\t\t\t\t\tif !ingredients.blank?\n\t\t\t\t\t\tredirect_to api_v1_recipe_ingredients_url(recipe_id: recipe.id, ingredients: ingredients, tags: tags)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Recipe not saved', data: recipe.errors}, status: :unprocessable_entity\n\t\t\t\tend\n\t\t\tend",
"def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end",
"def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end",
"def create\n @beverage = Beverage.new(params[:beverage])\n params[:ingredient].each{|ingr|\n @beverage.ingredients << Ingredient.find_by_name(ingr)\n } unless params[:ingredient].blank?\n\n\n respond_to do |format|\n if @beverage.save\n format.html { redirect_to @beverage, notice: 'Beverage was successfully created.' }\n format.json { render json: @beverage, status: :created, location: @beverage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ingredient_params\n params.require(:ingredient).permit(:name, :recipe_ids => [])\n end",
"def add_ingredients\n rid = params['id']\n name = params['name']\n quant = params['quantity']\n meas = params['measurement']\n\n ingredients = {\n 'name' => name,\n 'quantity' => quant,\n 'measurement' => meas,\n }\n\n if Aws.save_ingredient_to_db(rid, ingredients)\n msg = {:notice => \"Ingredient created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while creating ingredient!\"}\n render :json => msg\n end\n end",
"def get_recipe(id)\n recipe = Recipe.find(id)\n url = \"https://api2.bigoven.com/recipe/steps/#{recipe.id}?&api_key=#{ENV['API_KEY']}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # puts response\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n # recipe.ingredients.create!(\n if (!Ingredient.exists?(ingredient[\"IngredientID\"])) \n Ingredient.create!(\n id: ingredient[\"IngredientID\"],\n name: ingredient[\"Name\"],\n html_name: ingredient[\"HTMLName\"]\n )\n end\n end\n\n if (recipe.recipe_ingredients.count > 0)\n recipe.recipe_ingredients.destroy_all\n recipe.save\n recipe.reload\n end\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n \n # if (!recipe.recipe_ingredients.find_by(ingredient_id: ingredient[\"IngredientID\"]))\n recipe.recipe_ingredients.create!(\n ingredient_id: ingredient[\"IngredientID\"],\n quantity: ingredient[\"Quantity\"],\n display_quantity: ingredient[\"DisplayQuantity\"],\n unit: ingredient[\"Unit\"],\n metric_quantity: ingredient[\"MetricQuantity\"],\n metric_display_quantity: ingredient[\"MetricDisplayQuantity\"],\n metric_unit: ingredient[\"MetricUnit\"],\n preparation_notes: ingredient[\"PreparationNotes\"]\n )\n # end\n end\n \n recipe.steps = ''\n steps = JSON.parse(response)[\"Steps\"]\n steps.each do |step|\n step != steps.last ? recipe.steps += step[\"Text\"] + '$' : recipe.steps += step[\"Text\"]\n # recipe.steps += step[\"Text\"] + ','\n end\n \n recipe.save\n end",
"def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend",
"def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end",
"def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend",
"def add_ingredient_to_recipe quantity, measure, food_item_name, recipe \n food_item = FoodItem.new(:name => food_item_name, :price => nil)\n ingredient = Ingredient.new(:food_item => food_item, :quantity => quantity, :measure => measure, :recipe_id => recipe.id)\n recipe.ingredients << ingredient\n end",
"def ingredient_add_helper(recipe_id)\n added_ingredient = prompt.ask(\"What ingredient would you like to add\")\n new_recipe_ingredient_arr = user.recipes.where(id: recipe_id)[0].ingredient.split(\", \") << added_ingredient\n ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n end",
"def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end",
"def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end",
"def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end",
"def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n Instruction.multi_save(params[:instructions], @recipe)\n Ingredient.multi_save(params[:ingredients], @recipe)\n current_user.recipes << @recipe\n current_user.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end",
"def update\n @recipe.ingredients.clear\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n\n @recipe.update(recipe_params)\n redirect_to @recipe\n end",
"def recipe_params\n params.require(:recipe).permit(:name,:description, ingredient_ids: [])\n end",
"def set_recipe_ingredient\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n end",
"def set_ingredient_recipe\n @ingredient_recipe = IngredientRecipe.find(params[:id])\n end",
"def create\n puts recipe_params[:ingredients], recipe_params[:recipe], recipe_params[:user_id]\n recipe = Recipe.create(recipe_params[:recipe])\n if(recipe.valid?)\n Ingredient.create_and_assign(recipe_params[:ingredients], recipe.id)\n newUR = UserRecipe.create(recipe_id: recipe.id, user_id: recipe_params[:user_id])\n render json: UserRecipeSerializer.new(newUR).to_serialized_json\n else\n render json: recipe.errors.full_messages\n end\n end",
"def add_ingredients(ingredients_array)\n # ingredients_array[0] = RecipeIngredient.new(name, ingredients_array[0], self)\n ingredients_array.each do |ingredient|\n RecipeIngredient.new(ingredient.name, ingredient, self)\n end\n end",
"def create\n @ingredient = Ingredient.new(params[:ingredient])\n @food = Food.find_by_name(params[:food][:name])\n @ingredient.food_id = @food.id if @food\n respond_to do |format|\n if @recipe.ingredients << @ingredient\n flash[:notice] = 'Ingredient was successfully added.'\n format.html { redirect_to recipe_url(@recipe) }\n format.js\n format.xml { head :created, :location => ingredient_url(@ingredient) }\n else\n format.html { render :action => \"new\" }\n format.js\n format.xml { render :xml => @ingredient.errors.to_xml }\n end\n end\n end",
"def create\n recipeIngredient = rRcipeIngredient.create(recipeIngredient_params)\n render json: recipeIngredient\n end",
"def create\n begin\n ActiveRecord::Base.transaction do\n @recipe = Recipe.find_or_create_by!(trusted_params)\n @ingredient = Ingredient.find_or_create_by!(ingredient: params[:recipe][:ingredient])\n\n new_ingredient_recipe = IngredientRecipe.new(\n ingredient_id: @ingredient.id,\n recipe_id: @recipe.id,\n )\n new_ingredient_recipe.save!\n \n redirect_to @recipe, notice: \"Recipe was successfully created.\"\n end\n rescue\n render :new, status: :unprocessable_entity\n end\n end",
"def process_ingredient_list\n return if @ingredient_list.blank?\n\n # if this recipe was just created, save original_ingredient_list\n if original_ingredient_list.blank?\n self.original_ingredient_list = @ingredient_list\n end\n \n if @ingredient_list.is_a?(String)\n ingr_array = @ingredient_list.split(/\\n/)\n else\n ingr_array = @ingredient_list\n end\n\n # Usually Rails just sets the key to null. To really delete the record, the following two lines are needed\n ingredients_recipes.each {|ir| ir.delete}\n ingredients_recipes.reload\n \n ingr_array.each_with_index do |line, index|\n line.strip!\n next if line.empty?\n \n # check for groups first, then ingredients. Groups are deliminated with stars like this: *Group*\n attrs = {}\n if line =~ /^\\*(.*)\\*$/\n attrs[:description] = $1\n attrs[:group] = true\n else\n # If a comma, assume everything past is a comment so only parse the first part but then \n # add it back in before processing the description\n line.downcase!\n comma_index = line.index(\",\")\n desc_part = ''\n unless comma_index.blank?\n desc_part = line.slice!(comma_index .. -1)\n end\n attrs[:ingredient] = Ingredient.find_name_and_create(line)\n attrs[:weight] = Ingredient.find_num(line)\n attrs[:unit] = Ingredient.find_unit(line)\n line.slice!(desc_part) # Make sure desc_part is not included twice\n \n # if using the whole_unit, take it out here so it doesn't get repeated in the description\n if attrs[:unit] == 'whole' && !attrs[:ingredient].whole_unit.blank?\n line.slice!(attrs[:ingredient].whole_unit)\n end\n attrs[:description] = Ingredient.find_description(line + desc_part) \n end\n attrs[:line_num] = index\n attrs[:recipe_id] = self.id\n \n ingredient_recipe = IngredientsRecipe.create!(attrs)\n ingredients_recipes << ingredient_recipe\n Ingredient.standardize_unit(ingredient_recipe)\n end\n @ingredient_list = nil\n end",
"def create\n @ingredient = Ingredient.find(params[:id])\n \n @supplier.ingredients << @ingredient\n redirect_to supplier_path(@supplier)\n end",
"def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @recipe.directions = complete_directions\n params[\"ingredients\"].each_with_index do |ingredient, index|\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n end\n Userrecipe.create({:contribution_id => @recipe.id, :user_id => current_user.id})\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n @tag = Tag.find_by_name(tag)\n Recipetag.create({:recipe_id => @recipe.id,:tag_id => @tag.id})\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_ingredientusers(ingredients)\n ingredients.each {|ingredient| IngredientUser.create(user_id: self.id, ingredient_id: ingredient.id)}\n end",
"def ingredient_logic(ingredient)\n if all_ingredients.include?(ingredient)\n new_recipe_ingredient = ingredient_instance(ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n else\n new_recipe_ingredient = Ingredient.create(name: ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n end\n end",
"def ingredients_attributes=(ingredients_attributes)\n self.ingredients.destroy_all\n ingredients_attributes.each do |ingredient_attribute|\n # additional logic in the recipes controller rejects invalid ingredients\n \n self.ingredients.create(ingredient_attribute) unless all_blank?(ingredient_attribute)\n end\n end",
"def ingredient_recipe_params\n params.require(:ingredient_recipe).permit(:ingredient_id, :recipe_id)\n end",
"def create\n @recipe = current_user.recipes.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n if params[:lista].present?\n params[:lista].each do |(c,ingrediente)|\n Ingredient.create(name: ingrediente, recipe_id:@recipe.id) if ingrediente != \"\"\n end\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n format.js {flash.now[:notice] = 'La receta se ha creado de forma exitosa.'} #ajax\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al crear la receta.'} #ajax\n end\n end\n end",
"def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end",
"def ingredients_attributes=(ingredients_hash)\n ingredients_hash.each do |i|\n ingredient = Ingredient.find_or_create_by(name: i[:name], quantity: i[:quantity])\n self.ingredients << ingredient\n end\nend",
"def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n #@recipe.ingrediences = Ingredience.find(@params[:ingredience_ids]) if @params[:ingredience_ids]\n respond_to do |format|\n if @recipe.save\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to(@recipe) }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n @ingrediences = Ingredience.find(:all, :order => 'title')\n @categories = Category.find(:all, :conditions => [\"food = ?\", true])\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ingredient_params\n params.require(:ingredient).permit(:item_id, :qty, :recipe_id).merge({recipe_id: @recipe.id})\n end",
"def set_recipeingredient\n @recipeingredient = Recipeingredient.find(params[:id])\n end",
"def create\n @ingredient_recipe = IngredientRecipe.new(ingredient_recipe_params)\n\n respond_to do |format|\n if @ingredient_recipe.save\n format.html { redirect_to @ingredient_recipe, notice: 'Ingredient recipe was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient_recipe }\n else\n format.html { render :new }\n format.json { render json: @ingredient_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_ingredients(ingredients)\n RecipeIngredient.new(ingredients, self)\nend",
"def create\n\n @ingredient = Ingredient.find_by_name(params[\"ingredient\"][\"name\"]) || Ingredient.new(params[\"ingredient\"])\n respond_to do |format|\n if @ingredient.save and Amount.create(params[\"amount\"].merge(:ingredient_id => @ingredient.id, :recipe_id => @recipe.id))\n flash[:notice] = 'Ingredient was successfully created.'\n format.html {render :partial => 'list_ingredients', :object => @ingredient}\n format.xml { render :xml => @ingredient, :status => :created, :location => @ingredient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.user = current_user\n\n \n\n respond_to do |format|\n if @recipe.save\n recipe_ingredient_group = @recipe.recipe_ingredient_groups.new\n recipe_ingredient_group.name = \"Main ingredients\"\n recipe_ingredient_group.save\n format.html { redirect_to @recipe, notice: \"Recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n unless logged_in?\n render :file => 'public/401', :status => :unauthorized, :layout => false and return\n end\n\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to Item.find(@recipe.item_id), notice: 'Ingredient was successfully added to the recipe.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n flash.now[:error] = 'Unable to save ingredient'\n format.html { redirect_to new_recipe_ingredient_path }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n @ingredient_item = Item.find(@ingredient.item_id)\n end",
"def set_ingredient_list\n @ingredient_list = IngredientList.find(params[:id])\n end",
"def create\n ingredient = Ingredient.create(ingredient_params)\n render json: ingredient\n end",
"def create\n @bruschettum = Bruschettum.new(params[:bruschettum])\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n\n respond_to do |format|\n if @bruschettum.save\n format.html { redirect_to @bruschettum, notice: 'Bruschetta è stata creata con successo.' }\n format.json { render json: @bruschettum, status: :created, location: @bruschettum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to recipes_path, notice: 'Ingredient was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end",
"def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_empty_ingredients\n 10.times { recipe_ingredients.build.build_ingredient }\n end",
"def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end",
"def create\n\t\tif Recipe.find_by({api_id: params[:api_id]})\n\t\t\tflash[:error] = \"Recipe '#{params[:name]}' already exists in your saved recipes.\"\n\t\telse\n\t\t\t@recipe = Recipe.new(recipe_params)\n\t\t\tif @recipe.save\n\t\t\t\tids = params[:inventories].split(\",\")\n\t\t\t\tfor index in 0...ids.length\n\t\t\t\t\t@recipe.inventories << Inventory.where({id: ids[index].to_i})\n\t\t\t\tend\n\n\t\t\t\trender json: @recipe\n\t\t\telse\n\t\t\t\trender status: 400, nothing: true\n\t\t\tend\n\t\tend\n\tend",
"def add_to_database(recipe)\n\t\t# Parsing the recipe line\n\t\trecipe_db = Recipe.new(\n\t\t\ttitle: recipe[\"recipe\"][\"label\"].to_s,\n\t\t\timage: recipe[\"recipe\"][\"image\"].to_s,\n\t\t\tdescription: recipe[\"recipe\"][\"source\"].to_s,\n\t\t\tuser_id: 1\n\t\t\t)\n\t\trecipe_db.save\n\t\tputs recipe_db.errors.messages\n\t\tputs \"ID: #{recipe_db.id}\"\n\t\tputs \"TITLE: #{recipe_db.title}\"\n\t\tputs \"IMAGE: #{recipe_db.image}\"\n\t\t# Parsing the ingredients line\n\t\trecipe[\"recipe\"][\"ingredientLines\"].each do |ingredient|\n\t\t\t# Retrieving the ingredient\n\t\t\tingredient_db = Ingredient.create(\n\t\t\t\tname: ingredient,\n\t\t\t\trecipe_id: recipe_db.id\n\t\t\t\t)\n\t\t\trecipe_db.ingredients << ingredient_db\n\t\tend\n\n\t\trecipe_db\n\tend",
"def create\n @recipe = Recipe.new(params[:recipe])\n @errors = process_ingredient_inputs(params, @recipe)\n @errors = [\"You must include at least one ingredient in your recipe\"] if @recipe.recipe_ingredients.empty?\n if(! @errors.empty?) then\n\t\t# reshow\n\t\t@errors.each{ |msg| @recipe.errors[:base] << msg } \n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\tend\n\t\treturn\n\tend\n\t@recipe.entered_by_id = @current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to(@recipe, :notice => 'Recipe was successfully created.') }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(\n :title, \n :description, \n :instructions, \n :ingredient_count, \n ingredient_ids: [],\n ingredients_attributes: [\n :name, \n :description, \n recipe_ingredients_attributes: [\n :quantity\n ]\n ]\n \n )\n end",
"def enter_ingredients\n puts \"\\nPlease input your ingredients below. Separate each ingredient with a comma.\\n\"\n\n ingredients = gets.strip\n recipes = EverythingButTheKitchenSink::SpoonacularApi.get_recipes(ingredients)\n EverythingButTheKitchenSink::TransformData.get_id_and_title(recipes)\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to edit_receipe_url(@receipe), notice: 'Ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def create\n @recipe_ingredient = RecipeIngredient.new(recipe_ingredient_params)\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_ingredient }\n else\n format.html { render :new }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_shopping_list\n\n #pull out whichever recipe you are clicking on\n recipe = Yummly.find(params[:yummly_id])\n\n # create a recipe for the database for future use\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n #create new shopping list for each recipe\n s = ShoppingList.create(\n name: recipe.name, \n yummly_id: params[:yummly_id],\n user_id: current_user.id,\n recipe_id: r.id)\n\n #find recipe and ingredient name from yummly\n recipe.ingredients.each do |ingredient|\n ShoppingListItem.create(done: nil, shopping_list_id: s.id, ingredient_name: ingredient, ingredient_quantity: nil, ingredient_quantity_unit: nil)\n end\n\n redirect_to recipes_url, notice: \"Added recipe to your shopping lists\"\n\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :summary, :description, :picture, style_ids: [], ingredient_ids: [])\n end",
"def add_ingredient(ingredient)\n @ingredients.push(ingredient)\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def create\n if recipe_ingredient_params[:ingredients_list]\n fill_form_from_ingredients_list\n elsif recipe_params[:url] && !ingredient_params[:product_name]\n fill_form_from_url\n else\n @recipe = Recipe.new(recipe_params)\n @recipe.country_consumption = Country.find_or_create(recipe_name_params[:country_consumption_name])\n @recipe.user = current_user\n \n if ingredient_params[:product_name]\n ingredients = ingredient_params.values.transpose.map { |s| Hash[ingredient_params.keys.zip(s)] }\n ingredients.each do |ingredient|\n weight, item_name = Ingredient.parse(ingredient[\"item_name\"])\n if ingredient[\"product_name\"].length > 0 and not ingredient[\"product_name\"] == \"None\"\n @ingredient = Ingredient.new({:weight => ingredient[\"weight\"]})\n @ingredient.description = ingredient[\"item_name\"]\n @ingredient.product = Product.find_or_create(ingredient[\"product_name\"])\n @ingredient.country_origin = Country.find_or_create(ingredient[\"country_origin_name\"])\n @recipe.ingredients << @ingredient\n \n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = @ingredient.product\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n elsif item_name.length > 0\n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = Product.find_by(name: \"None\")\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n end\n end\n end\n \n save\n end\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end",
"def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end",
"def ingredient_params\n params.require(:ingredient).permit(:name, :amount, :recipe_id)\n end",
"def create\n @recipe_ingredient = Recipe_ingredient.new(params[:recipe_ingredient])\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe_ingredient was successfully created.' }\n format.json { render json: @recipe_ingredient, status: :created, location: @recipe_ingredient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title,\n :description,\n :notes,\n :acknowledgements,\n :preparation_time,\n :featured_image,\n :user_id,\n :jewel_id,\n :color_scheme_id,\n :cuisine_ids => [],\n :meal_type_ids => [],\n :diet_ids => [],\n :season_ids => [],\n :occasion_ids => [],\n :pairing_ids => [],\n :box_ids => [],\n steps_attributes: [:id, :_destroy, :position, :description],\n ingredients_attributes: [:id, :_destroy, :position, :title, :amount],)\n end"
] |
[
"0.78298724",
"0.7707803",
"0.76807326",
"0.7543995",
"0.7475863",
"0.74117917",
"0.7281296",
"0.72451466",
"0.71976566",
"0.7173304",
"0.712313",
"0.70645636",
"0.70533687",
"0.70269895",
"0.70242923",
"0.7013806",
"0.6969493",
"0.69605935",
"0.6952212",
"0.6933721",
"0.6919132",
"0.6918721",
"0.69153446",
"0.6913821",
"0.6895751",
"0.6895711",
"0.689025",
"0.6865131",
"0.6842207",
"0.6825596",
"0.68210816",
"0.6817064",
"0.68139094",
"0.67903703",
"0.67769885",
"0.6768832",
"0.67565006",
"0.67507106",
"0.67459536",
"0.67448276",
"0.67446077",
"0.6738541",
"0.67313105",
"0.6728209",
"0.669598",
"0.6683308",
"0.66702914",
"0.66682696",
"0.66550773",
"0.6638748",
"0.6628362",
"0.662763",
"0.6627179",
"0.662108",
"0.6619769",
"0.6581947",
"0.65773064",
"0.65749216",
"0.6555548",
"0.65475345",
"0.6539326",
"0.65304923",
"0.6525453",
"0.65240246",
"0.6514386",
"0.64947",
"0.64897317",
"0.6475886",
"0.6461191",
"0.64599967",
"0.64582956",
"0.6452558",
"0.64422154",
"0.6442155",
"0.6441654",
"0.6441654",
"0.642448",
"0.6424009",
"0.6411343",
"0.6411315",
"0.6411252",
"0.64003146",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63990486",
"0.63694614",
"0.63691527",
"0.635948",
"0.6352575"
] |
0.83935195
|
0
|
Create the tags for the recipe recipe_id: id of the recipe tags: list of tags for a recipe
|
def create_tag(recipe_id, tags)
destroy_tags = RecipeTag.where(recipe_id: recipe_id)
if !destroy_tags.blank?
destroy_tags.delete_all
end
tags.each do |recipe_tag|
tag = RecipeTag.new
tag.recipe_id = recipe_id
tag.tag = recipe_tag
tag.save!
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n \tset_tag_list\n\n @recipe = @current_user.recipes.build(params[:recipe])\n @recipe.status = @recipe.get_status\n item_client_ip(@recipe)\n # @recipe.is_draft = params[:is_draft]\n # @recipe.is_draft = @recipe.get_is_draft\n # @recipe.published_at = @recipe.get_published_at\n \n ActiveRecord::Base.transaction do \n\t\t\tif @recipe.save\n\t\t\t\t# @recipe.tag_list = params[:tags].strip if params[:tags] && !params[:tags].strip.blank?\n\t\t\t\treg_homepage(@recipe)\n\t\t\t\tafter_create_ok\n\t\t\telse\n\t\t\t\tafter_create_error\n\t\t\tend\n\t\tend\n end",
"def create_tags(resource_id, tags)\n # Tags need to be created individually in fog\n tags.each do |k, v|\n @compute_provider.tags.create(:resource_id => resource_id,\n :key => k.to_s, :value => v.to_s)\n end\n end",
"def create_new_tags\n if params[:listing][:tag_ids].present?\n params[:listing][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end",
"def create\n @recipe = current_user.recipes.build(recipe_params)\n @recipe.user = current_user\n @recipe.save\n @measurs = Array.new\n @ingrs = Array.new\n @tgs = Array.new\n #ovo bi trebalo unutar sebe prikupiti sastojke i mjere\n parse_ingredients\n parse_tags\n @recipe.measurements = @measurs\n @recipe.ingredients = @ingrs\n @recipe.recipe_tags = @tgs\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_tags\n\tend",
"def set_tag(string, recipes_hash, recipe)\n if recipes_hash[string]\n recipe_tag = RecipeTag.new()\n tag = Tag.find_by(name: string)\n recipe_tag.tag = tag\n recipe_tag.recipe = recipe\n recipe_tag.save\n end\nend",
"def create_ingredient(recipe_id, ingredients)\n\t\t\t\tdestroy_ingredients = RecipeIngredient.where(recipe_id: recipe_id)\n\t\t\t\tif !destroy_ingredients.blank? \n\t\t\t\t\tdestroy_ingredients.delete_all \n\t\t\t\tend\n\t\t\t\tingredients.each do |recipe_ingredient|\n\t\t\t\t\tingredient = RecipeIngredient.new\n\t\t\t\t\tingredient.recipe_id = recipe_id\n\t\t\t\t\tingredient.ingredient = recipe_ingredient\n\t\t\t\t\tingredient.save!\n\t\t\t\tend\n\t\t\tend",
"def sync_tags(attributes)\n return unless attributes.key?(TAG_IDS_ATTR)\n\n recipe.tags = Tag.where(id: attributes[TAG_IDS_ATTR])\n attributes.delete(TAG_IDS_ATTR)\n end",
"def tag_set(id, tags)\n wf_event_id?(id)\n tags = Array(tags)\n tags.each { |t| wf_string?(t) }\n api.post([id, 'tag'].uri_concat, tags, 'application/json')\n end",
"def create\n\t\t\t\trecipe = Recipe.new(recipe_params)\n\t\t\t\tingredients = params[:ingredients]\n\t\t\t\ttags = params[:tags]\n\t\t\t\t\n\t\t\t\tif recipe.save\n\t\t\t\t\tif !ingredients.blank?\n\t\t\t\t\t\tredirect_to api_v1_recipe_ingredients_url(recipe_id: recipe.id, ingredients: ingredients, tags: tags)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Recipe not saved', data: recipe.errors}, status: :unprocessable_entity\n\t\t\t\tend\n\t\t\tend",
"def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: recipe.id\n end\n end",
"def tag_list=(tags_string)\n self.taggings.destroy_all\n\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n\n tag_names.each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name)\n tagging = self.taggings.new\n tagging.tag_id = tag.id\n end # end of do iteration\n end",
"def create\n params[:product][:tag_ids] = Array.new\n params[:tags].split(\",\").each do |tag|\n tag_detail = Tag.where(\"title = ?\",tag).first\n if tag_detail.present?\n params[:product][:tag_ids] << tag_detail.id\n else\n new_tag = Tag.new(:title=>tag)\n new_tag.save\n params[:product][:tag_ids] << new_tag.id\n end\n end\n \n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def create_new_tags\n if params[:commoner][:tag_ids].present?\n params[:commoner][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end",
"def create_tags(tags)\n tags.each do |tag_name|\n self.tags.create!(name: tag_name.downcase) unless self.tags.find_by(name: tag_name.downcase)\n end\n end",
"def build_tags \n # First flush all tags so a duplicate record doesn't occur\n Tag.delete(@question.tags)\n\n tobuild = params[:tags]\n tobuild.each do |category|\n Tag.create(question_id: @question.id, category: category)\n end unless tobuild.nil?\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @recipe.directions = complete_directions\n params[\"ingredients\"].each_with_index do |ingredient, index|\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n end\n Userrecipe.create({:contribution_id => @recipe.id, :user_id => current_user.id})\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n @tag = Tag.find_by_name(tag)\n Recipetag.create({:recipe_id => @recipe.id,:tag_id => @tag.id})\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"def add_tags_from_definition_ids(tag_definition_ids, user, reason, comment, options)\n created_tag = self.class.post \"#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags\",\n tag_definition_ids,\n {},\n {\n :user => user,\n :reason => reason,\n :comment => comment,\n }.merge(options),\n Tag\n tags(false, 'NONE', options) unless created_tag.nil?\n end",
"def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend",
"def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tags tags\n aux_errors = []\n tags = tags.split(\",\") if tags.instance_of? String\n tags = tags.map{|tag| tag.strip }\n tags.each do |tag_name|\n # find a tag if exists\n tag = Tag.where(:name => tag_name).first\n\n if tag.nil?\n if Tag.creatable_by? current_user\n t = Tag.new :name => tag_name, :creator => current_user\n aux_errors.push \"Tag #{tag_name} could not be saved\" unless t.save\n else\n aux_errors.push \"You don't have permission to create tag #{tag_name}\"\n end\n else\n self.tags << tag\n end\n end\n aux_errors\n end",
"def create\n #...\n params[:cat].permit(...:tag_ids: []) #allow tag_ids and expect it to be an Array\n end",
"def create\n\t\tif params[:tag] \n\t\t\ttag_ids = params[:tag][:id]\n\t\tend\n\n\t\ttourist_sight_id = params[:tourist_sight_id]\n\t\t@tourist_sight = TouristSight.find(tourist_sight_id)\n\n\t\tnew_tags = []\n\t\tif tag_ids and tag_ids.length > 0\n\t\t\ttag_ids.each do |id|\n\t\t\t\tnew_tags << Tag.find(id)\n\t\t\tend\n\t\tend\n\n\t\tif @tourist_sight.save_tags(new_tags)\n\t\t\tflash[:notice] = 'Tags adicionadas com sucesso.'\n\t\telse\n\t\t\tflash[:error] = 'Falha ao adicionar tags!'\n\t\tend\n\n\t\trespond_to do |format|\n\t format.html { redirect_to(@tourist_sight) } # tourist_sights/show.html.erb\n\t\tend\n\tend",
"def add_ingredients(arr_of_ingredient_ids)\n arr_of_ingredient_ids.each do |id|\n RecipeIngredient.find_or_create_by(\n recipe_id: self.id,\n ingredient_id: id\n )\n end\n end",
"def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end",
"def make_tags\r\n Post.all.each do |post|\r\n 10.times do\r\n name = Faker::Lorem.word\r\n post.tags.create!(name: name)\r\n end\r\n end\r\nend",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n\n new_tags = params[:tags].split(',')\n\n new_tags.each do |stag|\n @event.tags.create(tag: stag)\n end\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag(taggable)\n Tagging.create :tag_id => id, :taggable => taggable\n taggings.reset\n end",
"def recipe_params\n params.require(:recipe).permit(:name,:description, ingredient_ids: [])\n end",
"def create\n @question = Question.new(question_params)\n @question.user_id = current_user.id\n @tags = params[:tags].split(',')\n @tagged = []\n\n\n respond_to do |format|\n if @question.save\n @activity = Activity.create(user_id: current_user.id, activity_type: 'Create', target_type: 'Question', target_id: @question.id)\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.create(taggable_id: @question.id, taggable_type: 'Question', tag_id: @tag.id)\n end\n end\n format.html { redirect_to \"/questions?question_id=#{@question.id}\", 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 end",
"def add_recipe(recipe)\n @recipes.push(recipe)\n save\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :servings, :description, :instructions, :url, :tags => [])\n end",
"def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n Instruction.multi_save(params[:instructions], @recipe)\n Ingredient.multi_save(params[:ingredients], @recipe)\n current_user.recipes << @recipe\n current_user.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vtodo = Vtodo.new\n @vtodo.summary = params[:vtodo][:summary]\n @vtodo.description = params[:vtodo][:description]\n @vtodo.status = ''\n list = params[:vtodo][:tags].split(\",\").each {|t| t.strip!}\n list.each do |item|\n tag = Tag.new\n tag = Tag.find_or_create_by_subject(item)\n tag.subject = item\n #tag.save \n @vtodo.tags << tag\n end\n\n respond_to do |format|\n if @vtodo.save\n flash[:notice] = 'Vtodo was successfully created.'\n format.html { redirect_to(@vtodo) }\n format.xml { render :xml => @vtodo, :status => :created, :location => @vtodo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vtodo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(params[:recipe])\n #@recipe.ingrediences = Ingredience.find(@params[:ingredience_ids]) if @params[:ingredience_ids]\n respond_to do |format|\n if @recipe.save\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to(@recipe) }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n @ingrediences = Ingredience.find(:all, :order => 'title')\n @categories = Category.find(:all, :conditions => [\"food = ?\", true])\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save_tags\n tagging_contexts.each do |context|\n tag_list = tag_list_on(context)\n\n ActsAsTaggableSimple::Tag.find_or_create_all_tags(tag_list)\n\n existing_tags = taggings_on(context).collect do |tagging|\n tagging.tag.name\n end\n new_tags = tag_list - existing_tags\n old_tags = existing_tags - tag_list\n\n destroyed_taggings = []\n taggings_on(context).each do |tagging|\n if old_tags.include? tagging.tag.name\n tagging.destroy\n destroyed_taggings << tagging\n end\n end\n\n self.taggings -= destroyed_taggings\n\n new_tags = ActsAsTaggableSimple::Tag.find_by_names(new_tags)\n new_tags.each do |tag|\n taggings.create! tag: tag, context: context\n end\n end\n end",
"def init_tags(object_id)\n next_token = nil\n tags_loaded = false\n\n tags = []\n\n while !tags_loaded do\n resp = @@client.describe_tags({\n filters: [\n {\n name: \"resource-id\",\n values: [object_id]\n }\n ]\n })\n\n tags.concat(resp.tags)\n tags_loaded = resp.next_token.nil? || resp.next_token.empty?\n next_token = resp.next_token\n\n end\n\n Hash[tags.map { |tag| [tag.key, tag.value] }]\n\n end",
"def create\n if current_user && current_user.email == 'zoe@test.com'\n resource = Resource.new(resource_params)\n #array of tag_ids from f.check_box_tag comes in as an array of strings\n tag_ids = params[:tag_ids].map(&:to_i)\n tag_array = []\n tag_ids.each do |id|\n tag = Tag.find(id)\n tag_array.push(tag)\n end\n if resource.save\n resource.tags << tag_array\n redirect_to resources_path\n end\n else\n redirect_to root_path\n flash[:error] = \"You do not have permission to perform this action.\"\n end\n end",
"def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_tags(tag_titles)\n update_counters_before\n tags = tag_titles.split(\",\").strip\n tags.each do |t|\n post_tag = self.post_type.post_tags.where(name: t).first_or_create!\n self.term_relationships.where({term_taxonomy_id: post_tag.id}).first_or_create!\n end\n update_counters(\"tags\")\n end",
"def get_recipes(recipe_name, recipe_tag, recipe_ingredients)\n\t\t\t\trecipes_ids = Set.new\n\t\t\t\tingredients_upcase = Set.new\n\t\t\t\t#search by\n\t\t\t\tcase\n\t\t\t\twhen !recipe_name.blank?\n\t\t\t\t\trecipes_ids = Recipe.where('UPPER(name) LIKE UPPER(?)', \"%#{recipe_name}%\").pluck(:id)\n\t\t\t\twhen !recipe_tag.blank?\n\t\t\t\t\trecipes_ids = RecipeTag.where('UPPER(tag) LIKE UPPER(?)', \"%#{recipe_tag}%\").pluck(:recipe_id)\n\t\t\t\twhen !recipe_ingredients.blank?\n\n\t\t\t\t\tingredients = recipe_ingredients.to_s.delete \"[\"\n\t\t\t\t\tingredients = ingredients.delete \"]\"\n\t\t\t\t\tingredients = ingredients.delete \" \"\n\n\t\t\t\t\tingredients_array = ingredients.split(\",\") \n\n\t\t\t\t\tingredients_array.each do |ingredient|\n\t\t\t\t\t\tingredients_upcase << ingredient.upcase\n\t\t\t\t\tend\n\n\t\t\t\t\trecipes_ids = RecipeIngredient.where('UPPER(ingredient) IN (?)', ingredients_upcase).pluck(:recipe_id)\n\t\t\t\telse\n\t\t\t\t\trecipes_ids = Recipe.all.pluck(:id)\n\t\t\t\tend\n\t\t\t\t#get recipes matching the ID\n\t\t\t\tif !recipes_ids.blank?\n\t\t\t\t\trecipes = Recipe.where(\"id IN (?)\", recipes_ids).order('created_at DESC')\n\t\t\t\t\t#get tags and ingredients for each recipe\n\t\t\t\t\trecipes.each do |recipe|\n\t\t\t\t\t\trecipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)\n\t\t\t\t\t\trecipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)\n\t\t\t\t\tend\n\n\t\t\t\t\treturn recipes\n\t\t\t\tend\n\t\t\tend",
"def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :author, :ingredients, :instructions, :image, tags_attributes: [:id, :name, :_destroy], ratings_attributes: [:id, :rate, :_destroy])\n end",
"def tags=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end",
"def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end",
"def generate_shopping_list\n\n #pull out whichever recipe you are clicking on\n recipe = Yummly.find(params[:yummly_id])\n\n # create a recipe for the database for future use\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n #create new shopping list for each recipe\n s = ShoppingList.create(\n name: recipe.name, \n yummly_id: params[:yummly_id],\n user_id: current_user.id,\n recipe_id: r.id)\n\n #find recipe and ingredient name from yummly\n recipe.ingredients.each do |ingredient|\n ShoppingListItem.create(done: nil, shopping_list_id: s.id, ingredient_name: ingredient, ingredient_quantity: nil, ingredient_quantity_unit: nil)\n end\n\n redirect_to recipes_url, notice: \"Added recipe to your shopping lists\"\n\n end",
"def create\n params[:tag_names].split(',').each do |name|\n @tag = Tag.find_or_create_by_name name.strip\n @tagging = Tagging.new(params[:tagging])\n @tagging.tag = @tag\n @tags_saved = @tagging.save\n end\n \n respond_to do |format|\n if @tags_saved\n format.html { redirect_to @tagging.taggable, notice: 'Tagged.' }\n format.json { render json: @tagging, status: :created, location: @tagging }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.create(blog_params)\n params[:tags][:tag_id].each do |p|\n @tagging = Tagging.create(tag_id: p.to_i, blog_id: @blog.id)\n end\n respond_to do |format|\n\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n\n end\nend",
"def update_tags(tags)\n rescue_extra_data\n tags = tags.split(\",\").strip\n post_tags = post_type.post_tags\n post_tags = post_tags.where.not(name: tags) if tags.present?\n term_relationships.where(\"term_taxonomy_id in (?)\", post_tags.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")).destroy_all\n tags.each do |f|\n post_tag = post_type.post_tags.where({name: f}).first_or_create(slug: f.parameterize)\n term_relationships.where({term_taxonomy_id: post_tag.id}).first_or_create\n end\n update_counters(\"tags\")\n end",
"def generate_tags\n tag_data = self.analyze_and_return_labels_with_score\n tag_data.each do |description, score|\n tag = Tag.find_or_create_by(description: description)\n self.image_tags.create(score: score, description: description, tag: tag)\n end\n end",
"def tag_ids=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end",
"def recipe_params\n params.require(:recipe).permit(:title, :description, :image, tag_ids:[], ingredients_attributes:[:id, :name, :amount, :_destroy], directions_attributes:[:id, :step, :_destroy])\n end",
"def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end",
"def create\n @recipe = Recipe.new(recipe_params)\n # if params[:add_ingredient]\n # @recipe.ingredients.build\n # end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tags(tags)\n self.tags = tags.map.each do |tag|\n Tag.find_or_create_by_name tag\n end\n end",
"def set_tags\n @tags = Tag.all\n @time = Tag.all.to_a.slice(0..4)\n @place = Tag.all.to_a.slice(5..8)\n @feeling = Tag.all.to_a.slice(9..13)\n @tag = Tag.find_by(id: params[:id])\n end",
"def save_tags\n Tag.transaction do\n taggings.delete_all\n\n scope = nil\n scope = send(self.class.taggable_options[:scope]) if self.class.taggable_options[:scope]\n\n parsed_tags(tagged_with).each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name)\n self.taggings.create(:tag => tag, :scope => scope)\n end\n end\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def get_recipe(id)\n recipe = Recipe.find(id)\n url = \"https://api2.bigoven.com/recipe/steps/#{recipe.id}?&api_key=#{ENV['API_KEY']}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # puts response\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n # recipe.ingredients.create!(\n if (!Ingredient.exists?(ingredient[\"IngredientID\"])) \n Ingredient.create!(\n id: ingredient[\"IngredientID\"],\n name: ingredient[\"Name\"],\n html_name: ingredient[\"HTMLName\"]\n )\n end\n end\n\n if (recipe.recipe_ingredients.count > 0)\n recipe.recipe_ingredients.destroy_all\n recipe.save\n recipe.reload\n end\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n \n # if (!recipe.recipe_ingredients.find_by(ingredient_id: ingredient[\"IngredientID\"]))\n recipe.recipe_ingredients.create!(\n ingredient_id: ingredient[\"IngredientID\"],\n quantity: ingredient[\"Quantity\"],\n display_quantity: ingredient[\"DisplayQuantity\"],\n unit: ingredient[\"Unit\"],\n metric_quantity: ingredient[\"MetricQuantity\"],\n metric_display_quantity: ingredient[\"MetricDisplayQuantity\"],\n metric_unit: ingredient[\"MetricUnit\"],\n preparation_notes: ingredient[\"PreparationNotes\"]\n )\n # end\n end\n \n recipe.steps = ''\n steps = JSON.parse(response)[\"Steps\"]\n steps.each do |step|\n step != steps.last ? recipe.steps += step[\"Text\"] + '$' : recipe.steps += step[\"Text\"]\n # recipe.steps += step[\"Text\"] + ','\n end\n \n recipe.save\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def create\n @post = Post.new(params[:post])\n\n if params['tag_field'] != nil\n tags_array = params['tag_field'].split(\",\")\n tags_array.each do |tag|\n @post.tags << Tag.find_or_create_by_etiqueta_and_post_id(tag.strip, @post.id)\n end\n end\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_tag\n puts \"******* add_new_tag *******\"\n puts \" ** params: #{params.inspect}\"\n\n @post_id = params[:post_id]\n\n # == create brand new tag; add to Tags\n if params[:new_tag] != \"new\"\n\n # == check if tag already exists\n check_tag = Tag.where(tag_name: params[:new_tag])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n # == create new tag if not existing and assign to post\n if check_tag.length == 0\n @tag = Tag.create(tag_name: params[:new_tag], tag_rank: 0)\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: @tag[:id])\n puts \" ** NEW TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n\n # == assign existing tag if selected from select box (not \"ng\")\n if params[:tag_id] != \"ng\"\n\n # == check if tag already assigned to post\n check_tag = PostTag.where(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n if check_tag.length == 0\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** EXISTING TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n @post_tags = PostTag.where(post_id: params[:post_id])\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end",
"def given_tags(*names)\n Tag.find_or_create_all_by_name(*names)\n end",
"def add_tags(tags)\n rsp = @flickr.send_request('flickr.photos.addTags', {:photo_id => self.id, :tags => tags}, :post)\n true\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :summary, :description, :picture, style_ids: [], ingredient_ids: [])\n end",
"def create\n @taggable = current_user.taggables.new(params[:taggable], :user_id => current_user.id)\n \n respond_to do |format|\n if @taggable.save\n # if the DB commit was successful then try to tag faces.\n logger.debug(@taggable.photo.path)\n faceArray = findFaces(@taggable.photo.path(:editable))\n \n faceArray.each do |rect|\n @tag = @taggable.tags.new(:upperLeftX => rect[0],\n :upperLeftY => rect[1],\n :lowerRightX => rect[2],\n :lowerRightY => rect[3],\n :person => \"Random Person\")\n @tag.save\n end\n\n format.html { redirect_to \"/tagging/#{@taggable.id}\", notice: 'Taggable was successfully created.' }\n format.json { render json: @taggable, status: :created, location: @taggable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_new_tag_to_tag_table(tag_attributes)\n\n tag_attributes.split(\",\").each do |value|\n value=value.strip\n available_tag = Tag.where('tagname = ?', value).first #checking if added tag is available in the list/not.\n new_tag = Tag.create(:tagname => value) if available_tag.blank? #If it's a new tag then create and Add it to Tag list.\n available_tag.blank? ? self.insert_ids_to_post_tags(new_tag.id) : self.insert_ids_to_post_tags(available_tag.id) #Depending on tag available or it's a new tag, updating post_tags tag.\n end\n\n end",
"def create_article_tags\n 5.times do\n Tag.create(tag_text: Faker::Hipster.word, author_id: Author.pluck(:id).sample, taggable_type: \"Article\", taggable_id: Article.pluck(:id).sample)\n end\nend",
"def add_tags(*list)\n tags.push(*list).uniq!\n tags\n end",
"def process_ingredient_list\n return if @ingredient_list.blank?\n\n # if this recipe was just created, save original_ingredient_list\n if original_ingredient_list.blank?\n self.original_ingredient_list = @ingredient_list\n end\n \n if @ingredient_list.is_a?(String)\n ingr_array = @ingredient_list.split(/\\n/)\n else\n ingr_array = @ingredient_list\n end\n\n # Usually Rails just sets the key to null. To really delete the record, the following two lines are needed\n ingredients_recipes.each {|ir| ir.delete}\n ingredients_recipes.reload\n \n ingr_array.each_with_index do |line, index|\n line.strip!\n next if line.empty?\n \n # check for groups first, then ingredients. Groups are deliminated with stars like this: *Group*\n attrs = {}\n if line =~ /^\\*(.*)\\*$/\n attrs[:description] = $1\n attrs[:group] = true\n else\n # If a comma, assume everything past is a comment so only parse the first part but then \n # add it back in before processing the description\n line.downcase!\n comma_index = line.index(\",\")\n desc_part = ''\n unless comma_index.blank?\n desc_part = line.slice!(comma_index .. -1)\n end\n attrs[:ingredient] = Ingredient.find_name_and_create(line)\n attrs[:weight] = Ingredient.find_num(line)\n attrs[:unit] = Ingredient.find_unit(line)\n line.slice!(desc_part) # Make sure desc_part is not included twice\n \n # if using the whole_unit, take it out here so it doesn't get repeated in the description\n if attrs[:unit] == 'whole' && !attrs[:ingredient].whole_unit.blank?\n line.slice!(attrs[:ingredient].whole_unit)\n end\n attrs[:description] = Ingredient.find_description(line + desc_part) \n end\n attrs[:line_num] = index\n attrs[:recipe_id] = self.id\n \n ingredient_recipe = IngredientsRecipe.create!(attrs)\n ingredients_recipes << ingredient_recipe\n Ingredient.standardize_unit(ingredient_recipe)\n end\n @ingredient_list = nil\n end",
"def addTags(photo,tags)\n photo = photo.id if photo.class == Flickr::Photo\n tstr = tags.join(',')\n @flickr.call_method('flickr.photos.addTags',\n 'photo_id' => photo, 'tags' => tstr)\n end",
"def create(options = {})\n optional = [:description,\n \t\t\t :compatible_with,\n \t\t\t :script_type\n ]\n params.required(:label).accepts(optional).validate!(options)\n response = request(:post, \"/recipes.json\", default_params(options))\n response['recipe']\n end",
"def update_tags!(filter_boxes)\n sections_with_content.each do |s|\n section = s['mampf_section']\n content_in_section(s).each do |c|\n # if tag for content already exists, add tag to the section and course\n if c['tag_id']\n tag = Tag.find_by_id(c['tag_id'])\n next unless tag\n next unless section\n next if section.in?(tag.sections)\n tag.sections |= [section]\n tag.courses |= [@lecture.course]\n next\n end\n next unless filter_boxes[c['counter']].second\n # if checkbox for tag creation is checked, create the tag,\n # associate it with course and section\n tag = Tag.new(courses: [@lecture.course],\n sections: [section])\n tag.notions.new(title: c['description'],\n locale: @lecture.locale || I18n.default_locale)\n tag.save\n end\n end\n end",
"def create_hash_tags\n get_name_hash_tags.each do |name|\n hash_tags.create(name: name)\n end\n end",
"def create\n @recipe = current_user.recipes.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n if params[:lista].present?\n params[:lista].each do |(c,ingrediente)|\n Ingredient.create(name: ingrediente, recipe_id:@recipe.id) if ingrediente != \"\"\n end\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n format.js {flash.now[:notice] = 'La receta se ha creado de forma exitosa.'} #ajax\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al crear la receta.'} #ajax\n end\n end\n end",
"def create_tags(article)\n tags_arr = []\n AlchemyAPI.key = @api_key\n a_entities = AlchemyAPI::EntityExtraction.new.search(text: article)\n a_entities.each { |e| tags_arr.push(e['text']) }\n # puts 'Alchemy concepts:'\n a_concepts = AlchemyAPI::ConceptTagging.new.search(text: article)\n a_concepts.each { |c| tags_arr.push(c['text']) }\n tags_arr\n rescue Exception => e\n Rails.logger.error { \"Tagging error: #{e}\" }\n end",
"def create\n\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n create_multiple_tags(task_params[\"tag\"], @task.id)\n\n format.html { redirect_to @task.list, notice: \"Task successfully created\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @event = Event.new(event_params)\n\n tag_array = event_params2['tags'].split(',')\n tag_array.each do |x|\n @tag = Tag.create(desc: x)\n @event.tags << @tag\n end\n EventTag.create(event_id: @event.id, tag_id: @tag.id)\n\n respond_to do |format|\n if @event.save\n params[:event]['images'].each do |a|\n @event_photo = @event.event_photos.create!(:image => a, :event_id => @event.id)\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\nend",
"def add_contextual_tags(context_tags, context)\r\n Tagging.destroy_all(:taggable_id => self.id, :taggable_type => \"Profile\", :context => context) # destroy old taggings\r\n unless context_tags.nil?\r\n context_tags.split(\",\").slice(0...10).each do |tag|\r\n context_tag = Tag.find_or_create_with_like_by_name(tag.clean)\r\n taggings << Tagging.create(:tag_id => context_tag.id, :context => context)\r\n end\r\n end \r\n end",
"def update_tags!\n return unless @params.key?(:tags)\n\n tags_to_remove.each do |tag_title|\n TaskTag.where(task: task).joins(:tag).merge(Tag.where(title: tag_title)).destroy_all\n end\n\n tags_to_add.each do |tag_title|\n TaskTag.where(task: task, tag: tag_from_title(tag_title)).first_or_create!\n end\n end",
"def get_recipe_by_id(recipe_id)\n\t\t\t\trecipe = Recipe.find_by(id: recipe_id)\n\t\t\t\trecipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)\n\t\t\t\trecipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)\n\n\t\t\t\treturn recipe\n\t\t\tend",
"def set_tag_ids nids\n # Ensure that the user's tags are all and only those in nids\n oids = tagging_tags.pluck :id\n\n # Add new tags as necessary\n (nids - oids).each { |tagid| assert_tagging tagid, @tagging_user_id }\n\n # Remove tags as nec.\n (oids - nids).each { |tagid| refute_tagging tagid, @tagging_user_id }\n end",
"def tag_books(tag, books)\n puts \"Tagging #{books.length} books as #{tag}\"\n books.each do |b|\n unless Tag.exists?(book_id: b.id, name: tag)\n Tag.create(book_id: b.id, name: tag)\n end\n end\n puts \"Done tagging #{tag}\"\nend",
"def tag_list=(tags_string)\n tag_names = tags_string.split(/[\\s,\",\"]/).map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def assign_tag(resource_arn, tag_list, region=@config['region'])\n begin\n tag_list.each do |each_pair|\n tag_resp = MU::Cloud::AWS.lambda(region: region, credentials: @config['credentials']).tag_resource({\n resource: resource_arn,\n tags: each_pair\n })\n end\n rescue Exception => e\n MU.log e, MU::ERR\n end\n end",
"def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end",
"def create\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.save_recipe_to_db(aws_params)\n msg = {:notice => \"Recipe created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end",
"def create_tags(article)\n tags_arr = []\n Indico.api_key = @api_key\n ind_keywords = Indico.keywords article\n ind_keywords.each { |k, _v| tags_arr.push(k) }\n ind_tags = Indico.text_tags article\n ind_tags_sorted = ind_tags.sort_by { |_k, v| -1.0 * v }.first(10).to_h\n ind_tags_sorted.each { |k, _v| tags_arr.push(k) }\n puts \"Indico tags:#{tags_arr}\"\n tags_arr\n rescue\n Rails.logger.error { 'Tagging error in Indico' }\n end",
"def create\n #tags are sent to the controller as a string array\n #we'll create our own way to find the Tag objects\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.new(new_equipment_params)\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully created.' }\n format.json { render json: @equipment, status: :created, location: @equipment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag_ids=(tag_id_list)\n tag_id_list.each { |tag_id| PostTag.create(post_id: self.id, tag_id: tag_id) if !tag_id.blank? }\n end",
"def create\n\t\tif Recipe.find_by({api_id: params[:api_id]})\n\t\t\tflash[:error] = \"Recipe '#{params[:name]}' already exists in your saved recipes.\"\n\t\telse\n\t\t\t@recipe = Recipe.new(recipe_params)\n\t\t\tif @recipe.save\n\t\t\t\tids = params[:inventories].split(\",\")\n\t\t\t\tfor index in 0...ids.length\n\t\t\t\t\t@recipe.inventories << Inventory.where({id: ids[index].to_i})\n\t\t\t\tend\n\n\t\t\t\trender json: @recipe\n\t\t\telse\n\t\t\t\trender status: 400, nothing: true\n\t\t\tend\n\t\tend\n\tend",
"def product_tags=(values)\n self.tag_list = values\n end",
"def add_tags?(instance_ids, opts = {})\n tags = params.tags\n (tags ||= {}).merge!(DTK_TAG) if opts[:with_dtk_tag]\n if tags\n client.create_tags(resources: instance_ids, tags: tags.map { |k, v| { key: k, value: v } })\n end\n end",
"def rebuild_taggings\n if @tags_updated\n tag_class = self.class.tag_class\n input = @tag_summary.split(',').map(&:strip).reject(&:blank?)\n existing = tags.all.map(&:name)\n deleted = existing - input\n added = input - existing\n\n # Remove taggings and check for orphaned tags\n unless deleted.empty?\n delete_query = [\"EXISTS (SELECT 1 FROM #{tag_class.table_name} WHERE name IN (?))\", deleted]\n taggings.where(delete_query).delete_all\n end\n\n # Create new taggings and tags (if nescessary)\n unless added.empty?\n added.each do |name|\n tag = tag_class.find_or_create_by(name: name)\n taggings.create(:tag => tag)\n end\n end\n\n # Delete orphaned tags\n self.class.tag_class.orphans.delete_all\n end\n end"
] |
[
"0.6504265",
"0.64722246",
"0.6460168",
"0.6329924",
"0.6221021",
"0.6200165",
"0.61626905",
"0.615402",
"0.600268",
"0.59847164",
"0.5966246",
"0.5955774",
"0.5938593",
"0.5935551",
"0.5929505",
"0.5904022",
"0.586058",
"0.5853507",
"0.58348316",
"0.5789006",
"0.5770832",
"0.5746605",
"0.5739098",
"0.57249224",
"0.57177377",
"0.5702046",
"0.565492",
"0.5644438",
"0.56355643",
"0.56349754",
"0.5631204",
"0.5620306",
"0.5616876",
"0.56026894",
"0.5600819",
"0.5562987",
"0.5561227",
"0.5552427",
"0.5547688",
"0.5526372",
"0.55193025",
"0.5515958",
"0.5515584",
"0.5507701",
"0.5502084",
"0.5499036",
"0.54895645",
"0.548245",
"0.547957",
"0.5473001",
"0.5470824",
"0.54659426",
"0.5457285",
"0.5447731",
"0.5442255",
"0.543846",
"0.5437593",
"0.543019",
"0.5426062",
"0.5425535",
"0.54225564",
"0.5419343",
"0.54182196",
"0.5417889",
"0.540457",
"0.54037815",
"0.5396994",
"0.53967637",
"0.53907716",
"0.538692",
"0.5383109",
"0.53815347",
"0.5379136",
"0.5377796",
"0.53769755",
"0.53713715",
"0.5371023",
"0.536954",
"0.5366712",
"0.53609145",
"0.5356123",
"0.53514075",
"0.5343047",
"0.5342426",
"0.5342254",
"0.5334924",
"0.53288794",
"0.5321165",
"0.531785",
"0.5317829",
"0.5311734",
"0.5307494",
"0.53001237",
"0.52939165",
"0.5290877",
"0.5289543",
"0.52847064",
"0.5281203",
"0.5279165",
"0.52739185"
] |
0.7807949
|
0
|
Find all recipes matching the parameters recipe_name: name of the recipe recipe_tag: a single tag for a recipe recipe_ingredients: list of ingredients
|
def get_recipes(recipe_name, recipe_tag, recipe_ingredients)
recipes_ids = Set.new
ingredients_upcase = Set.new
#search by
case
when !recipe_name.blank?
recipes_ids = Recipe.where('UPPER(name) LIKE UPPER(?)', "%#{recipe_name}%").pluck(:id)
when !recipe_tag.blank?
recipes_ids = RecipeTag.where('UPPER(tag) LIKE UPPER(?)', "%#{recipe_tag}%").pluck(:recipe_id)
when !recipe_ingredients.blank?
ingredients = recipe_ingredients.to_s.delete "["
ingredients = ingredients.delete "]"
ingredients = ingredients.delete " "
ingredients_array = ingredients.split(",")
ingredients_array.each do |ingredient|
ingredients_upcase << ingredient.upcase
end
recipes_ids = RecipeIngredient.where('UPPER(ingredient) IN (?)', ingredients_upcase).pluck(:recipe_id)
else
recipes_ids = Recipe.all.pluck(:id)
end
#get recipes matching the ID
if !recipes_ids.blank?
recipes = Recipe.where("id IN (?)", recipes_ids).order('created_at DESC')
#get tags and ingredients for each recipe
recipes.each do |recipe|
recipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)
recipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)
end
return recipes
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recipeingredientsearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end",
"def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end",
"def authoringredientrecipesearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def recipe_grep name='.'\n @recipe.select{ |r| r.name === name }\n end",
"def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end",
"def search\n @recipes = Recipe.find_by_contents params[:query]\n end",
"def search\n binding.pry\n @recipe = Recipe.where\n end",
"def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end",
"def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end",
"def ingredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n if params[:exclusive] == \"1\"\n Recipe.all.find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.all.find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end \n return @recipes\n end",
"def items_for_recipe(recipe)\n\t\t# Everything will be stored in terms of ounces\n\t\tids = []\n\t\t# Loop through the structured ingredients\n\t\trecipe.each do |r|\n\t\t\t# Pull all items from database with matching length\n\t\t\titems = Item.allForName(r[\"name\"])\n\t\t\t# Mostly for proof of concept, if there is only one item matching, add it to the list.\n\t\t\tif items.length == 1\n\t\t\t\tids << items.first.id\n\t\t\telse\n\t\t\t\t# Loop through resulting items from database.\n\t\t\t\titems.each do |item|\n\t\t\t\t\t# Compare quantities, if the recipe calls for a quantity of less than the item,\n\t\t\t\t\t# add it to the database and exit the loop. \n\t\t\t\t\tif r[\"qty\"] <= item.qty\n\t\t\t\t\t\tids << item.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Return the list of matching IDs\n\t\treturn ids\n\tend",
"def search_recipes\n # Prepare the pagination with 30 per page\n page = params[:p].blank? || params[:p].to_i < 1 ? 1 : params[:p].to_i\n per_page = 30\n\n # Break the search into its parts and search for each term\n query = params[:q].squish\n results = Recipe.search_recipes(query)\n .limit(per_page + 1)\n .offset((page - 1) * per_page)\n # We do +1 here because if, at the end, we have per_page + 1 entries, we know there's a next page\n @searchresults = results\n\n # Matches? Show the search form\n # Prepare simple pagination\n @prev_page = page > 1 ? (page - 1).to_s : nil\n @next_page = @searchresults.size > per_page ? (page + 1).to_s : nil\n @base_url = recipe_search_path + \"?q=\" + URI.encode(params[:q])\n # Pop the end off the results array so we can stick to per_page items per page\n @searchresults.try(:pop)\n end",
"def recipes\n return self.selected_recipes.map do |selected_recipe|\n selected_recipe.recipe\n end\n # recipes = []\n # self.selected_recipes.each do |selected_recipe|\n # recipes << selected_recipe.recipe\n # end\n # return recipes\n end",
"def authoringredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n \n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n \n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end",
"def all\n # returns all recipes\n @recipes\n end",
"def recipes_from_allrecipes(keyword)\n url = \"https://www.allrecipes.com/search/results/?search=#{keyword}\"\n doc = Nokogiri::HTML(URI.open(url))\n doc.search('.card__recipe').map do |card|\n name = card.search('.card__title').first.text.strip\n description = card.search('.card__summary').first.text.strip\n rating = card.search('.rating-star.active').size\n rating = nil if rating.zero?\n Recipe.new(name, description, rating)\n end\nend",
"def index\n search_query = params[:search]\n if search_query.blank? || search_query.nil?\n @recipes = Recipe.all\n else\n @recipes = Array.new\n\n @search = Sunspot.search Recipe, Tag, Ingredient do\n fulltext search_query\n end\n\n @search.results.each do |result|\n if result.is_a?(Tag)\n @recipe_tags = RecipeTag.select { |rt| rt.tag_id == result.id}\n\n @recipe_tags.each do |tag|\n Recipe.select { |rc| rc.id == tag.recipe_id }.each do |recipe|\n @recipes << recipe\n end\n end\n elsif result.is_a?(Ingredient)\n @measurements = Measurement.select { |m| m.ingredient_id == result.id }\n\n @measurements.each do |measurement|\n Recipe.select { |r| r.id == measurement.recipe_id }.each do |recipe|\n @recipes << recipe\n end\n end\n elsif result.is_a?(Recipe)\n @recipes << result\n end\n end\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end",
"def index\n @recipes = Recipe.where(nil)\n if params[:recipe].present?\n filtering_params(params).each do |key, value|\n @recipes = @recipes.public_send(key, value) if value.present?\n end\n end\n end",
"def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end",
"def by_ingredient_search(query)\n ingredient_query = Ingredient.where('name LIKE ?', \"%#{query}%\")\n if ingredient_query.any?\n return self.approved.where(:id => ingredient_query.collect(&:recipes).flatten.uniq.collect(&:id))\n end\n return self.approved\n end",
"def recipes\n recipe_cards.map { |c| c.recipe }\n end",
"def index\n @recipes = Recipe.search(params[:search])\n @ingredients = Ingredient.all\n end",
"def index\n if params[:searchingredients] != nil && params[:search] != nil && \n params[:searchauthor] != nil\n #Arrays and page_title are declared to avoid no-method errors if fields\n #that are null get into scope of a find or where clause\n @page_title = \"Some Recipes\"\n @recipes = []\n @recing = []\n @searchingreed = []\n #Search by recipe name, author,and ingredients.\n if params[:searchingredients].empty? == false && \n params[:search].empty? == false && params[:searchauthor].empty? == false\n @recipes = authoringredientrecipesearch()\n \n #Search by recipe name and ingredients.\n elsif params[:searchingredients].empty? == false && \n params[:search].empty? == false && params[:searchauthor].empty? == true\n @recipes = recipeingredientsearch()\n \n #Search by ingredients and author.\n elsif params[:searchingredients].empty? == false && \n params[:search].empty? == true && params[:searchauthor].empty? == false\n @recipes = authoringredientsearch()\n \n #Search by recipe name and author.\n elsif params[:searchingredients].empty? == true && \n params[:search].empty? == false && params[:searchauthor].empty? == false\n @query = params[:search]\n @author = User.find_by_username(params[:searchauthor])\n \n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n @recipes.push(r)\n end\n #Search only by ingredients.\n elsif params[:searchingredients].empty? == false && \n params[:search].empty? == true && params[:searchauthor].empty? == true\n @recipes = ingredientsearch()\n \n #Searching by name.\n elsif params[:searchingredients].empty? == true && \n params[:search].empty? == false && params[:searchauthor].empty? == true\n @query = params[:search]\n \n Recipe.where(\"name like :name\", {name: \"%#{@query}%\"}).find_each do |r|\n @recipes.push(r)\n end\n #Find by author alone.\n else\n @author = User.find_by_username(params[:searchauthor])\n \n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n @recipes.push(r)\n end \n end\n \n #This sorts the recipes by their recipe title.\n if (params[:order] == \"1\")\n @recipes.sort! {|a, b| b.name.downcase <=> a.name.downcase}\n else\n @recipes.sort! {|a, b| a.name.downcase <=> b.name.downcase}\n end\n \n #This sorts the recipes by their rating in descending order.\n if (params[:rating] == \"1\")\n @recipes.sort! do | a, b|\n a.rating == nil ? akey = -1 : akey = a.rating\n b.rating == nil ? bkey = -1 : bkey = b.rating\n bkey <=> akey\n end\n end\n \n else\n \n @page_title = \"All Recipes\"\n @recipes = Recipe.all \n end\n end",
"def get_recipe_titles(user_ingredients)\n \n search_params = 'http://www.recipepuppy.com/api/?i=' + user_ingredients.join(\",\")\n \n\n recipes = []\n search_string = RestClient.get(search_params)\n search_hash = JSON.parse(search_string)\n relevant_recipes = search_hash[\"results\"]\n relevant_recipes.collect do |recipe|\n recipes << recipe[\"title\"].strip\n end\n \n recipes\nend",
"def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end",
"def by_ingredient\n # If ingredient exists, find recipes that use it\n if Ingredient.exists?(params[:id])\n ingredient = Ingredient.find(params[:id])\n recipes = Recipe.recipes_of_ingredient(params[:id])\n else\n recipes = Recipe.all\n end\n\n # Render json\n render json: {recipes: recipes}, status: 200 \n end",
"def search\n puts params[:terms]\n query = 'FALSE'\n params[:terms].split(',').each do |term|\n query += \" OR item.name iLIKE ? OR ingredients.unit iLIKE ? OR ingredients.quantity iLIKE ?\"\n end\n @items = Item.where(query, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}).eager_load(:ingredients)\n if @items.any?\n @recipes = Recipe.joins(:ingredients).where('ingredients.item_id IN (?)', @items.pluck(:id)).uniq\n end\n end",
"def recipes\n @recipes.sort.collect {|id| $data_recipes[id] }\n end",
"def recipes\n @recipes ||= []\n end",
"def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end",
"def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n # RecipeCard.name\n end.map do |recipe_card|\n recipe_card.recipe\n end\n end",
"def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end",
"def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end",
"def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end",
"def index\n \tif( ! is_blank?(params[:name]) ) then\n \t@search_by = params[:name]\n\t @recipes = Recipe.find :all, :conditions => ['name LIKE ?', \"%#{@search_by}%\"]\n\telsif( ! is_blank?(params[:ingredient_name]) ) then\n \t@search_by_ingredient = params[:ingredient_name]\n\t @recipes = Recipe.find :all, :select => \"DISTINCT (recipe.*)\", :include => [:recipe_ingredients], :joins => :ingredients, :conditions => [\"ingredients.name LIKE ?\", \"%#{@search_by_ingredient}%\"]\n else\n\t @recipes = Recipe.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipes }\n end\n end",
"def find_recipe_by_title\n # view_recipe(Recipe.find_by(title: ask('Which recipe would you like to look for? >:'))) # ask for recipe title, search for it and display\n list_recipes(Recipe.where(\"title LIKE ?\", \"%\"+ ask('Which recipe would you like to look for? >:') + \"%\").order(:title))\n\n end",
"def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end",
"def recipe_finder(recipe_id)\n system 'clear'\n Recipe.all.select{|recipe| recipe.id == recipe_id}.each do |i|\n puts i.name.upcase\n puts \"Rating: #{i.rating}\"\n puts \"Cooking Time: #{i.time} hours\"\n puts \"Difficulty Level: #{i.difficulty}\"\n @recipe_ingredient = i.ingredient\n end\n prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"See ingredients\", -> {recipe_ingredients(recipe_id)}\n menu.choice \"Choose a different protein\", -> {choose_protein}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end",
"def all\n @recipes\n end",
"def all\n @recipes\n end",
"def all\n @recipes\n end",
"def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end",
"def get_nodes_by_recipe(recipe, includeme=true, options={})\n options = {\n :search_string => recipe,\n :include_me => includeme,\n :order => [:recipe],\n :safe_deref => nil,\n :current_node => nil,\n :one_or_all => :all\n }.merge(options)\n opsit_search(options)\n end",
"def recipes\n recipe_card_array = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n\n recipe_card_array.map do |recipe_card|\n recipe_card.recipe\n end\n end",
"def scrape_recipe(ingredient)\n @recipes_array = []\n @ingredient = ingredient\n url = \"https://www.allrecipes.com/search/results/?search=#{@ingredient}\"\n html_file = URI.open(url).read\n html_doc = Nokogiri::HTML(html_file)\n html_doc.search('.card__detailsContainer').each do |element|\n title = element.search('.card__title').first.text.strip\n description = element.search('.card__summary').first.text.strip\n rating = element.search('.review-star-text').text.strip.slice(/(\\d.?\\d*)/)\n url = element.search('.card__titleLink').first.attribute('href').value\n\n @recipes_array << {\n title: title,\n description: description,\n rating: rating,\n url: url\n }\n end\n @recipes_array\n end",
"def all\n return @recipes\n end",
"def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end",
"def scrape_recipes(ingredient)\n\turl = \"https://www.bbcgoodfood.com/search/recipes?query=#{ingredient}\"\n\n\thtml_string = open(url).read\n\thtml = Nokogiri::HTML(html_string)\n\n\t# We are searching for this:\n\t# <h3 class=\"teaser-item__title\">\n\t# \t<a href=\"\">Chocolate brownies</a>\n\t# </h3>\n\n\thtml.search(\".teaser-item__title a\")[0...2].each do |element|\n\t\ttitle = \"********\" + element.text + \"********\"\n\t\turl = element.attribute(\"href\").value\n\n\t\tsteps = scrape_steps(url)\n\n\t\tputs title\n\n\t\tsteps.each_with_index do |step, index|\n\t\t\tputs \"#{index + 1} - #{step}\"\n\t\t\tputs\n\t\tend\n\n\t\tputs\n\tend\nend",
"def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end",
"def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end",
"def recipes\n # should return all of the recipes this user has recipe cards for\n\n # first match up the user with their recipe cards\n # my_recipe_cards = RecipeCard.all.select do |recipe_card| #rc\n # # self == recipe_card.user # recipe_card.user == self\n # recipe_card.user == self\n # end\n\n # binding.pry\n # then take that array and get the recipes out of it\n self.recipe_cards.map do |recipe_card| # what is this an array of?\n recipe_card.recipe\n end\n # [recipe card objects for that user]\n\n # return an array of recipes\n end",
"def getRecipeByTag\n begin\n @recipe = Recipe.where('tags ILIKE ?', '%'+params[:tag]+'%').all\n\n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end",
"def find_recipe_by_ingredient\n print(\"What ingredients do you have? (Separate by comma)\")\n user_food = gets.chomp\n\n ingredient_ids = user_food.split(\",\").collect do |ingredient|\n Ingredient.find_by(name: ingredient).id\n end\n meal_arr = Meals.all.select do |meal|\n ingredent_ids.include?(meal.ingredient_id)\n end\n hash = {}\n meal_arr.each do |meal|\n if hash.keys.include?(meal.recipe_id)\n hash[meal.recipe_id] += 1\n else\n hash[meal.recipe_id] = 1\n end\n end\n arr = []\n hash.each do |recipe_id, ingredient_count|\n total_ingredients.to_f = Recipe.find(recipe_id).ingredients.size\n if ingredient_count / total_ingredients > 0.80\n arr << Recipe.find(recipe_id).name\n end\n end\n return arr\nend",
"def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end",
"def recipes\n RecipeCard.all.map{|recipe_card| recipe_card.recipe if recipe_card.user == self}.compact\n end",
"def recipes\n Array fetch(:run_list)\n end",
"def findrecipes\n\t\t@hide_menu = true\n puts \"In Find Recipes\"\n #this is where the data for the searching of recipes gets routed into\n input = params['query'].inspect\n\n ingreds = input.split(',')\n\n input = ingreds.join(\"%2C\")\n #this is the api \n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/findByIngredients?fillIngredients=false&ingredients=\" + input + \"&limitLicense=false&number=5&ranking=1\"\n\n res = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n\n recipes = res.body\n #for each recipe that gets returned, the following information is routed into the recipe results page\n recipes.each do |recipe|\n url2 = url2 = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recipe['id'].to_s + \"/information?includeNutrition=false\"\n\n res2 = Unirest.get url2,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n\n price = (\"$\" + (0.01 * res2.body['pricePerServing']).to_s)[0..5]\n\n recipe['price'] = price\n #this is the price of a recipe per serving\n\n end\n\n @recipeData = recipes\n render template: \"recipes/data\"\n end",
"def ingredients\n RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }\n end",
"def generate_recipes_list\n recipes = YARD::Registry.all(:recipe).uniq.sort_by {|recipe| recipe.Name.to_s}\n generate_full_list(recipes, 'Recipe', 'recipes')\nend",
"def recipes\n\t\tRecipeCard.all.select { |recipe_card| recipe_card.user == self }\n\tend",
"def for_ingredient_group(ingredient_group_id)\n ingredient_group = IngredientGroup.find_by_id(ingredient_group_id)\n if ingredient_group.present?\n recipe_ingredients = RecipeIngredient.where(:ingredient_id => ingredient_group.ingredient_ids )\n recipes = recipe_ingredients.collect {|ri| ri.recipe }\n return recipes.uniq\n end\n return [ self.approved, FAIL_SEARCH_MESSAGE ]\n end",
"def set_recipes\n @recipes = Recipe.includes(:ingredients).all #includes will cache the ingredients info and keep it there for later use, instead of querying again for this info later when it is needed\n @message = \"No Recipes Found\" if @recipes.empty?\n end",
"def recipe_instance(recipe_name) \n Recipe.find_by name: recipe_name\n end",
"def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end",
"def get_recipe_names\n users_recipes.map {|ur| ur.recipe.name}\n end",
"def selected_recipes\n SelectedRecipe.where(recipe_id: self.id )\n end",
"def recipes\n Recipe.all.select {|recipes| recipes.user == self}\n end",
"def index\n @fridge_item_ids = FridgeItem.pluck(:ingredient_id)\n @available_recipes = find_available_recipes\n @recipes = Recipe.paginate(page: params[:page])\n end",
"def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end",
"def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end",
"def recipe (recipe_id, name)\n if recipe_id\n this_recipe = Recipe.find(recipe_id.to_i)\n else\n this_recipe = Recipe.find_by(name)\n end\n\n creation = {\n :name => this_recipe[:name],\n :instructions => this_recipe.instructions.all,\n :ingredients => this_recipe.ingredients.all\n }\n # return the object\n creation\n end",
"def get_recipes(section)\n # Example: https://terraria.gamepedia.com/index.php?title=Recipes/Iron_Anvil&action=raw\n @connection.get '/index.php', {\n 'title' => \"Recipes/#{section}\",\n 'action' => 'raw'\n }\n end",
"def find_ingredient(ingredient_name)\n ingredients[ingredient_name]\n end",
"def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end",
"def search #recipes_search_path\n #binding.pry\n @keywords = params['keywords']\n if @keywords.blank?\n redirect_to root_path\n else\n @number_of_recipes = EdamamApiWrapper.find_number_of_recipes(@keywords)\n @recipes = EdamamApiWrapper.list_recipes(@keywords, 0, 9)\n end\n end",
"def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end",
"def recipes\n @ingredient = Ingredient.find(params[:id])\n \n respond_to do |format|\n format.html do\n @recipes = @ingredient.recipes.paginate(:page => params[:page], :order => 'name', :per_page => 5)\n end # recipes.html.haml\n format.xml do\n @recipes = @ingredient.recipes\n render :xml => @recipes\n end\n end\n end",
"def by_ingredients(query)\n # \"OR\" behavior by default\n apply_filter_list \"ingredients\", query\n\n self\n end",
"def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end",
"def index\n authorize! :read, Recipe\n @query = params[:query]\n @search_result = Recipe.search do\n fulltext params[:query]\n if params[:course_type_ids].present?\n all_of do\n params[:course_type_ids].each do |filter|\n with(:course_type_ids, filter)\n end\n end\n end\n if params[:exclu_course_type_ids].present?\n all_of do\n params[:exclu_course_type_ids].each do |filter|\n without(:course_type_ids, filter)\n end\n end\n end\n if params[:difficulty].present?\n all_of do\n params[:difficulty].each do |filter|\n with(:difficulty, filter)\n end\n end\n end\n if params[:exclu_difficulty].present?\n all_of do\n params[:exclu_difficulty].each do |filter|\n without(:difficulty, filter)\n end\n end\n end\n if params[:cost].present?\n all_of do\n params[:cost].each do |filter|\n with(:cost, filter)\n end\n end\n end\n if params[:exclu_cost].present?\n all_of do\n params[:exclu_cost].each do |filter|\n without(:cost, filter)\n end\n end\n end\n if params[:category_ids].present?\n all_of do\n params[:category_ids].each do |filter|\n with(:category_ids, filter)\n end\n end\n end\n if params[:exclu_category_ids].present?\n all_of do\n params[:exclu_category_ids].each do |filter|\n without(:category_ids, filter)\n end\n end\n end\n if params[:main_ingredient_ids].present?\n all_of do\n params[:main_ingredient_ids].each do |filter|\n with(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:exclu_main_ingredient_ids].present?\n all_of do\n params[:exclu_main_ingredient_ids].each do |filter|\n without(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:source_ids].present?\n all_of do\n params[:source_ids].each do |filter|\n with(:source_ids, filter)\n end\n end\n end\n if params[:exclu_source_ids].present?\n all_of do\n params[:exclu_source_ids].each do |filter|\n without(:source_ids, filter)\n end\n end\n end\n facet :course_type_ids\n facet :category_ids\n facet :main_ingredient_ids\n facet :source_ids\n facet :difficulty, :sort => :index\n facet :cost, :sort => :index\n paginate :page => params[:page] || 1, :per_page => 10\n order_by(:score, :desc)\n order_by(:created_at, :desc)\n end\n @query_params = params.except( :page )\n \n filters = [\n :course_type_ids, \n :exclu_course_type_ids, \n :difficulty, \n :exclu_difficulty, \n :cost, \n :exclu_cost, \n :category_ids, \n :exclu_category_ids, \n :main_ingredient_ids, \n :exclu_main_ingredient_ids, \n :source_ids, \n :exclu_source_ids\n ]\n filters.each do |filter|\n if params[filter].present?\n params[filter].map!{ |x| x.to_i }\n end\n end\n \n # @search_result.facet(:main_ingredient_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:course_type_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:category_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:source_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n \n sort_alphabetical(@search_result.facet(:main_ingredient_ids).rows)\n sort_alphabetical(@search_result.facet(:course_type_ids).rows)\n sort_alphabetical(@search_result.facet(:category_ids).rows)\n sort_alphabetical(@search_result.facet(:source_ids).rows)\n end",
"def call\n url = \"https://www.allrecipes.com/search/results/?search=#{@keyword}\"\n html = URI.open(url).read\n doc = Nokogiri::HTML(html)\n\n doc.search('.card__detailsContainer').first(5).map do |element|\n name = element.search('.card__title').text.strip\n description = element.search('.card__summary').text.strip\n rating = element.search('.rating-star.active').count\n\n # prep time\n prep_time = parse_prep_time(element)\n\n Recipe.new({ name: name, description: description, rating: rating, prep_time: prep_time })\n end\n end",
"def index\n if !current_user.nil? && current_user.admin?\n @recipes = Recipe.all\n else\n @recipes = Recipe.where(public: true)\n end\n\n # Return recipes that have all the terms in the search\n # F.e. if the user searches for \"vegan recipes\"\n # It will return all the recipes that include \"vegan\" and \"recipes\"\n # If I search for \"vegan\" or \"recipes\" it will return almost all recipes\n # becaule all of them have the word \"recipe\" inside.\n # Steps for searching:\n # 1. gets all recipes that are public\n # 2. from public recipes get the recipes with the first search term\n # 3. from public recipes with the first search term get the recipes with the second search term\n # 4. etc for the next search terms\n if params[:q]\n @search_term = params[:q]\n search_terms = @search_term.split(\" \")\n locale = I18n.locale\n search_terms.each do |term|\n @recipes = @recipes.search(term, locale).distinct\n end\n end\n\n if Rails.env.production?\n @recipes_index = @recipes.order(\"id DESC\")\n else\n @recipes_index = @recipes.order('\"recipes\".\"id\" DESC')\n end\n if params[:recipes_id].nil?\n @recipes = @recipes_index.first(6)\n else\n @new_recipes = @recipes_index.where(\"id < ?\", params[:recipes_id][-1]).first(6)\n @recipes = @recipes_index.where(\"id >= ?\", @new_recipes.pluck(:id)[-1])\n respond_to do |format|\n format.html\n format.js\n end\n end\n\n end",
"def results\n # @search_result = Recipe.where(\"name like ?\", \"%#{params[:search]}%\")\n\n @search_result = Recipe.joins(:food_items).joins(:directions).where(\"food_items.name ILIKE ? OR recipes.name ILIKE ? OR directions.instruction ILIKE ?\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").distinct\n \n end",
"def safe_recipes\n #want all of the recipes that do not contain ingredients in allergens (array of ingredients)\n #look through all of our recipes\n my_ingredients = self.recipes.map do |recipe|\n #for each recipe, get the ingredients\n recipe.ingredients #array, map makes it an array within an array\n end.flatten.uniq\n #see if any of those ingredients are not our allergens\n my_safe_ingredients = my_ingredients.select do |ingredient|\n !(self.allergens.include?(ingredient))\n end\n #select all recipe ingredients that have our safe ingredients\n my_safe_ris = RecipeIngredient.all.select do |ri|\n my_safe_ingredients.include?(ri.ingredient)\n end\n #return the recipe\n my_safe_ris.map do |ri|\n ri.recipe\n end\n\n end",
"def get_recipe_ingredient_list(url, ingredients, a, need, got)\n page = HTTParty.get(url)\n parse_page = Nokogiri::HTML(page)\n scraped_ingredient = []\n parse_page.css(\".ingredient-description\").map do |a|\n ing = a.text\n scraped_ingredient.push(ing)\n end\n\n for i in scraped_ingredient\n j = 0\n while j < a\n if i.downcase.include?(ingredients[j].downcase) == false\n need.push(i)\n j += 1\n else\n got.push(i)\n j += 1\n end\n end\n end\nend",
"def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def set_recipe\n @recipe = Recipe\n .includes(:category, :images, :recipe_tags, :tags, :ingredient_recipes,\n :ingredients)\n .find(params[:id])\n end",
"def start_recipe\n @recipe.delete_recipes\n puts File.foreach(\"ingredient_list.txt\") { |line| puts line }\n puts \"What Ingredients do you have?\".colorize(:yellow)\n user_input = gets.chomp\n @recipe.search(user_input)\n self.print_recipe\n self.recipe_ask_for_options()\n end",
"def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end",
"def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end",
"def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end",
"def supersearch\n @recipes = Recipe.search(params[:ingredient]) \n render :index\n end",
"def find_cartridges(name)\n logger.debug \"Finding cartridge #{name}\" if @mydebug\n regex = nil\n if name.is_a?(Hash)\n name = name[:name] if name[:name]\n regex = name[:regex] if name[:regex]\n end\n\n filtered = Array.new\n cartridges.each do |cart|\n if regex\n filtered.push(cart) if cart.name.match(regex)\n else\n filtered.push(cart) if cart.name == name\n end\n end\n return filtered\n end",
"def set_recipe\n @recipe = if params[:name]\n Recipe.find_by(name: params[:name])\n else\n Recipe.find_by(id: params[:id])\n end\n end"
] |
[
"0.70910263",
"0.70052564",
"0.69439673",
"0.6929965",
"0.69144803",
"0.68493646",
"0.6845398",
"0.67759395",
"0.6760274",
"0.67585033",
"0.67170596",
"0.6716653",
"0.6709615",
"0.667991",
"0.6667788",
"0.6638084",
"0.66001487",
"0.6578361",
"0.6520817",
"0.6519832",
"0.64928305",
"0.64928305",
"0.64791435",
"0.6457581",
"0.6437634",
"0.64230955",
"0.63858044",
"0.6385111",
"0.6355078",
"0.63502294",
"0.63455987",
"0.6330146",
"0.63057554",
"0.6280445",
"0.627925",
"0.6262468",
"0.6231166",
"0.621734",
"0.62150323",
"0.62015843",
"0.61981106",
"0.6193654",
"0.6192773",
"0.61751187",
"0.61716413",
"0.61716413",
"0.61716413",
"0.6165084",
"0.61614466",
"0.61608505",
"0.61471885",
"0.61466825",
"0.6087372",
"0.6071809",
"0.6061835",
"0.60579175",
"0.60252976",
"0.6024929",
"0.60120267",
"0.60090154",
"0.60065216",
"0.6000821",
"0.59976876",
"0.59975743",
"0.59973615",
"0.59958804",
"0.5994698",
"0.5990507",
"0.59893125",
"0.5982361",
"0.59650725",
"0.5964701",
"0.5961406",
"0.59490347",
"0.5927821",
"0.5916922",
"0.59142745",
"0.59093636",
"0.59071034",
"0.58990496",
"0.5897553",
"0.5895433",
"0.58819485",
"0.5879064",
"0.5870637",
"0.5862491",
"0.58545387",
"0.5854372",
"0.58503276",
"0.584339",
"0.58305556",
"0.5829376",
"0.5825191",
"0.5821877",
"0.58121014",
"0.58083874",
"0.5796528",
"0.5788304",
"0.5785763",
"0.578218"
] |
0.7930081
|
0
|
Get a single recipe matching the parameter recipe_id: id of a recipe
|
def get_recipe_by_id(recipe_id)
recipe = Recipe.find_by(id: recipe_id)
recipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)
recipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)
return recipe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def show\n recipe_id = params[:id].to_i\n @recipe = Recipe.find(recipe_id)\n end",
"def find_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end",
"def find_recipe\n \t\t@recipe = Recipe.friendly.find(params[:id])\n \tend",
"def find(id)\n params = {\n 'sys.id': id\n }\n entry = fetch(params).first\n raise Exceptions::RecordNotFound if entry.blank?\n\n to_recipe(entry)\n end",
"def set_recipe\n @recipe = Recipe.where(id: params[:id]).first\n render_404 unless @recipe\n end",
"def current_recipe\n recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = RecipeApi.find(params[:id])\n end",
"def show\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\r\n @recipe = Recipe.find_by(id: params[:id])\r\n end",
"def recipe_instance(recipe_name) \n Recipe.find_by name: recipe_name\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def show\n recipe = EdamamApiWrapper.show_recipe(params[:id])\n if recipe == nil\n flash[:error] = \"Recipe does not exist. Please do a new recipes search.\"\n redirect_to root_path\n else\n @recipe = recipe\n end\n end",
"def set_recipe\n @recipe = Recipe.includes(:ingredients, :references, :components).find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id]) # Find the recipe\n end",
"def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\r\n @recipe = Recipe.friendly.find(params[:id])\r\n end",
"def show\n\t\t@recipe = Recipe.find(params[:id])\n\tend",
"def set_recipe\n @recipe = Recipe.find params[:id]\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\n \n end",
"def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:recipe_id])\n end",
"def set_recipe\n @recipe = Recipe.find(params[:id])\nend",
"def set_recipe\n @recipe = Recipe\n .includes(:category, :images, :recipe_tags, :tags, :ingredient_recipes,\n :ingredients)\n .find(params[:id])\n end",
"def edit\n @recipe = Recipe.find(params[:id])\n end",
"def show\n # instance variable @recipe - Recipe(table) .find method using \n # params hash by id and passing to show view\n @recipe = Recipe.find(params[:id])\n end",
"def recipe (recipe_id, name)\n if recipe_id\n this_recipe = Recipe.find(recipe_id.to_i)\n else\n this_recipe = Recipe.find_by(name)\n end\n\n creation = {\n :name => this_recipe[:name],\n :instructions => this_recipe.instructions.all,\n :ingredients => this_recipe.ingredients.all\n }\n # return the object\n creation\n end",
"def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end",
"def recipe_finder(recipe_id)\n system 'clear'\n Recipe.all.select{|recipe| recipe.id == recipe_id}.each do |i|\n puts i.name.upcase\n puts \"Rating: #{i.rating}\"\n puts \"Cooking Time: #{i.time} hours\"\n puts \"Difficulty Level: #{i.difficulty}\"\n @recipe_ingredient = i.ingredient\n end\n prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"See ingredients\", -> {recipe_ingredients(recipe_id)}\n menu.choice \"Choose a different protein\", -> {choose_protein}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def edit\n @recipe = Recipe.find(params[:id])\nend",
"def set_recipe\n @recipe = if params[:name]\n Recipe.find_by(name: params[:name])\n else\n Recipe.find_by(id: params[:id])\n end\n end",
"def edit\n\t\t@recipe = Recipe.find(params[:id])\n\tend",
"def show\n @recipe = RecipeCacheService.find(params[:id])\n end",
"def edit_basics\n @recipe = Recipe.find(params[:id])\n end",
"def set_recipe\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.find_by(id: params[:id])\n @message = \"Cannot find recipe with id #{params[:id]}\"\n end",
"def show\n respond_with Recipe.find(params[\"id\"])\n end",
"def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end",
"def set_recipeingredient\n @recipeingredient = Recipeingredient.find(params[:id])\n end",
"def set_recipe\n @recipe = Recipe.render(params[:id])\n end",
"def set_ingredient_recipe\n @ingredient_recipe = IngredientRecipe.find(params[:id])\n end",
"def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end",
"def set_recipe_item\n @recipe_item = RecipeItem.find(params[:id])\n end",
"def current_recipeIngredient\n recipeIngredient = RecipeIngredient.find(params[:id])\n end",
"def show\n @data = @recipe.read(params[:id])\n render json: @data\n end",
"def by_ingredient\n # If ingredient exists, find recipes that use it\n if Ingredient.exists?(params[:id])\n ingredient = Ingredient.find(params[:id])\n recipes = Recipe.recipes_of_ingredient(params[:id])\n else\n recipes = Recipe.all\n end\n\n # Render json\n render json: {recipes: recipes}, status: 200 \n end",
"def set_recipe_ingredient\n @recipe_ingredient = RecipeIngredient.find(params[:id])\n end",
"def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @recipeIngredients = RecipeIngredient.where(:recipeId => params[:id])\n @ingredients = Ingredient.where(:id => @recipeIngredients.select(:ingredientId))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def get_recipe(id)\n recipe = Recipe.find(id)\n url = \"https://api2.bigoven.com/recipe/steps/#{recipe.id}?&api_key=#{ENV['API_KEY']}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # puts response\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n # recipe.ingredients.create!(\n if (!Ingredient.exists?(ingredient[\"IngredientID\"])) \n Ingredient.create!(\n id: ingredient[\"IngredientID\"],\n name: ingredient[\"Name\"],\n html_name: ingredient[\"HTMLName\"]\n )\n end\n end\n\n if (recipe.recipe_ingredients.count > 0)\n recipe.recipe_ingredients.destroy_all\n recipe.save\n recipe.reload\n end\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n \n # if (!recipe.recipe_ingredients.find_by(ingredient_id: ingredient[\"IngredientID\"]))\n recipe.recipe_ingredients.create!(\n ingredient_id: ingredient[\"IngredientID\"],\n quantity: ingredient[\"Quantity\"],\n display_quantity: ingredient[\"DisplayQuantity\"],\n unit: ingredient[\"Unit\"],\n metric_quantity: ingredient[\"MetricQuantity\"],\n metric_display_quantity: ingredient[\"MetricDisplayQuantity\"],\n metric_unit: ingredient[\"MetricUnit\"],\n preparation_notes: ingredient[\"PreparationNotes\"]\n )\n # end\n end\n \n recipe.steps = ''\n steps = JSON.parse(response)[\"Steps\"]\n steps.each do |step|\n step != steps.last ? recipe.steps += step[\"Text\"] + '$' : recipe.steps += step[\"Text\"]\n # recipe.steps += step[\"Text\"] + ','\n end\n \n recipe.save\n end"
] |
[
"0.79550666",
"0.7885108",
"0.7807008",
"0.76749164",
"0.76105464",
"0.7425577",
"0.74107885",
"0.72413427",
"0.7228666",
"0.7206796",
"0.71995807",
"0.71215147",
"0.7114356",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.71129227",
"0.7110961",
"0.7110961",
"0.7110961",
"0.7110961",
"0.7110961",
"0.71095604",
"0.71091753",
"0.7057443",
"0.7051952",
"0.7051952",
"0.7045168",
"0.7038175",
"0.70261467",
"0.70102525",
"0.7005102",
"0.6963287",
"0.69347686",
"0.6921984",
"0.68852174",
"0.6873625",
"0.6860749",
"0.6854317",
"0.6849945",
"0.6836843",
"0.68308055",
"0.6821666",
"0.67858034",
"0.6721379",
"0.66493595",
"0.6606054",
"0.6604598",
"0.6576123",
"0.6545483",
"0.6539681",
"0.6529095",
"0.6502054",
"0.6477838",
"0.64578927",
"0.64546907",
"0.644753",
"0.64357734",
"0.64185333",
"0.6373324",
"0.63689",
"0.6312446",
"0.6308135"
] |
0.7541437
|
5
|
GET /knowledges GET /knowledges.json
|
def index
if(current_user.profile.nil?)
redirect_to new_profile_path,
notice: "You need first to fill your profile ;)."
else
@knowledges = current_user.profile.knowledges.all
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end",
"def index\n @knowledges = Knowledge.all\n end",
"def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def index\n @freelancer_knowledges = FreelancerKnowledge.all\n end",
"def index\n @carrierknowledghes = Carrierknowledghe.all\n end",
"def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end",
"def index\n @knowledge_levels = KnowledgeLevel.includes(:knowledges).all\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n respond_with current_user.topics.all.to_json(:include => [:posts, :owner])\n end",
"def index\n\t\t@technologies = Technology.includes(:knowledges).all\n\tend",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end",
"def index\n @attendees = Attendees.all\n render json: @attendees\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end",
"def index\n @community_topics = CommunityTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @community_topics }\n end\n end",
"def index\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end",
"def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\n end\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @encriptions = Encription.all\n respond_to do |format|\n \n format.html \n format.json { render json: @encriptions }\n \n end\n end",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def index\n chapters = @project.chapters.all\n render json: { chapters: chapters }\n end",
"def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end",
"def index\n @topics = @pool.topics.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n if (params[:client_id])\n @engagements = Engagement.find_all_by_client_id(params[:client_id])\n else\n @engagements = Engagement.all\n end\n\n respond_with(@engagements)\n end",
"def index\n @agreement = Agreement.find(params[:agreement_id])\n @posting_rules = @agreement.posting_rules\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posting_rules }\n end\n end",
"def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def index\n @envelopes = Envelope.all\n end",
"def index\n @messies = Messy.all\n\n render json: @messies\n end",
"def index\n @api_v1_mentorship_interests = Api::V1::MentorshipInterest.all\n end",
"def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end",
"def index\n @lda_post_topics = LdaPostTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lda_post_topics }\n end\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def retrieve_snack_list\n response = RestClient.get SNACKS_URL\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def index\n @data_topics = DataTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_topics }\n end\n end",
"def index\n @topics = Topic.getCommunityTopic(params)\n respond_with(@topics)\n end",
"def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end",
"def index\n @associates = Associate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @associates }\n end\n end",
"def show\n @getadvice = Getadvice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getadvice }\n end\n end",
"def get_topics\n @chapter = Chapter.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @chapter.topics.map {|u| Hash[value: u.id, name: u.name]}\n else\n topic_ids = ContentUserLayout.get_unlocked_topics(@chapter,current_user)\n if !topic_ids.nil?\n list = @chapter.topics.where(:id=>topic_ids).map {|u| Hash[value: u.id, name: u.name]}\n else\n list = @chapter.topics.map {|u| Hash[value: u.id, name: u.name]}\n end\n end\n render json: list\n end",
"def index\n @excuses = Excuse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @excuses }\n end\n end",
"def index\n @recipients = Recipient.all\n # render json: @recipients\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end",
"def index\n @discussions = @issue.discussions.all\n end",
"def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend",
"def index\n @communities = Community.all\n\n render json: @communities.to_json(include: {posts: {include: :replies} })\n end",
"def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end",
"def index\n @announcements = Announcement.order(created_at: :desc).all\n render json: @announcements, each_serializer: AnnouncementsSerializer\n end",
"def index\n @sponsors = @event.sponsors\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end",
"def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end",
"def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end",
"def show\n @announce_c = AnnounceC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce_c }\n end\n end",
"def index\n @discussions = Discussion.includes(:user)\n .order('updated_at DESC')\n .paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def index\n @expertises = Expertise.all\n\n render json: @expertises\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end",
"def index\n @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interests }\n end\n end",
"def index\n @notes = Note.all\n render json: @notes\n end",
"def index\n @inquiries = Inquiry.all\n end",
"def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end",
"def index\n @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @interests }\n end\n end",
"def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end",
"def index\n\n @bans = @cloud.bans.where(\n params.select { |k,v| [:offender_id,:enforcer_id].include?(k.to_sym) }\n ).order_by(due: :desc)\n\n render status: 200\n end",
"def index\n # find all links to assigned invoices\n @links = current_recipient.links.includes(:invoice, :recipient)\n\n # only respond to html and json formats\n respond_to do |format|\n format.any(:html, :json)\n end\n end",
"def index\n @bulletins = Bulletin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bulletins }\n end\n end",
"def index\n @keys = Key.all\n render json: @keys\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @enrolls = Enroll.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolls }\n end\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def show\n @badge = Badge.find_by_key(params[:id])\n respond_to do |format|\n format.html\n end\n end",
"def index\n @desks = Desk.all\n\n render json: @desks\n end",
"def index\n @recipients = Recipient.order('email')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipients }\n end\n end",
"def index\n render json: Message.all\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @refund_requests = RefundRequest.order 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refund_requests }\n end\n end",
"def index\n if params[:conditions].present?\n @knowledges = Knowledge.where(params[:conditions]).paginate(:page => params[:page]).order('id DESC')\n else\n @knowledges = Knowledge.paginate(:page => params[:page]).order('id DESC')\n end\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), knowledges_path\n\n #fresh_when model's last recoder is newer\n if stale?(:etag => Knowledge.last)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end\n end",
"def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end",
"def show\n @yeargroup = Yeargroup.find(params[:id])\n @notes = @yeargroup.notes\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yeargroup }\n end\n end",
"def show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end",
"def index\n @producers = Producer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @producers }\n end\n end",
"def on_get(path)\n topics = I3.server.remote_account_as(Account).viewable_topics\n articles = Article.find_recent(MAX_ARTICLES, topics).collect do |article|\n item = I3::SharedObject.new\n if article.comments.count > 0\n item.modified_at = article.comments.last.posted_at\n item.last_contributor = article.comments.last.author.full_name\n else\n item.modified_at = article.posted_at\n item.last_contributor = article.author.full_name\n end #if\n item.author = article.author.full_name\n item.subject = article.subject\n item.uri = '/bboard/data/messages/%s/%s/%s' % [\n article.topic.permalink,\n article.posted_at.strftime(\"%Y/%m/%d\"),\n article.permalink\n ]\n item.comment_count = article.comments.count\n item\n end #collect\n I3.server.send_object(articles)\n end",
"def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end"
] |
[
"0.6894962",
"0.6482017",
"0.61019754",
"0.5879565",
"0.58354855",
"0.5797021",
"0.55280095",
"0.5476968",
"0.5464409",
"0.54550433",
"0.5425189",
"0.53943545",
"0.5381064",
"0.5370014",
"0.5312618",
"0.52783513",
"0.52783513",
"0.52783513",
"0.5245175",
"0.52289784",
"0.5228174",
"0.52194107",
"0.5215037",
"0.52063656",
"0.5195392",
"0.5195392",
"0.51741683",
"0.5171574",
"0.5169631",
"0.51651275",
"0.5156334",
"0.5147079",
"0.51376086",
"0.51255256",
"0.5119858",
"0.5115419",
"0.51145613",
"0.5089545",
"0.5083391",
"0.50609505",
"0.5060373",
"0.50586766",
"0.50491357",
"0.50455004",
"0.50452256",
"0.5043828",
"0.5043828",
"0.5043283",
"0.503989",
"0.503729",
"0.503261",
"0.5020266",
"0.50198185",
"0.50106245",
"0.50047165",
"0.50042546",
"0.499702",
"0.49964553",
"0.49956703",
"0.499306",
"0.49773976",
"0.4976397",
"0.49762025",
"0.49760285",
"0.49671814",
"0.4965492",
"0.49651006",
"0.49594393",
"0.49458763",
"0.49443436",
"0.49420872",
"0.4930783",
"0.49306256",
"0.49243966",
"0.49201605",
"0.49198982",
"0.49147022",
"0.49146333",
"0.49136975",
"0.49097875",
"0.49073532",
"0.4903998",
"0.4902818",
"0.48876825",
"0.48870587",
"0.48867995",
"0.48853672",
"0.4885081",
"0.4876625",
"0.48757288",
"0.48757288",
"0.4874852",
"0.48726076",
"0.48718977",
"0.48699415",
"0.4868171",
"0.48677447",
"0.48628974",
"0.4861801",
"0.48594996"
] |
0.59176093
|
3
|
GET /knowledges/1 GET /knowledges/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end",
"def index\n @knowledges = Knowledge.all\n end",
"def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def index\n @carrierknowledghes = Carrierknowledghe.all\n end",
"def index\n if(current_user.profile.nil?)\n redirect_to new_profile_path,\n notice: \"You need first to fill your profile ;).\"\n else\n @knowledges = current_user.profile.knowledges.all\n end\n end",
"def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end",
"def index\n @freelancer_knowledges = FreelancerKnowledge.all\n end",
"def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end",
"def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\n end\n end",
"def index\n @knowledge_levels = KnowledgeLevel.includes(:knowledges).all\n end",
"def show\n @announce_c = AnnounceC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce_c }\n end\n end",
"def index\n\t\t@technologies = Technology.includes(:knowledges).all\n\tend",
"def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end",
"def index\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def show\n @badge = Badge.find_by_key(params[:id])\n respond_to do |format|\n format.html\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def show\n @delivery_note = DeliveryNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery_note }\n end\n end",
"def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end",
"def create\n @knowledge = current_user.knowledges.new(params[:knowledge])\n\n respond_to do |format|\n if @knowledge.save\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully created.' }\n format.json { render json: @knowledge, status: :created, location: @knowledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @community_topics = CommunityTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @community_topics }\n end\n end",
"def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end",
"def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end",
"def index\n respond_with current_user.topics.all.to_json(:include => [:posts, :owner])\n end",
"def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end",
"def show\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @important_issue }\n end\n end",
"def index\n chapters = @project.chapters.all\n render json: { chapters: chapters }\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def index\n @topics = @pool.topics.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n if params[:conditions].present?\n @knowledges = Knowledge.where(params[:conditions]).paginate(:page => params[:page]).order('id DESC')\n else\n @knowledges = Knowledge.paginate(:page => params[:page]).order('id DESC')\n end\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), knowledges_path\n\n #fresh_when model's last recoder is newer\n if stale?(:etag => Knowledge.last)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end",
"def GetTopic id\n\n APICall(path: \"topics/#{id}.json\")\n\n end",
"def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt }\n end\n end",
"def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end",
"def new\n @topickey = Topickey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topickey }\n end\n end",
"def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end",
"def show\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @normal_issue }\n end\n end",
"def show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end",
"def index\n @discussions = @issue.discussions.all\n end",
"def show\n @getadvice = Getadvice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getadvice }\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def show\n @invoicedetail = Invoicedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicedetail }\n end\n end",
"def show\n @yeargroup = Yeargroup.find(params[:id])\n @notes = @yeargroup.notes\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yeargroup }\n end\n end",
"def index\n @encriptions = Encription.all\n respond_to do |format|\n \n format.html \n format.json { render json: @encriptions }\n \n end\n end",
"def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end",
"def show\n @reply = Reply.find(params[:id])\n\n render json: @reply\n end",
"def index\n @messies = Messy.all\n\n render json: @messies\n end",
"def on_get(path)\n topics = I3.server.remote_account_as(Account).viewable_topics\n articles = Article.find_recent(MAX_ARTICLES, topics).collect do |article|\n item = I3::SharedObject.new\n if article.comments.count > 0\n item.modified_at = article.comments.last.posted_at\n item.last_contributor = article.comments.last.author.full_name\n else\n item.modified_at = article.posted_at\n item.last_contributor = article.author.full_name\n end #if\n item.author = article.author.full_name\n item.subject = article.subject\n item.uri = '/bboard/data/messages/%s/%s/%s' % [\n article.topic.permalink,\n article.posted_at.strftime(\"%Y/%m/%d\"),\n article.permalink\n ]\n item.comment_count = article.comments.count\n item\n end #collect\n I3.server.send_object(articles)\n end",
"def show\n render :json => Topic.find(params[:id]) \n end",
"def getNote(key)\n refreshToken\n url = \"/api/note?key=#{key}&auth=#{@token}\\&email=#{@email}&encode=base64\"\n response, result = agent.get(url)\n\n unless response.code.to_i == 200 or response.nil?\n raise \"Failed to fetch note for \\'#{key}\\'\"\n end\n\n note = {}\n note['note-key'] = response['note-key']\n note['note-createdate'] = response['note-createdate']\n note['note-modifydate'] = response['note-modifydate']\n note['deleted'] = response['note-deleted']\n note['note-text'] = Base64.decode64(result) \n \n note\n end",
"def show\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money_receipt }\n end\n end",
"def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n @topics = @chapter.topics.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end",
"def new\n @announce_c = AnnounceC.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce_c }\n end\n end",
"def show\n @notification = current_user.find_client(params[:client_id]).notifications.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end",
"def index\n @data_topics = DataTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_topics }\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def show\n @voucher = Voucher.find(params[:id])\n @issues = @voucher.issues\n\n end",
"def show\n @topickey = Topickey.find(params[:id])\n @members = Member.where(\"topics.topic_id\"=>@topickey.topic_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topickey }\n end\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def show\n @showdown = Showdown.find(params[:id])\n @topics = Topic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @showdown }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @post = Post.new\n @announces = Announce.where(\"author_id = ? AND author_type = ?\", @project.id, '1')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @notes = Note.all\n render json: @notes\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def show\n @journal = Journal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@journal }\n end\n end",
"def index\n @notes = Note.where{project_id == my{@project.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end",
"def show\n render status: 200, json: Passage.find(params[:id])\n end",
"def index\n @topics = Topic.getCommunityTopic(params)\n respond_with(@topics)\n end",
"def index\n @discussions = Discussion.includes(:user)\n .order('updated_at DESC')\n .paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def show\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interested }\n end\n end",
"def index\n @discussions = @project.discussions\n\n respond_to do |format|\n format.html\n format.api\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n # @invoice = Invoice.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @messages = @topic.messages.order(\"created_at DESC\")\n @message = Message.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def show\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenancy_agreement }\n end\n end",
"def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end",
"def show\n @lease = Lease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lease }\n end\n end",
"def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end",
"def index\n @topics = Topic.where('timeint >= :timeint', :timeint => Topic.current_timeint(Time.now))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def show\n @entree_journal = EntreeJournal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entree_journal }\n end\n end",
"def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end",
"def show\n @mispronunciation = Mispronunciation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mispronunciation }\n end\n end",
"def index\n @attendees = Attendees.all\n render json: @attendees\n end",
"def index\n # Hubspot::Contact.create!(\"aaron@coderfactory.com\", {firstname: \"Test\", lastname: \"Contact\"})\n lists = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts \"HHHHHHHHHHH\"\n listp = lists.first.last.select { |list| list[\"name\"] == \"New Test List\"}\n listp = listp.first\n puts listp[\"name\"]\n puts \"FFFFFFFFFFFFFFF\"\n contact_list = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists/#{listp['listId'].to_i}/contacts/all?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts contact_list[\"contacts\"].first[\"properties\"][\"firstname\"][\"value\"]\n puts \"LLLLLLLLLLLLLL\"\n puts listp\n @enquiries = Enquiry.all\n end",
"def show\n @project_note = ProjectNote.find(params[:id])\n\n render json: @project_note\n end",
"def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def index\n @lda_post_topics = LdaPostTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lda_post_topics }\n end\n end"
] |
[
"0.6900761",
"0.6428908",
"0.63948995",
"0.5739901",
"0.5731566",
"0.5699565",
"0.5694085",
"0.5602825",
"0.53821665",
"0.5352143",
"0.5305461",
"0.53009176",
"0.5265316",
"0.5259351",
"0.52504337",
"0.52504337",
"0.52504337",
"0.5231967",
"0.5231337",
"0.51865196",
"0.51736265",
"0.51623714",
"0.5160751",
"0.5140494",
"0.51373124",
"0.5132867",
"0.5132867",
"0.5132778",
"0.51228166",
"0.5121108",
"0.51210713",
"0.5119338",
"0.5109368",
"0.5108612",
"0.5103474",
"0.51023513",
"0.5101475",
"0.5101475",
"0.50992",
"0.5096714",
"0.5093592",
"0.5090885",
"0.5081733",
"0.50705004",
"0.50680435",
"0.5067119",
"0.5065956",
"0.50618625",
"0.5061069",
"0.50585896",
"0.5052576",
"0.5035352",
"0.50304013",
"0.50298595",
"0.50296235",
"0.5028772",
"0.50218195",
"0.50185883",
"0.50185835",
"0.5006947",
"0.4998737",
"0.49918878",
"0.49893123",
"0.49880987",
"0.49868459",
"0.49738523",
"0.4973061",
"0.49631992",
"0.49603495",
"0.49591476",
"0.49556258",
"0.49492374",
"0.49460483",
"0.494601",
"0.49457836",
"0.49440777",
"0.49434337",
"0.49429423",
"0.49422115",
"0.49419257",
"0.4940631",
"0.49357665",
"0.49344212",
"0.4931169",
"0.4929209",
"0.49219862",
"0.49216545",
"0.4920277",
"0.49197644",
"0.49189195",
"0.49176913",
"0.49165964",
"0.49131784",
"0.4912295",
"0.4910518",
"0.49085552",
"0.49078405",
"0.49073073",
"0.4907144",
"0.4897958",
"0.4892416"
] |
0.0
|
-1
|
POST /knowledges POST /knowledges.json
|
def create
@knowledge = Knowledge.new(knowledge_params)
@knowledge.profile = current_user.profile
respond_to do |format|
if @knowledge.save
format.html { redirect_to knowledges_path, notice: 'Knowledge was successfully created.' }
format.json { render action: 'show', status: :created, location: @knowledge }
else
format.html { render action: 'new' }
format.json { render json: @knowledge.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @knowledge = current_user.knowledges.new(params[:knowledge])\n\n respond_to do |format|\n if @knowledge.save\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully created.' }\n format.json { render json: @knowledge, status: :created, location: @knowledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def create\n @carrierknowledghe = Carrierknowledghe.new(carrierknowledghe_params)\n\n respond_to do |format|\n if @carrierknowledghe.save\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully created.' }\n format.json { render :show, status: :created, location: @carrierknowledghe }\n else\n format.html { render :new }\n format.json { render json: @carrierknowledghe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end",
"def create\n topic = Topic.new(topic_params)\n if topic.save\n response_data = {\n status: 'success',\n txt: ['質問を投稿しました!'],\n }\n else\n response_data = {\n status: 'error',\n txt: topic.errors.full_messages,\n }\n end\n render json: response_data\n end",
"def create\n params[\"balance_enquiry\"][\"karigar_id\"] = params[\"karigar_id\"]\n @balance_enquiry = BalanceEnquiry.new(balance_enquiry_params)\n respond_to do |format|\n if @balance_enquiry.save\n format.html { redirect_to karigar_balance_enquiries_path(@karigar), notice: 'Balance enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @balance_enquiry }\n else\n format.html { render :new }\n format.json { render json: @balance_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @knowledges = Knowledge.all\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def create\n extra = ParamsFormatter.new(params[:enquiry]).generate\n @enquiry = Enquiry.new(enquiry_params.merge(extra))\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def create\n # @attention = Attention.new(attention_params)\n # @attention.participants = params[:participants]\n # @attention.responsible = params[:responsible]\n # @attention.nro_involved = params[:participants].count + 1\n\n # respond_to do |format|\n # if @attention.save\n # format.html { redirect_to @attention, notice: 'Attention was successfully created.' }\n # format.json { render :show, status: :created, location: @attention }\n # else\n # format.html { render :index }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @interest = GtInterest.new(:email => params[:email], :priority_code => params[:priority_code])\n if @interest.save\n @status = 200\n\n # Don't want to email when using this model to test \"subscribe via email\" signups\n unless /subscribe_to_roll:.+/.match(params[:priority_code])\n ShelbyGT_EM.next_tick { GtInterestMailer.interest_autoresponse(@interest.email).deliver }\n end\n else\n render_error(400, \"must have a valid email\")\n end\n end",
"def create_post topic_id, payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post POSTS, payload, topic_id, nil, \"create_post\" )\n\t\t\t\tend",
"def create\n\n if params[:sheduled_message].has_key? '0'\n params[:sheduled_message].each do |sm|\n # raise sm.last.to_hash.to_yaml\n SheduledMessage.create sm.last.to_hash\n end\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Messages was successfully queued.' }\n end\n else\n @sheduled_message = SheduledMessage.new(params[:sheduled_message])\n\n respond_to do |format|\n if @sheduled_message.save\n format.html { redirect_to @sheduled_message, notice: 'Sheduled message was successfully created.' }\n format.json { render json: @sheduled_message, status: :created, location: @sheduled_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheduled_message.errors, status: :unprocessable_entity }\n end\n end\n end\n\n \n end",
"def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end",
"def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end",
"def create\n @snack = Snack.new(snack_params)\n\n respond_to do |format|\n if @snack.save\n format.html { redirect_to @snack, notice: 'Snack was successfully created.' }\n format.json { render :show, status: :created, location: @snack }\n else\n format.html { render :new }\n format.json { render json: @snack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @enrollment = Enrollment.new(properties_data: enrollment_properties_params)\n #debugger\n #@enrollment = Enrollment.new()\n #render json: request.raw_post(), status: :created\n\n if @enrollment.save\n render json: {:reference_number => @enrollment.reference_number}, status: :created\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end",
"def email_kyc_approve(data_to_format)\n {}\n end",
"def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n student = Student.where(\"full_name ilike ?\", params[:walkathon_pledge][:student_name]).first rescue nil\n @walkathon_pledge =\n Walkathon::Pledge.where(student: student, sponsor_name: params[:walkathon_pledge][:sponsor_name]).first rescue nil if student\n\n # There was an old pledge. Delete it.\n @walkathon_pledge.delete if @walkathon_pledge\n\n @walkathon_pledge = Walkathon::Pledge.new(\n params[:walkathon_pledge][:pledge_type] == 'fixed' ? fixed_params : per_lap_params\n )\n @walkathon_pledge.student = student\n\n lap_record = Walkathon::LapCount.find_by_student_id(student.id) if student\n @walkathon_pledge.lap_count = lap_record.lap_count if lap_record\n\n respond_to do |format|\n if @walkathon_pledge.save\n UserMailer.new_pledge_email(student).deliver\n format.html { redirect_to :thankyou, notice: 'Pledge was successfully created.' }\n format.json { render :show, status: :created, location: @walkathon_pledge }\n else\n format.html { render :new }\n format.json { render json: @walkathon_pledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_bounce\n begin\n RestClient.post $cnf['mailgun']['apikey'] + $cnf['mailgun']['bounnces'],\n :address => 'bkotu6717@gmail.com'\n rescue Exception => e\n puts \"Exception raised add_bounce:\" + e.class.to_s\n puts e.message\n end\n end",
"def create\n @correspondence = Correspondence.new_from_sendgrid(params)\n @correspondence.save\n render :text => \"Saved\", :status => 200\n end",
"def create\n\n @pledge = Pledge.new\n @pledge.pledge_title = params[:pledge]['pledge_title']\n @pledge.pledge_description = params[:pledge]['pledge_description']\n @pledge.user_id = current_user.id\n @pledge.save()\n\n respond_to do |format|\n if @pledge.save\n format.html { redirect_to @pledge, notice: 'Pledge was successfully created.' }\n format.json { render json: @pledge, status: :created, location: @pledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pledge = Pledge.new(params[:pledge])\n\n respond_to do |format|\n if @pledge.save\n format.html { redirect_to @pledge, notice: 'Pledge was successfully created.' }\n format.json { render json: @pledge, status: :created, location: @pledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sigurance = Sigurance.new(sigurance_params)\n @sigurance.save!\n\n SiguranceMailer.new_sigurance(@sigurance).deliver_now\n\n respond_to do |format|\n if @sigurance.save\n format.html { redirect_to @sigurance, notice: 'Sigurance was successfully created.' }\n format.json { render :show, status: :created, location: @sigurance }\n else\n format.html { render :new }\n format.json { render json: @sigurance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to root_path, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_announcement\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/announcements/#{@announcement.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@announcement.user.login_name}さんからお知らせです。\"\n end",
"def create(args) \n help_form = {:tNote => args[:note],\n :xCategory => args[:category],\n :sFirstName => args[:first_name],\n :sLastName => args[:last_name],\n :sUserId => args[:user_id],\n :sEmail => args[:email],\n :sPhone => args[:phone],\n :fUrgent => args[:urgent]}.reject!{|k,v| v == nil}\n \n JSON.parse(api_request('request.create', 'POST', help_form))['xRequest'] rescue []\n end",
"def create_intervention_ticket\n #Call zendesk API create new client method\n client = ZendeskAPI::Client.new do |config|\n #Get config parameters from application.yml \n #These parameters are ignored by git \n config.url = ENV['ZENDESK_URL']\n config.username = ENV['ZENDESK_USERNAME']\n config.token = ENV['ZENDESK_TOKEN']\n end\n #create the ticket \n ZendeskAPI::Ticket.create!(client,\n #define subject with the current user name \n :subject => \"NEW INTERVENTION created by : \" + @currentusername.to_s ,\n #Requirements : \n # The Requester\n # The Customer (Company Name)\n # Building ID\n # The Battery ID\n # The Column ID if specified\n # Elevator ID if specified\n # The employee to be assigned to the task\n # Description of the request for intervention\n\n :comment => \"The customer ID : #{params[:customer]} \n Building ID : #{params[:building]} \n Battery ID : #{params[:battery]} \n Column ID : #{params[:column]} \n Elevator ID : #{params[:elevator]} \n Affected employee ID : #{params[:employee]} \n Description : #{params[:report]} \",\n #Set the priority \n :priority => \"urgent\",\n #Set the type \n :type => \"question\")\n end",
"def create\n begin\n params[:delivery][:attach_ids]=params[:delivery][:attach_ids].join(\",\")\n rescue => err\n p err\n end\n rm_unneed_attach\n \n @delivery=Delivery.new(params[:delivery])\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to deliveries_url, notice: '送货单 成功创建.' }\n format.json { render json: @delivery, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def enquiries_post(enquiry, opts = {})\n data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)\n data\n end",
"def create\n @announcement = Announcement.find(params[:announcement])\n\n @purchase = Purchase.new(announcement: @announcement, buyer_id: current_buyer.id, description: @announcement.title,seller_id: @announcement.seller.id )\n key = @announcement.seller.access_code\n Stripe.api_key = key\n\n token = params[:stripeToken]\n\n customer = if current_buyer.stripe_id?\n Stripe::Customer.retrieve(current_user.stripe_id)\n else\n Stripe::Customer.create(email: current_buyer.email, source: token)\n end\n\n payment_intent = Stripe::PaymentIntent.create({\n customer:customer,\n payment_method_types: ['card'],\n amount: @announcement.price.to_i * 100,\n currency: 'eur',\n confirm: true, \n }, stripe_account: @announcement.seller.uid)\n\n respond_to do |format|\n if @purchase.save\n #create the notifications\n Order.create(description: \"ordine 2\",seller: @announcement.seller,announcement: @announcement)\n Notification.create(recipient: @announcement.seller, actor: current_buyer, action: \"buy\" ,notifiable: @announcement)\n @user = current_buyer\n format.html { redirect_to buyer_my_purchases_path, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inquiry = Inquiry.new(inquiry_params)\n\n respond_to do |format|\n if @inquiry.save\n format.html { redirect_to root_path, notice: 'Inquiry was successfully created.' }\n format.json { render :show, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @inquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:question][:content].gsub(/[ \\t\\r\\n]/, '').length == 0\n respond_to do |format|\n format.json { render json: nil, status: :unprocessable_entity}\n end\n return\n end\n\n #@question = Question.new(params[:question])\n @question = current_user.questions.new(params[:question])\n @question.closed = false\n\n respond_to do |format|\n if @question.save\n #receiver = User.ne(_id: current_user).to_a.first\n receivers = User.ne(_id: current_user).to_a\n #notification = receiver.question_notifications.create!(:question_url => question_path(@question))\n #notification_data = {:url => notification_path(notification, :type => :q), :type => :q}\n #message = {:channel => '/notifications/users/' + receiver._id, :data => notification_data.to_json.html_safe}\n question_description = @question.content.truncate(20, separator: ' ')\n\n messages = []\n receivers.each do |receiver|\n if receiver.group == current_user.group\n notification = receiver.question_notifications.create!(:question_url => question_path(@question), :question_description => question_description)\n notification_data = {:url => notification_path(notification, :type => :q), :type => :q, :question_description => question_description}\n messages.push({:channel => '/notifications/users/' + receiver._id, :data => notification_data.to_json.html_safe})\n end\n end\n\n faye_uri = URI.parse(\"http://localhost:\" + TestMongoid::Application.config.faye_server_port.to_s + \"/faye\")\n Net::HTTP.post_form(faye_uri, :message => messages.to_json)\n\n #format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.html { redirect_to root_path, notice: 'Question was successfully created.' }\n format.json { render json: nil, status: :created}\n else\n #format.html { render action: \"new\" }\n format.html { redirect_to root_path, notice: 'Question was not created...' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @freelancer_knowledges = FreelancerKnowledge.all\n end",
"def create\n Rails.logger.info params\n render status: :ok\n # @enquiry = Enquiry.new(enquiry_params)\n\n # respond_to do |format|\n # if @enquiry.save\n # format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n # format.json { render json: @enquiry, status: :created }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def post_ticket(params)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = params[:title]\n ticket.body = params[:body]\n ticket.tags = params[:tags]\n ticket.save\n end",
"def create\n @answer = current_user.answers.build(params[:answer])\n if @answer.save\n @post = @answer.post\n Notifier.delay.new_answer(@post.user, @answer)\n if @post.user != current_user\n current_user.update_attributes(cred_count: current_user.cred_count + 10)\n end\n return render status: 200, json: { success: true }\n else\n return render :status => :unprocessable_entity,\n :json => { success: false, :error => \"There was a problem posting your advice.\" }\n end\n end",
"def CreateTopic params = {}\n \n APICall(path: 'topics.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @badge = Badge.new(params[:badge])\n \n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, notice: 'Badge was successfully created.' }\n format.json { render json: @badge, status: :created, location: @badge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts \"*********************CREATE*******************\"\n puts \"*************** intervention_params **************\" + intervention_params.to_s\n @intervention = Intervention.new(intervention_params)\n @intervention.intervention_result = \"incomplete\"\n @intervention.intervention_status = \"pending\"\n @currentusername = current_user.full_name\n @intervention.author = @currentuserid\n \n if @intervention.save\n ZendeskAPI::Ticket.create!($client, \n :subject => \"**NEW INTERVENTION** created by : \" + @currentusername.to_s ,\n :comment => \"The customer ID : #{params['intervention'][:customer_id]} \n building ID : #{params['intervention'][:building_id]} \n battery ID : #{params['intervention'][:battery_id]} \n column ID : #{params['intervention'][:column_id]} \n elevator ID : #{params['intervention'][:elevator_id]} \n affected employee ID : #{params['intervention'][:employee_id]} \n description ID : #{params['intervention'][:intervention_report]} \",\n :priority => \"urgent\",\n :type => \"question\")\n\n render 'static_pages/intervention_received'\n else\n flash.now[:error] = \"fail no intervention has been sent\"\n render :index\n end\n end",
"def create\n @tack = Tack.new(tack_params)\n\n if @tack.save\n render json: @tack, status: :created, location: @tack\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end",
"def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end",
"def create\n @agreement = Agreement.new(agreement_params)\n @agreement.user_id = current_user.id\n\n respond_to do |format|\n if @agreement.save\n format.html { redirect_to @agreement, notice: 'Agreement was successfully created.' }\n format.json { render :show, status: :created, location: @agreement }\n else\n format.html { render :new }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, :notice => 'Badge was successfully created.' }\n format.json { render :json => @badge, :status => :created, :location => @badge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end",
"def create\n @agreement = Agreement.new(agreement_params)\n\n respond_to do |format|\n if @agreement.save\n format.html { redirect_to @agreement, notice: 'Certificado criado com sucesso.' }\n format.json { render :show, status: :created, location: @agreement }\n else\n format.html { render :new }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n # Create Nudge for issueing user\n @nudge = Nudge.new\n @nudge.user_id = params[:user_id]\n @nudge.pet_id = params[:pet_id]\n @nudge.group_id = Pet.find(params[:pet_id]).group.id\n @nudge.response = -1\n @nudge.nudge_token = @nudge.generate_token\n\n respond_to do |format|\n if @nudge.save\n # Create Nudge for group memebers\n Group.find(@nudge.group_id).users.each do |user|\n next if user.id == @nudge.user_id || user.device.nil?\n @nudge_member = Nudge.new\n @nudge_member.user_id = user.id\n @nudge_member.pet_id = params[:pet_id]\n @nudge_member.group_id = Pet.find(params[:pet_id]).group.id\n @nudge_member.response = 0\n @nudge_member.nudge_token = @nudge.nudge_token\n\n if @nudge_member.save\n # Send push notification\n @apn = Houston::Client.development\n device_token = User.find(@nudge_member.user_id).device.device_token\n notification = Houston::Notification.new(device: device_token)\n notification.alert = User.find(@nudge.user_id).first_name + ': Has ' + Pet.find(@nudge.pet_id).name + ' been fed?'\n notification.category = 'fed.category'\n notification.content_available = true\n notification.sound = 'sosumi.aiff'\n notification.custom_data = { nudge_id: @nudge.id, nudge_token: @nudge.nudge_token }\n @apn.push(notification)\n end\n end\n format.json { render :show, status: :created, location: @nudge }\n else\n format.json { render json: @nudge.errors, status: :unprocessable_entity }\n end \n end\n end",
"def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end",
"def notify(interests, data = {})\n Request.new(\n @eventflit_client,\n :post,\n url(\"/publishes\"),\n {},\n payload(interests, data)\n ).send_sync\n end",
"def create\n @topickey = Topickey.new(params[:topickey])\n\n respond_to do |format|\n if @topickey.save\n format.html { redirect_to @topickey, notice: 'Topickey was successfully created.' }\n format.json { render json: @topickey, status: :created, location: @topickey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topickey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:mentions].each do |men_params|\n men_params = men_params.permit(:ticker_id, :positive_count, :negative_count, :neutral_count)\n @mention = Mention.new(men_params)\n @mention.save\n end\n respond_to do |format|\n msg = { :status => :ok, :message => \"Success!\", :html => '<b></b>' }\n format.html do\n redirect_to '/'\n end\n format.json { render :json => msg }\n end\n end",
"def index\n if(current_user.profile.nil?)\n redirect_to new_profile_path,\n notice: \"You need first to fill your profile ;).\"\n else\n @knowledges = current_user.profile.knowledges.all\n end\n end",
"def create\n @no_due = NoDue.new(no_due_params)\n\n respond_to do |format|\n if @no_due.save\n format.html { redirect_to @no_due, notice: 'No due was successfully created.' }\n format.json { render :show, status: :created, location: @no_due }\n else\n format.html { render :new }\n format.json { render json: @no_due.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @award = Award.new(award_params)\n respond_to do |format|\n if @award.save\n a_data = JSON.parse params[:json_string]\n a_data.each do |a|\n @item = get_new_award_item(@award, a) unless a.nil?\n end\n AwardMailer.approval_request(@award)\n if current_user.admin\n format.html { redirect_to patient_path(@award.patient), notice: 'Award was successfully created.' }\n else\n format.html { redirect_to new_patient_path, notice: 'Award was successfully created.' }\n end\n format.json { render :show, status: :created, location: @award }\n else\n format.html { render :new }\n format.json { render json: @award.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t\t@interested = Interested.new(params[:interested])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.save\n \t\t\t\tformat.html{ redirect_to @interested, notice: 'Interested was successfully created.'}\n \t\t\t\tformat.json{ render json: @interested, status: :create, location: @interested }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"new\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend",
"def create\n @inquiry_reply = InquiryReply.new(inquiry_reply_params)\n @inquiry_reply.user_id = flash[:user_id]\n @inquiry_reply.house_id = flash[:house_id]\n @inquiry_reply.inquiry_id = flash[:inquiry_id]\n @inquiry_reply.company_id = flash[:company_id]\n respond_to do |format|\n if @inquiry_reply.save\n UserMailer.with(user: User.find(@inquiry_reply.user_id), inquiry_reply: @inquiry_reply,\n inquiry: Inquiry.find(@inquiry_reply.inquiry_id), house: House.find(@inquiry_reply.house_id)).inquiry_reply_email.deliver_now\n format.html {redirect_to @inquiry_reply, notice: 'Inquiry reply was successfully created. We have notified the user via email'}\n format.json {render :show, status: :created, location: @inquiry_reply}\n else\n format.html {render :new}\n format.json {render json: @inquiry_reply.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @surgery = Surgery.new(params[:surgery])\n\n respond_to do |format|\n if @surgery.save\n format.html { redirect_to @surgery, notice: 'Surgery was successfully created.' }\n format.json { render json: @surgery, status: :created, location: @surgery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kennkoukiroku = Kennkoukiroku.new(kennkoukiroku_params)\n\n respond_to do |format|\n if @kennkoukiroku.save\n format.html { redirect_to @kennkoukiroku, notice: \"健康記録を追加しました\" }\n format.json { render :show, status: :created, location: @kennkoukiroku }\n else\n format.html { render :new }\n format.json { render json: @kennkoukiroku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n discounts = []\n (1..params[:discount_number].to_i).each do |i|\n @discount = Discount.new(params[:discount])\n @discount.generate_token params[:discount_six_length].to_i\n @discount.save\n discounts << @discount\n end\n respond_to do |format|\n format.html { redirect_to discounts_url, notice: I18n.t(:discount_created, n: params[:discount][:name], c: params[:discount_number] ) }\n format.json { render json: discounts, status: :created, location: discounts }\n end\n end",
"def create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_thanks \n end",
"def dispute_notification(id, amount, currency)\n @id, @amount, @currency = id, amount, currency\n \n mail to: \"kaysertranslation@gmail.com\",\n subject: \"Hikarigo dispute created. Attention may be needed\"\n end",
"def acknowledge\n attrs = {\n :acknowledged => true,\n :acknowledged_at => Time.now()\n }\n self.update_attributes(attrs)\n end",
"def create_inquiry(rental, options = {})\n post(\"rentals/#{rental}/inquiries\", inquiries: [options]).pop\n end",
"def create\n @due = Due.new(due_params)\n\n respond_to do |format|\n if @due.save\n format.html { redirect_to @due, notice: 'Due was successfully created.' }\n format.json { render :show, status: :created, location: @due }\n else\n format.html { render :new }\n format.json { render json: @due.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @envelope = Envelope.new(params[:envelope])\n\n respond_to do |format|\n if @envelope.save\n format.html { redirect_to @envelope, notice: 'Envelope was successfully created.' }\n format.json { render json: @envelope, status: :created, location: @envelope }\n else\n format.html { render action: \"new\" }\n format.json { render json: @envelope.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hold_request = HoldRequest.new(hold_request_params)\n\n respond_to do |format|\n if @hold_request.save\n format.html { redirect_to @hold_request, notice: 'Hold request was successfully created.' }\n format.json { render :show, status: :created, location: @hold_request }\n else\n format.html { render :new }\n format.json { render json: @hold_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hold_request = HoldRequest.new(hold_request_params)\n\n respond_to do |format|\n if @hold_request.save\n format.html { redirect_to @hold_request, notice: 'Hold request was successfully created.' }\n format.json { render :show, status: :created, location: @hold_request }\n else\n format.html { render :new }\n format.json { render json: @hold_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send(key)\n HTTParty.post(@add_url, {\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :body => {\n #:url => formatted[:url],\n :url => \"https://www.engadget.com/2016/10/09/more-galaxy-note-7-replacement-fires/\",\n #:tags => formatted[:tags],\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :access_token => key\n }.to_json\n })\n end",
"def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end",
"def create\n @indication = DisIndication.new(indication_params)\n\n\n if @indication.save\n flash[:notice] = \"Task was successfully created.\"\n respond_with(@indication)\n else\n flash[:notice] = \"Task was not created.\"\n end\n end",
"def create\n @enquiry = Enquiry.new(params[:enquiry])\n\n respond_to do |format|\n if @enquiry.save\n logger.info {\"Starting email first\"}\n EnquiryMailer.enquiry_received(@enquiry).deliver\n logger.info {\"Starting email second\"}\n EnquiryMailer.enquiry_response(@enquiry).deliver\n format.html { redirect_to thanks_path, notice: 'Thank you for your enquiry.' }\n format.json { render action: 'show', status: :created, location: @enquiry }\n else\n format.html { render action: 'new' }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end",
"def create(params)\n post(\"#{domain}/complaints\", params)\n end",
"def create\n @refund_request = RefundRequest.new(params[:refund_request])\n\n respond_to do |format|\n if @refund_request.save\n NoticeMailer.refund_request_email(@refund_request).deliver\n format.html { redirect_to root_path, notice: 'Solicitud de devolución correctamente ingresada.' }\n format.json { render json: @refund_request, status: :created, location: @refund_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end",
"def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n # current_user.add_badge(1)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Postagem criada com sucesso.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Build a ticket associated with the current user and fill with strong parameters\n @ticket = current_user.help_requests.build(ticket_params)\n # New Hash\n add_info = {}\n # New Nested Array\n add_info[:tagged_users] = []\n # Scan for tagged users in the report:\n @ticket.desc.scan(USER_TAG_REGEX) do |name|\n # Find a tagged user in the database\n user = User.find_by_name(name)\n # Add the tagged user to the hash of tagged users\n add_info[:tagged_users] << user.name unless user == nil\n end\n # Save a JSON representation of the add_info hash to the record\n @ticket.addinfo = JSON.generate(add_info)\n # Save the new record in the database\n @ticket.save\n # Send the user to their homepage\n redirect_to me_path\n end",
"def create\n @supaagent = Supaagent.new(supaagent_params)\n\n respond_to do |format|\n if @supaagent.save\n format.html { redirect_to action: \"thank_you\", notice: 'Supaagent was successfully created.' }\n format.json { render :show, status: :created, location: @supaagent }\n else\n format.html { render :new }\n format.json { render json: @supaagent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @user.hearts >= @reward.cost\n @redemption = Redemption.new()\n @redemption.user = @user\n @redemption.cost = @reward.cost\n @redemption.reward = @reward\n\n if @reward.ifttt?\n key = ENV[\"IFTTT_KEY\"]\n\turl = \"https://maker.ifttt.com/trigger/#{@user.account}#{@reward.event}/with/key/#{key}\"\n\tresponse = RestClient.get url\n\n\trespond_to do |format|\n\t if response.code == 200 && @redemption.save\n @user.hearts = @user.hearts - @reward.cost\n @user.save!\n\n format.json { render json: @redemption.as_json(include: {reward: {only: :name}}).merge({hearts: @user.hearts}), status: :created }\n else\n format.json { render json: nil, status: :not_acceptable }\n end\n end\n elsif @reward.cash?\n \trespond_to do |format|\n if @redemption.save\n @user.hearts = @user.hearts - @reward.cost\n\t @user.save!\n\t SmsMailer.sms_email(Admin.all.first).deliver\n\n\t format.json { render json: @redemption.as_json(include: {reward: {only: :name}}).merge({hearts: @user.hearts}), status: :created }\n\t else\n\t format.json { render json: nil, status: :not_acceptable }\n\t end\n\tend\n end\n else\n respond_to do |format|\n format.json { render json: {message: \"Not enough hearts!\"}, status: :not_acceptable }\n end\n end\n end",
"def create\n @enquiry = Enquiry.find params[:enquiry_id]\n content = params[:email_content].gsub(\"\\n\", '<br>')\n FoodPartnerMailer.new_order_notice(@enquiry, content).deliver_later\n SupplierCommunication.create! comm_params\n @enquiry.wait_on_supplier\n head :ok\n end",
"def create_intervention_ticket\n client = ZendeskAPI::Client.new do |config|\n config.url = ENV['ZENDESK_URL']\n config.username = ENV['ZENDESK_USERNAME']\n config.token = ENV['ZENDESK_TOKEN']\n end\n \n ZendeskAPI::Ticket.create!(client, \n :subject => \"Building: #{@intervention.building_id} requires intervention\", \n :comment => { \n :value => \n \"The Requester: #{Employee.find(@intervention.author_id).first_name+''+Employee.find(@intervention.author_id).last_name }\n The Customer (Company Name): #{@intervention.customer.company_name}\\n\n Building ID: #{@intervention.building_id}\\n\n Battery ID: #{params[:battery]}\\n\n Column ID: #{if (params[:column] == \"None\") then \"\" else params[:column] end} \n Elevators ID: #{if (params[:elevator] == \"None\" ) then \"\" else params[:elevator] end}\n #{if (@intervention.employee_id) then \"The employee to be assigned to the task: #{@intervention.employee.first_name} #{@intervention.employee.last_name}\" end}\n \n Description:#{@intervention.report}\"\n }, \n :requester => { \n \"name\": Employee.find(@intervention.author_id).first_name+''+Employee.find(@intervention.author_id).last_name \n },\n \n :type => \"problem\",\n :priority => \"normal\"\n )\n end",
"def create\n @message_hashtag = MessageHashtag.new(message_hashtag_params)\n\n respond_to do |format|\n if @message_hashtag.save\n format.html { redirect_to @message_hashtag, notice: 'Message hashtag was successfully created.' }\n format.json { render :show, status: :created, location: @message_hashtag }\n else\n format.html { render :new }\n format.json { render json: @message_hashtag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @getadvice = Getadvice.new(params[:getadvice])\n\n respond_to do |format|\n if @getadvice.save\n format.html { redirect_to @getadvice, notice: 'Getadvice was successfully created.' }\n format.json { render json: @getadvice, status: :created, location: @getadvice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @getadvice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end",
"def send_post_notification(post)\n @post = post\n @post = post\n @poster = post.poster\n if @post.post_needs.size == 0\n @post_needs = []\n else\n @post_needs = @post.post_needs.alphabetical\n end\n recipients = @post.notify_emails\n\n if recipients != \"\"\n mail(:to => recipients, :subject => 'New Request at ' + post.street_1)\n end\n end",
"def create\n @qanote = current_user.qanotes.build(qanote_parameters)\n \n respond_to do |format|\n if @qanote.save\n QanoteMailer.newtag(current_user).deliver\n format.html { redirect_to @qanote, notice: 'Qanote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @qanote }\n else\n format.html { render action: 'new' }\n format.json { render json: @qanote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topic = Topic.create(topic_params)\n current_user.topics.push(@topic)\n \n respond_with @topic\n end",
"def create\n inc_id = 1\n unless @event.attendees.blank?\n inc_id = @event.attendees.last.attendee_id.gsub(@event.token_for_id, \"\").to_i + 1\n end\n params[:attendee][:attendee_id] = @event.token_for_id + \"%04d\" % inc_id\n params[:attendee][:a_platform] = params[:attendee][:a_platform].join(\";\") unless params[:attendee][:a_platform].nil?\n params[:attendee][:a_market_segment] = params[:attendee][:a_market_segment].join(\";\") unless params[:attendee][:a_market_segment].nil?\n params[:attendee][:confirmation_token] = Array.new(10) {[*'0'..'9', *'a'..'z'].sample}.join\n params[:attendee][:a_sector] = \"N/A\"\n params[:attendee][:e_ext_number] = 0\n params[:attendee][:e_lada] = 0\n params[:attendee][:e_zip_code] = \"N/A\"\n @attendee = Attendee.new(params[:attendee])\n \n respond_to do |format|\n if @attendee.save\n #AttendeeMailer.welcome_email(@attendee).deliver!\n format.html { redirect_to @attendee, notice: t(:successfully_created) }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name = params[:name]\n seat = params[:seat]\n desc = params[:desc]\n group_name = params[:group]\n group = Group.where(name:group_name).first\n\n new_ticket = group.tickets.new(name:name,seat:seat,description:desc)\n\n if new_ticket.save\n notice = {\"notice\"=>\"new ticket created successfully.\"}\n puts notice.to_json\n redirect_to \"http://hacked.io/almanac/get-help/submitted\"\n else\n alert = {\"alert\"=>\"ticket was not created. check your params.\"}\n puts alert.to_json\n redirect_to \"http://hacked.io/almanac/get-help/not-submitted\"\n end\n end",
"def create\n n = params[:number_of_tickets].to_i\n\n # make sure there are enough tickets\n\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n @ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{@ticket.id}\"\n @ticket.van.seats_available -= 1\n @ticket.van.save\n @ticket.save\n Recipt.send_recipt(@ticket).deliver\n (n-1).times do\n ticket = Ticket.new(ticket_params)\n ticket.save\n ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{ticket.id}\"\n ticket.van.seats_available -= 1\n ticket.van.save\n ticket.save\n Recipt.send_recipt(ticket).deliver\n end\n\n if n == 1\n format.html { redirect_to @ticket, notice: 'Thank you for riding Gnome2Home. You will receive an email shortly with your QR code and confirmation number' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { redirect_to edit_passenger_registration_path, notice: \"Thanks for buying #{n} tickets. You can view all of you purchased tickets below. You will receive #{n} separate emails, each with a unique QR code ticket. Please keep those emails to check in. \"}\n format.json { render :show, status: :created, location: @ticket }\n end\n\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def create\n @surgery = Surgery.new(surgery_params)\n\n respond_to do |format|\n if @surgery.save\n format.html { redirect_to @surgery, notice: 'Surgery was successfully created.' }\n format.json { render :show, status: :created, location: @surgery }\n else\n format.html { render :new }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n _params = message_params\n if params.has_key? :key and !_params.has_key? :guestbook_id\n key = AccessKey.where(key: params[:key]).first\n if key != nil\n _params[:guestbook_id] = key.guestbook != nil ? key.guestbook.id : Guestbook.get_default.id\n end\n end\n\n # Insurance\n if _params[:guestbook_id] == nil\n _params[:guestbook_id] = Guestbook.get_default.id\n end\n guestbook = Guestbook.find(_params[:guestbook_id])\n\n # Auto approve, if passes filter\n _params[:approved] = guestbook.auto_approve\n if guestbook.filter_profanity && Obscenity.profane?(_params[:content])\n _params[:approved] = false\n end\n\n @message = Message.new(_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_back(fallback_location: '/admin/signatures') }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { redirect_to(:back, error: @message.errors.full_messages.first) }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(title, target, message, color)\n a_message_note = {\n 'color' => color,\n 'fields' => [\n {\n 'title' => 'Message',\n 'value' => message,\n 'short' => false\n },\n {\n 'title' => 'Archive Name',\n 'value' => target,\n 'short' => true\n },\n {\n 'title' => 'Status',\n 'value' => color,\n 'short' => false\n }\n ]\n }\n\n notify_user = ENV['SLACK_USER'] || 'notifier'\n notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'], :username => notify_user\n notifier.ping title, 'icon_emoji' => ENV['SLACK_ICON_EMOJI'], 'attachments' => [a_message_note]\nend",
"def create\n @mispronunciation = Mispronunciation.new(params[:mispronunciation])\n\n respond_to do |format|\n if @mispronunciation.save\n format.html { redirect_to @mispronunciation, :notice => 'Mispronunciation was successfully created.' }\n format.json { render :json => @mispronunciation, :status => :created, :location => @mispronunciation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @mispronunciation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @datum_receipt = DatumReceipt.new(datum_receipt_params)\n\n respond_to do |format|\n if @datum_receipt.save\n format.html { redirect_to @datum_receipt, notice: 'Datum receipt was successfully created.' }\n format.json { render :show, status: :created, location: @datum_receipt }\n else\n format.html { render :new }\n format.json { render json: @datum_receipt.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.60486805",
"0.5869254",
"0.56131476",
"0.55864567",
"0.5460759",
"0.54190147",
"0.5368599",
"0.52017134",
"0.5134812",
"0.5105741",
"0.5099558",
"0.50881994",
"0.50741667",
"0.50425446",
"0.50265867",
"0.50206363",
"0.5018448",
"0.5002765",
"0.49906895",
"0.4978807",
"0.49780235",
"0.4975928",
"0.49736595",
"0.4965792",
"0.49219084",
"0.4921237",
"0.49172804",
"0.49109828",
"0.49039787",
"0.49013025",
"0.48910707",
"0.4882591",
"0.48816112",
"0.4871085",
"0.48653188",
"0.48644906",
"0.48556787",
"0.48544887",
"0.48505262",
"0.48504314",
"0.48489466",
"0.48423183",
"0.48331082",
"0.4833014",
"0.4830597",
"0.48173648",
"0.4812169",
"0.4805698",
"0.48021516",
"0.479184",
"0.4789864",
"0.47870848",
"0.47860956",
"0.47843453",
"0.47768554",
"0.47757646",
"0.47687823",
"0.476558",
"0.4764426",
"0.47617856",
"0.47525144",
"0.47513482",
"0.47504804",
"0.47386602",
"0.47378138",
"0.47362012",
"0.47332907",
"0.47311622",
"0.47294724",
"0.4725139",
"0.4725139",
"0.47223756",
"0.4722294",
"0.47215813",
"0.4719284",
"0.47182798",
"0.47181925",
"0.47086573",
"0.47082615",
"0.4708099",
"0.47047618",
"0.4699288",
"0.46959853",
"0.46926197",
"0.46924943",
"0.46895835",
"0.46870884",
"0.46860605",
"0.4685405",
"0.46818978",
"0.46801546",
"0.4675837",
"0.46741626",
"0.46723333",
"0.466859",
"0.4666047",
"0.46653047",
"0.46650237",
"0.46645364",
"0.46641856",
"0.46633053"
] |
0.0
|
-1
|
PATCH/PUT /knowledges/1 PATCH/PUT /knowledges/1.json
|
def update
respond_to do |format|
if @knowledge.update(knowledge_params)
format.html { redirect_to knowledges_path, notice: 'Knowledge was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @knowledge.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @knowledge = current_user.knowledges.find(params[:id])\n\n respond_to do |format|\n if @knowledge.update_attributes(params[:knowledge])\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n if @compromise.update(compromise_params)\n Notification.delete_all([\"compromise_id = ?\", @compromise.id])\n create_for_each_notification_type(@compromise)\n head :no_content\n else\n render json: @compromise.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def updateNotification\n read = convertToBoolean(read)\n delivered = convertToBoolean(delivered)\n\n parameters={id_user: params[:id_user].to_i, subject: params[:subject].to_s, content: params[:content].to_s, read: params[:read], delivered: params[:delivered] }\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n url = \"http://192.168.99.101:4052/notifications/\"+params[:id].to_s\n results = HTTParty.put(url.to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update_record(http, ref)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Updated text.\"\n}|\n resp = http.send_request('POST', \"/v1/Article/#{ref}\", json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'update reply.code should be 0 meaning no error')\n updated = reply[:updated]\n assert_equal(1, updated.length, 'update reply.updated should contain exactly one member')\n ref = updated[0]\n refute_equal(nil, ref, 'update reply record reference can not be nil')\n refute_equal(0, ref, 'update reply record reference can not be 0')\n ref\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \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: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\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 note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end",
"def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tack = Tack.find(params[:id])\n\n if @tack.update(tack_params)\n head :no_content\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @enquiry.update(params[:enquiry])\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @carrierknowledghe.update(carrierknowledghe_params)\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully updated.' }\n format.json { render :show, status: :ok, location: @carrierknowledghe }\n else\n format.html { render :edit }\n format.json { render json: @carrierknowledghe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n# if @proposal.update(proposal_params)\n if @proposal.update_with_conflict_validation(proposal_params)\n format.html { redirect_to @proposal, notice: '提案を1件更新しました。' }\n format.json { render :show, status: :ok, location: @proposal }\n else\n format.html { render :edit }\n format.json { render json: @proposal.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 @topic.update_attributes!(topic_params)\n json_response(@topic)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\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 update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, :notice => 'Contact was successfully updated.' }\n format.json { render :json => @note }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @snack.update(snack_params)\n format.html { redirect_to @snack, notice: 'Snack was successfully updated.' }\n format.json { render :show, status: :ok, location: @snack }\n else\n format.html { render :edit }\n format.json { render json: @snack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update(params_topic)\n render json: topic, status: 200\n else\n render json: topic.errors, status: 422\n end\n\n end",
"def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend",
"def UpdateTopic id,params = {}\n \n APICall(path: \"topics/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n begin\n # Find note\n reply = Reply.find(params[:id]) \n # Authenticate\n if reply.user_id == current_user.id and reply.update_attributes(params[:reply])\n render :json => reply\n else\n error \"Failed to update the note\" \n end\n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper\"\n end\n end",
"def update\n @topickey = Topickey.find(params[:id])\n\n respond_to do |format|\n if @topickey.update_attributes(params[:topickey])\n format.html { redirect_to @topickey, notice: 'Topickey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topickey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @inquiry\n\n if @inquiry.update(inquiry_params)\n head :no_content\n else\n render json: {errors:@inquiry.errors.messages}, status: :unprocessable_entity\n end\n\n end",
"def update\n add_breadcrumb 'Edit Ticketnotes'\n\n respond_to do |format|\n if @ticketnote.update(ticketnote_params)\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @ticketnote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_with @topic.update(topic_params)\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n if params[:kid][:id]\n @kid = Kid.find(params[:kid][:id])\n else\n @kid = Kid.find_by_user_id_and_local_id(params[:kid][:user_id],params[:kid][:local_id])\n end\n params[:kid].delete(:user_id)\n params[:kid].delete(:id)\n if @kid.update_attributes(params[:kid])\n render json: @kid\n else\n render json: @kid.errors, status: :unprocessable_entity\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def patch\n end",
"def patch(path, **args); end",
"def update\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @envelope.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @enquiry.update(enquiry_params)\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @enquiry }\n else\n format.html { render :edit }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @enquiry.update(enquiry_params)\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @enquiry }\n else\n format.html { render :edit }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end",
"def incident_update(statuspage_id, incident_id, incident_details, current_status, current_state, notifications = 0, message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n data['incident_details'] = incident_details\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'incident/update',\n :payload => data\n end",
"def update\n respond_to do |format|\n @issue.votes = 0\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agreement.update(agreement_params)\n format.html { redirect_to @agreement, notice: 'Agreement was successfully updated.' }\n format.json { render :show, status: :ok, location: @agreement }\n else\n format.html { render :edit }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n invoice={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @invoice.update(invoice)\n format.json { head :no_content }\n end",
"def update\n @notice.update(notice_params)\n respond_to do |format|\n format.json { render action: 'show' }\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\t\tchanges = \"\"\n\t\tnew_employee = params[:ticket][:employee_id].nil? || params[:ticket][:employee_id].empty? ? nil : Employee.find(params[:ticket][:employee_id])\n\t\tunless new_employee == @ticket.employee\n\t\t\tchanges += \"> Responsible changed from #{@ticket.employee ? @ticket.employee.login : \"None\"} to #{new_employee.login}\"\n\t\t\t@ticket.employee = new_employee\n\t\tend\n\t\tnew_status = params[:ticket][:status_id].nil? || params[:ticket][:status_id].empty? ? nil : Status.find(params[:ticket][:status_id])\n\t\tunless new_status == @ticket.status\n\t\t\tchanges += $/ + \"> Status changed from \\\"#{@ticket.status ? @ticket.status.name : \"None\"}\\\" to \\\"#{new_status.name}\\\"\"\n\t\t\t@ticket.status = new_status\n\t\tend\n\t\t@reply = @ticket.replies.build(params[:reply])\n\t\t@reply.meta = changes\n\t\t@reply.author = current_user.login\n respond_to do |format|\n if @ticket.valid? && @reply.valid?\n\t\t\t\t@ticket.save\n\t\t\t\t@reply.save\n\t\t\t\tCustomerSupport.update_ticket_email(@ticket,@reply).deliver\n format.html { redirect_to backend_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\" }\n format.json { render json: @ticket.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 @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @key.update(key_params)\n render json: @key\n else\n render json: @key.errors, status: :unprocessable_entity\n end\n end",
"def update\n notification = Notification.find(params[:id])\n notification.update(\n params.permit(:title, :description)\n )\n notification.active = false\n notification.save\n render json: notification\n end",
"def update_signage\n @nugget = Nugget.find(params[:id])\n @nugget.unset_editable_time\n\n respond_to do |format|\n if @nugget.update_attributes(params[:nugget])\n @nugget.signage_review!\n\n # JAH - Jan 7 2014\n # There used to be a state here to \"review\" signage that isn't\n # necessary. Ergo we're going to transition the nugget immediately\n # from signage_review to signage_approve to move it further along.\n @nugget.signage_approve!\n\n format.html { redirect_to jobboard_path, notice: 'Read Signage Job completed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to jobboard_path, error: 'Something went wrong. Job not completed.' }\n format.json { render json: @nugget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @keyclientorder.update(keyclientorder_params)\n format.html { redirect_to @keyclientorder, notice: 'Keyclientorder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @keyclientorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n respond_to do |format|\n if @kpi_notification.update(kpi_notification_params)\n format.html { redirect_to @kpi_notification, notice: 'Kpi notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @kpi_notification }\n else\n format.html { render :edit }\n format.json { render json: @kpi_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n @email_reminder.update(email_reminder_params)\n respond_with @email_reminder\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update_attributes(topic_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => topic.errors}, :status => :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n params[:client][:contact_ids] ||= []\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @journal = Journal.find(params[:id])\n @journal.update_attributes(params[:journal])\n respond_with(@user,@journal)\n end",
"def update\n respond_to do |format|\n if @note1.update(note1_params)\n format.html { redirect_to @note1, notice: \"Note1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @note1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @note1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params_as_note_attributes_hash)\n format.html { redirect_to(@note, :notice => 'Note was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kont_klient.update(kont_klient_params)\n format.html { redirect_to @kont_klient, notice: 'Kont klient was successfully updated.' }\n format.json { render :show, status: :ok, location: @kont_klient }\n else\n format.html { render :edit }\n format.json { render json: @kont_klient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n params[:newsletter][:subcontact_ids] ||= []\n params[:newsletter][:email_ids] ||= []\n @newsletter = Newsletter.find(params[:id])\n\n #respond_to do |format|\n # if @newsletter.update_attributes(params[:newsletter])\n # format.html { redirect_to @newsletter, :notice => 'Newsletter was successfully updated.' }\n # format.json { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @newsletter.errors, :status => :unprocessable_entity }\n # end\n #end\n if @newsletter.update_attributes(params[:newsletter]) \n params.keys.each do |k|\n\t\tset_params_newsletter(k)\t\n\tend\t\n else\n\t flash[:notice] = t(\"newsletters.update.notice_failure\")\n\t render :edit \n end\n\n #redirect_to(:back)\n end",
"def update\n @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:topic].delete :messages_attributes\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to topic_url(@topic), notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n if @normal_issue.update_attributes(params[:normal_issue])\n format.html { redirect_to @normal_issue, notice: 'Normal issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @normal_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @issue_received_method.update(issue_received_method_params)\n format.html { redirect_to @issue_received_method, notice: 'Issue received method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @issue_received_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n if @important_issue.update_attributes(params[:important_issue])\n format.html { redirect_to @important_issue, notice: 'Important issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @important_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inquiry_reply.update(inquiry_reply_params)\n UserMailer.with(user: User.find(@inquiry_reply.user_id), inquiry_reply: @inquiry_reply,\n inquiry: Inquiry.find(@inquiry_reply.inquiry_id), house: House.find(@inquiry_reply.house_id)).inquiry_reply_email.deliver_now\n format.html {redirect_to @inquiry_reply, notice: 'Inquiry reply was successfully updated. We have notified the user via email'}\n format.json {render :show, status: :ok, location: @inquiry_reply}\n else\n format.html {render :edit}\n format.json {render json: @inquiry_reply.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n\t\t#check condition for present or not.\n\t\tif @case_note.present?\n\t\t\t# updating the case note attributes for the particular case note\n\t\t @case_note.update_attributes(case_note_params)\n\t\t #response in json format\n\t render json: { success: true,message: \"Case Note Successfully Updated.\", response: CaseNoteSerializer.new(@case_note).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Notes are not present\" },:status=> 203\n\t end \n\tend",
"def update\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n\n if @service_level_agreement.update_attributes(params[:service_level_agreement])\n render :json => {:success => true}\n else\n render :json => {:success => false, :message => @service_level_agreement.errors.full_messages.join(\". \") }\n end\n end",
"def update\n respond_to do |format|\n if @balance_enquiry.update(balance_enquiry_params)\n format.html { redirect_to karigar_balance_enquiries_path(@karigar), notice: 'Balance enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @balance_enquiry }\n else\n format.html { render :edit }\n format.json { render json: @balance_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end",
"def update\n # respond_to do |format|\n # if @attention.update(attention_params)\n # format.html { redirect_to @attention, notice: 'Attention was successfully updated.' }\n # format.json { render :show, status: :ok, location: @attention }\n # else\n # format.html { render :edit }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @delivery_note = DeliveryNote.find(params[:id])\n\n respond_to do |format|\n if @delivery_note.update_attributes(params[:delivery_note])\n format.html { redirect_to @delivery_note, notice: 'Delivery note was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @delivery_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n if @kit.update_attributes(params[:kit])\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @note.update(note_params)\n\n respond_to do |format|\n format.json { render json: flash.to_hash }\n end\n\n end",
"def update\n if @notification.update(notification_params)\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def update\n @badge = Badge.find_by_key(params['id'])\n @badge.approved_at = Time.now unless session[:admin]\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, :notice => 'Badge was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kit.update(kit_params)\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inquiry.update(inquiry_params)\n format.html { redirect_to @inquiry, notice: 'Inquiry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inquiry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@sudoku = Sudoku.find(params[:id])\n @get_sudoku_topic = SudokuTopic.new(params[:sudoku_topic])\n # @get_sudoku_topic.topic=\"test update by code\"\n @get_sudoku_topic.save\n\n\n respond_to do |format|\n if @sudoku.update_attributes(params[:sudoku_topic])\n format.html { redirect_to @sudoku, notice: 'Sudoku was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def update\n respond_with []\n end",
"def update\n respond_to do |format|\n puts \"pregnancy_params => #{pregnancy_params}\"\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_need = ClientNeed.find(params[:id])\n\n respond_to do |format|\n if @client_need.update_attributes(params[:client_need])\n format.html { redirect_to @client_need, notice: 'Client need was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @complain.update complain_params\n notice = if params[:complain][:status_event] != Constant.TICKET_EVENTS[:EDIT]\n \"Ticket #{@complain.status} successfully.\"\n else\n 'Ticket updated successfully.'\n end\n if @complain.errors.present?\n notice += @complain.errors.full_messages.to_sentence\n format.html { redirect_to @complain, alert: notice }\n format.js { flash.now[:alert] = notice }\n format.json { render json: { message: notice, data: @complain.for_api } }\n else\n format.html { redirect_to @complain, notice: notice }\n format.js { flash.now[:notice] = notice }\n format.json { render json: { message: notice, data: @complain.for_api } }\n end\n else\n alert = @complain.errors.full_messages.first\n format.html { redirect_to @complain, alert: alert }\n format.js { flash.now[:alert] = \"Can't update. #{alert}\" }\n format.json { render json: { error_message: alert, error_status: :unprocessable_entity }, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_note = ProjectNote.find(params[:id])\n\n if @project_note.update(project_note_params(params[:project_note]))\n head :no_content\n else\n render json: @project_note.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.6237848",
"0.5796376",
"0.572529",
"0.5679823",
"0.56785727",
"0.56472677",
"0.5646884",
"0.5627597",
"0.5605231",
"0.5598421",
"0.5583601",
"0.5547218",
"0.554358",
"0.55402416",
"0.55396783",
"0.5535727",
"0.5521551",
"0.5514551",
"0.5512269",
"0.55005026",
"0.55005026",
"0.5494837",
"0.5489435",
"0.5481014",
"0.54808795",
"0.5476398",
"0.5476387",
"0.54758644",
"0.5472855",
"0.54604316",
"0.54556394",
"0.54390514",
"0.54344994",
"0.54308575",
"0.54262286",
"0.54214823",
"0.54167044",
"0.5410624",
"0.54053086",
"0.5396833",
"0.53888965",
"0.5384897",
"0.5384897",
"0.5377368",
"0.53591204",
"0.5353092",
"0.5352883",
"0.5346957",
"0.53439265",
"0.53431284",
"0.5342645",
"0.53329945",
"0.53318363",
"0.5329395",
"0.5323516",
"0.5317774",
"0.5313506",
"0.53123146",
"0.5312243",
"0.53031445",
"0.5301321",
"0.529824",
"0.5297651",
"0.52953094",
"0.5294219",
"0.5293135",
"0.52903086",
"0.52887475",
"0.52857333",
"0.5285226",
"0.5283372",
"0.5281457",
"0.52752686",
"0.52734727",
"0.52723265",
"0.52722883",
"0.5271598",
"0.5270655",
"0.5268712",
"0.5266714",
"0.5263493",
"0.52594507",
"0.52475995",
"0.5246676",
"0.5241389",
"0.5239726",
"0.52396756",
"0.52380705",
"0.5236833",
"0.52360237",
"0.523593",
"0.52335435",
"0.5233063",
"0.52329814",
"0.52310646",
"0.5230432",
"0.5228823",
"0.52279866",
"0.52228165",
"0.5222664",
"0.52222663"
] |
0.0
|
-1
|
DELETE /knowledges/1 DELETE /knowledges/1.json
|
def destroy
@knowledge.destroy
respond_to do |format|
format.html { redirect_to knowledges_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @inquiry.destroy\n respond_to do |format|\n format.html { redirect_to inquiries_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n @carrierknowledghe.destroy\n respond_to do |format|\n format.html { redirect_to carrierknowledghes_url, notice: 'Carrierknowledghe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end",
"def destroy\n @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agreement.destroy\n respond_to do |format|\n format.html { redirect_to agreements_url, notice: 'Agreement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hold_request.destroy\n respond_to do |format|\n format.html { redirect_to student_requests_path, notice: 'Hold request was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @topickey = Topickey.find(params[:id])\n @topickey.destroy\n\n respond_to do |format|\n format.html { redirect_to topickeys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_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 @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end",
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @pharmacy_notices = PharmacyNotices.find(params[:id])\n @pharmacy_notices.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_notices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy\n @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @delivery_note = DeliveryNote.find(params[:id])\n @delivery_note.destroy\n\n respond_to do |format|\n format.html { redirect_to delivery_notes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @snack.destroy\n respond_to do |format|\n format.html { redirect_to snacks_url, notice: 'Snack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n client = current_user.find_client(params[:client_id])\n @notification = client.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to client_notifications_url(client) }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @aki_diagnosis.destroy\n respond_to do |format|\n format.html { redirect_to aki_diagnoses_url, notice: 'Diagnosis aki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agreement_renewal.destroy\n respond_to do |format|\n format.html { redirect_to agreement_renewals_url, notice: 'Agreement renewal 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 destroy\n @inquirement = Inquirement.find(params[:id])\n @inquirement.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_inquirements_url, notice: '該筆詢問已刪除' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pack_group_receipt = PackGroupReceipt.find(params[:id])\n @pack_group_receipt.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 @discipline.topics.delete_all\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @announce = Announce.find(params[:id])\n @announce.destroy\n #AnnounceMailer.delete_mail(@announce).deliver\n\n respond_to do |format|\n format.html { redirect_to announces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url, notice: 'Enquiry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url, notice: 'Enquiry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @balance_enquiry.destroy\n respond_to do |format|\n format.html { redirect_to karigar_balance_enquiries_path(@karigar), notice: 'Balance enquiry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to badges_url, notice: 'Badge was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announce_c = AnnounceC.find(params[:id])\n @announce_c.destroy\n\n respond_to do |format|\n format.html { redirect_to announce_cs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notify = Notify.find(params[:id])\n @notify.destroy\n\n respond_to do |format|\n format.html { redirect_to notifies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hold_request.destroy\n respond_to do |format|\n format.html { redirect_to hold_requests_url, notice: 'Hold request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Devis supprime.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n render json:@announcement\n\n end",
"def destroy\n authorize @inquiry\n @inquiry.destroy\n\n head :no_content\n end",
"def destroy\n authorize @inquiry\n @inquiry.destroy\n\n head :no_content\n end",
"def delete_note id\n @nimble.delete \"contact/notes/#{id}\"\n end",
"def cancelReservation(lease_uuid)\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s \n cert_path = APP_CONFIG['cert_path']\n \n header = {\"Content-Type\" => \"application/json\"}\n options = {uuid: lease_uuid}\n\n #puts options.to_json \n uri = URI.parse(broker_url+\"/resources/leases\")\n pem = File.read(cert_path)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.cert = OpenSSL::X509::Certificate.new(pem)\n http.key = OpenSSL::PKey::RSA.new(pem)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Delete.new(uri.request_uri, header)\n request.body = options.to_json\n\n response = http.request(request)\n puts response\n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response\n end\n end",
"def destroy\n @freelancer_knowledge.destroy\n respond_to do |format|\n format.html { redirect_to freelancer_knowledges_url, notice: 'Freelancer knowledge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ourmail.destroy\n respond_to do |format|\n format.html { redirect_to ourmails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inform_mail.destroy\n respond_to do |format|\n format.html { redirect_to inform_mails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to invoice_clients_url, notice: 'Invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end",
"def destroy\n @client = Client.find(params[:client_id])\n @casenote = Casenote.find(params[:id])\n @casenote.destroy\n\n respond_to do |format|\n format.html { redirect_to client_casenotes_path(@client) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @advice.destroy\n respond_to do |format|\n format.html { redirect_to advices_url, notice: 'Message successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n @fundamental_announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_announcements_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @add_to_invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to add_to_invoice_clients_url, notice: 'Add to invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @invoicedetail.destroy\n respond_to do |format|\n format.html { redirect_to invoicedetails_url, notice: 'Invoicedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inquirydetail.destroy\n respond_to do |format|\n format.html { redirect_to inquirydetails_url, notice: 'Inquirydetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ireceipt.destroy\n respond_to do |format|\n format.html { redirect_to ireceipts_url, notice: 'Receipt was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @note1.destroy\n respond_to do |format|\n format.html { redirect_to note1s_url, notice: \"Note1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mk_missatge.destroy\n respond_to do |format|\n format.html { redirect_to mk_missatges_url, notice: 'Mk missatge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Платеж успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @keyclientorder.destroy\n respond_to do |format|\n format.html { redirect_to keyclientorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n respond_to do |format|\n format.html { render html: '200', status: :ok }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\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 @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @money_receipt = MoneyReceipt.find(params[:id])\n @money_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to money_receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @noriskmessage = Noriskmessage.find(params[:id])\r\n @noriskmessage.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to noriskmessages_url }\r\n format.json { head :ok }\r\n end\r\n end"
] |
[
"0.71543026",
"0.6475935",
"0.64649564",
"0.6419162",
"0.64101493",
"0.64013314",
"0.63922596",
"0.6386774",
"0.63782674",
"0.63745177",
"0.63665164",
"0.6356153",
"0.63523823",
"0.63523823",
"0.6334917",
"0.6330435",
"0.63227755",
"0.6317183",
"0.629697",
"0.629453",
"0.62752134",
"0.6273424",
"0.6269906",
"0.62662715",
"0.6264532",
"0.62541103",
"0.624775",
"0.6246163",
"0.6244532",
"0.62415403",
"0.6239",
"0.623757",
"0.6227431",
"0.6225815",
"0.6213117",
"0.62058294",
"0.62058294",
"0.62058294",
"0.62058294",
"0.62048",
"0.6202236",
"0.62018496",
"0.6198592",
"0.6197656",
"0.6196081",
"0.6196081",
"0.6196081",
"0.6196081",
"0.619261",
"0.6190321",
"0.61892366",
"0.6188924",
"0.6188924",
"0.61811143",
"0.61811006",
"0.61653364",
"0.6162076",
"0.61615014",
"0.6155754",
"0.6154864",
"0.61533713",
"0.614858",
"0.6144345",
"0.6141612",
"0.61404973",
"0.613881",
"0.6136124",
"0.6136006",
"0.6136006",
"0.61340296",
"0.6133051",
"0.613164",
"0.6130497",
"0.6130163",
"0.6128951",
"0.61255455",
"0.6124726",
"0.6123031",
"0.6121934",
"0.6119469",
"0.61178225",
"0.6117222",
"0.6115787",
"0.61144316",
"0.6112788",
"0.6112722",
"0.6112332",
"0.6110524",
"0.61052376",
"0.6101742",
"0.610076",
"0.609921",
"0.60947067",
"0.6093133",
"0.6092118",
"0.60919476",
"0.60908115",
"0.60861915",
"0.60856265",
"0.6081961",
"0.60805386"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_knowledge
@knowledge = Knowledge.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 knowledge_params
params.require(:knowledge).permit(:name, :desc)
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
|
Instantiates a new accessPackageResourceRoleScope and sets the default values.
|
def initialize()
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resource_role_scopes=(value)\n @resource_role_scopes = value\n end",
"def init\n self.role ||= \"standard\" #will set the default value only if it's nil\n end",
"def initialize(role, &blk)\n @role, @policies, @scopes = role, {}, {}\n instance_eval(&blk) if block_given?\n end",
"def set_default_role\n self.role ||= :standard\n end",
"def build_resource(hash = nil)\n super(hash)\n resource.role = User::GROUP_MEMBER_ROLE\n end",
"def resource_scope=(resource_scope)\n @resource_scope = \"/#{resource_scope}\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.accessReviewInstanceDecisionItemAzureRoleResource\"\n end",
"def set_role\n self.role ||= 'standard'\n end",
"def new\n @role = System::Role.new\n end",
"def new_resource model = controller_model\n resource || set_resource(model.new.tap do |record|\n settings = params[model.name.underscore] || {}\n attributes = params_with_parents(model).merge(settings)\n record.assign_attributes attributes, as: current_role\n end)\n end",
"def set_default_role\n \tself.role ||= :normal\n end",
"def protected_scope(*args)\n self.scope_without_resource_definition_addition(*args)\n end",
"def assign_default_role\n if self.roles.blank?\n self.add_role :Cursist\n end\n end",
"def initialize(role = :viewer)\n @permissions = 0\n case role\n when Fixnum\n @permissions = role\n else\n # Fixnum has [], but not []=\n @permissions |= 2 ** ROLEMAP[role]\n end\n end",
"def set_default_role\n self.role ||= Role.find_by_name('user')\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role\n self.role ||= :student\n end",
"def set_default_role\n self.role ||= :student\n end",
"def resource_scopes=(value)\n @resource_scopes = value\n end",
"def resource_scopes=(value)\n @resource_scopes = value\n end",
"def set_default_role\n self.role ||= :user\n end",
"def set_default_role!\n clear!\n end",
"def set_default_role!\n clear!\n end",
"def set_default_role!\n clear!\n end",
"def default_scope=(_arg0); end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.directoryRole\"\n end",
"def set_default_role\n self.roles = [Role.find_by_name('user')]\n end",
"def edge_scope role_kind:, role_name:, namespace:\n role_label = make_label role_kind, role_name\n ns_label = make_label namespace\n\n add_relation role_label, :SCOPE, ns_label\n end",
"def build_resource(hash=nil)\n super(hash)\n self.resource.auto_approve = true if self.resource && session[:auto_approve_account] == true\n end",
"def set_initial_role\n self.role ||= :standard # defining the initial / default role \n end",
"def initialize_rights\n @permissions ||= {}\n @user_groups ||= {}\n\n @public_access ||= []\n @protected_access ||= []\n end",
"def resource_roles=(value)\n @resource_roles = value\n end",
"def new\n @role = Role.new\n end",
"def set_default_role\n\n\t\tself.role ||= :user\n\n\tend",
"def assign_role\n if self.organization\n self.add_role :organization if self.roles.blank?\n else\n self.add_role :standard if self.roles.blank?\n end\n end",
"def assign_access_scope(scope)\n ACCESS_SCOPES.include?(scope.to_s) or raise \"'#{ scope }' is not a valid scope.\"\n self.access_scope = scope.to_s\n end",
"def pundit_scope(*scope)\n @pundit_api_scope ||= scope\n end",
"def initialize(user, resource = nil)\n @user = user || User.new # guest user (not logged in)\n @resource = resource\n @roles = resource.nil? ? @user.roles : @user.roles.where(resource: resource)\n\n # abilities: read, create, update, destroy, manage, dummy, whatever\n # syntax: can [:update, :destroy], [Article, Comment], { query hash }\n # :manage represents ANY action on object => :manage is not just :create, :read, :update, :destroy on object but really ANY action\n alias_action :update, :destroy, to: :modify\n alias_action :create, :read, :update, :destroy, to: :crud\n\n role_names = @roles.pluck('DISTINCT roles.name')\n role_names.unshift('guest') unless role_names.include?('guest')\n role_names.each { |role_name| send(role_name) if respond_to?(role_name) }\n end",
"def resource_role_scopes\n return @resource_role_scopes\n end",
"def defaults(defaults = {})\n @scope = @scope.new(defaults: merge_defaults_scope(@scope[:defaults], defaults))\n yield\n ensure\n @scope = @scope.parent\n end",
"def apply_standard_scope\n each_sort do |attribute, direction|\n @scope = resource.adapter.order(@scope, attribute, direction)\n end\n @scope\n end",
"def policy_scope(scope, policy_scope_class: nil)\n api_scope = self.class.inherited_pundit_api_scope || []\n\n super(api_scope + [scope], policy_scope_class: policy_scope_class)\n end",
"def new\n @role.state ||= 'open'\n end",
"def initialize(name, metadata = {}, &block)\n raise 'No name provided' unless name\n raise 'No roles provided' unless metadata[:roles]\n\n @name = name\n @roles = metadata[:roles]\n @packages = []\n self.instance_eval(&block)\n end",
"def assign_default_role\n self.add_role(:newuser) if self.roles.blank?\n end",
"def assign_default_role\n self.add_role(:newuser) if self.roles.blank?\n end",
"def assign_role\n \tdefault_role = Role.where(name: 'LeadGenerator').last\n \t self.role_id = default_role.id if self.role_id.blank? && default_role.present?\t\t\t\n end",
"def new\n requires({'role' => ['admin','faculty']})\n end",
"def create_default_roles\n # Create the default Rolesets\n Jak.rolesets.each do |role_set|\n my_role = roles.find_or_create_by(name: role_set.role_name, key: role_set.role_name.parameterize, company: self)\n my_role.permission_ids = role_set.permission_ids\n my_role.save!\n end\n end",
"def set_scope\n if (scope = params[:scope])\n if @resource.respond_to?(scope)\n @resource = @resource.send(scope)\n else\n not_allowed\n end\n end\n end",
"def initialize(arg = nil, **opt)\n opt[:scope] ||= :submittable\n super\n end",
"def auth_options\n { scope: resource_name }\n end",
"def set_default_role\n update_attribute :roles, [UserRoles::CUSTOMER] if roles.empty?\n end",
"def assign_default_role\n add_role(:owner)\n end",
"def initialize(issuer, scope, key)\n self.issuer = issuer\n self.scope = scope\n self.expiry = 60 # 1 min default \n self.key = key\n end",
"def initialize(user = nil, scope)\n @user = user\n @scope = scope\n end",
"def build_resource_params\n parameters = permitted_params || params\n rparams = [parameters[resource_request_name] || parameters[resource_instance_name] || {}]\n if without_protection_given?\n rparams << without_protection\n else\n rparams << as_role if role_given?\n end\n\n rparams\n end",
"def set_default_role\n if User.count == 0\n self.global_role = GlobalRole.administrator\n else\n self.global_role = GlobalRole.regular_user\n end\n end",
"def set_default_role\n if User.count == 0\n self.global_role = GlobalRole.administrator\n elsif self.global_role.nil?\n self.global_role = GlobalRole.regular_user\n end\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n self.resource.role = params[:r] if hash.blank?\n self.resource.build_profile if self.resource.profile.blank?\n end",
"def initialize(resource=4, indria_resource=4)\n @buckets = []\n @bucketCounts = []\n @bucketsCount = 0\n @resource = resource\n @indria_resource = indria_resource\n end",
"def default_role\n self.role_id = Role.user.id\n end",
"def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[scopeUri section]\n end",
"def roles(klass)\n if @resource_config[:roles]\n raise DefinitionError, \"roles already declared in #{self}\"\n end\n @resource_config[:roles] = klass\n end",
"def setup_role role_kind:, role:\n role_info = extract_role_attrs role: role\n role_name = role_info[:role_name]\n version = role_info[:version]\n created_at = role_info[:created_at]\n is_default = role_info[:is_default]\n is_composite = role_info[:is_composite]\n is_aggregable = role_info[:is_aggregable]\n aggregable_by = role_info[:aggregable_by]\n\n info \"-- Indexing [#{role_kind}] #{role_name}\"\n\n cache_aggregable_roles aggregable_by: aggregable_by, role_kind: role_kind, role_name: role_name\n\n namespace = role_kind == :Role ? role['metadata']['namespace'] : Krane::Rbac::Graph::Builder::ALL_NAMESPACES_PLACEHOLDER\n\n # caching role namespace scope\n @role_ns_lookup[role_name] = namespace if role_kind == :Role \n\n entry = {\n role_kind: role_kind,\n role_name: role_name\n }\n \n @defined_roles << entry # caching role as defined\n @default_roles << entry if is_default # cache default roles\n\n node :namespace, { name: namespace }\n node :role, { \n kind: role_kind, \n name: role_name, \n is_default: is_default, \n is_composite: is_composite,\n is_aggregable: is_aggregable, \n aggregable_by: aggregable_by.join(', '),\n version: version,\n created_at: created_at \n }\n edge :scope, { \n role_kind: role_kind, \n role_name: role_name, \n namespace: namespace \n }\n\n return if role_info[:rules].blank?\n\n # Iterating the Rules\n role_info[:rules].map {|rule| process_rule rule }.flatten.each do |rule|\n node :rule, { rule: rule }\n edge :grant, {\n role_kind: role_kind,\n role_name: role_name,\n rule: rule\n }\n edge :security, { rule: rule }\n end\n end",
"def initialize(client, params = {}, api_ver = nil)\n @data ||= {}\n @data['type'] ||= 'Scope'\n super\n end",
"def with_role(role)\n self.resources_configuration[:self][:role] = role.try(:to_sym)\n end",
"def build_resource\n resource = resource_base.new\n\n unless @options[:bypass_params_assignation]\n resource.assign_attributes(resource_params || {})\n end\n\n assign_attributes(resource)\n end",
"def new(attributes = {})\n resource = repository.scope { model.new(default_attributes.update(attributes)) }\n self << resource\n resource\n end",
"def newscope(parent, options = {})\n parent ||= topscope\n scope = Puppet::Parser::Scope.new(self, **options)\n scope.parent = parent\n scope\n end",
"def initialize(args)\n scope = args.delete(:scope)&.to_sym\n org_id = args.delete(:org_id)\n\n valid_value_check(:scope, scope, VALID_SCOPES)\n\n if scope == :user\n @uri_prefix = '/user'\n else\n id_check(:org_id, org_id)\n\n @uri_prefix = \"/organizations/#{org_id}\"\n end\n\n super(**args)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.deviceAndAppManagementRoleDefinition\"\n end",
"def assign_role\n self.role = Role.find_by name: \"Regular\" if self.role.nil?\n end",
"def role_params\n params.require(:role).permit(:name, :resource_id, :resource_type)\n end",
"def has_role_scope(options = {})\n options.symbolize_keys!\n custom_options = options.slice!(:type, :only, :except, :if, :unless, :default, :as, :using, :allow_blank)\n\n options.reverse_merge!(\n :as => 'role',\n :default => E9::Roles.bottom,\n :only => [:show, :index]\n )\n\n has_scope :for_roleable, options do |controller, scope, value|\n controller.send(:_has_role_scope, scope, value, custom_options)\n end\n end",
"def initialize(scope: \"https://www.googleapis.com/auth/analytics.readonly\", ga: nil)\n self.scope = scope\n self.ga = ga\n end",
"def role(name, options = {}, &block)\n final_options = { name: name }.merge(options).merge(scoped_options: scoped_options)\n require_namespace!('role', final_options)\n\n definitions << Matsuri::DSL::Cluster::Role.new(final_options).tap do |role|\n if options[:resources].present? && options[:verbs].present?\n role.resources(options[:resources], names: options[:resource_names], verbs: options[:verbs], api_groups: options[:api_groups])\n end\n\n role.configure(&block)\n end\n end",
"def set_routable_scope(router_class, routable_scope)\n scope router_class.scope_name, routable_scope || -> {}\n end",
"def initialize(params)\n raise 'No companyid given' unless (params[:companyid] or params[:company])\n raise 'No name given' unless params[:name]\n\n super(params)\n\n # COPY role_ (roleid, companyid, classnameid, classpk, name, description, type_) FROM stdin;\n # +10151\t10109\t0\t0\tRegular role\tThis role is a test\t1\n\n self.classnameid ||= 0\n self.classpk ||= 0\n self.description ||= ''\n # Type: 1 = regular, 2 = community, 3 = organization\n self.type_ ||= 1\n\n self.save\n\n # Resource with code scope 1 is primkey'd to company.\n # Resource with code scope 4 is primkey'd to this role.\n\n # These are created regardless of what type_ is.\n\n # COPY resourcecode (codeid, companyid, name, scope) FROM stdin;\n # +29\t10109\tcom.liferay.portal.model.Role\t1\n # +30\t10109\tcom.liferay.portal.model.Role\t4\n\n [1,4].each do |scope|\n rc = self.resource_code(scope)\n unless rc\n ResourceCode.create(\n Company.primary_key => self.companyid,\n :name => self.liferay_class,\n :scope => scope\n )\n end\n end\n\n # COPY resource_ (resourceid, codeid, primkey) FROM stdin;\n # +33\t29\t10109\n # +34\t30\t10151\n\n self.get_resource(:scope => 1)\n r = self.get_resource(:scope => 4)\n\n # Permissions (given to administrators)\n\n # COPY permission_ (permissionid, companyid, actionid, resourceid) FROM stdin;\n # +70 10109 ASSIGN_MEMBERS 34\n # +71 10109 DEFINE_PERMISSIONS 34\n # +72 10109 DELETE 34\n # +73 10109 MANAGE_ANNOUNCEMENTS 34\n # +74 10109 PERMISSIONS 34\n # +75 10109 UPDATE 34\n # +76 10109 VIEW 34\n\n # COPY users_permissions (userid, permissionid) FROM stdin;\n # +10129\t70\n # +10129\t71\n # +10129\t72\n # +10129\t73\n # +10129\t74\n # +10129\t75\n # +10129\t76\n\n self.class.actions.each do |actionid|\n p = Permission.get(\n :companyid => self.companyid,\n :actionid => actionid,\n :resourceid => r.id\n )\n self.company.administrators.each do |user|\n user.permissions << p\n end\n end\n end",
"def required_resource_access=(value)\n @required_resource_access = value\n end",
"def initialize_cancan_ability\n ability_class_name = resource.namespace.cancan_ability_class\n\n if ability_class_name.is_a?(String)\n ability_class = ActiveSupport::Dependencies.constantize(ability_class_name)\n else\n ability_class = ability_class_name\n end\n\n ability_class.new(user)\n end",
"def initialize(namespace = nil)\n raise ArgumentError, '`namespace` is required!' if namespace.nil?\n\n # Set the namespace\n self.my_namespace = namespace\n\n # TODO: maybe add an optional `uuid` attribute so I can do `Jak.constraint_manager.find_by_uuid('some_uuid')` ??\n\n # Set the default actions\n self.my_actions ||= Jak.default_actions\n end",
"def initialize(user)\n return unless user\n\n case user.role\n when 'researcher'\n can_acces_rails_admin\n can_do_collection_scoped_actions\n can_do_member_scoped_actions\n when 'super'\n can_acces_rails_admin\n can_do_collection_scoped_actions\n can_do_member_scoped_actions\n end\n end",
"def assign_role\n self.role = Role.find_by name: \"Aanvrager\" if self.role.nil?\n end",
"def initialize(key)\n key ||= Apicasso::Key.new\n cannot :manage, :all\n cannot :read, :all\n key.scope&.each do |permission, klasses_clearances|\n build_permissions(permission: permission, clearance: klasses_clearances)\n end\n end",
"def create_default_roles\n if self.root?\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Campus Coordinator', _(:position, :ministry_role) => 2)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Ministry Leader', _(:position, :ministry_role) => 4, :description => 'a student who oversees a campus, eg LINC leader')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Missionary', _(:position, :ministry_role) => 3)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Student Leader', _(:position, :ministry_role) => 5)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Involved Student', _(:position, :ministry_role) => 6, :description => 'we are saying has been attending events for at least 6 months')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Student', _(:position, :ministry_role) => 7)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Registration Incomplete', _(:position, :ministry_role) => 8, :description => 'A leader has registered them, but user has not completed rego and signed the privacy policy')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Approval Pending', _(:position, :ministry_role) => 9, :description => 'They have applied, but a leader has not verified their application yet')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Honourary Member', _(:position, :ministry_role) => 10, :description => 'not a valid student or missionary, but we are giving them limited access anyway')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Admin', _(:position, :ministry_role) => 1)\n end\n true # otherwise subsequent after_create calls will fail\n end",
"def initialize path:, options: nil\n @path = path\n @options = options\n @role_ns_lookup = {} # Internal lookup for Role's namespace\n @node_weights = Hash.new { |h, k| h[k] = 0 } # holds information on Node weight (more weight to popular nodes)\n @labels = {} # List all labels and their respective ID\n @labels_counter = 0 # Internal initial ID counter for labels \n @node_buffer = Set.new # holds all graph Nodes\n @edge_buffer = Set.new # holds all graph Edges\n @defined_roles = Set.new # List of all defined roles\n @undefined_roles = Set.new # List of all undefined roles which are referred to in bindings\n @referenced_roles = Set.new # List of roles which are referenced and assigned to a Subject\n @bindings_without_subject = Set.new # List of bindings without any Subjects attached\n @default_roles = Set.new # Local cache of default (built-in) roles\n @aggregable_roles = Hash.new { |h, k| h[k] = Set.new } # Maps cluster role with aggregation rules to its composite roles\n end",
"def build_resource_params\n parameters = respond_to?(:permitted_params, true) ? permitted_params : params\n rparams = [parameters[resource_request_name] || parameters[resource_instance_name] || {}]\n if without_protection_given?\n rparams << without_protection\n else\n rparams << as_role if role_given?\n end\n\n rparams\n end",
"def set_role\n @role = role\n end",
"def initialize(user)\n if user.nil?\n can :read, [Category, Product]\n elsif user.role? \"admin\" #roles.pluck(:name).include? \"admin\"\n can :manage, [Category, Product, Review]\n elsif user.role? \"moderator\"\n can :read, [Category, Product, Review]\n can :create, Review\n can :update, [Category, Product]\n can :destroy, Review\n \n elsif user.role? \"customer\"\n can :read, [Category, Product]\n can [:create, :read], Review\n can [:update, :destroy], Review do |review|\n review.user_id == user.id\n end\n end \n end",
"def initialize credentials, retries: nil, timeout: nil, host: nil, quota_project: nil\n @credentials = credentials\n @service = API::CloudResourceManagerService.new\n @service.client_options.application_name = \\\n \"gcloud-ruby\"\n @service.client_options.application_version = \\\n Google::Cloud::ResourceManager::VERSION\n @service.client_options.open_timeout_sec = timeout\n @service.client_options.read_timeout_sec = timeout\n @service.client_options.send_timeout_sec = timeout\n @service.request_options.retries = retries || 3\n @service.request_options.header ||= {}\n @service.request_options.header[\"x-goog-api-client\"] = \\\n \"gl-ruby/#{RUBY_VERSION} \" \\\n \"gccl/#{Google::Cloud::ResourceManager::VERSION}\"\n @service.request_options.quota_project = quota_project if quota_project\n @service.authorization = @credentials.client\n @service.root_url = host if host\n end",
"def define_all_scopes\n if self.resource_definition[\"scopes\"]\n self.resource_definition[\"scopes\"].each_pair do |name, opts|\n self.scope(name, opts)\n end\n end\n true\n end",
"def set_resource_group\n @resource_group = ResourceGroup.find(params[:id])\n # authorize(@resource_group)\n end",
"def create\n Statements::CreateRole.new(context: self)\n end",
"def apply_custom_scope\n each_sort do |attribute, direction|\n @scope = custom_scope\n .call(@scope, attribute, direction, resource.context)\n end\n @scope\n end",
"def set_default_role\n self.add_role :merchant\n end",
"def init_rac_data\n \n if connected_user and (self.permission_owner.nil? or self.permission_owner.empty?)\n self.permission_owner = connected_user.username\n end\n\n if connected_user and connected_user.usergroups.length > 0 and (self.permission_group.nil? or self.permission_group.empty?)\n self.permission_group = connected_user.usergroups.first.group \n end\n\n if self.permission_modifier_owner.nil? \n self.permission_modifier_owner = 6 \n end\n \n if self.permission_modifier_group.nil?\n self.permission_modifier_group = 2 \n end\n \n if self.permission_modifier_all.nil?\n self.permission_modifier_all = 0\n end \n\n end",
"def default_role\n self.role ||= Roles::USER\n end"
] |
[
"0.57594454",
"0.5284224",
"0.5265433",
"0.5224826",
"0.5126986",
"0.5101388",
"0.50970745",
"0.49880448",
"0.496245",
"0.49465865",
"0.48914415",
"0.4870479",
"0.48666537",
"0.4846254",
"0.4802115",
"0.47951952",
"0.47951952",
"0.47951952",
"0.47951952",
"0.47883323",
"0.47883323",
"0.4769163",
"0.4769163",
"0.47563583",
"0.47472012",
"0.47472012",
"0.47472012",
"0.47371915",
"0.4734087",
"0.47258252",
"0.47096777",
"0.47093987",
"0.47070402",
"0.4690972",
"0.46710157",
"0.46703497",
"0.46677783",
"0.46591443",
"0.4656325",
"0.46529925",
"0.46456605",
"0.4640872",
"0.4630512",
"0.4617443",
"0.4613549",
"0.46031973",
"0.4600913",
"0.45951745",
"0.45951745",
"0.4593988",
"0.45920968",
"0.4589177",
"0.45816007",
"0.45814952",
"0.45755476",
"0.4574333",
"0.45733246",
"0.45640284",
"0.4554284",
"0.45449606",
"0.45428002",
"0.45395195",
"0.4531493",
"0.4513537",
"0.45040408",
"0.45037296",
"0.4499866",
"0.44981796",
"0.44957578",
"0.44922227",
"0.4484121",
"0.44839668",
"0.4475518",
"0.44645262",
"0.44625518",
"0.44503427",
"0.44465715",
"0.44442508",
"0.4443771",
"0.4442603",
"0.4440394",
"0.44257662",
"0.4409811",
"0.44022125",
"0.44014862",
"0.4398862",
"0.4397769",
"0.4394575",
"0.43851507",
"0.43791538",
"0.437835",
"0.4376704",
"0.4374508",
"0.43731552",
"0.43725133",
"0.43677098",
"0.4363833",
"0.43633354",
"0.43612406",
"0.43550318",
"0.43545258"
] |
0.0
|
-1
|
Gets the createdDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z
|
def created_date_time
return @created_date_time
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def created_date_time_utc\n return @created_date_time_utc\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_at_timestamp\n Time.now.gmtime.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end",
"def timestamp\n self.created_at.to_s(:db)\n end",
"def created_at\n object.created_at.iso8601\n end",
"def created_at\n attributes.send(:ts_created) rescue nil\n end",
"def created_at\n Time.at(created.to_i)\n end",
"def created_at\n Time.at(created.to_i)\n end",
"def created_at\n if able_to_store_created_at?\n time = instance_read(:created_at)\n time && time.to_f.to_i\n end\n end",
"def datetime_stamp\n Time.now.utc.iso8601\n end",
"def created_at\n Convert.millis_to_time @gapi.statistics.creation_time\n end",
"def created_at\n @gapi[\"timeCreated\"]\n end",
"def created_time\n Time.parse(object[\"created_time\"]) if object[\"created_time\"]\n end",
"def created_at\n Time.at(created)\n end",
"def created_at\n Time.at(created)\n end",
"def timestamp\n return result.created_at\n end",
"def createdAt\n self.created_at.to_s(:db)\n end",
"def created_at\n Time.parse(@created_at).utc unless @created_at.nil?\n end",
"def created_at\n ensure_full_data!\n Time.at(@gapi[\"creationTime\"] / 1000.0)\n end",
"def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend",
"def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend",
"def created_at\n data['creationDate'].to_date\n end",
"def created_at\n object.created_at.in_time_zone.iso8601 if object.created_at\n end",
"def created_at\n return DateTime.parse(@created_at) if @created_at\n\n @created_at\n end",
"def creation_time\n data[:creation_time]\n end",
"def created_at\n begin\n Time.parse(self.create_date)\n rescue\n nil\n end\n end",
"def createTimestamp\n result = @@create_date[name]\n result ||= attrs['createTimestamp'][0] rescue nil # in case not loaded\n result ||= ASF.search_one(base, \"uid=#{name}\", 'createTimestamp')[0][0]\n result\n end",
"def created_at\n @created_at ||= self[:created_at] ? Time.parse(self[:created_at]) : nil\n end",
"def created_at\n @created_at ||= Time.zone.now.utc.to_i\n end",
"def created_at\n Time.parse(attributes['created_at'])\n end",
"def created_at\n object.created_at.to_time.to_i\n end",
"def creationdate\n if !record.nil? and record.respond_to? :created_at\n record.created_at.httpdate\n end\n end",
"def created_at\n @record.created_at\n end",
"def creation_date\n self.created_at.iso8601\n end",
"def created_time\n ctime\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n @attributes[:created_at]\n end",
"def created_at\n\t\tobject.created_at.strftime(\"%A, %B %e\")\n\tend",
"def created_at\n @created_at ||=\n Utilities.utc_to_localtime(@ldap_entry[:whencreated].first)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def created_at\n with_type!(Fixnum) { attribute_from_model(:created_at) || attribute_from_model(:created) }\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n Time.at(response[\"createdAt\"]) if response[\"createdAt\"]\n end",
"def created_at\n Time.parse @gapi.creation_time\n rescue StandardError\n nil\n end",
"def created_at_datetime\n @created_at_datetime ||= DateTime.parse(@created_at)\n end",
"def timestamp\n TimeStamp.new\n end",
"def get_time\n created_at.strftime('%H:%M:%S %d %B %Y')\n end",
"def created\n Time.parse(@json['user']['meta']['created'])\n end",
"def creation_date\n data.creation_date\n end",
"def created\n DateTime.parse(@json['project']['meta']['created'])\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end"
] |
[
"0.7632163",
"0.7629736",
"0.7564724",
"0.747261",
"0.74667794",
"0.7427643",
"0.7340075",
"0.7340075",
"0.73321664",
"0.7329063",
"0.72721404",
"0.7224356",
"0.7213787",
"0.71779525",
"0.71779525",
"0.7156535",
"0.7149605",
"0.71494406",
"0.7144883",
"0.7130442",
"0.7130442",
"0.7128096",
"0.7124668",
"0.7115059",
"0.71016604",
"0.7101431",
"0.7101155",
"0.7095639",
"0.70155394",
"0.70134103",
"0.7012451",
"0.6986196",
"0.6949497",
"0.69085366",
"0.6886459",
"0.6864103",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6862777",
"0.6857837",
"0.6847797",
"0.6839105",
"0.6839105",
"0.6839105",
"0.6808084",
"0.6768278",
"0.6768278",
"0.6768278",
"0.6766667",
"0.6762796",
"0.6755022",
"0.6738531",
"0.67383957",
"0.6725672",
"0.6698579",
"0.66932094",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132",
"0.6687132"
] |
0.7664124
|
18
|
Sets the createdDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z
|
def created_date_time=(value)
@created_date_time = value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def created_date_time=(createdDateTime)\n @created_date_time = createdDateTime\n end",
"def created_date_time_utc=(value)\n @created_date_time_utc = value\n end",
"def created_at=(value)\n @created_at = DateTime.parse(value)\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def set_record_created_at\n self.record_created_at = Time.current.utc.iso8601(3)\n end",
"def set_created_at\n if !timeless? && !created_at\n time = Time.configured.now\n self.updated_at = time if is_a?(Updated) && !updated_at_changed?\n self.created_at = time\n end\n clear_timeless_option\n end",
"def created_at=(val)\n if val.is_a?(String)\n @created_at = Time.parse(val)\n else\n @created_at = val\n end\n end",
"def setCreatedTime(createdTime)\r\n\t\t\t\t\t@createdTime = createdTime\r\n\t\t\t\tend",
"def setCreatedTime(createdTime)\r\n\t\t\t\t\t@createdTime = createdTime\r\n\t\t\t\tend",
"def created_date_time_utc\n return @created_date_time_utc\n end",
"def created_at\n @created_at ||= self[:created_at] ? Time.parse(self[:created_at]) : nil\n end",
"def set_created_at\n self.created_at ||= Date.today if new_record?\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_at_timestamp\n Time.now.gmtime.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_at_datetime\n @created_at_datetime ||= DateTime.parse(@created_at)\n end",
"def created_at\n attributes.send(:ts_created) rescue nil\n end",
"def created_at\n @created_at ||= Time.zone.now.utc.to_i\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n @created_at ||= Time.now\n end",
"def created_at\n Time.at(created.to_i)\n end",
"def created_at\n Time.at(created.to_i)\n end",
"def created_at\n Time.at(created)\n end",
"def created_at\n Time.at(created)\n end",
"def initialize\n @created_at = Time.now\n end",
"def create\n self[:created] = Time.now.to_s\n save\n end",
"def datetime_stamp\n Time.now.utc.iso8601\n end",
"def created_at\n ensure_full_data!\n Time.at(@gapi[\"creationTime\"] / 1000.0)\n end",
"def createTimestamp\n result = @@create_date[name]\n result ||= attrs['createTimestamp'][0] rescue nil # in case not loaded\n result ||= ASF.search_one(base, \"uid=#{name}\", 'createTimestamp')[0][0]\n result\n end",
"def set_timestamps\n self.created_at = Time.now\n #Set updated_at initially before manually setting because column cannot be null.\n self.updated_at = Time.now \n end",
"def created_at\n object.created_at.iso8601\n end",
"def created_at\n begin\n Time.parse(self.create_date)\n rescue\n nil\n end\n end",
"def created_time\n Time.parse(object[\"created_time\"]) if object[\"created_time\"]\n end",
"def date\n Time.at(self.created_utc)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def date\n Time.at(self.created_utc)\n end",
"def created_at\n Time.parse(@created_at).utc unless @created_at.nil?\n end",
"def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['dcterms:created']\n\n @creation_date = Time.parse(metadata['dcterms:created'])\n end",
"def timestamp\n self.created_at.to_s(:db)\n end",
"def created_at\n return DateTime.parse(@created_at) if @created_at\n\n @created_at\n end",
"def created_at\n with_type!(Fixnum) { attribute_from_model(:created_at) || attribute_from_model(:created) }\n end",
"def created_at\n Convert.millis_to_time @gapi.statistics.creation_time\n end",
"def creation_date\n self.created_at.iso8601\n end",
"def creation_time # :nodoc:\n @creation_time.dup\n end",
"def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend",
"def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend"
] |
[
"0.7829137",
"0.75813115",
"0.721586",
"0.71146333",
"0.71145517",
"0.6998485",
"0.6927011",
"0.6865355",
"0.68208086",
"0.68208086",
"0.65876204",
"0.6540059",
"0.64710087",
"0.64651",
"0.6439961",
"0.6432874",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.6432863",
"0.64246696",
"0.6386345",
"0.6375538",
"0.635003",
"0.635003",
"0.635003",
"0.62988883",
"0.62988883",
"0.62900424",
"0.62900424",
"0.62815034",
"0.6232255",
"0.6224107",
"0.62239444",
"0.61962783",
"0.61941284",
"0.6176864",
"0.61692333",
"0.6160495",
"0.6153812",
"0.6153812",
"0.6153812",
"0.6146858",
"0.6125358",
"0.61171204",
"0.61098427",
"0.6090159",
"0.6061853",
"0.60387343",
"0.6028408",
"0.60178137",
"0.60178137"
] |
0.7733337
|
20
|
The deserialization information for the current model
|
def get_field_deserializers()
return super.merge({
"createdDateTime" => lambda {|n| @created_date_time = n.get_date_time_value() },
"role" => lambda {|n| @role = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::AccessPackageResourceRole.create_from_discriminator_value(pn) }) },
"scope" => lambda {|n| @scope = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::AccessPackageResourceScope.create_from_discriminator_value(pn) }) },
})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"fileDetails\" => lambda {|n| @file_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n })\n end",
"def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"attribution\" => lambda {|n| @attribution = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImageInfo.create_from_discriminator_value(pn) }) },\n \"backgroundColor\" => lambda {|n| @background_color = n.get_string_value() },\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayText\" => lambda {|n| @display_text = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"detectionType\" => lambda {|n| @detection_type = n.get_string_value() },\n \"method\" => lambda {|n| @method = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"maxImageSize\" => lambda {|n| @max_image_size = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"timeout\" => lambda {|n| @timeout = n.get_duration_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"headerValue\" => lambda {|n| @header_value = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"callEndSubReason\" => lambda {|n| @call_end_sub_reason = n.get_number_value() },\n \"callType\" => lambda {|n| @call_type = n.get_string_value() },\n \"calleeNumber\" => lambda {|n| @callee_number = n.get_string_value() },\n \"callerNumber\" => lambda {|n| @caller_number = n.get_string_value() },\n \"correlationId\" => lambda {|n| @correlation_id = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_number_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"failureDateTime\" => lambda {|n| @failure_date_time = n.get_date_time_value() },\n \"finalSipCode\" => lambda {|n| @final_sip_code = n.get_number_value() },\n \"finalSipCodePhrase\" => lambda {|n| @final_sip_code_phrase = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"inviteDateTime\" => lambda {|n| @invite_date_time = n.get_date_time_value() },\n \"mediaBypassEnabled\" => lambda {|n| @media_bypass_enabled = n.get_boolean_value() },\n \"mediaPathLocation\" => lambda {|n| @media_path_location = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"signalingLocation\" => lambda {|n| @signaling_location = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"successfulCall\" => lambda {|n| @successful_call = n.get_boolean_value() },\n \"trunkFullyQualifiedDomainName\" => lambda {|n| @trunk_fully_qualified_domain_name = n.get_string_value() },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"versionId\" => lambda {|n| @version_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"buildNumber\" => lambda {|n| @build_number = n.get_string_value() },\n \"bundleId\" => lambda {|n| @bundle_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"versionNumber\" => lambda {|n| @version_number = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"imageFile\" => lambda {|n| @image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n \"parentProcessCreationDateTime\" => lambda {|n| @parent_process_creation_date_time = n.get_date_time_value() },\n \"parentProcessId\" => lambda {|n| @parent_process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"parentProcessImageFile\" => lambda {|n| @parent_process_image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"processCommandLine\" => lambda {|n| @process_command_line = n.get_string_value() },\n \"processCreationDateTime\" => lambda {|n| @process_creation_date_time = n.get_date_time_value() },\n \"processId\" => lambda {|n| @process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"userAccount\" => lambda {|n| @user_account = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityUserAccount.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::OperationStatus) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"progress\" => lambda {|n| @progress = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DataPolicyOperationStatus) },\n \"storageLocation\" => lambda {|n| @storage_location = n.get_string_value() },\n \"submittedDateTime\" => lambda {|n| @submitted_date_time = n.get_date_time_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"completedUnits\" => lambda {|n| @completed_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"progressObservationDateTime\" => lambda {|n| @progress_observation_date_time = n.get_date_time_value() },\n \"totalUnits\" => lambda {|n| @total_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"units\" => lambda {|n| @units = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"provisioningStepType\" => lambda {|n| @provisioning_step_type = n.get_enum_value(MicrosoftGraph::Models::ProvisioningStepType) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ProvisioningResult) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"check32BitOn64System\" => lambda {|n| @check32_bit_on64_system = n.get_boolean_value() },\n \"comparisonValue\" => lambda {|n| @comparison_value = n.get_string_value() },\n \"fileOrFolderName\" => lambda {|n| @file_or_folder_name = n.get_string_value() },\n \"operationType\" => lambda {|n| @operation_type = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppFileSystemOperationType) },\n \"operator\" => lambda {|n| @operator = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppRuleOperator) },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n })\n end",
"def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end",
"def get_field_deserializers()\n return {\n \"destinationFileName\" => lambda {|n| @destination_file_name = n.get_string_value() },\n \"sourceFile\" => lambda {|n| @source_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemReference.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return {\n \"newText\" => lambda {|n| @new_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numBytes\" => lambda {|n| @num_bytes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"oldText\" => lambda {|n| @old_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"startNum\" => lambda {|n| @start_num = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"targetType\" => lambda {|n| @target_type = n.get_enum_value(MicrosoftGraph::Models::FeatureTargetType) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"activationUrl\" => lambda {|n| @activation_url = n.get_string_value() },\n \"activitySourceHost\" => lambda {|n| @activity_source_host = n.get_string_value() },\n \"appActivityId\" => lambda {|n| @app_activity_id = n.get_string_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"contentInfo\" => lambda {|n| @content_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fallbackUrl\" => lambda {|n| @fallback_url = n.get_string_value() },\n \"historyItems\" => lambda {|n| @history_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ActivityHistoryItem.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::Status) },\n \"userTimezone\" => lambda {|n| @user_timezone = n.get_string_value() },\n \"visualElements\" => lambda {|n| @visual_elements = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::VisualInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"category\" => lambda {|n| @category = n.get_string_value() },\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"malwareIdentifier\" => lambda {|n| @malware_identifier = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"lastActionDateTime\" => lambda {|n| @last_action_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operation\" => lambda {|n| @operation = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"identityType\" => lambda {|n| @identity_type = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"dataLocationCode\" => lambda {|n| @data_location_code = n.get_string_value() },\n \"hostname\" => lambda {|n| @hostname = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"root\" => lambda {|n| @root = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Root.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return {\n \"address\" => lambda {|n| @address = n.get_string_value() },\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"relevanceScore\" => lambda {|n| @relevance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"selectionLikelihood\" => lambda {|n| @selection_likelihood = n.get_enum_value(MicrosoftGraph::Models::SelectionLikelihoodInfo) },\n }\n end",
"def get_field_deserializers()\n return {\n \"hashes\" => lambda {|n| @hashes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Hashes.create_from_discriminator_value(pn) }) },\n \"mimeType\" => lambda {|n| @mime_type = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"processingMetadata\" => lambda {|n| @processing_metadata = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"errorDetails\" => lambda {|n| @error_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::GenericError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"sourceId\" => lambda {|n| @source_id = n.get_string_value() },\n \"targetId\" => lambda {|n| @target_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"contentSource\" => lambda {|n| @content_source = n.get_string_value() },\n \"hitId\" => lambda {|n| @hit_id = n.get_string_value() },\n \"isCollapsed\" => lambda {|n| @is_collapsed = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"rank\" => lambda {|n| @rank = n.get_number_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resultTemplateId\" => lambda {|n| @result_template_id = n.get_string_value() },\n \"summary\" => lambda {|n| @summary = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignedUserPrincipalName\" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },\n \"groupTag\" => lambda {|n| @group_tag = n.get_string_value() },\n \"hardwareIdentifier\" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"importId\" => lambda {|n| @import_id = n.get_string_value() },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"serialNumber\" => lambda {|n| @serial_number = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"audioRoutingGroups\" => lambda {|n| @audio_routing_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AudioRoutingGroup.create_from_discriminator_value(pn) }) },\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_string_value() },\n \"callOptions\" => lambda {|n| @call_options = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallOptions.create_from_discriminator_value(pn) }) },\n \"callRoutes\" => lambda {|n| @call_routes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CallRoute.create_from_discriminator_value(pn) }) },\n \"callbackUri\" => lambda {|n| @callback_uri = n.get_string_value() },\n \"chatInfo\" => lambda {|n| @chat_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ChatInfo.create_from_discriminator_value(pn) }) },\n \"contentSharingSessions\" => lambda {|n| @content_sharing_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ContentSharingSession.create_from_discriminator_value(pn) }) },\n \"direction\" => lambda {|n| @direction = n.get_enum_value(MicrosoftGraph::Models::CallDirection) },\n \"incomingContext\" => lambda {|n| @incoming_context = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IncomingContext.create_from_discriminator_value(pn) }) },\n \"mediaConfig\" => lambda {|n| @media_config = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaConfig.create_from_discriminator_value(pn) }) },\n \"mediaState\" => lambda {|n| @media_state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallMediaState.create_from_discriminator_value(pn) }) },\n \"meetingInfo\" => lambda {|n| @meeting_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MeetingInfo.create_from_discriminator_value(pn) }) },\n \"myParticipantId\" => lambda {|n| @my_participant_id = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CommsOperation.create_from_discriminator_value(pn) }) },\n \"participants\" => lambda {|n| @participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Participant.create_from_discriminator_value(pn) }) },\n \"requestedModalities\" => lambda {|n| @requested_modalities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Modality.create_from_discriminator_value(pn) }) },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ParticipantInfo.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::CallState) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InvitationParticipantInfo.create_from_discriminator_value(pn) }) },\n \"tenantId\" => lambda {|n| @tenant_id = n.get_string_value() },\n \"toneInfo\" => lambda {|n| @tone_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ToneInfo.create_from_discriminator_value(pn) }) },\n \"transcription\" => lambda {|n| @transcription = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallTranscriptionInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"teacherNumber\" => lambda {|n| @teacher_number = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"key\" => lambda {|n| @key = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"thumbprint\" => lambda {|n| @thumbprint = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"usage\" => lambda {|n| @usage = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"allowMultipleLines\" => lambda {|n| @allow_multiple_lines = n.get_boolean_value() },\n \"appendChangesToExistingText\" => lambda {|n| @append_changes_to_existing_text = n.get_boolean_value() },\n \"linesForEditing\" => lambda {|n| @lines_for_editing = n.get_number_value() },\n \"maxLength\" => lambda {|n| @max_length = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"textType\" => lambda {|n| @text_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"assignCategories\" => lambda {|n| @assign_categories = n.get_collection_of_primitive_values(String) },\n \"copyToFolder\" => lambda {|n| @copy_to_folder = n.get_string_value() },\n \"delete\" => lambda {|n| @delete = n.get_boolean_value() },\n \"forwardAsAttachmentTo\" => lambda {|n| @forward_as_attachment_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"forwardTo\" => lambda {|n| @forward_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"markAsRead\" => lambda {|n| @mark_as_read = n.get_boolean_value() },\n \"markImportance\" => lambda {|n| @mark_importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"moveToFolder\" => lambda {|n| @move_to_folder = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"permanentDelete\" => lambda {|n| @permanent_delete = n.get_boolean_value() },\n \"redirectTo\" => lambda {|n| @redirect_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"stopProcessingRules\" => lambda {|n| @stop_processing_rules = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"acceptMappedClaims\" => lambda {|n| @accept_mapped_claims = n.get_boolean_value() },\n \"knownClientApplications\" => lambda {|n| @known_client_applications = n.get_collection_of_primitive_values(UUIDTools::UUID) },\n \"oauth2PermissionScopes\" => lambda {|n| @oauth2_permission_scopes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PermissionScope.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preAuthorizedApplications\" => lambda {|n| @pre_authorized_applications = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PreAuthorizedApplication.create_from_discriminator_value(pn) }) },\n \"requestedAccessTokenVersion\" => lambda {|n| @requested_access_token_version = n.get_number_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return {\n \"failedRuns\" => lambda {|n| @failed_runs = n.get_number_value() },\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulRuns\" => lambda {|n| @successful_runs = n.get_number_value() },\n \"totalRuns\" => lambda {|n| @total_runs = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_guid_value() },\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"recommendedActions\" => lambda {|n| @recommended_actions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RecommendedAction.create_from_discriminator_value(pn) }) },\n \"resolvedTargetsCount\" => lambda {|n| @resolved_targets_count = n.get_number_value() },\n \"simulationEventsContent\" => lambda {|n| @simulation_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SimulationEventsContent.create_from_discriminator_value(pn) }) },\n \"trainingEventsContent\" => lambda {|n| @training_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TrainingEventsContent.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"hint\" => lambda {|n| @hint = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"secretText\" => lambda {|n| @secret_text = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"isRequired\" => lambda {|n| @is_required = n.get_boolean_value() },\n \"locations\" => lambda {|n| @locations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LocationConstraintItem.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"suggestLocation\" => lambda {|n| @suggest_location = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"activityType\" => lambda {|n| @activity_type = n.get_string_value() },\n \"chainId\" => lambda {|n| @chain_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"previewText\" => lambda {|n| @preview_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"recipient\" => lambda {|n| @recipient = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkNotificationRecipient.create_from_discriminator_value(pn) }) },\n \"templateParameters\" => lambda {|n| @template_parameters = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::KeyValuePair.create_from_discriminator_value(pn) }) },\n \"topic\" => lambda {|n| @topic = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkActivityTopic.create_from_discriminator_value(pn) }) },\n }\n end",
"def metadata\n self.class.metadata\n end",
"def get_field_deserializers()\n return {\n \"activityIdentifier\" => lambda {|n| @activity_identifier = n.get_string_value() },\n \"countEntitled\" => lambda {|n| @count_entitled = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEntitledForProvisioning\" => lambda {|n| @count_entitled_for_provisioning = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowed\" => lambda {|n| @count_escrowed = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowedRaw\" => lambda {|n| @count_escrowed_raw = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExported\" => lambda {|n| @count_exported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExports\" => lambda {|n| @count_exports = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImported\" => lambda {|n| @count_imported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedDeltas\" => lambda {|n| @count_imported_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedReferenceDeltas\" => lambda {|n| @count_imported_reference_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"error\" => lambda {|n| @error = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::SynchronizationTaskExecutionResult) },\n \"timeBegan\" => lambda {|n| @time_began = n.get_date_time_value() },\n \"timeEnded\" => lambda {|n| @time_ended = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"content\" => lambda {|n| @content = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"transportKey\" => lambda {|n| @transport_key = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"activeDeviceCount\" => lambda {|n| @active_device_count = n.get_number_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"modelAppHealthScore\" => lambda {|n| @model_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceAccess\" => lambda {|n| @resource_access = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ResourceAccess.create_from_discriminator_value(pn) }) },\n \"resourceAppId\" => lambda {|n| @resource_app_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end",
"def get_field_deserializers()\n return {\n \"anchor\" => lambda {|n| @anchor = n.get_boolean_value() },\n \"apiExpressions\" => lambda {|n| @api_expressions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::StringKeyStringValuePair.create_from_discriminator_value(pn) }) },\n \"caseExact\" => lambda {|n| @case_exact = n.get_boolean_value() },\n \"defaultValue\" => lambda {|n| @default_value = n.get_string_value() },\n \"flowNullValues\" => lambda {|n| @flow_null_values = n.get_boolean_value() },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeDefinitionMetadataEntry.create_from_discriminator_value(pn) }) },\n \"multivalued\" => lambda {|n| @multivalued = n.get_boolean_value() },\n \"mutability\" => lambda {|n| @mutability = n.get_enum_value(MicrosoftGraph::Models::Mutability) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"referencedObjects\" => lambda {|n| @referenced_objects = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ReferencedObject.create_from_discriminator_value(pn) }) },\n \"required\" => lambda {|n| @required = n.get_boolean_value() },\n \"type\" => lambda {|n| @type = n.get_enum_value(MicrosoftGraph::Models::AttributeType) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"averageBlueScreens\" => lambda {|n| @average_blue_screens = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageRestarts\" => lambda {|n| @average_restarts = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"blueScreenCount\" => lambda {|n| @blue_screen_count = n.get_number_value() },\n \"bootScore\" => lambda {|n| @boot_score = n.get_number_value() },\n \"coreBootTimeInMs\" => lambda {|n| @core_boot_time_in_ms = n.get_number_value() },\n \"coreLoginTimeInMs\" => lambda {|n| @core_login_time_in_ms = n.get_number_value() },\n \"deviceCount\" => lambda {|n| @device_count = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"diskType\" => lambda {|n| @disk_type = n.get_enum_value(MicrosoftGraph::Models::DiskType) },\n \"groupPolicyBootTimeInMs\" => lambda {|n| @group_policy_boot_time_in_ms = n.get_number_value() },\n \"groupPolicyLoginTimeInMs\" => lambda {|n| @group_policy_login_time_in_ms = n.get_number_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"loginScore\" => lambda {|n| @login_score = n.get_number_value() },\n \"manufacturer\" => lambda {|n| @manufacturer = n.get_string_value() },\n \"model\" => lambda {|n| @model = n.get_string_value() },\n \"modelStartupPerformanceScore\" => lambda {|n| @model_startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"operatingSystemVersion\" => lambda {|n| @operating_system_version = n.get_string_value() },\n \"responsiveDesktopTimeInMs\" => lambda {|n| @responsive_desktop_time_in_ms = n.get_number_value() },\n \"restartCount\" => lambda {|n| @restart_count = n.get_number_value() },\n \"startupPerformanceScore\" => lambda {|n| @startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"connectingIP\" => lambda {|n| @connecting_i_p = n.get_string_value() },\n \"deliveryAction\" => lambda {|n| @delivery_action = n.get_string_value() },\n \"deliveryLocation\" => lambda {|n| @delivery_location = n.get_string_value() },\n \"directionality\" => lambda {|n| @directionality = n.get_string_value() },\n \"internetMessageId\" => lambda {|n| @internet_message_id = n.get_string_value() },\n \"messageFingerprint\" => lambda {|n| @message_fingerprint = n.get_string_value() },\n \"messageReceivedDateTime\" => lambda {|n| @message_received_date_time = n.get_date_time_value() },\n \"messageSubject\" => lambda {|n| @message_subject = n.get_string_value() },\n \"networkMessageId\" => lambda {|n| @network_message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"application\" => lambda {|n| @application = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Identity.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preventsDownload\" => lambda {|n| @prevents_download = n.get_boolean_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"webHtml\" => lambda {|n| @web_html = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"uploadUrl\" => lambda {|n| @upload_url = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceCountWithCrashes\" => lambda {|n| @device_count_with_crashes = n.get_number_value() },\n \"isLatestUsedVersion\" => lambda {|n| @is_latest_used_version = n.get_boolean_value() },\n \"isMostUsedVersion\" => lambda {|n| @is_most_used_version = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"attributeMappings\" => lambda {|n| @attribute_mappings = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeMapping.create_from_discriminator_value(pn) }) },\n \"enabled\" => lambda {|n| @enabled = n.get_boolean_value() },\n \"flowTypes\" => lambda {|n| @flow_types = n.get_enum_value(MicrosoftGraph::Models::ObjectFlowTypes) },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ObjectMappingMetadataEntry.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Filter.create_from_discriminator_value(pn) }) },\n \"sourceObjectName\" => lambda {|n| @source_object_name = n.get_string_value() },\n \"targetObjectName\" => lambda {|n| @target_object_name = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appHangCount\" => lambda {|n| @app_hang_count = n.get_number_value() },\n \"crashedAppCount\" => lambda {|n| @crashed_app_count = n.get_number_value() },\n \"deviceAppHealthScore\" => lambda {|n| @device_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"messageId\" => lambda {|n| @message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"replyChainMessageId\" => lambda {|n| @reply_chain_message_id = n.get_string_value() },\n \"threadId\" => lambda {|n| @thread_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"isUsable\" => lambda {|n| @is_usable = n.get_boolean_value() },\n \"isUsableOnce\" => lambda {|n| @is_usable_once = n.get_boolean_value() },\n \"lifetimeInMinutes\" => lambda {|n| @lifetime_in_minutes = n.get_number_value() },\n \"methodUsabilityReason\" => lambda {|n| @method_usability_reason = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"temporaryAccessPass\" => lambda {|n| @temporary_access_pass = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return {\n \"bargeInAllowed\" => lambda {|n| @barge_in_allowed = n.get_boolean_value() },\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"initialSilenceTimeoutInSeconds\" => lambda {|n| @initial_silence_timeout_in_seconds = n.get_number_value() },\n \"maxRecordDurationInSeconds\" => lambda {|n| @max_record_duration_in_seconds = n.get_number_value() },\n \"maxSilenceTimeoutInSeconds\" => lambda {|n| @max_silence_timeout_in_seconds = n.get_number_value() },\n \"playBeep\" => lambda {|n| @play_beep = n.get_boolean_value() },\n \"prompts\" => lambda {|n| @prompts = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Prompt.create_from_discriminator_value(pn) }) },\n \"stopTones\" => lambda {|n| @stop_tones = n.get_collection_of_primitive_values(String) },\n }\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"response\" => lambda {|n| @response = n.get_enum_value(MicrosoftGraph::Models::ResponseType) },\n \"time\" => lambda {|n| @time = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"driveId\" => lambda {|n| @drive_id = n.get_string_value() },\n \"driveType\" => lambda {|n| @drive_type = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n \"shareId\" => lambda {|n| @share_id = n.get_string_value() },\n \"sharepointIds\" => lambda {|n| @sharepoint_ids = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SharepointIds.create_from_discriminator_value(pn) }) },\n \"siteId\" => lambda {|n| @site_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"activeMalwareDetectionCount\" => lambda {|n| @active_malware_detection_count = n.get_number_value() },\n \"category\" => lambda {|n| @category = n.get_enum_value(MicrosoftGraph::Models::WindowsMalwareCategory) },\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"distinctActiveMalwareCount\" => lambda {|n| @distinct_active_malware_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"issuerName\" => lambda {|n| @issuer_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::CertificateStatus) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"subjectName\" => lambda {|n| @subject_name = n.get_string_value() },\n \"uploadDateTime\" => lambda {|n| @upload_date_time = n.get_date_time_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"servicePrincipalId\" => lambda {|n| @service_principal_id = n.get_string_value() },\n \"servicePrincipalName\" => lambda {|n| @service_principal_name = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"riskDetections\" => lambda {|n| @risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskDetection.create_from_discriminator_value(pn) }) },\n \"riskyServicePrincipals\" => lambda {|n| @risky_service_principals = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyServicePrincipal.create_from_discriminator_value(pn) }) },\n \"riskyUsers\" => lambda {|n| @risky_users = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyUser.create_from_discriminator_value(pn) }) },\n \"servicePrincipalRiskDetections\" => lambda {|n| @service_principal_risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ServicePrincipalRiskDetection.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return {\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"failedUsers\" => lambda {|n| @failed_users = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulUsers\" => lambda {|n| @successful_users = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"durationInSeconds\" => lambda {|n| @duration_in_seconds = n.get_number_value() },\n \"joinDateTime\" => lambda {|n| @join_date_time = n.get_date_time_value() },\n \"leaveDateTime\" => lambda {|n| @leave_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"entityType\" => lambda {|n| @entity_type = n.get_string_value() },\n \"mailNickname\" => lambda {|n| @mail_nickname = n.get_string_value() },\n \"onBehalfOfUserId\" => lambda {|n| @on_behalf_of_user_id = n.get_guid_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"actionName\" => lambda {|n| @action_name = n.get_string_value() },\n \"actionState\" => lambda {|n| @action_state = n.get_enum_value(MicrosoftGraph::Models::ActionState) },\n \"lastUpdatedDateTime\" => lambda {|n| @last_updated_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"accountName\" => lambda {|n| @account_name = n.get_string_value() },\n \"azureAdUserId\" => lambda {|n| @azure_ad_user_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"domainName\" => lambda {|n| @domain_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n \"userSid\" => lambda {|n| @user_sid = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_guid_value() },\n \"cloudServiceDeploymentEnvironment\" => lambda {|n| @cloud_service_deployment_environment = n.get_string_value() },\n \"cloudServiceDeploymentId\" => lambda {|n| @cloud_service_deployment_id = n.get_string_value() },\n \"cloudServiceInstanceName\" => lambda {|n| @cloud_service_instance_name = n.get_string_value() },\n \"cloudServiceName\" => lambda {|n| @cloud_service_name = n.get_string_value() },\n \"deviceDescription\" => lambda {|n| @device_description = n.get_string_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"mediaLegId\" => lambda {|n| @media_leg_id = n.get_guid_value() },\n \"mediaQualityList\" => lambda {|n| @media_quality_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TeleconferenceDeviceMediaQuality.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"participantId\" => lambda {|n| @participant_id = n.get_guid_value() },\n }\n end",
"def _before_validation\n serialize_deserialized_values\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isBuiltIn\" => lambda {|n| @is_built_in = n.get_boolean_value() },\n \"roleAssignments\" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },\n \"rolePermissions\" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_string_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"color\" => lambda {|n| @color = n.get_string_value() },\n \"criterion1\" => lambda {|n| @criterion1 = n.get_string_value() },\n \"criterion2\" => lambda {|n| @criterion2 = n.get_string_value() },\n \"dynamicCriteria\" => lambda {|n| @dynamic_criteria = n.get_string_value() },\n \"filterOn\" => lambda {|n| @filter_on = n.get_string_value() },\n \"icon\" => lambda {|n| @icon = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookIcon.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operator\" => lambda {|n| @operator = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end"
] |
[
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.61200523",
"0.6089013",
"0.60869795",
"0.6079146",
"0.60785794",
"0.6070405",
"0.6063533",
"0.60625833",
"0.6061235",
"0.60584134",
"0.6055769",
"0.6051312",
"0.60465735",
"0.6046329",
"0.6031944",
"0.6029311",
"0.6028314",
"0.60255736",
"0.6022033",
"0.60210633",
"0.6009887",
"0.5988654",
"0.59844214",
"0.59793943",
"0.5975247",
"0.5969614",
"0.596824",
"0.5966432",
"0.5965554",
"0.596292",
"0.5951651",
"0.5950895",
"0.59456754",
"0.59448177",
"0.593984",
"0.59362113",
"0.5935833",
"0.59319806",
"0.59312665",
"0.59307545",
"0.5930406",
"0.5926444",
"0.5926136",
"0.59240156",
"0.5922303",
"0.591605",
"0.591336",
"0.5913327",
"0.59130335",
"0.5910617",
"0.5906052",
"0.5906045",
"0.59042066",
"0.5903306",
"0.5902868",
"0.59027255",
"0.5902389",
"0.5902219",
"0.5901496",
"0.58978146",
"0.5891392",
"0.5890228",
"0.5885622",
"0.5885429",
"0.5884738",
"0.5883899",
"0.5883899",
"0.5883899",
"0.58811784",
"0.5878516",
"0.5877111",
"0.5869185",
"0.5844199",
"0.58430207",
"0.58408237",
"0.58383596",
"0.58362466",
"0.5836192",
"0.5835942",
"0.5834559",
"0.583357"
] |
0.0
|
-1
|
Gets the role property value. The role property
|
def role
return @role
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def role\n @role\n end",
"def get_role\n\t\tself.role\n\tend",
"def role\r\n r = read_attribute(:role)\r\n r.capitalize unless r.nil?\r\n end",
"def get_role\n return case self.role_id\n when 2\n \"User\"\n else\n \"N/A\"\n end\n end",
"def get_role\n\t\tif self.roles[0]\t\n\t\t\tself.roles[0].role_type \n\t\telse\n\t\t\t0\n\t\tend\n\tend",
"def user_role\n USER_ROLE[role]\n end",
"def role=(value)\n @role = value\n end",
"def role_id\n data.role_id\n end",
"def role_name\n object.role_name\n end",
"def role_name\r\n Role.find(object.role_id).role_name\r\n end",
"def role_arn\n data.role_arn\n end",
"def role= val\n write_attribute(:role, val.to_s)\n end",
"def role= val\n write_attribute(:role, val.to_s)\n end",
"def display_role\n ROLE_LIST[self.role]\n end",
"def role_arn\n data[:role_arn]\n end",
"def role\n @pool.role\n end",
"def role_definition\n return @role_definition\n end",
"def role_definition\n return @role_definition\n end",
"def get_role(role_name)\n self.class.get_role(role_name)\n end",
"def role\n return self.position.name\n end",
"def role_object\n (APP_CONFIG[\"user_roles\"]+SYSTEM_DATA[\"user_roles\"]).select{|role| role[\"name\"] == self.role}.first\n end",
"def getRole jid\n\t\tuser = @users.read ['role'], ['jid', jid]\n\t\tif user.count > 0\n\t\t\tuser[0]['role']\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def user_role\n current_user.role if current_user\n end",
"def role_name\n @role_name ||= object.meta[:role].try(:capitalize)\n end",
"def role\n if self.admin || (Setting.no_security == \"true\")\n return :admin\n elsif self.reviewer\n return :reviewer\n else\n return :default\n end\n end",
"def role_data\n APP_CONFIG['roles'].find { |role| role['name'] == self.role }\n end",
"def active_role\n Role.find(self.active_role_id)\n end",
"def current_role\n \treturn @current_role if defined? @current_role\n \t@current_role = current_user && current_user.role_symbol\n end",
"def role_type\n return User.role_type_from_string(self.role)\n end",
"def role\n admin ? \"admin\" : \"user\"\n end",
"def current_user_role\n current_user.try(:role).try(:to_sym) || :normal\n end",
"def role\n @role ||=\n if is_admin?\n :admin\n else\n :customer\n end\n end",
"def guild_role\n\t\t@guild_role\n\tend",
"def role(organization = nil)\n # Return cached version if available\n return self.read_attribute(:role) if !organization\n \n org = self.organizations.to_a.find { |o| o.id.to_s == organization.id.to_s }\n org ? org.role : nil\n end",
"def role; end",
"def role; end",
"def current_role\n if user_signed_in?\n @current_role ||= current_user.roles.pluck(:name)\n end\n end",
"def role_str\n if (role == nil)\n role_result = \"participant\"\n else\n role_result = role\n end\n role_result\n end",
"def get_role user\n project_role_user = ProjectRoleUser.where(:project_id => self, :user_id => user).first\n if project_role_user\n project_role_user.role.name\n else\n nil\n end\n end",
"def role(role_name)\n context.send(role_name)\n end",
"def role?(role)\n self.role == role.to_s\n end",
"def role?(role)\n self.role == role.to_s\n end",
"def get!(role)\n raise Exception, \"Role 'role_id' not found\" unless has?(role)\n role_id = (role.class <= Rend::Acl::Role) ? role.id : role.to_s\n roles[role_id][:instance]\n end",
"def role?(role)\n self.role.to_s == role.to_s\n end",
"def role?(role)\n self.role&.name == role\n end",
"def get_role(the_role)\n self.roles.where(user_id:self.id,roleable_type:the_role).first\n end",
"def role(user)\n if user.admin\n return \"Admin\"\n else return \"User\"\n end\n end",
"def role?(role)\n self.role == role.to_s ? true : false\n end",
"def role?(r)\n self.role == r.to_s\n end",
"def role\n return :admin unless organization\n if has_role?(:admin, organization)\n return :admin\n elsif organization.owner_id == self.id\n return :owner\n else\n return :member\n end\n end",
"def get_full_role\n if role == \"admin\"\n return \"Administrator\"\n elsif role == \"lead\"\n return \"Organization Lead\"\n end\n end",
"def role\n permission_type\n end",
"def user_role\n r = Role.find_by_role(WFConsts::USER)\n r\n end",
"def current_role\n session.has_key?(:role) ? session[:role] : nil\n end",
"def nature\n\t\tself.role\n\tend",
"def get_role_or_nil\n if user_type == \"UserControl\"\n \"UserControl\"\n elsif user_signed_in?\n current_user.role.name\n else\n nil\n end\n end",
"def role\n @manifest_options[:role] || \"\"\n end",
"def role_permissions\n return @role_permissions\n end",
"def primary_role\n return nil if user.person_role.blank?\n user.person_role\n end",
"def role?(role)\n\t self.role == role\n\tend",
"def getRole (user)\n case user.role\n when 0\n return 'user'\n when 1\n return 'operator'\n when 2\n return 'cto_user'\n when 3\n return 'owner'\n when 4\n return 'anonymous'\n else\n raise ('invalid user' + user.role)\n end\n end",
"def get_puppet_role(data)\n data['extensions']['pp_role'] || 'none'\n end",
"def monitoring_role_arn\n data[:monitoring_role_arn]\n end",
"def monitoring_role_arn\n data[:monitoring_role_arn]\n end",
"def role= new_role\n @role = String new_role\n end",
"def rails_role_user\n current_user\n end",
"def role_name\n @values.fetch('ai.device.roleName') { \n @values['ai.device.roleName'] = nil\n }\n end",
"def arn\n cloud_desc.role_arn\n end",
"def current_role\n \tcase current_user.role\n \twhen 1 \n \t\t@current_role='Empleado'\n \twhen 2 \n \t\t@current_role='Jefe Departamento'\n \twhen 3 \n \t\t@current_role='Auditor'\n \twhen 4 \n \t\t@current_role='Administrador'\n \tend\n end",
"def role_definition_id\n return @role_definition_id\n end",
"def find_role(name)\n self.roles.find {|a| a.name == name}\n end",
"def role?(role)\n if self.role == role.to_s\n return true\n else\n return false\n end\n end",
"def role\n @path = \"/services/Admin\"\n @role ||= Nephophobia::Resource::Role.new self\n end",
"def role?(role)\n\t self.role.name == role\n end",
"def role(role)\n @roles = @roles | [@salticid.role(role)]\n end",
"def roleid\n [ account, kind, identifier ].join(':')\n end",
"def pdb_get_role(facts)\n if facts.is_a?(Hash) && !facts['trusted'].nil? && !facts['trusted']['value'].nil? && !facts['trusted']['value']['extensions'].nil? && !facts['trusted']['value']['extensions']['pp_role'].nil?\n role = facts['trusted']['value']['extensions']['pp_role']\n Puppet.info(\"#{log_prefix} puppet role for node is: role=#{role}\")\n role\n else\n \"Unknown\"\n end\n end",
"def user_role\n UserRole.find_by(approval_group_id: cart.approval_group.id, user_id: user_id)\n end",
"def get_user_name(role)\n get_user(role).full_name\n end",
"def get_role_of(object)\n return has_role_with(object)\n end",
"def role?(role_to_compare)\n self.role.to_s == role_to_compare.to_s\n end",
"def name\n \"#{role_name} #{user&.email}\"\n end",
"def role(name)\n json = client.get(\"/v1/auth/approle/role/#{encode_path(name)}\")\n return Secret.decode(json)\n rescue HTTPError => e\n return nil if e.code == 404\n raise\n end",
"def role_cls\n User\n end",
"def role\n # get all the employee's role\n # binding.pry\n Role.all.select{|role| role.employee == self}\n end",
"def get_full_role\n\t\tif role == \"lead\"\n\t\t\treturn \"Project Lead\"\n\t\telsif role == \"editor\"\n\t\t\treturn \"editor\"\n\t\tend\n\tend",
"def role=(value)\n self.user_type = ROLES[value]\n end",
"def checkrole\n if roles_mask == 4\n 'User'\n elsif roles_mask == 6\n 'Administrator'\n end\n end",
"def roles\n roles_from_users\n end",
"def role? role\n return !!self.roles.find_by_name(role.to_s)\n end",
"def set_role role\n set_ds_field role.to_s\n end",
"def role(req)\n \"admin:#{dealership(req).id}\"\n end",
"def role?(value)\n roles.include?(value.to_s)\n end",
"def has_role(r)\n self.role == r\n end",
"def has_role?( role )\n\t\treturn self.role.title.to_sym == role if self.role\n\t\tfalse\n\tend",
"def role?(role_name)\n role == role_name\n \n end",
"def role?(role)\n \n if self.is_admin\n return true\n end\n \n self.roles.each do |item|\n if item.name.to_s == role.to_s\n return true\n end\n end\n \n return false\n end",
"def downcase_role\n self.role.downcase\n end",
"def masqueraded_role\n @masqueraded_role ||= masquerade_as[:role]\n end",
"def roles\n self.dig_for_array(\"roles\")\n end"
] |
[
"0.8208447",
"0.81522584",
"0.78307474",
"0.77477396",
"0.7668824",
"0.763459",
"0.74447405",
"0.74383163",
"0.74054605",
"0.7371139",
"0.7263034",
"0.7184341",
"0.7184341",
"0.7183879",
"0.7175226",
"0.71302915",
"0.7122539",
"0.7122539",
"0.706573",
"0.7042955",
"0.7023937",
"0.69897455",
"0.6982779",
"0.69808865",
"0.69767284",
"0.6967515",
"0.690652",
"0.69026953",
"0.688159",
"0.6869434",
"0.68330395",
"0.6815018",
"0.67795575",
"0.6767385",
"0.673166",
"0.673166",
"0.66976756",
"0.66910267",
"0.66900396",
"0.6688418",
"0.66841346",
"0.66841346",
"0.667956",
"0.6670884",
"0.6646756",
"0.6623964",
"0.662054",
"0.6611712",
"0.6599637",
"0.65803885",
"0.6580093",
"0.65687984",
"0.65579015",
"0.65376717",
"0.6507847",
"0.65041924",
"0.64716685",
"0.64712274",
"0.64694214",
"0.6443269",
"0.6442519",
"0.6438799",
"0.6426501",
"0.6426501",
"0.64196044",
"0.64032716",
"0.6399008",
"0.63960373",
"0.6391023",
"0.6362269",
"0.6359899",
"0.6358763",
"0.6356245",
"0.6350886",
"0.6328374",
"0.6316405",
"0.6305654",
"0.6305557",
"0.62769943",
"0.6235244",
"0.6231382",
"0.62082523",
"0.6204287",
"0.620048",
"0.61901015",
"0.6187915",
"0.6181717",
"0.61751366",
"0.6165045",
"0.61650026",
"0.6162901",
"0.6153139",
"0.6150507",
"0.6150383",
"0.6148229",
"0.61396503",
"0.6136002",
"0.61250615",
"0.6118602",
"0.6116024"
] |
0.84608644
|
0
|
Sets the role property value. The role property
|
def role=(value)
@role = value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_role\n @role = role\n end",
"def role= val\n write_attribute(:role, val.to_s)\n end",
"def role= val\n write_attribute(:role, val.to_s)\n end",
"def role= new_role\n @role = String new_role\n end",
"def set_Role(value)\n set_input(\"Role\", value)\n end",
"def set_role role\n set_ds_field role.to_s\n end",
"def set_Role(value)\n set_input(\"Role\", value)\n end",
"def set_Role(value)\n set_input(\"Role\", value)\n end",
"def role=(value)\n self.user_type = ROLES[value]\n end",
"def set_role\n @role = Role.find_by_actor_id_and_project_id(current_actor.id, @project.id)\n end",
"def set_role\n @role = Role.find_by_actor_id_and_project_id(current_actor.id, @project.id)\n if @role\n @role_level = (RoleLevel.find(@role.role_level_id)).name\n else\n @role_level = ''\n end\n end",
"def set_role\n @role = RightManager::Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n return if role?\n\n self.role = 'regular'\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\r\n @role = Role.find(params[:id])\r\n end",
"def role_id=(value)\n @permission_keys = nil\n @user_permission_keys = nil\n\n self[:role_id] = value\n end",
"def set_user_role(role)\n role_id = Role.where(role_type: role).first.id\n self.update_attributes(role_id: role_id) \n end",
"def set_role\n @role = Role.find(params[:id]) if params[:id].present?\n end",
"def set_role(role_name, value)\n if value == \"1\"\n for role in self.roles\n if role.name == role_name\n return\n end\n end\n r = Role.find(:first, :conditions => ['name =?', role_name])\n self.roles.push(r)\n else\n for role in self.roles\n if role.name == role_name\n self.roles.delete(role)\n return\n end\n end\n end\n end",
"def set_role\n self.role ||= 'standard'\n end",
"def set_role\n role = Spree::Role.find_by name:\"user\"\n self.spree_roles << role\n end",
"def set_role(role, user)\n\t\tprivs = privileges(user)\n\t\tunless privs[:edit]\n\t\t\traise TinyException, TinyException::MESSAGES[TinyException::NOPRIVILEGES]\n\t\tend\n\t\t\n\t\tcase role\n\t\twhen \"student\"\n\t update_attribute(:role, Enrollment::ROLE_STUDENT)\n\t when \"instructor\"\n\t update_attribute(:role, Enrollment::ROLE_INSTRUCTOR)\n\t end\n\tend",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def set_role\n @role = Role.find(params[:id])\n end",
"def role_definition=(value)\n @role_definition = value\n end",
"def role_definition=(value)\n @role_definition = value\n end",
"def assign_role\n self.role = Role.find_by name: \"Aanvrager\" if self.role.nil?\n end",
"def set_user\n @role = Role.find(params[:id])\n end",
"def active_role=(role)\n if self.active_role_id != role.id\n self.password = ''\n self.update_attribute(:active_role_id, role.id)\n self.reload\n end\n end",
"def role(role)\n @roles = @roles | [@salticid.role(role)]\n end",
"def set_role\n self.role = 'developer'\n end",
"def assign_role\n self.role = Role.find_by name: \"Regular\" if self.role.nil?\n end",
"def user_roles=(value)\n roles[:user_roles]=value\n end",
"def assign_role\n\t\tself.role = Role.find_by role_name: \"PIC Pengadaan\" if self.role.nil?\n\tend",
"def set_role(user, role)\n membership = membership_of(user)\n\n if membership\n if role.blank?\n membership.destroy\n else\n membership.update_attributes(:role => role)\n end\n elsif user and not role.blank?\n memberships.build(:user => user, :role => role)\n end\n end",
"def set_role\n new_role = params[:role]\n return render(nothing: true, status: :unauthorized) if new_role == 'superuser' && current_user.role != 'superuser'\n\n @user.role = new_role\n @user.save!\n respond_to do |format|\n format.js\n end\n end",
"def set_users_role\n @users_role = Users::Role.find(params[:id])\n end",
"def roles= *new_roles\n roles.set_roles new_roles\n end",
"def set_role\n @user = User.find(params[:id])\n @user.role_id = params[:role_id]\n if @user.save\n render :text => \"Updated\"\n else\n render :text => @user.errors.to_a.flatten.join(\", \")\n end\n end",
"def set_role\n role = Role.find_by_name(user_params[:role]) rescue nil\n role ? user_params_with_role(role) :\n (render json: { status: 400, error: \"Mention a proper Role for User\" })\n end",
"def set_role(role, agency)\n if !agency && !role\n raise \"Expecting values for role and agency\"\n end\n # Add role with an agency if applicable\n if role == \"superuser\"\n self.add_role(role)\n elsif agency == \"\"|| agency.nil?\n self.add_role(role)\n elsif staff_agency.nil?\n self.add_role(role,agency)\n elsif agency\n self.remove_role(self.roles.last.name.to_sym)\n self.add_role(role,agency)\n end\n end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end",
"def set_system_role\n @role = System::Role.find(params[:id])\n end",
"def assign_role\n #self.role = Role.find_by name: '訪客' if self.role.nil?\n self.role = Role.find_by name: 'Guest' if self.role.nil?\n end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end",
"def []=( key, val )\n key = key.to_sym\n if key == :roles\n add( *val )\n else\n @props[ key.to_sym ] = val\n end\n val\n end",
"def set_users_role\n @users_role = UsersRole.find(params[:id])\n end",
"def set_as_admin\n self.role = USER_ROLES[:admin]\n end",
"def set_user_to_role\n @user_to_role = UserToRole.find(params[:id])\n end",
"def set_ContactRole(value)\n set_input(\"ContactRole\", value)\n end",
"def set_valid_role\n\t\treturn unless self.role.nil?\n\t\tguest_role = Role.find_by(name: 'Guest')\n\t\tif guest_role.nil?\n\t\t\tRole.create!(name: 'Guest')\n\t\t\tguest_role = Role.find_by(name: 'Guest')\n\t\tend\n\t\tself.role = guest_role\n end",
"def set_user\n @role = Role.find(params[:id])\n authorize @role\n end",
"def set_role\n @role = RoleMaster.find_by_id(params[:id])\n if @role\n else\n \trender json: { valid: false}, status: 404\n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def set_user_role\n role = Role.where({:name => \"system_user\"}).first\n raise RuntimeError, \"Error: unable to find role: system_user\" unless role\n user_role = UserRole.new\n user_role.role_id = role.id\n user_role.user_id = self.id\n user_role.save!\n end",
"def role(role, options = {})\n append_role role, options\n @current_role = role\n yield\n ensure\n @current_role = nil\n end",
"def role(role, options = {})\n append_role role, options\n @current_role = role\n yield\n ensure\n @current_role = nil\n end",
"def name=(name)\n update_role_data(name: name)\n end",
"def setup_role\n \tif self.role_ids.empty?\n \t self.role_ids = [3]\n \tend\n end",
"def set_movie_role\n @movie_role = @movie.roles.find_by(:id => params[:id])\n end",
"def set_admin_role\n @admin_role = Admin::Role.find(params[:id])\n end",
"def assign_role\n self.role = Role.find_by name: \"Survivor\" if self.role.nil?\n end",
"def ensure_there_is_a_role\n if role.blank?\n self.role = \"student\"\n end\n end",
"def set_role_url(url, role_index=0)\n implementation[\"roles\"][role_index][\"role_url\"]=url\n end",
"def set_org_role\n @org_role = OrgRole.find(params[:id])\n end",
"def colour=(colour)\n update_role_data(colour: colour)\n end",
"def assign_role(user, role_name)\n role = Role.find_by_name role_name\n user.role = role\n user.save!\nend",
"def assign_role\n self.add_role!(\"user\")\n end",
"def role_name=(value)\n if value == @defaults['ai.device.roleName']\n @values.delete 'ai.device.roleName' if @values.key? 'ai.device.roleName'\n else\n @values['ai.device.roleName'] = value\n end\n end",
"def check_for_role\n\t\tself.role = ROLES[:user] if !self.role.present?\n\tend",
"def set_entity_role\n @entity_role = EntityRole.find(params[:id])\n end",
"def role_permissions=(value)\n @role_permissions = value\n end",
"def with_role(role)\n self.resources_configuration[:self][:role] = role.try(:to_sym)\n end",
"def change_role(role)\n role_list.each do |old_role|\n remove_role old_role\n end\n puts role\n add_role role\n puts roles\n end",
"def set_team_role\n @team_role = TeamRole.find(params[:id])\n end",
"def set_role_privilege\n @role_privilege = RolePrivilege.find(params[:id])\n end",
"def setup_role\n #get_statuses(@role)\n #set_default_status(@role)\n end"
] |
[
"0.861649",
"0.8046014",
"0.8046014",
"0.796943",
"0.79629016",
"0.7945792",
"0.78999215",
"0.78999215",
"0.7875896",
"0.7750461",
"0.7684081",
"0.7671929",
"0.7653162",
"0.7516295",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7481412",
"0.7480449",
"0.7338464",
"0.7336672",
"0.7329321",
"0.73041064",
"0.7272566",
"0.7270398",
"0.72362006",
"0.72231114",
"0.71497226",
"0.71497226",
"0.71497226",
"0.71497226",
"0.71497226",
"0.71497226",
"0.71497226",
"0.71497226",
"0.71026975",
"0.71026975",
"0.7023466",
"0.70231885",
"0.7022734",
"0.6966979",
"0.69620883",
"0.6960204",
"0.6942947",
"0.6926916",
"0.6884628",
"0.6880745",
"0.6863133",
"0.6849284",
"0.6827346",
"0.6819073",
"0.68084574",
"0.68023235",
"0.67155874",
"0.6706956",
"0.6706789",
"0.6703604",
"0.66977096",
"0.6694903",
"0.665682",
"0.6656042",
"0.66556805",
"0.66433656",
"0.6631073",
"0.66234183",
"0.66234183",
"0.66234183",
"0.6620349",
"0.6611321",
"0.6611321",
"0.6604063",
"0.65924287",
"0.6590652",
"0.65847665",
"0.6572633",
"0.65692866",
"0.656865",
"0.65376335",
"0.6521847",
"0.65156496",
"0.6511148",
"0.65098125",
"0.65051806",
"0.6502514",
"0.650011",
"0.6494561",
"0.64870477",
"0.6473535",
"0.6473108",
"0.6471119"
] |
0.87294894
|
0
|
Gets the scope property value. The scope property
|
def scope
return @scope
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scope_value\n return unless position_scope_attr\n send(position_scope_attr)\n end",
"def scope\n @attributes[:scope]\n end",
"def scope\n read_attr :scope, :to_sym\n end",
"def scope\n parameter[:scope]\n end",
"def scope\n @scope\n end",
"def scope\n @scope\n end",
"def find_property\n @property ||= scope.find(params[:id])\n end",
"def custom_scope_get scope_name\n\t\t\tThread.current[SESSION].custom_scope_get scope_name\n\t\tend",
"def scope\n field[:scope]\n end",
"def current_scope\n @scope\n end",
"def scope\n\t\treturn @scopes.last\n\tend",
"def scope\n return !@scopes.empty? ? @scopes[-1] : @storage[:scope]\n end",
"def scope_name scope\n\t\traise \"No data-source set\" unless data_source\n\t\tdata_source.scopes.get(scope).human_name\n\tend",
"def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end",
"def scope_name; end",
"def scope=(val)\n set_scope(val)\n val\n end",
"def scope\n @options[:scope]\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def get_current_scope\n get_current_hub&.current_scope\n end",
"def property\n @property\n end",
"def get\n @value\n end",
"def get(scope: 'default', key: nil)\n key || raise(ArgumentError, 'A key must be provided')\n result= nil\n transaction {\n result= @@global_state[scope + '-' + key]\n }\n return result\n end",
"def settings\n @scope.settings\n end",
"def scope\n @scope.dup\n end",
"def scope\n @scope ||= {}\n end",
"def scope\n @scope ||= {}\n end",
"def evaluate(value, _scope)\n value\n end",
"def attributes\n\t\treturn self.scope.__locals__\n\tend",
"def value\n @property_hash[:value]\n end",
"def scope\n GlobalScope.instance\n end",
"def scope_level; end",
"def get\n val\n end",
"def get\n val\n end",
"def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = AssemblyComponent.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end",
"def scope\n @scope ||= Scope.new(parent)\n end",
"def scope\n finder_or_run(:scope)\n end",
"def prop\n return PropertyContext\n end",
"def prop\n return PropertyContext\n end",
"def get_attribute(name)\n rule_properties_scope = self.attr_grammar_type_to_rule_properties_scope[self.attr_grammar.attr_type]\n if (!(rule_properties_scope.get_attribute(name)).nil?)\n return rule_properties_scope.get_attribute(name)\n end\n if (!(@referenced_rule.attr_return_scope).nil?)\n return @referenced_rule.attr_return_scope.get_attribute(name)\n end\n return nil\n end",
"def valence\n @ob.get_valence\n end",
"def privacy_scope\r\n\t\t\tif @privacy_scope.nil?\r\n\t\t\t\t@privacy_scope = privacy_owner.get_privacy_scope(self.class.privacy_rule_name, privacy_object_id)\r\n\t\t\tend\r\n\t\t\treturn @privacy_scope\r\n\t\tend",
"def getEditorObjectScope _obj, _args\n \"_obj getEditorObjectScope _args;\" \n end",
"def return_value_node_of_scope(scope); end",
"def app_scope\n return @app_scope\n end",
"def scope_info\n if is_scoped? && scoped_manual.present?\n {\n \"scope\" => {\n \"title\" => scoped_manual.to_hash.fetch(\"title\", \"\"),\n },\n \"unscoped_results\" => unscoped_results,\n }\n else\n {}\n end\n end",
"def scope\n if @scope.kind_of? String\n @scope = @scope.split \",\"\n else\n @scope || []\n end\n end",
"def get_value\n @value\n end",
"def scope_context\n @sssn\n end",
"def scope_association\n parent? ? scope_parent_association : scope_model\n end",
"def return_value_node_of_scope(scope)\n body_node = scope.body_node\n\n if body_node.begin_type?\n body_node.children.last\n else\n body_node\n end\n end",
"def current_scope\n Thread.current[:webspicy_scope] || default_scope\n end",
"def scopes\n @scope.scopes\n end",
"def get_content_scope\n if !self.custom_scope.blank?\n File.join('/', self.custom_scope) # make sure the scope starts with a '/'\n elsif !self.contentable.blank?\n self.class.contentable_to_scope(self.contentable)\n else\n if self.uri_path\n self.uri_path\n else\n MuckContents::GLOBAL_SCOPE\n end\n end\n end",
"def scope(attribute, value)\n attribute.eq(value)\n end",
"def method_missing(name, *args)\n value = fetch(name)\n if value == Scope::NOT_FOUND\n value = super.method_missing(name, *args)\n end\n return value\n end",
"def get\n data[\"_value\"]\n end",
"def inspect\n \"<Mongo::Scope:0x#{object_id} namespace='#{@collection.full_namespace}\" +\n \" @selector=#{@selector.inspect} @opts=#{@opts.inspect}>\"\n end",
"def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = StateComponentTypeTax.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end",
"def scope_model\n @scope_association ||= scoping_object.send(model_name_to_method_sym)\n end",
"def read_scope(user)\n self\n end",
"def read_scope(reader)\n self\n end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope_options; end",
"def scope_options; end",
"def value\n self[@name]\n end",
"def value\n variable.value\n end",
"def app_scope_id\n return @app_scope_id\n end",
"def resolve(scope)\n scope\n end",
"def value\n return @value\n end",
"def value\n return @value\n end",
"def value\n return @value\n end",
"def context_scope\n defined?(@_scope) ? @_scope : nil\n end",
"def selected_scope\n (params[:scope] || :default).to_sym\n end",
"def value\n self['value']\n end",
"def get_value\n @value \n end",
"def scope(level = @skl_level)\n return @skl_levelcache[level][:scope]\n end",
"def options\n @scope.options\n end",
"def current_value\n @value\n end",
"def property(name)\n get(\"/session/#{session_id}/element/#{element_id}/property/#{name}\").value\n end",
"def scopes\n model.scopes\n end",
"def value\n @value\n end"
] |
[
"0.76529604",
"0.7231924",
"0.7132736",
"0.71291715",
"0.70269835",
"0.70269835",
"0.6714944",
"0.66890556",
"0.66710365",
"0.66449",
"0.663996",
"0.6462612",
"0.6291019",
"0.6286597",
"0.6268645",
"0.62028855",
"0.612111",
"0.6105797",
"0.6105797",
"0.6105797",
"0.6105797",
"0.6105797",
"0.6105797",
"0.61021185",
"0.60782194",
"0.60694486",
"0.6034899",
"0.6028831",
"0.60118973",
"0.5992902",
"0.5992902",
"0.5899027",
"0.5869917",
"0.5837801",
"0.5808306",
"0.578464",
"0.5742898",
"0.5742898",
"0.5737076",
"0.57119703",
"0.5701685",
"0.5686833",
"0.5673614",
"0.56490237",
"0.5617204",
"0.56079805",
"0.5606075",
"0.5589734",
"0.55872786",
"0.55823493",
"0.5569177",
"0.55591136",
"0.55428344",
"0.5542153",
"0.5484939",
"0.5484001",
"0.5481576",
"0.5474893",
"0.54718626",
"0.5460871",
"0.54506403",
"0.543818",
"0.5428782",
"0.54248434",
"0.54139686",
"0.5413619",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.54105276",
"0.5405944",
"0.5405944",
"0.53934824",
"0.5393067",
"0.53861356",
"0.53803784",
"0.53664625",
"0.53664625",
"0.53664625",
"0.53587645",
"0.5356437",
"0.5351365",
"0.5345123",
"0.534254",
"0.534016",
"0.5337017",
"0.5309236",
"0.5304618",
"0.53038293"
] |
0.73586154
|
6
|
Sets the scope property value. The scope property
|
def scope=(value)
@scope = value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scope=(val)\n set_scope(val)\n val\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_scope(val)\n @scope = val\n build_path_query\n @scope\n end",
"def set_scope(scope)\n run_callbacks :set_scope do\n self.scope = scope\n end\n end",
"def scope=(v); end",
"def scope=(v); end",
"def set_scope\n @scope = Scope.find(params[:id])\n end",
"def set_scope\n @scope = Scope.find(params[:id])\n end",
"def puppet_scope=(value)\n @puppet_scope = value\n end",
"def scope=(_); end",
"def app_scope=(value)\n @app_scope = value\n end",
"def update_scope\n @scope = params[:scope] || params[:q] || {}\n end",
"def privacy_scope=(scope)\r\n\t\t\t@privacy_scope = scope\r\n\t\tend",
"def apply_to_scope(scope)\n scope\n end",
"def directory_scope=(value)\n @directory_scope = value\n end",
"def scope=(sc)\n raise ArgumentError, \"A Rule's scope can only be 'public' or 'private'\" unless %w{public private}.include?(sc.to_s)\n self[:scope] = sc\n end",
"def resource_scope=(resource_scope)\n @resource_scope = \"/#{resource_scope}\"\n end",
"def scope=(new_scope)\n case new_scope\n when Array\n @scope = new_scope.join(' ')\n when String\n @scope = new_scope\n when nil\n @scope = ''\n else\n raise TypeError, \"Expected Array or String, got #{new_scope.class}\"\n end\n end",
"def set_current_scope(scope)\n Thread.current[:webspicy_scope] = scope\n end",
"def set_scope\n if (scope = params[:scope])\n if @resource.respond_to?(scope)\n @resource = @resource.send(scope)\n else\n not_allowed\n end\n end\n end",
"def constant_scope=(scope)\n @constant_scope = scope\n end",
"def constant_scope=(scope)\n @constant_scope = scope\n end",
"def scope= new_scope\n case new_scope\n when Array\n new_scope.each do |scope|\n if scope.include? \" \"\n raise ArgumentError,\n \"Individual scopes cannot contain the space character.\"\n end\n end\n @scope = new_scope\n when String\n @scope = new_scope.split \" \"\n when nil\n @scope = nil\n else\n raise TypeError, \"Expected Array or String, got #{new_scope.class}\"\n end\n end",
"def scope(object = nil)\n configure(:scope, object)\n end",
"def scope\n @scope ||= {}\n end",
"def scope\n @scope ||= {}\n end",
"def scope=(object)\n @scope ||= (\n #qua_class = (class << object; self; end)\n #methods = [object.public_methods, Object.private_instance_methods].flatten\n #methods.each do |m|\n # next if /^(__|instance_|singleton_method_|binding$|method_missing$|extend$|initialize$|object_id$|p$)/ =~ m.to_s\n # next if keep.any?{ |k| k === m.to_s }\n # qua_class.__send__(:undef_method, m)\n #end\n parser = self\n object.instance_eval{ @__parser__ = parser }\n #object.instance_eval{ extend MethodMissing }\n MethodMissing.__send__(:extend_object, object)\n object\n )\n end",
"def scope_options; end",
"def scope_options; end",
"def i18n_scope=(scope)\n @i18n_scope = scope\n end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def set_scope_product\n @scope_product = ScopeProduct.find(params[:id])\n end",
"def assign_access_scope(scope)\n ACCESS_SCOPES.include?(scope.to_s) or raise \"'#{ scope }' is not a valid scope.\"\n self.access_scope = scope.to_s\n end",
"def scope() binding end",
"def scope\n @scope\n end",
"def scope\n @scope\n end",
"def directory_scope_id=(value)\n @directory_scope_id = value\n end",
"def scope scope = nil, &proc\n @scope = (proc || scope) if (scope || proc) && configurable?\n @setup[:scope] ||= @scope ||\n (@controller.ctrl.slice.view.scope if @controller)\n end",
"def scope\n parameter[:scope]\n end",
"def app_scope_id=(value)\n @app_scope_id = value\n end",
"def allowed_target_scope=(value)\n @allowed_target_scope = value\n end",
"def set_observation\n @observation = scope.find(params[:id])\n end",
"def set_scope\n @scope = 'images'\n end",
"def set!(name, value)\n scope = innermost_binding(name)\n raise UndefinedVariable.new(\"Cannot set undefined variable '#{name}'\") if scope.nil?\n scope[name] = value\n end",
"def scope_by(&block)\n raise 'Cannot define scope after scope has been called.' if @scope\n\n @scope_block = block\n end",
"def initialize\n super\n @scope = ::Set.new\n end",
"def scope\n scope_hash = [settings.force_mode,state.total].hash\n return @state.scope unless @state.scope.nil? or scope_hash != @state.scope_hash\n state.scope_at = [\n settings.force_mode || ($stdout.isatty ? :tty : :notty),\n :unknown == state.total ? :infinite : :finite\n ]\n state.scope = state.settings\n state.scope_at.each do |s|\n begin\n state.scope = state.scope[s]\n rescue NoMethodError\n raise StandardError, \"Invalid configuration: #{state.scope_at.join('.')} \"+\n \"(Can't resolve: #{state.scope_at[state.scope_at.index(s)-1]})\"\n end\n end\n state.scope_hash = scope_hash\n state.scope\n end",
"def notification_recipient_scope=(value)\n @notification_recipient_scope = value\n end",
"def set_value_for(scope_type, variable_name, value)\n raise_invalid_scope_type!(scope_type)\n @registry[scope_type][variable_name] = value\n end",
"def set_scope_class\n klass = self.class::Scope\n klass.send(:include, ScopeMethods)\n @scope_class = klass.new(@scope, @search_attributes)\n end",
"def scope\n @scope ||= Scope.new(parent)\n end",
"def scoped_members=(value)\n @scoped_members = value\n end",
"def move_within_scope(scope_id)\n send(\"#{scope_name}=\", scope_id)\n save!\n end",
"def scope\n @scope.dup\n end",
"def set_scope(key)\n response_filters << lambda do |data|\n fetch_path(data, *key)\n end\n end",
"def scoped\n self.default_scopable = true\n apply_default_scope\n end",
"def inherit_scope(other)\n @scope = other.scope\n end",
"def set_status_dependency_scope(opts)\n opts = check_params(opts,[:scopes])\n super(opts)\n end",
"def resource_scopes=(value)\n @resource_scopes = value\n end",
"def resource_scopes=(value)\n @resource_scopes = value\n end",
"def scope_value\n return unless position_scope_attr\n send(position_scope_attr)\n end",
"def massage_scope!(set)\n set[\"scope\"] ||= {}\n set[\"scope\"][\"path\"] ||= \"\"\n return unless set[\"scope\"][\"type\"] && !set[\"scope\"][\"collection\"]\n\n set[\"scope\"][\"collection\"] = set[\"scope\"][\"type\"]\n end",
"def scope\n read_attr :scope, :to_sym\n end",
"def apply_attribute_filter(filter, value)\n self.scope = scope.where(filter => value)\n end",
"def browse(scope, _value)\n scope.none\n end",
"def scope\n @attributes[:scope]\n end",
"def scope\n @options[:scope]\n end",
"def nested_set_scope(options = {})\n add_scope_conditions_to_options(options)\n\n self.class.base_class.default_scoped.nested_set_scope options\n end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def it_scope\n @it_scope ||= Example::Scope.new(self)\n end",
"def in_scope(scope)\n cur_scope = @scope\n @scope = scope\n yield\n ensure\n @scope = cur_scope\n end",
"def with_scope(scope)\n current_scope = @current_scope\n @current_scope = scope\n result = yield\n @current_scope = current_scope\n result\n end"
] |
[
"0.8007941",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.777591",
"0.77737504",
"0.77737504",
"0.76533264",
"0.73469883",
"0.7148777",
"0.7148777",
"0.7084341",
"0.7084341",
"0.672913",
"0.6698267",
"0.6563456",
"0.6490476",
"0.6438544",
"0.6404789",
"0.63564134",
"0.6251141",
"0.617529",
"0.6152729",
"0.61065453",
"0.61029494",
"0.6014024",
"0.6014024",
"0.59839654",
"0.59670293",
"0.5930733",
"0.5930733",
"0.5930542",
"0.5870408",
"0.5870408",
"0.5833448",
"0.5814419",
"0.5814419",
"0.5814419",
"0.5809566",
"0.5795753",
"0.5775234",
"0.5773753",
"0.5773753",
"0.57721496",
"0.57699883",
"0.5761147",
"0.57576054",
"0.5747775",
"0.5738377",
"0.57371974",
"0.57285315",
"0.57248646",
"0.57004726",
"0.56748617",
"0.5638457",
"0.5621446",
"0.5611228",
"0.5607636",
"0.5569419",
"0.55386937",
"0.5526754",
"0.551487",
"0.5513284",
"0.5506133",
"0.5499985",
"0.5496207",
"0.5496207",
"0.5487222",
"0.54616416",
"0.54518545",
"0.5446121",
"0.54448026",
"0.54427326",
"0.5436613",
"0.54278564",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.54077905",
"0.53348005",
"0.5332624",
"0.53224814"
] |
0.82731503
|
5
|
Serializes information the current object
|
def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
super
writer.write_date_time_value("createdDateTime", @created_date_time)
writer.write_object_value("role", @role)
writer.write_object_value("scope", @scope)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
"def serialize\n self.to_hash.to_json\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def serialize\n @raw_data\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end",
"def serialize\n @serializer.serialize(self.output)\n end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"def serializer; end",
"def serialize!\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def serialize(object)\n object.to_s\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def inspect\n serialize.to_s\n end",
"def serialize\n YAML::dump(self)\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end",
"def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end",
"def serialize(object, data); end",
"def serialize\n JSON.generate(to_h)\n end",
"def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end",
"def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end",
"def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end",
"def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end",
"def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end",
"def serializable_hash\n self.attributes\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end",
"def to_s\r\n dump\r\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end",
"def serialize(io)\n Encoder.encode(io, self)\n io\n end",
"def _dump() end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end",
"def _dump()\n #This is a stub, used for indexing\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end",
"def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end",
"def inspect\n self.to_hash.inspect\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end",
"def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end",
"def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end"
] |
[
"0.794954",
"0.7644408",
"0.75776637",
"0.75776637",
"0.7438072",
"0.72067255",
"0.72067255",
"0.7206416",
"0.7015435",
"0.69990283",
"0.6991208",
"0.6981951",
"0.6970214",
"0.69652086",
"0.69652086",
"0.6942139",
"0.6939684",
"0.69322175",
"0.69122285",
"0.68901",
"0.68790954",
"0.68761015",
"0.68761015",
"0.68761015",
"0.68739885",
"0.6849865",
"0.6835531",
"0.6835531",
"0.68231064",
"0.6813793",
"0.6805304",
"0.6798453",
"0.6792754",
"0.67703515",
"0.67330843",
"0.6726598",
"0.6696043",
"0.6681359",
"0.6671691",
"0.6665963",
"0.6665702",
"0.66585046",
"0.66564167",
"0.6650104",
"0.6634777",
"0.6626288",
"0.6626288",
"0.6626288",
"0.66247225",
"0.66143185",
"0.6611944",
"0.6609617",
"0.659552",
"0.6594748",
"0.65925026",
"0.65912217",
"0.65818477",
"0.6578545",
"0.65783787",
"0.65748245",
"0.6569461",
"0.65692085",
"0.6565135",
"0.6558692",
"0.6553053",
"0.65391034",
"0.65360427",
"0.65329546",
"0.65257674",
"0.6522513",
"0.6522433",
"0.65211874",
"0.6515406",
"0.6511799",
"0.6506063",
"0.64973897",
"0.6496209",
"0.6494857",
"0.64841264",
"0.6479888",
"0.64798355",
"0.6478859",
"0.6474099",
"0.6473704",
"0.64658266",
"0.6461814",
"0.64604753",
"0.6459039",
"0.6455051",
"0.64497936",
"0.6437324",
"0.6433139",
"0.64295584",
"0.6421604",
"0.6419301",
"0.6419301",
"0.6419301",
"0.6419301",
"0.6419301",
"0.6416233",
"0.64129406"
] |
0.0
|
-1
|
Return the date when the folder was last updated
|
def last_updated
updated_at
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_modified\n stat.mtime\n end",
"def last_edited\n\t\tself.latest_update.to_date\n\tend",
"def last_edited\n self.latest_update.to_date\n end",
"def last_updated\n f = Folder.where(:id => params['id']).first\n render json: f.nil? ? \"unknown\" : f.updated_at\n end",
"def last_update\n folder = ( params[:id].nil? ? session[:user].root_folder : XFile.get(params[:id]) )\n raise RequestError.new(:file_not_found, \"Folder not found\") if folder.nil?\n raise RequestError.new(:bad_access, \"No access\") unless folder.users.include? session[:user] \n @result = { last_update: folder.last_update, success: true }\n end",
"def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end",
"def last_updated\n repo = Grit::Repo.init_bare_or_open(File.join(path , '.git'))\n repo.commits.first.commited_date\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_updated_date_time\n return @last_updated_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_modified\n# stat.mtime\n @bson['uploadDate'] || Date.new\n end",
"def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at]\n timestamps.sort.last\n end",
"def last_modified_time\n mtime\n end",
"def updated_at\r\n File.stat(\"#{RAILS_ROOT}/public/games/container.swf\").mtime\r\n end",
"def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def latest_modified_time\n tmp = Dir.glob(\"#{@dir}/**/*\").max_by do |file|\n File.mtime(file)\n end\n File.mtime(tmp)\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at] + self.page.elements.collect{|e| e.last_modified}\n timestamps.sort.last\n end",
"def last_modified\n @metadata[:last_modified] || Time.now.utc\n end",
"def last_update\n Time.parse(@record.SystemModstamp)\n end",
"def date_updated\n updated_at.strftime(\"%b %d, %Y\")\n end",
"def last_updated_time\n data[:last_updated_time]\n end",
"def updated_for_repo(repo)\n repo.updated_at.iso8601\n end",
"def date\n t, tz = changeset.date\n begin\n return [FileUtils.lstat(@repo.join(@path)).mtime, tz]\n rescue Errno::ENOENT\n return [t, tz]\n end\n end",
"def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end",
"def updated_at\n dateChanged\n end",
"def last_modified\n @file_stat ? file_stat.mtime.to_s : 'Unknown'\n end",
"def updated_at\n @udpated_at ||=\n Utilities.utc_to_localtime(@ldap_entry[:whenchanged].first)\n end",
"def last_modified\n @resource.last_modified\n end",
"def last_modified\n @last_modified ||= Date.parse(theme.created_at)\n end",
"def getlastmodified\n if !record.nil? and record.respond_to? :updated_at\n record.updated_at.httpdate\n end\n end",
"def last_modified_at(page)\n Gtn::ModificationTimes.obtain_time(page['path'])\n end",
"def last_updated_at\n RefreshReportingViews.last_updated_at_facility_daily_follow_ups_and_registrations\n end",
"def date() updated; end",
"def last_modification\n File.mtime(File.new(self.file_path, 'r'))\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def last_updated_at\n @last_updated_at\n end",
"def last_modified\n @file_stat ? file_stat.mtime : nil\n end",
"def history_end_dt\n @parent.last_updated_dt\n end",
"def modified_date_time\n return @modified_date_time\n end",
"def modified_date_time\n return @modified_date_time\n end",
"def modified_date_time\n return @modified_date_time\n end",
"def get_last_modified(feed)\n\t\t\t#assume, that first entry is newest\n\t\t\tfeed.last_modified || (feed.entries[0] && feed.entries[0].published) || Time.now\n\t\tend",
"def modified_date\n date_field('system_modified')\n end",
"def remote_last_updated_at\n require 'rexml/document'\n doc = REXML::Document.new(request('update'))\n Time.iso8601(doc.root.attributes['time'])\n end",
"def last_modified_date()\n\t\tmax_update = @database.execute(\"SELECT MAX(updated) as maxmodified FROM invoices;\")\n\t\tif (DBCHOICE == 'sqlite3') then\n\t\t\treturn max_update[0][0]\n\t\telsif (DBCHOICE == 'mysqltest' || DBCHOICE == 'mysql') then\n\t\t\t# structure is hash of hashes, look for the maxmodified key in 1st record and return\n\t\t\tmax_update.each do |row|\n\t\t\t\treturn row['maxmodified']\n\t\t\tend # max_update.each\n\t\tend\n\tend",
"def updated_at\n @gapi[\"updated\"]\n end",
"def modified_at\n ensure_full_data!\n Time.at(@gapi[\"lastModifiedTime\"] / 1000.0)\n end",
"def date\n updated_at.strftime(\"%d %b %y %H:%M\")\n end",
"def last_modified\n nil\n end",
"def last_modified_in dir\n Dir.glob( File.join( dir,'*' ) ).\n select {|f| File.file? f }.\n sort_by {|f| File.mtime f }.\n last\nend",
"def time\r\n @time ||= @last_build_file.modification_time\r\n end",
"def modified_at\n @modified_at ||= @path.pathname.mtime\n end",
"def get_modification_timestamp(path)\n File.mtime(path)\n end",
"def get_modified_date\n Questionnaire.find(self.node_object_id).updated_at\n end",
"def last_synchronize\n last_update\n end",
"def last_updated_at\n [ self.calendar_items.accessible.maximum('nodes.created_at'), self.updated_at ].compact.max\n end",
"def last_refresh\n @dt\n end",
"def last_refresh\n @dt\n end",
"def last_refresh\n @dt\n end",
"def crl_last_update\n stat = Puppet::FileSystem.stat(@crlpath)\n Time.at(stat.mtime)\n rescue Errno::ENOENT\n nil\n end",
"def last_ftp_login_at\n @attributes[:last_ftp_login_at]\n end",
"def last_modified_at\n as_time(rpc(:account_info, _access: :modified_timestamp))\n end",
"def modified_date\n Time.parse(self['system_modified_dtsi']).in_time_zone.to_date\n end",
"def modification_date; end",
"def modified_at\n @photo.updated.to_datetime.utc\n end",
"def last_timetable_datetime_with_zone\n TimetableFileInfo.last.last_modified\n end",
"def last_modified\n [updated_at, user.try(:updated_at)].max\n end",
"def last_updated_at\n if cache\n @last_updated_at ||= remote_last_updated_at\n else\n remote_last_updated_at\n end\n end",
"def last_sync_date_time\n return @last_sync_date_time\n end",
"def last_sync_date_time\n return @last_sync_date_time\n end",
"def mod_time\n File.mtime(@filepath)\n end",
"def updated\n Time.parse @node.at_xpath(\"atom:updated\", ::AtomFeed::NS).content\n end",
"def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end",
"def rev\n updated_at\n end",
"def last_modified\n if v = @meta['last-modified']\n Time.httpdate(v)\n else\n nil\n end\n end",
"def last_update\n \"none\"\n end",
"def updated\n Time.parse @doc.at_xpath(\"atom:feed/atom:updated\", ::AtomFeed::NS).content\n end",
"def source_file_mtime; end",
"def mtime; end"
] |
[
"0.75223345",
"0.7472307",
"0.7438879",
"0.74246",
"0.7423659",
"0.7398121",
"0.7366014",
"0.7242574",
"0.7242574",
"0.7242574",
"0.7242574",
"0.72367316",
"0.72367316",
"0.72367316",
"0.72367316",
"0.7219034",
"0.7113856",
"0.710986",
"0.70554984",
"0.7042453",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.70423234",
"0.6985732",
"0.69844663",
"0.69038373",
"0.6859203",
"0.6851689",
"0.68448615",
"0.6835672",
"0.6799812",
"0.67871475",
"0.6751497",
"0.6739026",
"0.6731088",
"0.6722097",
"0.6680591",
"0.66764313",
"0.66741693",
"0.66691095",
"0.66214526",
"0.66214204",
"0.6604529",
"0.6596457",
"0.6596457",
"0.6594599",
"0.6587078",
"0.6581376",
"0.6569654",
"0.6569654",
"0.6569654",
"0.6566152",
"0.6558949",
"0.6549146",
"0.65487605",
"0.65038854",
"0.6496483",
"0.64935726",
"0.6463689",
"0.644494",
"0.6440423",
"0.6426442",
"0.6424722",
"0.6407415",
"0.6405593",
"0.63954633",
"0.6393733",
"0.6393733",
"0.6393733",
"0.6393053",
"0.63919705",
"0.63846403",
"0.6380683",
"0.6377249",
"0.63760746",
"0.63657165",
"0.63571423",
"0.6357086",
"0.6356485",
"0.6356485",
"0.6337665",
"0.6337273",
"0.63310736",
"0.6325688",
"0.63078415",
"0.62977844",
"0.62966686",
"0.62942463",
"0.6281336"
] |
0.70330036
|
34
|
Return the number of files in the folder (nonrecursive)
|
def number_of_files
assets.length
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end",
"def get_count(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if !file.is_dir\n file.files_count\n end",
"def dir_file_count\n directory = APP_CONFIG['import_maps_sftp_path']\n count = Dir[File.join(directory, '**')].count { |file| File.file?(file) }\n\n return count\n end",
"def file_count(dir_path)\n Dir.entries(dir_path).count - 2\n end",
"def GetFileCount(aDir):\n return Dir[File.join(aDir, '*')].count {|file| File.file?(file)}\n end",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def CountFiles\n\t\tchildrenFiles = []\n\t\tcwd = File.dirname(__FILE__) # get parent directory from our script\n\t\tchildrenFiles = Dir.glob(cwd + '/**/*').select{ |e| File.file? e }\n\n\t\tchildrenFiles.each do |file|\n\t\t\tif File.extname(file).empty?\n\t\t\t\t@count += 1\n\t\t\t\t@files.push(file)\n\t\t\tend\n\t\tend\n\tend",
"def volume_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.directory?(file)\n end\n end",
"def archive_file_count\n Dir.glob('*', base: mounted_path).length\n end",
"def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end",
"def count_files_for_each_dir(path, dirs)\n dirs.each do |dir|\n \n num = 0\n # count flag\n\n Dir.entries(File.join(path, dir)).each do |file|\n num = (num + 1) if file.to_s!=\".\" and file.to_s!=\"..\" and file.to_s!=\".DS_Store\"\n end\n \n # print result\n puts \"#{dir} : #{num}\"\n end\nend",
"def getFolderSize(folder)\n total_size=0\n @files = Dir.glob(folder+\"**/**\")\n for file in @files\n total_size=total_size+File.size(file)\n end \n return total_size\nend",
"def numImages(path)\n\t\tDir.entries(path).size\n\tend",
"def file_counter\n Dir.glob(File.join(\"Goal/\", '**', '*')).select { |file| File.file?(file) }.count + 1\nend",
"def test_run_num_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(6,f.files.length)\n\tend",
"def file_count(path, ext = 'scss')\n file_list(path, ext).length\n end",
"def count\n coverable_files.size\n end",
"def count_number_of_lines(change_to_dir)\n Dir.chdir(change_to_dir)\n puts Dir.pwd.blue \n content = Dir.glob(\"*\")\n cur_dirs = []\n content.each do |file|\n file = \"#{Dir.pwd}/#{file}\"\n\n if File.directory?(file)\n cur_dirs << file\n else\n n = File.readlines(file).size\n print \"#{file} \"\n print \" #{n} lines\\n\".green\n end\n end\n cur_dirs.each do |dir| \n count_number_of_lines(dir)\n end\n\nend",
"def count\n Dir.glob(File.join(@dir, '*.{yml,yaml}')).size\n end",
"def count\n `wc -l < #{filepath}`.to_i - 1\n end",
"def file_count\n source_dir = Item.new(Path.new(params[:source]))\n type = params[:type]\n\n response = {}\n response[:source_dir] = source_dir\n file_count = source_dir.path.file_count(file_type: type)\n \n if file_count\n response[:msg] = \"Success\"\n response[:file_count] = file_count\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end",
"def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end",
"def directory_size(path)\n\ta = get_dir_size(path)\n\tdisplay(a)\n\t@calls = 0\n\treturn a\nend",
"def signups_count\n if File.exists?('./tmp/signup')\n Dir['./tmp/signup/*'].count\n else\n 0\n end\nend",
"def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end",
"def dir_size(dir)\n total_size = 0\n dir_list(dir).each do |name, size|\n total_size += (size == '/' ? dir_size(dir + '/' + name) : size.to_i)\n end\n total_size\n end",
"def total_filesize_count(folder_name)\n\n # You will fill in something here. Remember that the method only\n # gets the folder name, not the folder handle. So the method needs\n # to first create the corresponding handle object.\n\nend",
"def getImgCount(hash)\n\t\tsetImgDir()\n\t\tinner_path = DEFAULT_DIRECTORY\n\t\tinner_path += \"/#{hash[:folder_index]}\" unless hash[:folder_index].nil?\n\t\tinner_path += \"/#{hash[:entry_path]}\" unless hash[:entry_path].nil?\n\t\t#Count all real files that aren't txt\n\t\tDir.glob(File.join(\"#{inner_path}\", '**', '*')).select { |file| File.file?(file) && !file.end_with?(\".txt\") }.count\n\tend",
"def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end",
"def count\n folder.data_objects.all(parameters).count\n end",
"def count_objects\n\n count = 0\n\n Find.find(@basepath) do |path|\n\n next unless File.exist? path\n next if File.stat(path).directory?\n\n count += 1 if path[-5..-1] == '.yaml'\n end\n\n count\n end",
"def calculate_tree_size(folder)\n\t\ttotal_size = 0\n\t\t@files.each do |name, size|\n\t\t\tbegin\n\t\t\t\tif name.include? folder\n\t\t\t\t\tlocal_size = Integer(size)\n\t\t\t\t\ttotal_size = total_size + local_size\n\t\t\t\tend\n\t\t\trescue TypeError\n\t\t\tend\n\t\tend\n\t\treturn total_size\n\tend",
"def total_count(file)\n file_obj = File.new(file,'r')\n file_obj.readlines.size\n end",
"def size\n @files.size\n end",
"def get_all_size\n s_old = 0\n Dir.glob($dir + '/**/*').each { | a_file |\n dn = File.dirname(a_file)\n s = File.lstat(a_file).size.to_i\n $file_size[ a_file ] = s\n $dir_size[ dn ] = (s_old = $dir_size[ dn ]) ? s_old + s : s\n }\nend",
"def size\n @file_list.size\n end",
"def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end",
"def actual_path_length\n folders.count\n end",
"def count\n dir = '/Users/zzygis/lab/tekstai/stenogramos/'\n Dir.foreach(dir) do |f_sn|\n current_dir = dir + f_sn + '/'\n if current_dir =~ /\\d+/ then\n Dir.foreach(dir + f_sn) do |f_sp| \n yield f_sn, current_dir + f_sp if f_sp.include? '.txt'\n end\n end\n end\nend",
"def calcDirSize(path)\n if !File.directory?(path)\n return File.size(path)\n end\n list = Dir.entries(path);\n sizeToReturn = 0\n for index in 0 ... list.size\n if list[index] != '.' && list[index] != '..'\n if File.directory?(path + \"\\\\\" + list[index])\n sizeToReturn += calcDirSize (path + \"\\\\\" + list[index])\n else\n sizeToReturn += File.size(path + \"\\\\\" + list[index])\n end\n end\n end\n return sizeToReturn\nend",
"def _total_size(folder, size)\n folder.assets.each do |a|\n size = size + a.file_size\n end\n folder.children.each do |f|\n size = _total_size(f,size)\n end\n return size\n end",
"def folders_count\n wayfinder.ephemera_folders_count\n end",
"def test_calculate_tree_size_many_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(2705,f.calculate_tree_size(\"./TestFolders/Folder1/\"))\n\tend",
"def sizeOnDisk(someFile)\n #get directory\n #size of file in directories\n #add\n return Dir.glob(File.join(someFile, '**', '*')).map{|f| File.size(f)}.inject(:+)\nend",
"def count_total_lines files\n files.each do |f, k|\n lines_output = `wc -l #{f.to_s}`\n if $? != 0 then\n raise 'Error in counting total lines.'\n end\n lines_count = lines_output.strip.split(' ')[0].to_i\n k['total_lines'] = lines_count\n end\n return files\n end",
"def audio_file_count\n @audio_file_list.length\n end",
"def getTorrentFileCount(infoHash)\n return @rpc.call('d.get_size_files', infoHash)\n end",
"def path_size (path)\n if Dir.exist? path\n o, e, s = Open3.capture3('du', '-s', '-b', path)\n o.split('/')[0].to_i\n end\n end",
"def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end",
"def line_count\n entries.inject(0) do |count, entry|\n count + (entry.dir? ? 0 : entry.lines.size)\n end\n end",
"def dir_count(route, dir)\n route.count(dir)\nend",
"def num_files_owned_by_user(in_user_name)\n command_string = 'find '+@install_root+' -user '+in_user_name+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def showSizes(filename)\n if File.exists?(filename)\n puts(File.stat(filename).size)\n elsif File.directory?(filename)\n puts(Dir.entries(filename).select {|f| !File.directory? f}.size)\n end\nend",
"def recursive_loc_count(dir, tree_or_blob, total_count=nil)\n total_count ||= Hash.new{|h,k| h[k]=0 }\n if tree_or_blob.is_a?(Grit::Tree) # directory\n tree_or_blob.contents.each do |tob|\n dname = dir ? File.join(dir, tree_or_blob.name) : tree_or_blob.name\n recursive_loc_count(dname, tob, total_count)\n end\n elsif tree_or_blob.is_a?(Grit::Blob) # file\n file = dir ? File.join(dir, tree_or_blob.name) : tree_or_blob.name\n matcher.each do |glob, block|\n if File.fnmatch?(glob, file)\n tree_or_blob.data.lines.each do |line|\n group = block.call(file, line)\n if group\n total_count[group] += 1\n end\n #total_count['Total'] += 1\n end\n end\n end\n else\n # what is it then?\n end\n total_count\n end",
"def repo_size\n Dir.glob(File.join(repo.path, '**', '*'), File::FNM_DOTMATCH).reject do |f|\n f.include?('..')\n end.map do |f|\n File.expand_path(f)\n end.uniq.map do |f|\n File.stat(f).size.to_i\n end.reduce(:+)\n end",
"def get_dir_size(path)\n\t#get the contents of the directory\n\tmetadata = @client.metadata(path) #a Hash\n\tcontents = metadata['contents'] #an array of Hashs\n\n\t@calls += 1\n\tputs @calls\n\n\t#create list of subdirectory paths\n\tsubdirs_list = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdirs_list << i['path']\n\t\tend\n\tend\n\n\t#size the directory\n\tsize = 0\n\tcontents.each { |entry| size += entry['bytes'] }\n\n\tif subdirs_list == []\n\t\treturn size\n\telse\n\t\tadditional_sizes = []\n\t\tsubdirs_list.each { |dir| additional_sizes << get_dir_size(dir) }\n\t\tsum = 0\n\t\tadditional_sizes.each { |i| sum += i.to_i }\n\t\treturn size + sum\n\tend\nend",
"def test_run_num_folders\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(6,f.sub_folders.length) #note that there are 6 sub folders\n\tend",
"def get_size(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if file.is_dir\n file.info[:size]\n end",
"def size\n File.stat(@repo.join(@path)).size\n end",
"def trailing_count\n repository.files.map do |path|\n file = repository.read(path)\n\n if file\n file.lines.map do |line|\n line.scan(/[ \\t]+$/).size\n end.sum\n else\n 0\n end\n end.sum\n end",
"def list_files(configs, a)\n puts \"Files for #{a}:\"\n\n count = 0\n sum_fs = 0\n Dir.foreach(configs[a]).each{|f|\n if not IGNORE.include?(f) then\n full_path = File.join(configs[a], f)\n puts \" #{count+=1}. #{f}#{File.directory?(full_path)? '/':''}\"\n sum_fs += File.size(full_path)\n end\n }\n \n puts \"#{count} file#{(count==1)?'':'s'}, sum #{sum_fs}B.\"\nend",
"def test_calculate_tree_size_no_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(0,f.calculate_tree_size(\"./TestFolders/Folder2/\"))\n\tend",
"def extract_files_and_return_count(src_directory)\n Dir.chdir $executor_directory\n\n \n number_files_before = TestUtils.count_files_directory($dst_directory)\n number_files_src_directory = TestUtils.count_files_directory(src_directory)\n\n system(\"#{$executor_command} #{src_directory} #{$dst_directory}\")\n\n number_files_after = TestUtils.count_files_directory($dst_directory)\n\n total_correct_amount_of_files = number_files_before + number_files_src_directory\n return number_files_before, number_files_after, total_correct_amount_of_files\n\n\tclean_directory\n end",
"def test_calculate_tree_size_one_file\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(391,f.calculate_tree_size(\"./TestFolders/Folder3/\"))\n\tend",
"def count\n @count ||= begin\n Grim.processor.count(@path)\n end\n end",
"def find_files(path)\n entries = Dir[path + \"/*\"]\n puts entries.size\n entries.select! { |entry| File.file?(entry) }\n entries\n end",
"def size\n File.size( fullpath )\n end",
"def flay_count filename\n count = `flay #{filename}|grep #{filename}|wc -l`\n return count.chomp.to_i\n end",
"def uploaded_images_count\n fog_storage = get_fog_storage\n bucket = get_bucket\n \n directory = fog_storage.directories.get(bucket)\n \n images_count = 0 \n \n directory.files.each do |file|\n \n if ( file.key.to_s.start_with? \"uploads/quiz/#{quiz_id}/quiz_question_images/\")\n images_count += 1\n end \n end\n \n return images_count\n end",
"def count_lines(dir, excludes)\n\n\tfiles = Dir[dir + '/**/*.{c,cpp,h}']\n\tlines = 0\n\tfor f in files \n\t\tnext if exclude?(excludes, f)\n\t\tn = 0\n\t\tFile.new(f, \"r\").each { n += 1 }\n\t\tputs \"#{f} #{n}\" if $print_files\n\t\tlines += n\n\tend\n\n\treturn lines\nend",
"def generate!(folder)\n counter = 0\n files.each_with_index do |file, index|\n counter += file.videos.length\n file.write!(folder, index+1)\n end\n return counter\n end",
"def count_objects(key)\n\n puts \"Bucket: #{@bucket_name} - key: #{key}\\n\"\n\n files = @client.buckets[@bucket_name].\n objects.with_prefix(key)\n\n count = 0\n files.each do |o|\n count += 1\n end\n puts \"Count of files in #{@bucket_name}/#{key}: #{count}\"\n return count\n end",
"def bytes\n @bytes = 0\n @files.each do |file|\n @bytes += File.new(\"#{file}\").size\n end\n @bytes\n end",
"def get_file_count_from_response(response)\n response.values.map {|entry| entry[:total_files]}.reduce(&:+)\nend",
"def user_song_uploads_total\r\n self.user_song_uploads.count\r\n end",
"def size\n File.size(path)\n end",
"def added_files\n file_stats.count { |file| file.status == :added }\n end",
"def count_all_images(dir)\n perform_global_search('//img', [], dir)\n end",
"def size\n ::File.size(@path)\n end",
"def stat\n factory.system.dir_stat(@path)\n end",
"def send_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/send/).size\n end.sum\n end",
"def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_download_count( fs.id )\n }\n return sum\n end",
"def path_count(*args)\n path_rels(*args).size\n end",
"def filter \n # get files contained in the list and also in db\n # ==> files to eliminate\n count = 0\n f = @files.values.flatten(1)\n saved = @current_source.schema.filter_files f\n @files.keys.each do |folder|\n files = @files[folder]\n ocount = files.size\n files -= saved\n ncount = files.size\n @files[folder] = files\n Logger.<<(__FILE__,\"INFO\",\"Filtering (#{folder}) : #{ocount} => #{ncount}\")\n count += ncount\n end\n return count\n end",
"def is_directory?\n files.count > 1\n end",
"def word_count_a_file(file_path)\nend",
"def num_items\n backup_photo_albums.size\n end",
"def filesize\n File.size?(path)\n end",
"def size\n # return @file.size if @file.respond_to?(:size)\n File.size(self.path) rescue 0\n end",
"def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # to_i handles any nil file sizes\n end",
"def size(children: true)\n c_size = 0\n request = $postgres.exec_prepared('wsfile_size', [self.id])\n c_size += request[0].map{|k,v| v.to_i }.inject(:+)\n c_size += self.children.map{|child| child.size}.inject(:+) || 0 if children\n c_size\n end",
"def word_count_a_file(file_path)\n IO.read(file_path).split.length\nend",
"def line_count\n `wc -l public/HelloWorld.txt`.to_i\n end",
"def depth\n return 0 if %w(index 404).include?(self.fullpath)\n self.fullpath.split('/').size\n end",
"def deleted_files\n file_stats.count { |file| file.status == :deleted }\n end",
"def size\n if is_path?\n exists? ? File.size(path) : 0\n elsif @file.respond_to?(:size)\n @file.size\n elsif path\n exists? ? File.size(path) : 0\n else\n 0\n end\n end",
"def size(full_path)\n\t\t`du -s #{Rush.quote(full_path)}`.match(/(\\d+)/)[1].to_i\n\tend",
"def fulltree_count(*args)\n fulltree_rels(*args).size\n end"
] |
[
"0.85770965",
"0.80287963",
"0.80157185",
"0.78351307",
"0.7808689",
"0.77524316",
"0.77524316",
"0.77011675",
"0.75714916",
"0.7502841",
"0.74982953",
"0.74948597",
"0.74729097",
"0.73686343",
"0.7363276",
"0.7212741",
"0.70857286",
"0.7082247",
"0.70731115",
"0.69482607",
"0.69403636",
"0.6847808",
"0.6828545",
"0.68053794",
"0.67964673",
"0.67483234",
"0.67360264",
"0.6705791",
"0.669828",
"0.6678692",
"0.6647197",
"0.6640737",
"0.66340786",
"0.66114783",
"0.65795183",
"0.6556082",
"0.65202695",
"0.6513222",
"0.6506336",
"0.64581096",
"0.64445734",
"0.6426072",
"0.63904697",
"0.6375335",
"0.6368262",
"0.6352866",
"0.6347513",
"0.62925327",
"0.62896824",
"0.6287848",
"0.6229923",
"0.6227946",
"0.62187546",
"0.6216819",
"0.6216766",
"0.62101287",
"0.62052464",
"0.6188124",
"0.6179791",
"0.6174531",
"0.61582863",
"0.6156358",
"0.61373395",
"0.6123559",
"0.610038",
"0.6082803",
"0.60591054",
"0.60525936",
"0.6021686",
"0.5993595",
"0.5986698",
"0.5984257",
"0.59493977",
"0.5930131",
"0.5928632",
"0.5913113",
"0.5903434",
"0.58979535",
"0.58763397",
"0.5869582",
"0.5868292",
"0.5861627",
"0.5860033",
"0.5857175",
"0.58449066",
"0.5842311",
"0.5835821",
"0.5812663",
"0.580875",
"0.5799071",
"0.57935137",
"0.5791589",
"0.5762112",
"0.5754117",
"0.5752209",
"0.5726728",
"0.57219446",
"0.571937",
"0.5718611",
"0.5682216"
] |
0.6518612
|
37
|
Checks to see if the folder is a 'root' or home folder
|
def is_root?
root == id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_root?()\n @rootpath == @path\n end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def root?\n \tfolder_id.nil?\n end",
"def root?(path)\n \n root_objects = [\"gemfile\", \"procfile\", \"readme\"]\n current_objects = Dir[path + \"/*\"].map do |file|\n File.basename(file).downcase\n end\n dir = \"\"\n current_objects.each do |co|\n dir = (root_objects.include?(co) == true)? \"ROOT\" : \"NOT ROOT\"\n break if dir == \"ROOT\"\n end\n return true if dir == \"ROOT\"\n return false if dir == \"NOT ROOT\"\n \n end",
"def root?\n !self.hier? || self.path == '/' || self.path.to_s.empty?\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end",
"def home_path?(path)\n path[0] == ?~\n end",
"def root_folder?\n if new_record?\n material_folders.find(&:root?).present?\n else\n material_folders.find_by(parent: nil).present?\n end\n end",
"def root?\n !!@root || app_file?\n end",
"def root?\n is_root?(@path)\n end",
"def root?\n !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)\n end",
"def folder?\n return false if type.nil?\n \"folder\".casecmp(type).zero?\n end",
"def root?\n full_name.empty?\n end",
"def web_root? path\n path.start_with? SLASH\n end",
"def root?\n self.path == '/'\n end",
"def active_homedir_exists?( username )\n\t\t\thomedir = HOMEDIR_BASE + username\n\t\t\treturn homedir.directory?\n\t\tend",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def is_root?\n false\n end",
"def root_directory?(path)\n File.directory?(path) &&\n File.expand_path(path) == File.expand_path(File.join(path, \"..\"))\nend",
"def root?\n env[\"PATH_INFO\"] == '/'\n end",
"def is_public_root?\n false\n end",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def is_root?() @name === '__root__'; end",
"def validate_directory_structure\n return false unless File.exists? @root\n Find.find(@root) do |path|\n stat = File::Stat.new path\n return false unless stat.uid == OWNER and stat.gid == GROUP\n if File.directory? path\n return false unless stat.mode == DIRMODE\n else\n return false unless stat.mode == FILEMODE\n end\n end\n true\n end",
"def detect_home(set_if_missing=false)\n if(ENV['HOME'] && Pathname.new(ENV['HOME']).absolute?)\n ENV['HOME']\n else\n home = File.directory?('/root') && File.writable?('/root') ? '/root' : '/tmp'\n if(set_if_missing)\n ENV['HOME'] = home\n end\n home\n end\n end",
"def archived_homedir_exists?( username )\n\t\t\tarchived_homedir = ARCHIVE_BASE + username\n\t\t\treturn archived_homedir.directory?\n\t\tend",
"def directory?() end",
"def workspace_dir?(selection)\n selection == \"#{ws.root_dir}/\" || selection == \"#{ws.prefix_dir}/\"\n end",
"def home_dir(name=nil)\n username = (name || self.username)\n if (username == \"root\")\n \"/root\"\n else\n \"/home/#{username}\"\n end\n end",
"def root?; path == '' end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def folder?\n children.any?\n end",
"def file_inside_root?(full_path)\n full_path = File.expand_path full_path\n if full_path.match Regexp.new('^' + Regexp.escape(root_path))\n true\n else\n false\n end\n end",
"def root?\n true\n end",
"def root?\n true\n end",
"def folder_exists?\n empty_name?\n\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\") || File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\")\n print \"Directory `#{@name}` exists in #{LOCAL_PATH}. Pass a new name: \"\n elsif File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n print \"Directory `#{@name}.git` exists in #{REMOTE_PATH}. Pass a new name: \"\n end\n\n @name = gets.chomp\n folder_exists?\n end\n\n false\n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def starts_with_root_ui_entry?\n @data[16,4] == \"root\" or @data[32,4] == \"root\"\n end",
"def root?\n false\n end",
"def control_repo_root?(path = Dir.pwd)\n CONTROL_REPO_FILES.any? { |file| PDK::Util::Filesystem.file?(File.join(path, file)) }\n end",
"def root?\n Process.uid == 0\n end",
"def outside_configured_directory?(dir); end",
"def root?\n true\n end",
"def is_root?\n cmd_exec('/usr/bin/id -ru').eql? '0'\n end",
"def in_test_or_root_user\n if !current_user.sk.root?\n in_test\n end\n end",
"def ensure_root\n if self.root? and self.root_cfs_directory.blank?\n self.root_cfs_directory = self\n self.save!\n end\n true\n end",
"def root?\n @type == ROOT\n end",
"def find_root\n pwd = Dir.pwd\n if pwd.end_with? \"rootfs\"\n \"\" # analysing a supportconfig\n elsif pwd =~ %r{/nts_} && File.directory?(\"rootfs\")\n \"rootfs/\" # analysing a supportconfig\n elsif File.exist? \"/var/log/crowbar/install.log\"\n \"/\" # on an actual admin server\n else\n abort \"Couldn't find log files; aborting.\"\n end\nend",
"def exists?\n folder_location.present?\n end",
"def root?\n Process.uid.zero?\n end",
"def root?\n Process.uid.zero?\n end",
"def root_private?\n self.root.private?\n end",
"def exists?\n File.exists?(File.join(@root))\n end",
"def in_module_root?(path = Dir.pwd)\n PDK::Util::MODULE_FOLDERS.any? { |dir| PDK::Util::Filesystem.directory?(File.join(path, dir)) } ||\n PDK::Util::Filesystem.file?(File.join(path, 'metadata.json'))\n end",
"def root?\n false\n end",
"def check_root\n\t# Make sure we are running as root\n\tprint_status(\"Checking if running as root\")\n\tif Process.uid != 0\n\t\tprint_error(\"You are not running as Root!\")\n\t\texit\n\tend\n\t# Make sure we are running in Linux\n\tif not RUBY_PLATFORM =~ /linux/\n\t\tprint_error(\"This script only works in linux\")\n\t\texit\n\tend\nend",
"def is_root?()\n return (name.nil? and parent.nil?) \n end",
"def lib_root?\n false\n end",
"def root_valid?\n index_files = Dir[File.join(path, \"index.*\")].count\n return true if index_files > 0\n return false\n end",
"def root_path_match?\n url == '/'\n end",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def subfolders?\n !self.subfolders.nil?\n end",
"def root?\n root\n end",
"def bad_xcode_select_path?\n folder == \"/\"\n end",
"def has_share_access?(folder) \n\n # doesn't have share access if folder is nil (i.e., file is top-level)\n return false if folder.nil?\n\n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false \n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true \n end \n end \n \n return false \nend",
"def is_dir?(pristine)\n return pristine['is_dir'] if service.downcase.include? \"dropbox\"\n end",
"def root?\n ROOT == self\n end",
"def __detect_project_home__(path, li = '.lithium')\n path = File.expand_path(path)\n prev_path = nil\n while path && prev_path != path\n marker = File.join(path, li)\n break if File.directory?(marker) && File.exists?(marker)\n prev_path = path\n path = File.dirname(path)\n end\n return path != prev_path ? path : nil\nend",
"def root_public?\n self.root.public?\n end",
"def directory?\n !file?\n end",
"def current_directory?\n File.exist? current_directory\n end",
"def is_root_site?\n @depth == 0\n end",
"def fully_qualified_dir_path?(path)\n path[0, 1] == '/'\n end",
"def handle_user_directories(current_dir_name, path)\n return true unless current_dir_name == 'UTILISATEURS'\n return true if path.start_with?('.')\n\n admin_password = fetch_admin_password(path)\n print(\"#{'Entrez le mot de passe pour entrer dans le dossier'.underline}: \")\n user_input = $stdin.gets.chomp&.strip\n if user_input == admin_password\n puts \"Bienvenue #{path.split('_').first}\"\n true\n else\n puts 'ERREUR: Mauvais mot de passe !'.red\n false\n end\n end",
"def local_dir_exists?(full_path)\n File.directory?(full_path)\nend",
"def directory?\n case type\n when T_DIRECTORY then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def can_traverse?(user, path)\n return true if user == 'root'\n byme = File.stat(path).uid == -> { Etc.getpwnam(user).uid } && File.stat(path).mode & 64 == 64 # owner has x\n byus = File.stat(path).gid == -> { Etc.getpwnam(user).gid } && File.stat(path).mode & 8 == 8 # group has x\n byall = File.stat(path).mode & 1 == 1 # other has x\n byme || byus || byall\n end",
"def shared? \n \t!self.shared_folders.empty? \n\tend",
"def end_of_path?(dir, root = nil)\n dir.nil? || dir.empty? || dir == '.' || dir == root\n end",
"def accessing_outside_parent(path)\n base_path = Pathname.new(\"#{__dir__}/../ECOLE/ADMIN/admin\")\n pn = Pathname.new(path)\n return false if base_path.expand_path == pn.expand_path\n return false if pn.expand_path.to_s.start_with?(base_path.expand_path.to_s)\n\n true\n end",
"def git_root_till_home\n Pathname.new(Dir.pwd).ascend do |dir_pathname|\n return dir_pathname if File.directory?(\"#{dir_pathname}/.git\")\n return nil if dir_pathname.to_s == home_dir\n end\n end",
"def check_folder_ducktype(folder)\n raise 'folder must be a Pathname like object (ducktype)' unless folder.respond_to?(:join)\n end",
"def has_share_access?(folder) \n \n if(!folder) \n return true\n end \n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false\n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true\n end\n end\n \n return false\nend",
"def ensure_and_valid_root\n if root.empty?\n puts\n @root = prompt.ask('Path to redmine root:', required: true, default: 'redmine')\n end\n\n @root = File.expand_path(@root)\n\n unless Dir.exist?(@root)\n create_dir(@root)\n end\n\n logger.info(\"REDMINE_ROOT: #{@root}\")\n\n unreadable_files = []\n all_directories = []\n\n Find.find(@root).each do |item|\n if unreadable_files.size > CHECK_N_INACCESSIBLE_FILES\n break\n end\n\n # Installer only need read permission for a few files\n # but for sure it checks all of them\n if !File.readable?(item)\n unreadable_files << item\n next\n end\n\n # Actualy this permission should not be needed\n # becase deletable is checked by parent directory\n # if !File.writable?(item)\n # unreadable_files << item\n # end\n\n # Parent directory of the root can have any permission\n if item != @root\n all_directories << File.dirname(item)\n end\n end\n\n if unreadable_files.any?\n error \"Application root contains unreadable files. Make sure that all files in #{@root} are readable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{unreadable_files.join(', ')})\"\n end\n\n unwritable_directories = []\n\n all_directories.uniq!\n all_directories.each do |item|\n if !File.writable?(item)\n unwritable_directories << item\n end\n end\n\n if unwritable_directories.any?\n error \"Application root contains unwritable directories. Make sure that all directories in #{@root} are writable for user #{env_user} (limit #{CHECK_N_INACCESSIBLE_FILES} files: #{unwritable_directories.join(', ')})\"\n end\n end",
"def is_tyrant_root?( dir )\n cfg = File.join( dir, config_file_basename )\n if File.directory?( dir ) and File.exist?( cfg ) then\n IO.readlines( cfg ).each do |line|\n return true if line.index( MAGIC_LINE )\n end\n end\n return false\n end",
"def directory?\n kind == NODE_DIR\n end",
"def directory?(path)\n return File.directory? path\n rescue SystemCallError => e\n if Windows\n dir = ''\n cmd = \"if exist \\\"#{path}/*\\\" echo dir\"\n IO.popen(cmd) { |io| dir = io.read } # dir = \"dir\\n\" if target is a directory\n\n return !dir.empty?\n else\n # JRUBY's' File.directory? has a bug for checking folders with chinese(unicode) characters.\n # Do not raise exception if 'Unknown Error (20047)'.In our case\n # this means a folder already exists (I hope).\n raise unless e.message.match(/Unknown Error \\(20047\\)/)\n end\n end",
"def entry_directory?(entry)\n File.directory?(build_directory_location(entry)) \n end",
"def superior_to?(folder)\n @location.superior_to?(folder.location)\n end",
"def shared?\n \t!self.shared_folders.empty?\n end",
"def has_root?\n @root != nil\n end",
"def accessing_parent_of_admin(current_dir_name, path)\n return true if current_dir_name == 'admin' && path == '..'\n\n false\n end",
"def top_level_glob?(glob)\n !glob.include?('/') && !glob.include?('**')\n end",
"def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end",
"def lookup_root\n pwd = File.expand_path(Dir.pwd)\n home = File.expand_path('~')\n while pwd != '/' && pwd != home\n return pwd if ROOT_INDICATORS.any?{ |r| File.exist?(File.join(pwd, r)) }\n pwd = File.dirname(pwd)\n end\n return nil\n end",
"def root?\n @uid || @uid = fetch_uid\n end",
"def can_mkdir?(path)\n #return false unless Process.uid == FuseFS.reader_uid\n base, rest = split_path(path)\n case\n when base.nil?\n false\n when rest.nil?\n ! (@subdirs.has_key?(base) || @files.has_key?(base))\n when ! @subdirs.has_key?(base)\n false\n else\n @subdirs[base].can_mkdir?(rest)\n end\n end",
"def in_drupal_root?\n File.exist?(File.expand_path('modules/system/system.module'))\nend",
"def mountpoint?\n begin\n stat1 = expand_tilde.lstat\n stat2 = expand_tilde.parent.lstat\n stat1.dev == stat2.dev && stat1.ino == stat2.ino ||\n stat1.dev != stat2.dev\n rescue Errno::ENOENT\n false\n end\n end",
"def has_share_access?( folder )\n\n return false if folder.nil?\n\n # has share access if the folder is one of his own\n return true if self.folders.include?( folder )\n\n #has share access if the folder is one of the shared_folders_by_others\n return true if self.shared_folders_by_others.include?( folder )\n\n # for checking sub_folders under one of the being_shared_folders\n return value = false\n\n folder.ancestors each do |ancestor_folder|\n return_value = self.being_shared_folders.include?( ancestor_folder )\n if return_value # if it's true\n return true\n end\n end\n\n return false\n end",
"def has_share_access?(folder) \n \t#has share access if the folder is one of one of his own \n \treturn true if self.folders.include?(folder) \n \n \t#has share access if the folder is one of the shared_folders_by_others \n \treturn true if self.shared_folders_by_others.include?(folder) \n \n \t#for checking sub folders under one of the being_shared_folders \n \treturn_value = false\n print folder\n \tfolder.ancestors.each do |ancestor_folder| \n \n \t\treturn_value = self.shared_folders_by_others.include?(ancestor_folder) \n \t\tp ancestor_folder \n if return_value #if it's true \n \t\treturn true\n \t\tend\n \tend\n \n \treturn false\n\tend"
] |
[
"0.7635429",
"0.7603582",
"0.7402844",
"0.72816133",
"0.7264885",
"0.71866584",
"0.70869243",
"0.70226663",
"0.70019364",
"0.6995364",
"0.6962513",
"0.6954728",
"0.6926277",
"0.68727416",
"0.68653464",
"0.6791847",
"0.67270875",
"0.67032766",
"0.66695434",
"0.6658272",
"0.66545576",
"0.66095155",
"0.66059536",
"0.6556065",
"0.65078133",
"0.64960045",
"0.6490647",
"0.64739454",
"0.6464362",
"0.6446471",
"0.6445906",
"0.6444337",
"0.6439384",
"0.6402824",
"0.6402824",
"0.64011896",
"0.63449717",
"0.63287306",
"0.6309857",
"0.63085026",
"0.62934524",
"0.629283",
"0.62727726",
"0.6268443",
"0.62609434",
"0.6253325",
"0.62478095",
"0.62475765",
"0.6243561",
"0.62139624",
"0.62139624",
"0.61895794",
"0.6183613",
"0.6181922",
"0.6178307",
"0.61744386",
"0.6168866",
"0.61473924",
"0.6137018",
"0.61355466",
"0.6132037",
"0.6120521",
"0.6118294",
"0.6105048",
"0.6104503",
"0.6083861",
"0.60766536",
"0.6056263",
"0.6047821",
"0.60455096",
"0.6038417",
"0.60284334",
"0.60256195",
"0.60118115",
"0.60080665",
"0.59898853",
"0.5981857",
"0.59696335",
"0.5964829",
"0.59642804",
"0.59636426",
"0.59612393",
"0.5959878",
"0.5952604",
"0.5948619",
"0.5942619",
"0.59393346",
"0.5927922",
"0.592681",
"0.5926014",
"0.59212404",
"0.59103024",
"0.59089094",
"0.5908493",
"0.5908372",
"0.5898881",
"0.5893887",
"0.58932954",
"0.5885594",
"0.5878532",
"0.5874615"
] |
0.0
|
-1
|
Checks if the folder is shared
|
def shared?
!self.shared_folders.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shared? \n \t!self.shared_folders.empty? \n\tend",
"def has_share_access?(folder)\n return false if folder.nil?\n return true if self.folders.include?(folder)\n return true if self.shared_folders_by_others.include?(folder)\n \n unless folder.nil?\n folder.ancestors.each do |ancestor_folder|\n return true if self.being_shared_folders.include?(ancestor_folder)\n end\n end\n return false\n end",
"def has_share_access?(folder) \n \n if(!folder) \n return true\n end \n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false\n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true\n end\n end\n \n return false\nend",
"def has_share_access?( folder )\n\n return false if folder.nil?\n\n # has share access if the folder is one of his own\n return true if self.folders.include?( folder )\n\n #has share access if the folder is one of the shared_folders_by_others\n return true if self.shared_folders_by_others.include?( folder )\n\n # for checking sub_folders under one of the being_shared_folders\n return value = false\n\n folder.ancestors each do |ancestor_folder|\n return_value = self.being_shared_folders.include?( ancestor_folder )\n if return_value # if it's true\n return true\n end\n end\n\n return false\n end",
"def has_share_access?(folder) \n \t#has share access if the folder is one of one of his own \n \treturn true if self.folders.include?(folder) \n \n \t#has share access if the folder is one of the shared_folders_by_others \n \treturn true if self.shared_folders_by_others.include?(folder) \n \n \t#for checking sub folders under one of the being_shared_folders \n \treturn_value = false\n print folder\n \tfolder.ancestors.each do |ancestor_folder| \n \n \t\treturn_value = self.shared_folders_by_others.include?(ancestor_folder) \n \t\tp ancestor_folder \n if return_value #if it's true \n \t\treturn true\n \t\tend\n \tend\n \n \treturn false\n\tend",
"def has_share_access?(folder) \n\n # doesn't have share access if folder is nil (i.e., file is top-level)\n return false if folder.nil?\n\n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false \n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true \n end \n end \n \n return false \nend",
"def shareable?(share_with)\n str = @asset.shared_with.to_s\n a = str.split(\",\")\n #Ensures that the file isn't being shared to ones self\n if share_with == current_user.id\n return false\n end\n #Ensures that the file isn't being shared to someone it has already been shared to.\n 0.upto(a.length-1) do |x|\n if a[x].to_i == share_with\n return false\n end\n end\n return true\n end",
"def shared?\n sharing != 'none'\n end",
"def shared?\n sharing != 'none'\n end",
"def belongs_to_me? file\n #The only difference between shared files that have been added to your Drive\n #and those that haven't is that those that have have a file path (parents)\n return true if @config['sync_shared_in_drive'] and file.parents != nil and file.parents != []\n file.shared_with_me_time.nil? and file.owners != nil and file.owners.select{|owner| owner.me}.count > 0\n end",
"def shared?\n self[:filename].nil? or self[:filename].start_with? \"content/\"\n end",
"def is_shared? \n if self.library_entries.where(shared: true).empty?\n return false\n else \n return true\n end \n end",
"def is_shareable?\n true\n end",
"def is_shared\n return @is_shared\n end",
"def share?\n\t\t!Rails.env.development? and do_share && can_share?\n\tend",
"def shared?\n @shared ||= options[:shared]\n end",
"def shared?\n !self.shared_assets.empty?\nend",
"def shared_folders\n manifest[:shared_folders]\n end",
"def using_nfs?\n !!synced_folders(@machine)[:nfs]\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def shared_access_allowed\n @settings.get_value(\"Shared Access\") == \"true\"\n end",
"def can_share\n return @can_share\n end",
"def can_share?\n can?('s')\n end",
"def already_shared(user_id, file_id)\n if $db.execute(\"SELECT * FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id) != []\n return true\n end\n return false\nend",
"def share_folders(folders)\n end",
"def share\n @share ? @share : 'yes'\n end",
"def share_folders(prefix, folders)\n folders.each do |type, local_path, remote_path|\n if type == :host\n env[:machine].config.vm.share_folder(\n \"v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}\",\n remote_path, local_path, :nfs => config.nfs)\n end\n end\n end",
"def shared?\n !self.native? & (self.fb_object_id != FBSharing::Underway) \n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def private?\n self.public_folders.empty?\n end",
"def shared?\n\t\tself.project_groups.count > 1\n\tend",
"def sharing?\r\n App.sharing? && params[:partner_style] != \"ros\"\r\n end",
"def shared?\n @roomer_scope == :shared\n end",
"def share_folder(location, name, box)\n if location\n box.vm.share_folder(name, name, location, :nfs => true)\n end\nend",
"def is_shared=(value)\n @is_shared = value\n end",
"def share_folders(machine, folders, transient)\n defs = []\n warn_user_symlink = false\n\n folders.each do |id, data|\n hostpath = data[:hostpath]\n if !data[:hostpath_exact]\n hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath)\n end\n\n enable_symlink_create = true\n\n if ENV['VAGRANT_DISABLE_VBOXSYMLINKCREATE']\n enable_symlink_create = false\n end\n\n unless data[:SharedFoldersEnableSymlinksCreate].nil?\n enable_symlink_create = data[:SharedFoldersEnableSymlinksCreate]\n end\n\n warn_user_symlink ||= enable_symlink_create\n\n # Only setup the shared folders that match our transient level\n if (!!data[:transient]) == transient\n defs << {\n name: os_friendly_id(id),\n hostpath: hostpath.to_s,\n transient: transient,\n SharedFoldersEnableSymlinksCreate: enable_symlink_create,\n automount: !!data[:automount]\n }\n end\n end\n\n if warn_user_symlink\n display_symlink_create_warning(machine.env)\n end\n\n driver(machine).share_folders(defs)\n end",
"def share_folders(folders)\n folders.each do |folder|\n # Add the shared folder\n execute_prlctl('set', @uuid,\n '--shf-host-add', folder[:name],\n '--path', folder[:hostpath])\n end\n end",
"def exists?\n folder_location.present?\n end",
"def not_currently_shared\n return false unless Share.where(recipient: recipient, user: user, birth_record: birth_record).kept.any?\n\n errors.add(:recipient, 'is currently shared with this entity')\n end",
"def has_shared?(shareable)\n if shareable.is_a?(Journal)\n return shares.journals.pluck(:shareable_id).include?(shareable.id)\n elsif shareable.is_a?(Submission)\n return shares.submissions.pluck(:shareable_id).include?(shareable.id)\n end \n end",
"def public?\n !self.public_folders.empty?\n end",
"def users_for_shared_access\n errors.add(:access, :share_project) if self[:access] == \"Shared\" && !self.permissions.any?\n end",
"def render_sharing?\n true\n end",
"def member_of_shared_to? \r\n shared_to = self.shared_to_type.constantize.find(self.shared_to_id)\r\n User.find(self.user_id).groups.include?(shared_to) ? true : false\r\n end",
"def folder_exists?\n empty_name?\n\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\") || File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\")\n print \"Directory `#{@name}` exists in #{LOCAL_PATH}. Pass a new name: \"\n elsif File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n print \"Directory `#{@name}.git` exists in #{REMOTE_PATH}. Pass a new name: \"\n end\n\n @name = gets.chomp\n folder_exists?\n end\n\n false\n end",
"def users_for_shared_access\n errors.add(:access, :share_account) if self[:access] == \"Shared\" && !self.permissions.any?\n end",
"def outside_configured_directory?(dir); end",
"def clear_shared_folders\n end",
"def own_shared_to?\r\n shared_to = self.shared_to_type.constantize.find(self.shared_to_id)\r\n shared_to.user_id == self.user_id ? true : false\r\n end",
"def share_directory dir\n path = Pathname.new(dir).expand_path\n @shared_directories << path unless @shared_directories.include? path\n\n # This takes awhile so don't block the reactor\n EventMachine.defer { run_update path }\n end",
"def can_share?\n\t\tprovider.in? [\"facebook\", \"twitter\", \"lastfm\"]\n\tend",
"def fs_remote?(mount)\n fs_type(mount) == 'nfs'\n end",
"def check_fields_nas_domain?\n return false if @fields[:share] == \"Google\" # File Listing\n return false if @fields[:src_sharename] == \"Google\" || @fields[:dst_sharename] == \"Google\" # File Copy/Move\n return false if @fields[:sharename] == \"Google\" # File Deletion\n return true\n end",
"def device_sharing_allowed\n return @device_sharing_allowed\n end",
"def dir_exists?(path)\n begin\n @meta_data = @client.stat(path)\n if (@meta_data[\"type\"] == \"DIRECTORY\")\n return true\n else\n return false\n end\n rescue\n return false\n end \n end",
"def static_shares?\n dependencies.all? { |dep| node.input.key?(dep) }\n end",
"def accessible?\n workdir.executable? && workdir.readable?\n end",
"def shared_path\n @shared_path ||= @deploy_to + '/shared'\n end",
"def has_access_to_file(file_id, user_id)\n if get_all_user_data(user_id).first[\"rank\"] >= 1\n return true\n end\n \n owner_id = $db.execute(\"SELECT owner_id FROM files WHERE file_id = ?\", file_id).first[\"owner_id\"]\n if owner_id == user_id\n return true\n end\n\n shared_users = $db.execute(\"SELECT user_id FROM shared_files WHERE file_id = ?\", file_id)\n shared_users.each do |user|\n if user[\"user_id\"] == user_id\n return true\n end\n end\n return false\nend",
"def folder_exists?(path, site_path=nil)\n url = computed_web_api_url(site_path)\n path = [site_path, path].compact.join('/')\n url = uri_escape \"#{url}GetFolderByServerRelativeUrl('#{path}')\"\n easy = ethon_easy_json_requester\n easy.http_request(url, :get)\n easy.perform\n easy.response_code == 200\n end",
"def has_local_match?(files)\n files.each do |file|\n return true if self.drive_path == file.sub_path\n end\n false\n end",
"def isSharingWith(user)\n friends.where(:id => user.id).exists?\n end",
"def shared_folders\n {}.tap do |result|\n @env[:machine].config.vm.synced_folders.each do |id, data|\n # Ignore NFS shared folders\n next if !data[:type] == :nfs\n\n # This to prevent overwriting the actual shared folders data\n result[id] = data.dup\n end\n end\n end",
"def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end",
"def set_sharedfolder\n @sharedfolder = Sharedfolder.find(params[:id])\n end",
"def may_share_document?(document=nil)\n\t\t\tdocument && ( \n\t\t\t\tself.is_administrator? ||\n\t\t\t\t( document.owner && self == document.owner ) \n\t\t\t)\n\t\tend",
"def configure_shared_folders(config, shared_folders)\n shared_folders.each do |name, folder|\n config.vm.synced_folder folder['host_path'], folder['vm_path'], mount_options: ['dmode=777,fmode=777'], create: true\n end\n end",
"def nfs?\n false\n end",
"def has_repoman_direct_access?\n self[:repo_manager_direct_access]\n end",
"def directory?() end",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def manage_symlink_access?\n false\n end",
"def manage_symlink_access?\n false\n end",
"def owned?(path)\n info = Private.info_with(path, GLib::G_FILE_ATTRIBUTE_OWNER_USER)\n owner = GLib.g_file_info_get_attribute_string(info, GLib::G_FILE_ATTRIBUTE_OWNER_USER)\n owner == GLib.g_get_user_name()\n end",
"def archived_homedir_exists?( username )\n\t\t\tarchived_homedir = ARCHIVE_BASE + username\n\t\t\treturn archived_homedir.directory?\n\t\tend",
"def browse\n \t# first find the current folder within own folders\n \t@current_folder = current_user.folders.find_by_id(params[:folder_id])\n \t@is_this_folder_being_shared = false if @current_folder # just an instance variable to help hiding buttons on view\n\n # if not found in own folders, find it in being_shared_folders\n if @current_folder.nil?\n folder = Folder.find_by_id(params[:folder_id])\n \n @current_folder ||= folder if current_user.has_share_access?(folder)\n @is_this_folder_being_shared = true if @current_folder # just an instance variable to help hiding buttons on view\n end\n\n \tif @current_folder\n # if under a sub-folder, we shouldn't see shared folders\n @being_shared_folders = []\n\n \t #getting the folders which are inside this @current_folder\n \t @folders = @current_folder.children\n\n \t #We need to fix this to show files under a specific folder if we are viewing that folder\n \t @assets = @current_folder.assets.order(\"uploaded_file_file_name desc\")\n\n \t render :action => \"index\"\n \telse\n \t flash[:error] = \"Don't be cheeky! Mind your own folders!\"\n \t redirect_to root_url\n \tend\n end",
"def reshare dir, host\n if File.exist? \"#{dir}/#{host}/.completed\"\n `share -F nfs -o ro=#{host},anon=0 #{dir}/#{host} > /dev/null 2>&1`\n end\nend",
"def may_exist?\n\t\t\t\texist? or symlink?\n\t\t\tend",
"def for_share\n lock_style(:share)\n end",
"def root?\n \tfolder_id.nil?\n end",
"def workspace_dir?(selection)\n selection == \"#{ws.root_dir}/\" || selection == \"#{ws.prefix_dir}/\"\n end",
"def folder?\n children.any?\n end",
"def can_share=(value)\n @can_share = value\n end",
"def subfolders_locked?\n @attributes[:subfolders_locked?]\n end",
"def source_is_local?\n File.directory?(@source)\n end",
"def folder?\n return false if type.nil?\n \"folder\".casecmp(type).zero?\n end",
"def check_and_assign_shared_ids_to_shared_folders\n shared_folders = SharedFolder.find_all_by_shared_email(self.email)\n if ! shared_folders.empty?\n shared_folders.each do |shared_folder|\n shared_folder.shared_user_id = self.id\n shared_folder.save\n end\n # if the account has shared folders they were invited, so they\n # don't need administrative activation.\n logger.info \"ACTIVATING ACCOUNT: #{email} has shared folders\"\n self.account_active = 1\n self.save!\n end \n end",
"def available?\n path.directory?\n end",
"def preserve_folder(aReleaseFolder,aSharedFolder)\t\n\t\taReleaseFolder = File.join(release_path,aReleaseFolder)\n\t\taSharedFolder = File.join(shared_path,aSharedFolder)\n\t\trelease_exists = file_exists?(aReleaseFolder)\n\t\tshared_exists = file_exists?(aSharedFolder)\n\t\tif shared_exists\n\t\t\trun \"rm -rf #{aReleaseFolder}\" if release_exists\n\t\telse\n\t\t\trun \"mv #{aReleaseFolder} #{aSharedFolder}\" if release_exists\n\t\tend\n\t\tensure_link(\"#{aSharedFolder}\",\"#{aReleaseFolder}\",nil,\"#{user}:#{apache_user}\")\n\tend",
"def exist?\n File.directory? @full_path\n end",
"def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end",
"def symlink_outside_site_source?(entry); end",
"def folders_list?\n 'crew,confirm_payment_asaas,confirm_payment'\n end",
"def mountpoint?\n begin\n stat1 = self.lstat\n stat2 = self.parent.lstat\n stat1.dev == stat2.dev && stat1.ino == stat2.ino ||\n stat1.dev != stat2.dev\n rescue Errno::ENOENT\n false\n end\n end",
"def is_managed?(path)\n # Short circuit if the directory is not present\n return false unless File.directory?(path)\n\n git = Facter::Core::Execution.which('git')\n svn = Facter::Core::Execution.which('svn')\n\n Dir.chdir(path) do\n if git\n %x{#{git} ls-files . --error-unmatch &> /dev/null}\n\n return true if $?.success?\n end\n\n if svn\n %x{#{svn} info &> /dev/null}\n\n return true if $?.success?\n end\n end\n\n return false\nend",
"def folder_exists_in_audio?(folder_name)\n `ls audio/ | grep #{folder_name}`.chomp.length > 0\n end",
"def drive_connected?(path)\n drive_path = $cached_drive_paths.keys.find { |p| path.start_with?(p) }\n return $cached_drive_paths[drive_path] if drive_path && $cached_drive_paths[drive_path]\n drive_path = Pathname.new(path).descend.take(3).fetch(2, path).to_s\n\n exists = File.exist?(drive_path) && File.directory?(drive_path)\n $cached_drive_paths[drive_path] = exists if drive_path != path\n exists\nend",
"def check_fields_google_domain?\n return true if @fields[:share] == \"Google\" # File Listing\n return true if @fields[:src_sharename] == \"Google\" && @fields[:dst_sharename] == \"Google\" # File Copy/Move\n return true if @fields[:sharename] == \"Google\" # File Deletion\n return false\n end",
"def init_shared_folder(config, settings)\n\n if settings['shared_folder_type'] == \"rsync\"\n # args: do not copy symlinks\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"rsync\",\n rsync__exclude: settings['rsync_exclude'],\n rsync__chown: true,\n rsync__args: [\"--verbose\", \"--archive\", \"--delete\", \"-z\"]\n else\n config.vm.synced_folder \"../../\", \"/vagrant\", type: \"nfs\", mount_options: [\"rw\", \"tcp\", \"nolock\", \"async\"], nfs_udp: false\n config.nfs.map_uid = Process.uid\n config.nfs.map_gid = Process.gid\n end\n\nend",
"def is_directory?\n files.count > 1\n end"
] |
[
"0.84485424",
"0.78783685",
"0.7725481",
"0.76962864",
"0.76598984",
"0.7588193",
"0.73082435",
"0.72057045",
"0.71458274",
"0.71205026",
"0.7097011",
"0.6978434",
"0.6955756",
"0.68979573",
"0.6827829",
"0.6822201",
"0.6806507",
"0.67288357",
"0.6699674",
"0.6632166",
"0.6610354",
"0.65497094",
"0.65299565",
"0.65127057",
"0.65119094",
"0.64717704",
"0.639434",
"0.63454187",
"0.63325167",
"0.6233572",
"0.62211674",
"0.61649424",
"0.6141938",
"0.6123834",
"0.61120516",
"0.6096075",
"0.6090293",
"0.6041159",
"0.60251135",
"0.60245067",
"0.6012461",
"0.59742916",
"0.5967633",
"0.593598",
"0.59177655",
"0.5910889",
"0.59066147",
"0.58790797",
"0.5876269",
"0.58396626",
"0.5838034",
"0.5834311",
"0.5828393",
"0.5828059",
"0.58158773",
"0.5774765",
"0.57730955",
"0.57584316",
"0.5753213",
"0.57428026",
"0.5721842",
"0.57174957",
"0.57087535",
"0.5707256",
"0.57056284",
"0.5694467",
"0.56840533",
"0.56803024",
"0.5668213",
"0.56669134",
"0.5655779",
"0.5645342",
"0.5645342",
"0.56443757",
"0.56360126",
"0.56355447",
"0.56324774",
"0.562998",
"0.56288123",
"0.56197125",
"0.56120545",
"0.56061095",
"0.55878305",
"0.55867505",
"0.5571124",
"0.5568778",
"0.5553168",
"0.55512744",
"0.5546773",
"0.5546648",
"0.5519204",
"0.5519061",
"0.5518709",
"0.5518488",
"0.5509602",
"0.5502961",
"0.55008703",
"0.54973817",
"0.5488144",
"0.5487515"
] |
0.8503409
|
0
|
Checks if the folder is public
|
def public?
!self.public_folders.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private?\n self.public_folders.empty?\n end",
"def is_public?\n is_public == true && requires_login == false\n end",
"def root_public?\n self.root.public?\n end",
"def is_public?\n @status == \"public\"\n end",
"def is_public?\n @status == \"public\"\n end",
"def is_public?\n true\n end",
"def is_public?(file)\n return file =~ %r{^([^/]*/)?(solution|software-tests(?!/public))/}\n end",
"def is_public_root?\n false\n end",
"def public?\n @public\n end",
"def open_to_public?\n request.subdomains.first != 'admin'\n end",
"def fully_public?\n public && public_write\n end",
"def public?\n # If it's not in a group, it's public\n if group\n !group.private\n else\n true\n end\n end",
"def is_public?\n return @uti.start_with?(\"public.\")\n end",
"def is_public?\n self.is_public\n end",
"def is_public?\n return true if self.statut == \"public\"\n end",
"def public?\n self.mode == PUBLIC\n end",
"def public?\n status == Status::PUBLIC\n end",
"def public?\n # first line just for formatting\n false || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ } || \\\n bucket_policy.any? { |s| s.effect == \"Allow\" && s.principal == \"*\" }\n end",
"def public?\n self.privacy == PUBLIC\n end",
"def public?\n !private?\n end",
"def public_folder\n @public_folder ||= 'public'\n end",
"def public_user?\n \tcurrent_user.username.eql? \"public_user\"\n end",
"def public?\n parsed {\n @status == 'Public'\n }\n end",
"def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end",
"def public_folder\n @options[:public] || @options[:root]\n end",
"def public?( revset=nil )\n\t\treturn self.phase( revset ).values.all?( :public )\n\tend",
"def open_to_public?\n allow_external_students? || allow_external_volunteers?\n end",
"def public?\r\n is_live and !priv? and !draft?\r\n end",
"def publicly_viewable(path)\n %w(disclaimer about copyright privacy editorial users)\n .include?(path.split('/').first) || path.blank?\n end",
"def include_public_users?\n true\n end",
"def check_if_public_user\n if session[:public_user]\n session[:public_user] = nil\n session[:user_id] = nil\n flash[:notice] = \"RESTRICTED: You do not have access\"\n redirect_to controller: :access, action: :user_menu\n false\n end\n end",
"def is_publicly_visible?\n return false if visibility.nil?\n return( visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC )\n end",
"def public?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"public\" : true\n end",
"def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end",
"def trip_is_public(trip, user)\n if (logged_in? and user.id == current_user.id) # User always sees his/her own trips\n return true\n else\n if trip.is_public == 1 # When browsing to other users page, user only sees public trips\n return true\n else\n return false\n end\n end\n end",
"def will_serve_file?(file_path)\n file_path.include?(\"/public\")\n end",
"def publishable?(user)\n user.present? && !public?\n end",
"def public?\n !private\n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def public?\n return true if @public_key\n \n load_public_key\n !@public_key.nil?\n end",
"def public_requested?\r\n return (self.public_status == PUBLIC_STATUS_REQUESTED) ? true : false\r\n end",
"def public?\n category_tree.include?(Sfcatnode.root)\n end",
"def root_private?\n self.root.private?\n end",
"def public?\n return true unless @public_key.nil?\n \n load_public_key\n !@public_key.nil?\n end",
"def public?(time = Time.current)\n already_public_for?(time) && still_public_for?(time)\n end",
"def claim_public?\n @current_user.nil?\n end",
"def show\n\t\tnot_found\tunless for_public?\n\tend",
"def downloadable?\n return false unless respond_to?(:downloadable)\n return visible? && public_readable_state? if downloadable.nil?\n return false unless visible?\n\n downloadable&.include?(\"public\")\n end",
"def published?\n [:public, :private].include?(self.status)\n end",
"def command_query_is_public?\n unless can_view_queries?\n flash[:warning] = \"The user command's queries are private. \"\n redirect_to public_user_command_path(@user_command)\n return false\n end\n true\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def is_protected?\n is_public == true && requires_login == true\n end",
"def public_is_false\n return if public_domain.present?\n self.public_domain = false\n true\n end",
"def public_is_false\n return if public_domain.present?\n self.public_domain = false\n true\n end",
"def has_public_profile?\n is_visible? && (show_profile == Visibility::PUBLIC)\n end",
"def can_access?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n unless user.projects.include?(project) or project.visibility == \"Public\"\n redirect_to root_url, :notice => \"You're not authorized to access this project!\"\n end\n elsif project.visibility != \"Public\"\n redirect_to root_url, :notice => \"You're not authorized to access this project!\"\n end\n end",
"def requested_public_url?\n request.env['PATH_INFO'].ends_with?('/desktop_client/version')\n end",
"def stop_if_public\n return true if destroyable_even_if_public\n @media_element = Valid.get_association self, :id\n if @media_element.try(:is_public)\n errors.add :is_public, :undestroyable\n false\n else\n true\n end\n end",
"def accessible?\n admin? || owner? || @project.is_open_source?\n end",
"def public?\n ( new_record? ? username : username_was ) == 'Public'\n end",
"def is_private?\n is_public == false || (is_public == false && requires_subscription == true)\n end",
"def enforce_public\n return unless current_user\n\n Rails.logger.info('Authenticated user accessing public page - redirecting to dashboard')\n redirect_to dashboard_url\n end",
"def public_health?\n has_role?(:public_health)\n end",
"def public_bookmarks\n @public_bookmarks ||=\n Bookmark.with_missing_bookmarkable.or(\n Bookmark.with_bookmarkable_visible_to_all\n ).is_public\n end",
"def check_public_section\n #redirect_to dashboard_path if (Rails.env == 'production' && action_name == 'index')\n end",
"def organization_public_member?(org, username)\n boolean_request :get, \"/orgs/#{org}/public_members/#{username}\"\n end",
"def is_private?\n ! is_public?\n end",
"def is_private?\n ! is_public?\n end",
"def is_editable?\n is_public\n end",
"def has_share_access?(folder)\n return false if folder.nil?\n return true if self.folders.include?(folder)\n return true if self.shared_folders_by_others.include?(folder)\n \n unless folder.nil?\n folder.ancestors.each do |ancestor_folder|\n return true if self.being_shared_folders.include?(ancestor_folder)\n end\n end\n return false\n end",
"def public\n public_files = []\n files = session[:user].x_files.all(public: true)\n files.each do |file|\n public_files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: public_files, success: true }\n end",
"def private_visibility?\n try(:read_groups).blank?\n end",
"def is_published?\n if !@is_admin || !@is_editor\n redirect_to root_path if !@page.published?\n end\n end",
"def public?\r\n restriction_level == Relationshiptype.everyone\r\n end",
"def show_public\n success = false\n\n if params.key?(:link_uuid)\n public_link = PublicLink.find_by(link_uuid: params[:link_uuid])\n\n success = public_link and @file.project_id == public_link.project_id\n end\n\n if success\n render json: @file, serializer: FileSerializer, :root => \"file\"\n else\n render_error\n end\n end",
"def static_file?(path_info)\n return unless public_dir = settings.public_folder\n public_dir = File.expand_path(public_dir)\n path = File.expand_path(public_dir + unescape(path_info))\n return unless path.start_with?(public_dir)\n return unless File.file?(path)\n return path\n end",
"def is_public?\n !@@hide_status_choices.include?(self.status)\n end",
"def publicly_available?\n return false unless access_rights.present?\n\n access_rights.none? do |value|\n value == 'deny' || %w[allow:icus allow:pdus].include?(value)\n end\n end",
"def response_publicly_cached?\n !!(response.cache_control[:public])\n end",
"def has_access?\n true\n end",
"def has_access?\n true\n end",
"def can_publish?\n !user.discourse_username.empty?\n end",
"def requires_public_permissions?\r\n in_inbox? || (self.is_a?(Album) && album_item_in_inbox?)\r\n end",
"def is_in_admin_view\n !request.path.match(\"/admin\").nil?\n end",
"def is_in_admin_view\n !request.path.match(\"/admin\").nil?\n end",
"def root\n 'public'\n end",
"def make_permission_public(name)\n permission(name).is_public\n end",
"def check_access\n if current_user.nil? or !current_user.is_admin?\n flash[:error] = t('no_access')\n redirect_to :root\n return false\n end\n end",
"def published?\n is_public && pcp_step.released?\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def can_view_or_not_private?( id )\n if private?\n acl.has_permission?( id, AlbumACL::VIEWER_ROLE)\n else\n true\n end\n end",
"def publicized_organization_member?(org_name)\n members = github_request(\"orgs/#{org_name}/public_members\")\n members.map { |org| org[\"login\"] }.include?(login)\n rescue RestClient::Forbidden, RestClient::Unauthorized, RestClient::ResourceNotFound => e\n false\n end",
"def authenticated?\n return true if @client.folders.count\n rescue Viewpoint::EWS::Errors::UnauthorizedResponseError\n return false\n end",
"def public_path; end",
"def public_path; end",
"def public_path; end",
"def is_visible?(path)\n File.basename(path)[0] != '.'\n end",
"def set_public\n file = session[:user].x_files.get(params[:id])\n # first check if it exist and if it synchronized then => error\n raise RequestError.new(:bad_param, \"Can not set a synchronized file as public\") if file && file.user != session[:user]\n # second if it not exist take a look into the shared_to_me files\n file = session[:user].x_files_shared_to_me.get(params[:id]) unless file\n # thrid if it still does not exist => error\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n # fourth check for root folder OR not uploaded\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not set the root folder as public\") if file.id == session[:user].root_folder.id\n\n file.public = true if params[:public] == \"true\"\n file.public = false if params[:public] == \"false\"\n file.save\n @result = { file: file.description(session[:user]), success: true }\n end",
"def subdir_is_writable?\n Medium.path_is_writeable?(thumbnail_path)\n end",
"def public_path\n application && Pathname.new(application.paths[\"public\"].first)\n end"
] |
[
"0.81339365",
"0.7830179",
"0.770985",
"0.75022835",
"0.75022835",
"0.7498561",
"0.74536574",
"0.743142",
"0.7347058",
"0.732532",
"0.7320422",
"0.7311843",
"0.73076993",
"0.7279272",
"0.72162926",
"0.7105144",
"0.70732546",
"0.70480096",
"0.69759923",
"0.6965689",
"0.69637185",
"0.689635",
"0.68704087",
"0.6862878",
"0.6837564",
"0.67981803",
"0.6785315",
"0.6782099",
"0.67236996",
"0.6706494",
"0.6679785",
"0.66500354",
"0.6628564",
"0.66004115",
"0.6538853",
"0.6527927",
"0.6527586",
"0.65045303",
"0.6498129",
"0.64823455",
"0.6470423",
"0.6427425",
"0.6408746",
"0.6400703",
"0.63453794",
"0.633857",
"0.6321644",
"0.6308356",
"0.62804943",
"0.6279092",
"0.6275457",
"0.6260087",
"0.62540555",
"0.62540555",
"0.62140256",
"0.6209638",
"0.6182474",
"0.617936",
"0.6178242",
"0.616923",
"0.6164473",
"0.61640865",
"0.61593825",
"0.6154953",
"0.6123049",
"0.61222523",
"0.611064",
"0.611064",
"0.6103345",
"0.6090804",
"0.60876894",
"0.6079978",
"0.607656",
"0.6069612",
"0.6059279",
"0.6049045",
"0.6048733",
"0.6048482",
"0.6047556",
"0.60449594",
"0.60449594",
"0.60372835",
"0.6031118",
"0.60265887",
"0.60265887",
"0.6025909",
"0.6024568",
"0.6017773",
"0.60139304",
"0.60101324",
"0.60082567",
"0.5989317",
"0.5977217",
"0.5973795",
"0.5973795",
"0.5973795",
"0.59675765",
"0.59624416",
"0.59464985",
"0.5943418"
] |
0.8432387
|
0
|
Checks to see if the folder is private. (not public)
|
def private?
self.public_folders.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_private?\n ! is_public?\n end",
"def is_private?\n ! is_public?\n end",
"def public?\n !self.public_folders.empty?\n end",
"def root_private?\n self.root.private?\n end",
"def is_private?\n is_public == false || (is_public == false && requires_subscription == true)\n end",
"def is_private?\n return true if visibility.nil?\n return( visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE && !is_under_embargo?)\n end",
"def private?\n @private\n end",
"def private?\n private == 'private'\n end",
"def private_visibility?\n try(:read_groups).blank?\n end",
"def transitioned_to_private?\n return true if changes['visibility'].present? &&\n (changes['visibility'][0] != JupiterCore::VISIBILITY_PRIVATE) &&\n (changes['visibility'][1] == JupiterCore::VISIBILITY_PRIVATE)\n end",
"def private?\n self.private\n end",
"def private?\n false\n end",
"def private?\n sensitivity == \"Private\"\n end",
"def private?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"private\" : false\n end",
"def private_namespaces?\n owned_namespaces?.reject {|key,value| value.shareMode!=:Private}\n end",
"def private?\n private\n end",
"def private?\n private\n end",
"def priviledged?\n @priviledged\n end",
"def private?\n false\n end",
"def private?\n self.private\n end",
"def can_view_or_not_private?( id )\n if private?\n acl.has_permission?( id, AlbumACL::VIEWER_ROLE)\n else\n true\n end\n end",
"def priv?\n !org?\n end",
"def public?\n # If it's not in a group, it's public\n if group\n !group.private\n else\n true\n end\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def public?\n !private\n end",
"def is_public_root?\n false\n end",
"def global_namespace_cannot_be_private\n if global? && visibility_private?\n errors.add(:visibility, \"global namespace cannot be private\")\n return false\n end\n true\n end",
"def can_view_private_items\n return @can_view_private_items\n end",
"def public?\n !private?\n end",
"def is_public?\n is_public == true && requires_login == false\n end",
"def has_privates?\n super || userpass_file.present? || user_as_pass\n end",
"def root_public?\n self.root.public?\n end",
"def private?\n !self.public\n end",
"def can_read?(folder_id)\n administrator? or\n permissions.for_read.exists? :folder_id => folder_id\n end",
"def allowed?(key, id)\n key = @manager.check_key(key)\n key == :private\n end",
"def is_public?\n true\n end",
"def has_private_profile?\n self.private\n end",
"def subfolders_locked?\n @attributes[:subfolders_locked?]\n end",
"def private?\n return (self.owner_id != 0)\n end",
"def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end",
"def private?\n self.privacy == PASSWORD\n end",
"def not_private\n !self.private\n end",
"def has_share_access?(folder) \n\n # doesn't have share access if folder is nil (i.e., file is top-level)\n return false if folder.nil?\n\n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false \n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true \n end \n end \n \n return false \nend",
"def has_share_access?(folder)\n return false if folder.nil?\n return true if self.folders.include?(folder)\n return true if self.shared_folders_by_others.include?(folder)\n \n unless folder.nil?\n folder.ancestors.each do |ancestor_folder|\n return true if self.being_shared_folders.include?(ancestor_folder)\n end\n end\n return false\n end",
"def all_private\n \treturn is_name_private && is_message_private && is_amount_private\n end",
"def private?\n return true if @destination == nil\n\n @private ||= (not @connection.support(\"CHANTYPES\", \"#&\").include? @destination.chr)\n end",
"def require_member_of_group_if_private\n if !current_group.public\n require_member_of_group\n end\n end",
"def is_public?\n self.is_public\n end",
"def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end",
"def private?\n return true if @private_key\n \n load_private_key\n !@private_key.nil?\n end",
"def private?\n !public? && !for_profit?\n end",
"def publicly_available?\n return false unless access_rights.present?\n\n access_rights.none? do |value|\n value == 'deny' || %w[allow:icus allow:pdus].include?(value)\n end\n end",
"def has_access_to_folder(folder_id, user_id)\n if get_all_user_data(user_id).first[\"rank\"] >= 1\n return true\n end\n owner_id = $db.execute(\"SELECT owner_id FROM folders WHERE folder_id = ?\", folder_id).first[\"owner_id\"]\n if owner_id == user_id\n return true\n else\n return false\n end\nend",
"def checkGroupFileAccess(groupName, fToAccess, fAccess)\n\n if File.exist?(fAccess)\n\n fileProps = YAML.load_file(fAccess)\n\n fileGroups = fileProps[\"groups\"]\n if(fileGroups.index(\";guests;\") != nil || fileGroups.index(\";#{groupName};\") != nil)\n return true\n else\n return false\n end\n end\n return false\n end",
"def validate_directory_structure\n return false unless File.exists? @root\n Find.find(@root) do |path|\n stat = File::Stat.new path\n return false unless stat.uid == OWNER and stat.gid == GROUP\n if File.directory? path\n return false unless stat.mode == DIRMODE\n else\n return false unless stat.mode == FILEMODE\n end\n end\n true\n end",
"def has_share_access?(folder) \n \n if(!folder) \n return true\n end \n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false\n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true\n end\n end\n \n return false\nend",
"def has_repoman_direct_access?\n self[:repo_manager_direct_access]\n end",
"def has_share_access?( folder )\n\n return false if folder.nil?\n\n # has share access if the folder is one of his own\n return true if self.folders.include?( folder )\n\n #has share access if the folder is one of the shared_folders_by_others\n return true if self.shared_folders_by_others.include?( folder )\n\n # for checking sub_folders under one of the being_shared_folders\n return value = false\n\n folder.ancestors each do |ancestor_folder|\n return_value = self.being_shared_folders.include?( ancestor_folder )\n if return_value # if it's true\n return true\n end\n end\n\n return false\n end",
"def is_public?(file)\n return file =~ %r{^([^/]*/)?(solution|software-tests(?!/public))/}\n end",
"def has_privates?\n password.present? || pass_file.present? || !additional_privates.empty? || blank_passwords\n end",
"def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end",
"def dir_forbidden?\n File.stat(run_dir).mode.to_s(8) == \"100000\" || File.stat(run_dir).mode.to_s(8) == \"40000\"\n end",
"def public?\n self.privacy == PUBLIC\n end",
"def publicly_viewable(path)\n %w(disclaimer about copyright privacy editorial users)\n .include?(path.split('/').first) || path.blank?\n end",
"def is_public?\n return @uti.start_with?(\"public.\")\n end",
"def filter_private_pages\n if @public_mode\n @site.pages.delete_if do |p|\n p.relative_path.start_with? '/pages/private'\n end\n end\n end",
"def private?\n return true unless @private_key.nil?\n \n load_private_key\n !@private_key.nil?\n end",
"def fields_are_private_by_default?\n ensure_setup!\n options[:visibility] == :private\n end",
"def has_share_access?(folder) \n \t#has share access if the folder is one of one of his own \n \treturn true if self.folders.include?(folder) \n \n \t#has share access if the folder is one of the shared_folders_by_others \n \treturn true if self.shared_folders_by_others.include?(folder) \n \n \t#for checking sub folders under one of the being_shared_folders \n \treturn_value = false\n print folder\n \tfolder.ancestors.each do |ancestor_folder| \n \n \t\treturn_value = self.shared_folders_by_others.include?(ancestor_folder) \n \t\tp ancestor_folder \n if return_value #if it's true \n \t\treturn true\n \t\tend\n \tend\n \n \treturn false\n\tend",
"def subdir_is_writable?\n Medium.path_is_writeable?(thumbnail_path)\n end",
"def fully_public?\n public && public_write\n end",
"def public?\n # first line just for formatting\n false || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ } || \\\n bucket_policy.any? { |s| s.effect == \"Allow\" && s.principal == \"*\" }\n end",
"def is_visible?(path)\n File.basename(path)[0] != '.'\n end",
"def restricted_by_location?\n rights.restricted_by_location?(file_name)\n end",
"def authorize_reading\n unless @logged_in_user.can_read(folder_id)\n flash.now[:folder_error] = \"You don't have read permissions for this folder.\"\n redirect_to :controller => 'folder', :action => 'list', :id => nil and return false\n end\n end",
"def publicly_accessible?\n codelet.publicly_accessible?\n end",
"def has_access?\n true\n end",
"def has_access?\n true\n end",
"def checkGroupFileAccess(groupName, filePath)\n\n #filePath = GlobalSettings.changeFilePathToMatchSystem(filePath)\n fAccess = filePath+\".access\"\n if File.exist?(fAccess)\n\n return checkGroupFileAccess(groupName, filePath, fAccess)\n end\n return false\n end",
"def test_property_permissions_private\n assert_equal(['FULL_CONTROL'], AwsS3Bucket.new('Private Bucket').permissions.owner)\n assert_equal([], AwsS3Bucket.new('Private Bucket').permissions.authUsers)\n assert_equal([], AwsS3Bucket.new('Private Bucket').permissions.everyone)\n assert_equal([], AwsS3Bucket.new('Private Bucket').permissions.logGroup)\n end",
"def public?\n self.mode == PUBLIC\n end",
"def checkFileAccess(userName, fToAccess, fAccess)\n\n #return false if fAccess.end_with?(\".access\")\n if File.exist?(fAccess) && userExists(userName)\n\n fileProps = YAML.load_file(fAccess)\n fileUsers = fileProps[\"users\"]\n fileGroups = fileProps[\"groups\"]\n if fileGroups.index(\";guests;\") != nil\n return true\n end\n\n if userName == nil\n return false\n end\n\n user = loadUser(userName)\n groups = Array.new\n groupFound = true\n groupAt = 0\n while groupFound\n\n if user.key?(\"group#{groupAt}\")\n groupTmp = user[\"group#{groupAt}\"]\n groups << groupTmp\n groupAt = groupAt.next\n else\n groupFound = false\n end\n end\n\n if(fileUsers.index(\";#{userName};\") != nil || fileUsers.index(\";guest;\") != nil)\n return true\n end\n if fileGroups.index(\";guests;\") != nil\n return true\n end\n for i in 0..groups.size\n\n if(fileGroups.index(\";#{groups[i]};\") != nil)\n return true\n end\n end\n return false\n end\n return false\n end",
"def trying_to_access_parent_unauthorized(current_dir_name, path)\n unless accessing_parent_of_admin(current_dir_name, path) ||\n accessing_absolute_path(path) ||\n accessing_outside_parent(path)\n return false\n end\n\n puts <<~TXT.red\n Attention, tu ne peux pas aller plus loin, il faut que tu restes dans le dossier admin \\\n et les dossiers qu'il y a dedans ! Tu peux taper `exit` pour quitter le mode admin.\n TXT\n true\n end",
"def authenticated?\n return true if @client.folders.count\n rescue Viewpoint::EWS::Errors::UnauthorizedResponseError\n return false\n end",
"def manage_symlink_access?\n false\n end",
"def manage_symlink_access?\n false\n end",
"def authorize_reading\n unless current.user.can_read? folder_id\n flash[:folder_error] = 'You don\\'t have read permissions for this folder.'\n redirect_to root_path\n end\n end",
"def watched_list_cannot_be_private\n errors.add(:base, \"Private list cannot be watched\") if self.list.private?\n end",
"def is_protected?\n is_public == true && requires_login == true\n end",
"def private?\n !@key.nil?\n end",
"def is_public?\n return true if self.statut == \"public\"\n end",
"def outside_configured_directory?(dir); end",
"def check_if_public_user\n if session[:public_user]\n session[:public_user] = nil\n session[:user_id] = nil\n flash[:notice] = \"RESTRICTED: You do not have access\"\n redirect_to controller: :access, action: :user_menu\n false\n end\n end",
"def forbidden?\n request_path.index(root_dir) != 0\n end",
"def downloadable?\n return false unless respond_to?(:downloadable)\n return visible? && public_readable_state? if downloadable.nil?\n return false unless visible?\n\n downloadable&.include?(\"public\")\n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end",
"def can_view_private_items=(value)\n @can_view_private_items = value\n end",
"def is_public?\n @status == \"public\"\n end",
"def is_public?\n @status == \"public\"\n end"
] |
[
"0.73256844",
"0.73256844",
"0.725405",
"0.72359383",
"0.7198773",
"0.7038912",
"0.70309997",
"0.69863147",
"0.69767743",
"0.6966052",
"0.678988",
"0.67898464",
"0.67678964",
"0.6761252",
"0.6729177",
"0.6721514",
"0.6721514",
"0.6702083",
"0.6671887",
"0.6654216",
"0.66317004",
"0.6600773",
"0.6564514",
"0.6563076",
"0.65320635",
"0.65302455",
"0.6514482",
"0.6485848",
"0.64558315",
"0.6451317",
"0.64325666",
"0.64296263",
"0.6415414",
"0.64138275",
"0.63741004",
"0.6373267",
"0.63667065",
"0.63567233",
"0.6352978",
"0.6344744",
"0.6331068",
"0.6330602",
"0.6308984",
"0.63078237",
"0.63065374",
"0.63057005",
"0.62847203",
"0.6284358",
"0.62596923",
"0.6253816",
"0.6246892",
"0.6246465",
"0.62403965",
"0.62288976",
"0.6228578",
"0.6223967",
"0.6221901",
"0.62096006",
"0.62095976",
"0.62069553",
"0.62023157",
"0.61967903",
"0.618163",
"0.61776155",
"0.61762846",
"0.6161141",
"0.6160469",
"0.61479956",
"0.61462814",
"0.61394083",
"0.6134153",
"0.6132869",
"0.61220205",
"0.6112609",
"0.6092672",
"0.60865235",
"0.6081624",
"0.6081624",
"0.6079461",
"0.60700923",
"0.6062262",
"0.6055082",
"0.6047605",
"0.6046249",
"0.6046114",
"0.6046114",
"0.6039967",
"0.60345227",
"0.60233074",
"0.60194755",
"0.6013882",
"0.60113174",
"0.5994456",
"0.5988591",
"0.59765095",
"0.59644586",
"0.59591466",
"0.59579927",
"0.5949009",
"0.5949009"
] |
0.8238323
|
0
|
Is the root folder public?
|
def root_public?
self.root.public?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_public_root?\n false\n end",
"def public?\n !self.public_folders.empty?\n end",
"def private?\n self.public_folders.empty?\n end",
"def root_private?\n self.root.private?\n end",
"def root?\n is_root?(@path)\n end",
"def is_root?()\n @rootpath == @path\n end",
"def root\n 'public'\n end",
"def root?\n !!@root || app_file?\n end",
"def is_public?\n is_public == true && requires_login == false\n end",
"def root?\n self.path == '/'\n end",
"def public_folder\n @options[:public] || @options[:root]\n end",
"def root?\n env[\"PATH_INFO\"] == '/'\n end",
"def root?\n \tfolder_id.nil?\n end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def root?\n true\n end",
"def root?\n true\n end",
"def root?\n !self.hier? || self.path == '/' || self.path.to_s.empty?\n end",
"def is_public?\n true\n end",
"def open_to_public?\n request.subdomains.first != 'admin'\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end",
"def web_root? path\n path.start_with? SLASH\n end",
"def public_folder\n @public_folder ||= 'public'\n end",
"def public?\n # If it's not in a group, it's public\n if group\n !group.private\n else\n true\n end\n end",
"def fully_public?\n public && public_write\n end",
"def root?\n true\n end",
"def public?\n @public\n end",
"def public?\n self.mode == PUBLIC\n end",
"def is_public?(file)\n return file =~ %r{^([^/]*/)?(solution|software-tests(?!/public))/}\n end",
"def root?; path == '' end",
"def is_public?\n self.is_public\n end",
"def is_root_site?\n @depth == 0\n end",
"def is_root?\n false\n end",
"def root?\n false\n end",
"def root_valid?\n index_files = Dir[File.join(path, \"index.*\")].count\n return true if index_files > 0\n return false\n end",
"def root?\n full_name.empty?\n end",
"def public_user?\n \tcurrent_user.username.eql? \"public_user\"\n end",
"def public?\n category_tree.include?(Sfcatnode.root)\n end",
"def will_serve_file?(file_path)\n file_path.include?(\"/public\")\n end",
"def root_dir\n File.join(self.runner.path, 'public')\n end",
"def is_public?\n @status == \"public\"\n end",
"def is_public?\n @status == \"public\"\n end",
"def is_public?\n return @uti.start_with?(\"public.\")\n end",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def root?\n false\n end",
"def root_path_match?\n url == '/'\n end",
"def root?\n root\n end",
"def public?\n !private?\n end",
"def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end",
"def importable?\n root?\n end",
"def root_folder?\n if new_record?\n material_folders.find(&:root?).present?\n else\n material_folders.find_by(parent: nil).present?\n end\n end",
"def exist?\n\t\t\tClient.head @root\n\t\tend",
"def public?\n return true if @public_key\n \n load_public_key\n !@public_key.nil?\n end",
"def public?\n self.privacy == PUBLIC\n end",
"def authorize?\n @root.attributes[\"ath\"].to_i == 1\n end",
"def public_path\n @public_path ||= root + \"/public\"\n end",
"def public?\n # first line just for formatting\n false || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n bucket_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ } || \\\n bucket_policy.any? { |s| s.effect == \"Allow\" && s.principal == \"*\" }\n end",
"def public_path\n application && Pathname.new(application.paths[\"public\"].first)\n end",
"def root?(path)\n \n root_objects = [\"gemfile\", \"procfile\", \"readme\"]\n current_objects = Dir[path + \"/*\"].map do |file|\n File.basename(file).downcase\n end\n dir = \"\"\n current_objects.each do |co|\n dir = (root_objects.include?(co) == true)? \"ROOT\" : \"NOT ROOT\"\n break if dir == \"ROOT\"\n end\n return true if dir == \"ROOT\"\n return false if dir == \"NOT ROOT\"\n \n end",
"def server_root\r\n File.expand_path(\"#{rails_root}/public/\")\r\n end",
"def public?( revset=nil )\n\t\treturn self.phase( revset ).values.all?( :public )\n\tend",
"def root?\n root_id.nil?\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def is_public?\n return true if self.statut == \"public\"\n end",
"def root?\n self.class.roots.exists?(self.id)\n end",
"def public?\n return true unless @public_key.nil?\n \n load_public_key\n !@public_key.nil?\n end",
"def document_root\n File.join(Rails.root,'public') \n end",
"def root?\n ROOT == self\n end",
"def lib_root?\n false\n end",
"def include_public_users?\n true\n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def public?\n status == Status::PUBLIC\n end",
"def requested_public_url?\n request.env['PATH_INFO'].ends_with?('/desktop_client/version')\n end",
"def public_path\r\n public_regexp = Regexp.new(\"^#{RAILS_ROOT}/public\")\r\n full_path =~ public_regexp ? full_path.gsub(public_regexp, '') : nil\r\n end",
"def public?\r\n is_live and !priv? and !draft?\r\n end",
"def is_root?() @name === '__root__'; end",
"def outside_configured_directory?(dir); end",
"def _is_root?\n !@parent.is_a?(BaseEndpoint)\n end",
"def claim_public?\n @current_user.nil?\n end",
"def root_page?\n current_page == root_page\n end",
"def forbidden?\n request_path.index(root_dir) != 0\n end",
"def shared?\n \t!self.shared_folders.empty?\n end",
"def in_test_or_root_user\n if !current_user.sk.root?\n in_test\n end\n end",
"def root?\n !has_parent?\n end",
"def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end",
"def open_to_public?\n allow_external_students? || allow_external_volunteers?\n end",
"def shared? \n \t!self.shared_folders.empty? \n\tend",
"def root?\n !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)\n end",
"def root?\n Process.uid == 0\n end",
"def public_path; end",
"def public_path; end",
"def public_path; end",
"def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end",
"def public?\n parsed {\n @status == 'Public'\n }\n end",
"def is_protected?\n is_public == true && requires_login == true\n end",
"def root?\n @type == ROOT\n end",
"def exists?\n File.exists?(File.join(@root))\n end",
"def folder?\n children.any?\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def public_uri\n @public_uri ||=\n @rack_context.getInitParameter('public.root') || 'public'\n end",
"def public?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"public\" : true\n end"
] |
[
"0.8766247",
"0.8121792",
"0.77916783",
"0.7780392",
"0.75076646",
"0.74951524",
"0.7491971",
"0.74848545",
"0.7470077",
"0.74284256",
"0.7405733",
"0.73801637",
"0.73181605",
"0.72479516",
"0.7112154",
"0.7112154",
"0.7102775",
"0.7100188",
"0.70814687",
"0.7055447",
"0.7049113",
"0.7029966",
"0.70191896",
"0.6997354",
"0.6987285",
"0.69789857",
"0.6947756",
"0.69165474",
"0.690934",
"0.68833554",
"0.68440473",
"0.6820836",
"0.6814535",
"0.6777398",
"0.6776333",
"0.6775305",
"0.6716313",
"0.67102224",
"0.67024434",
"0.66930443",
"0.66930443",
"0.66929543",
"0.667775",
"0.6674678",
"0.66711503",
"0.6613328",
"0.6565356",
"0.6553927",
"0.6543651",
"0.65396863",
"0.65367824",
"0.6532591",
"0.6524334",
"0.6508472",
"0.6505972",
"0.65035367",
"0.6499495",
"0.64855427",
"0.64814395",
"0.64534557",
"0.64503795",
"0.6450372",
"0.6438966",
"0.64342767",
"0.643239",
"0.64310974",
"0.6409674",
"0.6401721",
"0.6387525",
"0.63862705",
"0.637485",
"0.63683075",
"0.6353846",
"0.6335716",
"0.63328356",
"0.63241756",
"0.6321337",
"0.6283473",
"0.6274849",
"0.6274188",
"0.62516284",
"0.62508744",
"0.6243639",
"0.623974",
"0.6235489",
"0.62307733",
"0.6228096",
"0.6203221",
"0.62009585",
"0.62009585",
"0.62009585",
"0.6198368",
"0.61967826",
"0.6193905",
"0.61914796",
"0.61868083",
"0.61757314",
"0.6171617",
"0.6163112",
"0.6154916"
] |
0.8915485
|
0
|
Is the root folder private?
|
def root_private?
self.root.private?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_public_root?\n false\n end",
"def root_public?\n self.root.public?\n end",
"def private?\n self.public_folders.empty?\n end",
"def is_root?()\n @rootpath == @path\n end",
"def root?\n \tfolder_id.nil?\n end",
"def public?\n !self.public_folders.empty?\n end",
"def root?\n is_root?(@path)\n end",
"def root?\n !!@root || app_file?\n end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def is_root?\n false\n end",
"def in_test_or_root_user\n if !current_user.sk.root?\n in_test\n end\n end",
"def root?\n self.path == '/'\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end",
"def authorize?\n @root.attributes[\"ath\"].to_i == 1\n end",
"def root?\n !self.hier? || self.path == '/' || self.path.to_s.empty?\n end",
"def root?\n true\n end",
"def root?\n true\n end",
"def is_public?\n is_public == true && requires_login == false\n end",
"def root?\n env[\"PATH_INFO\"] == '/'\n end",
"def outside_configured_directory?(dir); end",
"def validate_directory_structure\n return false unless File.exists? @root\n Find.find(@root) do |path|\n stat = File::Stat.new path\n return false unless stat.uid == OWNER and stat.gid == GROUP\n if File.directory? path\n return false unless stat.mode == DIRMODE\n else\n return false unless stat.mode == FILEMODE\n end\n end\n true\n end",
"def root?\n Process.uid == 0\n end",
"def root?\n false\n end",
"def root?\n true\n end",
"def root?(path)\n \n root_objects = [\"gemfile\", \"procfile\", \"readme\"]\n current_objects = Dir[path + \"/*\"].map do |file|\n File.basename(file).downcase\n end\n dir = \"\"\n current_objects.each do |co|\n dir = (root_objects.include?(co) == true)? \"ROOT\" : \"NOT ROOT\"\n break if dir == \"ROOT\"\n end\n return true if dir == \"ROOT\"\n return false if dir == \"NOT ROOT\"\n \n end",
"def can_traverse?(user, path)\n return true if user == 'root'\n byme = File.stat(path).uid == -> { Etc.getpwnam(user).uid } && File.stat(path).mode & 64 == 64 # owner has x\n byus = File.stat(path).gid == -> { Etc.getpwnam(user).gid } && File.stat(path).mode & 8 == 8 # group has x\n byall = File.stat(path).mode & 1 == 1 # other has x\n byme || byus || byall\n end",
"def is_private?\n ! is_public?\n end",
"def is_private?\n ! is_public?\n end",
"def public?\n # If it's not in a group, it's public\n if group\n !group.private\n else\n true\n end\n end",
"def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end",
"def root_folder?\n if new_record?\n material_folders.find(&:root?).present?\n else\n material_folders.find_by(parent: nil).present?\n end\n end",
"def has_privates?\n super || userpass_file.present? || user_as_pass\n end",
"def root?\n Process.uid.zero?\n end",
"def root?\n Process.uid.zero?\n end",
"def web_root? path\n path.start_with? SLASH\n end",
"def root?\n false\n end",
"def is_root_site?\n @depth == 0\n end",
"def forbidden?\n request_path.index(root_dir) != 0\n end",
"def is_private?\n is_public == false || (is_public == false && requires_subscription == true)\n end",
"def trying_to_access_parent_unauthorized(current_dir_name, path)\n unless accessing_parent_of_admin(current_dir_name, path) ||\n accessing_absolute_path(path) ||\n accessing_outside_parent(path)\n return false\n end\n\n puts <<~TXT.red\n Attention, tu ne peux pas aller plus loin, il faut que tu restes dans le dossier admin \\\n et les dossiers qu'il y a dedans ! Tu peux taper `exit` pour quitter le mode admin.\n TXT\n true\n end",
"def root?; path == '' end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def priv?\n !org?\n end",
"def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end",
"def private?\n @private\n end",
"def is_root?() @name === '__root__'; end",
"def secure_admin?\n File.exist?(\"#{context.domain_directory}/config/secure.marker\")\n end",
"def root?\n full_name.empty?\n end",
"def directory?() end",
"def lib_root?\n false\n end",
"def is_protected?\n is_public == true && requires_login == true\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def is_public?\n true\n end",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def fully_public?\n public && public_write\n end",
"def public_access?(perm_symbol)\n obj = find_permission_object(perm_symbol)\n obj.nil? ? false : obj.public_access? \n end",
"def has_share_access?(folder) \n\n # doesn't have share access if folder is nil (i.e., file is top-level)\n return false if folder.nil?\n\n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false \n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true \n end \n end \n \n return false \nend",
"def has_access_to_folder(folder_id, user_id)\n if get_all_user_data(user_id).first[\"rank\"] >= 1\n return true\n end\n owner_id = $db.execute(\"SELECT owner_id FROM folders WHERE folder_id = ?\", folder_id).first[\"owner_id\"]\n if owner_id == user_id\n return true\n else\n return false\n end\nend",
"def subdir_is_writable?\n Medium.path_is_writeable?(thumbnail_path)\n end",
"def root_valid?\n index_files = Dir[File.join(path, \"index.*\")].count\n return true if index_files > 0\n return false\n end",
"def private?\n private == 'private'\n end",
"def has_repoman_direct_access?\n self[:repo_manager_direct_access]\n end",
"def root?\n self.class.roots.exists?(self.id)\n end",
"def public_user?\n \tcurrent_user.username.eql? \"public_user\"\n end",
"def priviledged?\n @priviledged\n end",
"def public?\n self.mode == PUBLIC\n end",
"def is_root?\n cmd_exec('/usr/bin/id -ru').eql? '0'\n end",
"def root?\n !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)\n end",
"def root\n 'public'\n end",
"def in_module_root?(path = Dir.pwd)\n PDK::Util::MODULE_FOLDERS.any? { |dir| PDK::Util::Filesystem.directory?(File.join(path, dir)) } ||\n PDK::Util::Filesystem.file?(File.join(path, 'metadata.json'))\n end",
"def authenticated?\n return true if @client.folders.count\n rescue Viewpoint::EWS::Errors::UnauthorizedResponseError\n return false\n end",
"def shared?\n \t!self.shared_folders.empty?\n end",
"def subfolders_locked?\n @attributes[:subfolders_locked?]\n end",
"def is_public?\n self.is_public\n end",
"def root_path_match?\n url == '/'\n end",
"def has_share_access?(folder) \n \n if(!folder) \n return true\n end \n #has share access if the folder is one of one of his own \n return true if self.folders.include?(folder) \n \n #has share access if the folder is one of the shared_folders_by_others \n return true if self.shared_folders_by_others.include?(folder) \n \n #for checking sub folders under one of the being_shared_folders \n return_value = false\n \n folder.ancestors.each do |ancestor_folder| \n \n return_value = self.being_shared_folders.include?(ancestor_folder) \n if return_value #if it's true \n return true\n end\n end\n \n return false\nend",
"def is_public?(file)\n return file =~ %r{^([^/]*/)?(solution|software-tests(?!/public))/}\n end",
"def root?\n @uid || @uid = fetch_uid\n end",
"def shared? \n \t!self.shared_folders.empty? \n\tend",
"def has_share_access?(folder)\n return false if folder.nil?\n return true if self.folders.include?(folder)\n return true if self.shared_folders_by_others.include?(folder)\n \n unless folder.nil?\n folder.ancestors.each do |ancestor_folder|\n return true if self.being_shared_folders.include?(ancestor_folder)\n end\n end\n return false\n end",
"def standalone?\n Merb.root == ::MerbAuthSlicePassword.root\n end",
"def ensure_root\n if self.root? and self.root_cfs_directory.blank?\n self.root_cfs_directory = self\n self.save!\n end\n true\n end",
"def private?\n self.private\n end",
"def root?\n root\n end",
"def private_visibility?\n try(:read_groups).blank?\n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def private?\n private\n end",
"def private?\n private\n end",
"def has_share_access?(folder) \n \t#has share access if the folder is one of one of his own \n \treturn true if self.folders.include?(folder) \n \n \t#has share access if the folder is one of the shared_folders_by_others \n \treturn true if self.shared_folders_by_others.include?(folder) \n \n \t#for checking sub folders under one of the being_shared_folders \n \treturn_value = false\n print folder\n \tfolder.ancestors.each do |ancestor_folder| \n \n \t\treturn_value = self.shared_folders_by_others.include?(ancestor_folder) \n \t\tp ancestor_folder \n if return_value #if it's true \n \t\treturn true\n \t\tend\n \tend\n \n \treturn false\n\tend",
"def public?\n !private?\n end",
"def has_access?\n true\n end",
"def has_access?\n true\n end",
"def root?\n ROOT == self\n end",
"def trying_to_access_parent_unauthorized(current_dir_name, path)\n unless accessing_parent_of_ecole(current_dir_name, path) ||\n accessing_absolute_path(path) ||\n accessing_outside_parent(path)\n return false\n end\n\n puts <<~TXT.red\n Attention, tu ne peux pas aller plus loin, il faut que tu restes dans le dossier ECOLE \\\n et les dossiers qu'il y a dedans !\"\n TXT\n true\n end",
"def root?\n root_id.nil?\n end",
"def private?\n self.private\n end",
"def control_repo_root?(path = Dir.pwd)\n CONTROL_REPO_FILES.any? { |file| PDK::Util::Filesystem.file?(File.join(path, file)) }\n end",
"def has_share_access?( folder )\n\n return false if folder.nil?\n\n # has share access if the folder is one of his own\n return true if self.folders.include?( folder )\n\n #has share access if the folder is one of the shared_folders_by_others\n return true if self.shared_folders_by_others.include?( folder )\n\n # for checking sub_folders under one of the being_shared_folders\n return value = false\n\n folder.ancestors each do |ancestor_folder|\n return_value = self.being_shared_folders.include?( ancestor_folder )\n if return_value # if it's true\n return true\n end\n end\n\n return false\n end",
"def private_key?\n !node.private_key.nil?\n end",
"def folder?\n children.any?\n end"
] |
[
"0.81862265",
"0.8099162",
"0.7788598",
"0.7372862",
"0.7259929",
"0.718087",
"0.7054533",
"0.69742143",
"0.68834984",
"0.68371654",
"0.6778444",
"0.6753355",
"0.6752832",
"0.6751803",
"0.67372376",
"0.6725696",
"0.6725696",
"0.669453",
"0.66662127",
"0.66474575",
"0.6644184",
"0.6642248",
"0.6599367",
"0.6594929",
"0.65706885",
"0.6534262",
"0.65288347",
"0.65288347",
"0.6494751",
"0.64872384",
"0.6486419",
"0.648154",
"0.6477328",
"0.6477328",
"0.6468669",
"0.64654326",
"0.64644766",
"0.6451848",
"0.6437629",
"0.6423646",
"0.64226353",
"0.6414559",
"0.64123714",
"0.64082754",
"0.640401",
"0.63871926",
"0.6386262",
"0.6380891",
"0.6379778",
"0.6377175",
"0.637426",
"0.6364937",
"0.63645494",
"0.6362743",
"0.63498104",
"0.63466156",
"0.634078",
"0.6329499",
"0.63263756",
"0.63217026",
"0.63143617",
"0.63067657",
"0.62974507",
"0.62956226",
"0.6275699",
"0.6275345",
"0.6272396",
"0.6267169",
"0.6253759",
"0.6253424",
"0.62523466",
"0.62414765",
"0.6240619",
"0.62386376",
"0.62356",
"0.6229185",
"0.62286234",
"0.62271464",
"0.62232405",
"0.6218093",
"0.6208353",
"0.6206838",
"0.61863023",
"0.61797345",
"0.61734027",
"0.6170974",
"0.61683375",
"0.61683375",
"0.6156085",
"0.6152419",
"0.61453557",
"0.61453557",
"0.6141249",
"0.61350024",
"0.61342204",
"0.613224",
"0.6130925",
"0.61239696",
"0.61196023",
"0.6116019"
] |
0.85230035
|
0
|
Gather a list of all the email adresses that the folder is shared with
|
def to_shared_emails
#shared_to = SharedFolder.select("shared_email").find(:all, :conditions => ["folder_id = ?",id])
email_addresses = Array.new
shared_folders.each do |folder|
email_addresses.push(folder.shared_email)
end
email_addresses
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_attendees()\n\t\turl = request.referrer.split(\"/\")\t# Get the URL of where the request CAME from, not the url that was requested.\n redis_key = url[-1].to_s + \":\" + url[-2].to_s + \":emails\";\n\t\tattendees = $redis.lrange(redis_key,0,-1)\n\t\tattendees.uniq!\n\t\tlogger.error \"@@@@@@@@@@@@ ATTENDEES: \" + attendees.to_s\n\t\treturn attendees\n\tend",
"def email_addresses\n emails.map(&:address)\n end",
"def email_addresses\n begin\n @email_addresses ||= xmlrpc_client.call(\"list_emails\", session_id)\n rescue Timeout::Error => e\n raise \"Error during connection. Please try again later.\" \n end\n end",
"def mailboxes_list\n get \"mailboxes\"\n end",
"def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end",
"def all\n get(\"#{domain}/mailboxes\")\n end",
"def get_mailboxes()\n begin\n mblist = @imap_client.list('', '*')\n rescue => error\n p \"ERROR getting mailboxes: #{error}\"\n return [] \n end\n\n return order_mailboxes(mblist)\n end",
"def lists\n @links = Link.all\n @short_link = ActionMailer::Base.default_url_options[:host]\n end",
"def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end",
"def attachment_uris\n Array.wrap(attachments).uniq.delete_if(&:empty?)\n end",
"def email_list\n end",
"def mailbox_aliases\n return @mailbox_aliases if @mailbox_aliases\n @mailbox_aliases = {}\n @default_mailbox_aliases.each do |shortname, fullname_list|\n fullname_list.each do |fullname|\n [ \"[Gmail]\", \"[Google Mail]\" ].each do |prefix|\n if self.mailboxes.include?( \"#{ prefix }/#{ fullname }\" )\n @mailbox_aliases[shortname] = \"#{ prefix }/#{ fullname }\"\n end\n end\n end\n end\n log \"Setting aliases to #{ @mailbox_aliases.inspect }\"\n @mailbox_aliases\n end",
"def get_mailboxes\n get(\"mailboxes\")\n end",
"def emails\n self[\"gd$email\"] ? self[\"gd$email\"].map { |e| e.address } : []\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def emails\n Array(@emails)\n end",
"def email_list\n @entries.collect do |line|\n name, email = line.split(\",\")\n format_email_address name, email.chomp\n end.join(\", \")\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def mailboxes\n if @mailboxes.nil?\n list_mailboxes\n end\n @mailboxes\n end",
"def mailboxes\n if @mailboxes.nil?\n list_mailboxes\n end\n @mailboxes\n end",
"def mailbox_aliases\n return @mailbox_aliases if @mailbox_aliases\n aliases = {\"sent\" => \"Sent Mail\",\n \"all\" => \"All Mail\",\n \"starred\" => \"Starred\",\n \"important\" => \"Important\",\n \"drafts\" => \"Drafts\",\n \"spam\" => \"Spam\",\n \"trash\" => \"Trash\"}\n @mailbox_aliases = {}\n aliases.each do |shortname, fullname|\n [ \"[Gmail]\", \"[Google Mail\" ].each do |prefix|\n if self.mailboxes.include?( \"#{prefix}/#{fullname}\" )\n @mailbox_aliases[shortname] = \"#{prefix}/#{fullname}\"\n end\n end\n end\n log \"Setting aliases to #{@mailbox_aliases.inspect}\"\n @mailbox_aliases\n end",
"def get_all_emails\n urls = get_all_the_urls_of_val_doise_townhalls\n emails = []\n\n urls.each do |url|\n emails << get_the_email_of_a_townhal_from_its_webpage(url)\n end\n\n emails\nend",
"def host_aliases\n @fragments.map(&:host_aliases).flatten.uniq + [name]\n end",
"def sharing_blocked_domain_list\n return @sharing_blocked_domain_list\n end",
"def parse\n emails = @email_list.scan(/\\w+@\\w+.\\w+/)\n emails.uniq\n end",
"def getEmailList\n\t\tdata = index()\n\t\temailList = []\n\t\tdata.each do |person|\n\t\t\temailList.push(\"#{person[\"email_address\"]}\")\n\t\tend\n\t\treturn emailList\n\tend",
"def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end",
"def email_ids\n []\n end",
"def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end",
"def emails\n return [] unless email_access_allowed?\n access_token.options[:mode] = :header\n @emails ||= access_token.get('user/emails', :headers => { 'Accept' => 'application/vnd.github.v3' }).parsed\n end",
"def email_addresses\n\t\treturn [self]\n\tend",
"def client_attachments\n self.messages.where(location_submitted: Message::CLIENT_EMAIL_LOCATIONS).collect { |message| message.attachments }.flatten\n end",
"def index\n @mailing_lists = MailingList.all\n @email = @mailing_lists.collect(&:email).join(\"; \")\n end",
"def getScrapingURLs(shared)\n\tFile.open(\"urls.txt\").each do |line|\n\t\tshared.pushurl(line.chomp)\n\tend\nend",
"def find_destinations(email, changes)\n destination = []\n destination << email if email&.include?('@')\n if changes && changes['email']\n old_email = changes['email'][0]\n destination << old_email if old_email&.include?('@')\n end\n destination.uniq\n end",
"def address_list_for(emails, retried = false)\n emails = emails * \", \"\n list = Mail::AddressList.new(self.class.unescape(emails))\n addrs = list.addresses.each { |a| a.decoded }\n addrs.uniq!\n addrs\n rescue Mail::Field::ParseError\n if retried\n raise\n else\n address_list_for(emails.scan(EMAIL_REGEX), true)\n end\n end",
"def all_related_data_files\n via_assay = related_assays.collect do |assay|\n assay.data_file_masters\n end.flatten.uniq.compact\n via_assay | related_data_files\n end",
"def email_addresses(objects)\n conference = [objects].flatten.first.conference\n if !conference.send_all_emails_to.blank?\n conference.send_all_emails_to.split(' ')\n else\n objects.map{|o| o.email unless o.email.blank?}.uniq.compact\n end\n end",
"def getEmailList()\n emailListFile = File.dirname(File.dirname(__FILE__)) + \"/config/\" +\n \"email_recepients.txt\"\n lines = IO.readlines(emailListFile)\n\n lines.each do |line|\n if line.match(/^EMAIL_RESULTS/)\n temp = line.gsub(/EMAIL_RESULTS=/, \"\")\n temp.strip!\n @resultRecepients = temp.split(\",\")\n elsif line.match(/^EMAIL_ERRORS/)\n temp = line.gsub(/EMAIL_ERRORS=/, \"\")\n temp.strip!\n @errorRecepients = temp.split(\",\") \n elsif line.match(/^EMAIL_CAPTURE/)\n temp = line.gsub(/EMAIL_CAPTURE=/, \"\")\n temp.strip!\n @captureRecepients = temp.split(\",\") \n end\n end\n end",
"def find_recipients_for(message)\n message.to_addrs\n end",
"def email_list(event_id, exclude_owner = false)\n list = Array.new\n @event = Event.includes(:users).find(event_id)\n\n @event.users.where(:notification_emails => true).each do |user|\n list.push(user.email)\n end\n\n if(exclude_owner)\n list.delete(@event.owner.email)\n end\n\n return list\n end",
"def get_emails\n emails = [self.email1, self.email2, self.email3]\n emails.compact!\n emails.delete('')\n return emails\n end",
"def shared_to_me\n files_list = []\n files = session[:user].x_files_shared_to_me.all(uploaded: true)\n files.each { |file| files_list.push( file: file.description(session[:user]) ) }\n @result = { files: files_list, success: true }\n end",
"def get_apple_mail_contacts(vcf_data)\n @user = current_user\n begin\n temp_file = \"/tmp/#{Time.now.to_i.to_s}.vcf\"\n f = open(temp_file, \"wb\")\n contents = vcf_data\n c = contents.gsub(/[^\\x00-\\x7F]/n,'')\n f.write(c)\n f.close\n\n cards = Vpim::Vcard.decode(File.open(temp_file))\n @importedContacts = []\n @emails = []\n cards.each do |card|\n person = {}\n person[\"fname\"] = card.name.formatted\n person[\"email\"] = card.email.to_s\n #person[\"email\"] = person[\"email\"].tr(\"\\n\", \"\") if person[\"email\"]\n if !person[\"email\"].blank?\n #Do not add duplicates\n unless @importedContacts.any? {|h| h[\"email\"] == person[\"email\"]}\n @importedContacts << person\n end\n end\n end\n @importedContacts.each do |mail|\n @emails.push(mail.fetch('email'))\n end\n @importedContacts.sort! { |a, b| a.fetch(\"fname\").downcase <=> b.fetch(\"fname\").downcase }\n rescue\n #do nothing\n end\n\n return @importedContacts\n end",
"def sharing_allowed_domain_list\n return @sharing_allowed_domain_list\n end",
"def peeraddrs\n @peeraddrs ||= {}\n end",
"def current_emails\n @current_emails || []\n end",
"def available_emails\n sent_emails = StudioEmail.sent_to(self).collect(&:email_name).collect(&:to_sym)\n Notifier.studio_emails - sent_emails\n end",
"def archived_emails(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Archived/Emails\", params: params)\n end",
"def shared_folders\n manifest[:shared_folders]\n end",
"def all_emails(current_user)\n mails = []\n self.users.map{ |u| mails << u.email unless u == current_user || !u.accepting_emails }.compact.join(\", \")\n end",
"def generate_address_list\n adresses = super\n adresses.blank? ? [ \"#{request.host_with_port}/storage\" ] : adresses\n end",
"def recipient_emails\n recipients.map(&:first)\n end",
"def list_email()\nsession = GoogleDrive::Session.from_config(\"config.json\")\nws = session.spreadsheet_by_key(\"1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc\").worksheets[0]\n#define a lopp with each for the spreadsheet.\n(1..w_sheet.num_rows).each do |list|\n\t\tmail = ws[list, 2]\n\t\tcity = ws[list, 1]\n list_email(\"email\",\"password\",mail, city)\n end\nend",
"def owned_and_shared_folders\n folders = Folder.includes(:topic_shares).where(\"user_id = ? OR topic_shares.recipient_id = ?\", self.id, self.id).order('folders.updated_at DESC').references(:shares)\n folders\n end",
"def attached_files\n array = []\n frm.ul(:class=>/attachList/).lis.each { |li| array << li.link.text }\n array\n end",
"def all_organizations_emails\n orgs = apply_forms.accepted.select(:organization_id).map(&:organization_id)\n mails = EmailContact.incoming.where('organization_id in (?)',orgs).select(:address).map(&:address)\n mails.join(', ')\n end",
"def admin_emails\n admins.collect { |p| p.confirmed_notification_email_addresses } .flatten\n end",
"def admin_emails\n admins.collect { |p| p.confirmed_notification_email_addresses } .flatten\n end",
"def mailbox_list\n begin\n @imap = WmailImapUtils.current_imap\n folder_list = WmailImapUtils.get_mailbox_list\n @folders_count_hash = Hash[ folder_list.map do |a|\n [a.name, @imap.status(a.name, [\"UNSEEN\"])[\"UNSEEN\"]] unless a.name == \"[Gmail]\"\n end ]\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Connection Lost. Please login to your account'}\n format.js {render :js => \"window.location = '\" + authenticate_wmail_accounts_path(:redirect => params) + \"';\"}\n end\n end\n end",
"def legal_emails\n %w[stmm.confirmation@kristoffs.com\n stmm.confirmationa@aol.com\n paul@kristoffs.com\n paul.kristoff@kristoffs.com\n retail@kristoffs.com\n justfaith@kristoffs.com\n financial@kristoffs.com]\n end",
"def find_relatives\n Email.where(\"conversation_id = ?\", self.conversation_id)\n end",
"def recipient_list(workgroup)\n list = Array.new\n wrkgrpusrs = WorkgroupUser.find(:all, :conditions => {:workgroup_id => workgroup})\n wrkgrpusrs.each do |usr|\n s = User.find(:first, :conditions => {:id => usr.user_id})\n list << s.email unless s.email.nil? || s.email == \"\"\n end\n if list.length < 1\n list << \"blank@example\" #duct-tape-uber-hack an empty array of recipients breaks the mailer and cause the referral to not be sent...\n end\n return list\n end",
"def list\n @client.call(method: :get, path: 'recipient-lists')\n end",
"def email_all\n wc = Incoming::Workcamp.find(params[:id])\n addresses = wc.participants.map { |p| p.organization.email.to_s.strip }\n redirect_to \"mailto:#{addresses.join(',')}\"\n end",
"def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end",
"def mailing\n gb = Gibbon.new\n @lists = Hash.new\n for i in 1..gb.lists['total'] do\n list_id = gb.lists['data'][i - 1]['id']\n name = gb.lists['data'][i - 1]['name']\n @lists[name] = []\n members = gb.list_members({:id => list_id})\n members['data'].map { |m| @lists[name].push(m['email']) }\n end\n end",
"def user_email_list\n @email_list = []\n\n EmailList.all.each do |email|\n if email.creator_id == current_user.id\n @email_list << email \n end\n end\n @email_list\n end",
"def addresses\n @addresses ||= get_addresses.map do |address_tree|\n Mail::Address.new(address_tree)\n end\n end",
"def share\n # first we need to separate the emails with a comma\n email_addresses = params[:email_addresses].split(\",\")\n \n email_addresses.each do |email_address|\n # save the details in the ShareFolder table\n @shared_folder = current_user.shared_folders.new\n @shared_folder.folder_id = params[:folder_id]\n @shared_folder.shared_email = email_address\n \n # getting the shared user id right the owner the email has already signed up with ShareBox\n # if not, the field \"shared_user_id\" will be left nil for now\n shared_user = User.find_by_email(email_address)\n @shared_folder.shared_user_id = shared_user.id if shared_user\n \n @shared_folder.message = params[:message]\n @shared_folder.save\n \n # now we need to send email to recipients\n UserMailer.invitation_to_share(@shared_folder).deliver\n end\n \n # since this action is mainly for ajax (javascript request), we'll respond with js file back (refer to share.js.erb)\n respond_to do |format|\n format.js {\n }\n end\n end",
"def get_to_links\n to_links = []\n\n dotfiles_dir = File.dirname(__FILE__)\n\n Dir.entries(dotfiles_dir).each do |filename|\n if File.directory? filename and not $exclude_list.include? filename\n subfiles = Dir.entries File.join dotfiles_dir, filename\n\n subfiles.each do |sfilename|\n if not sfilename.eql? '..' and not sfilename.eql? '.'\n full_path = File.join dotfiles_dir, filename, sfilename\n to_links << full_path\n end\n end\n\n end\n end\n\n to_links\nend",
"def list_shared_assets\n str = current_user.shared_files.to_s\n a = str.split(\",\")\n @assets = []\n \n 0.upto(a.length-1) do |x|\n aId = a[x].to_i\n @assets << Asset.find(aId)\n end\n \n @assets \n end",
"def list_hosts(folder = '')\n rows = JSON.parse(http_request(@uri + '/view.py', {\n wato_folder: folder,\n\tsearch: 'Search',\n\tfilled_in: 'filter',\n\thost_address_prefix: 'yes',\n\tview_name: 'searchhost',\n\toutput_format: 'json',\n\t}))\n rows.shift # skip the header\n rows.map { |r| r[1] }\n end",
"def guest_paths(folders)\n folders.map { |parts| parts[2] }\n end",
"def inbox\n folders.find_by_name(\"Inbox\")\n end",
"def inbox\n folders.find_by_name(\"Inbox\")\n end",
"def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end",
"def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend",
"def share_folders(folders)\n end",
"def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end",
"def getEmailsByRecipient(recipientEmail)\n searchCriteria = Hash.new\n searchCriteria['recipient']= recipientEmail\n return getEmails(searchCriteria)\n end",
"def townhall_email_array\n urls = townhalls_urls\n size = urls.size\n emails_array = []\n for i in (0..size-1) do\n emails_array << townhall_email(urls[i])\n end \n return emails_array\nend",
"def find_mailboxes\n mailboxes = @imap.list(@root, \"*\")\n\n if mailboxes.nil? then\n log \"Found no mailboxes under #{@root.inspect}, you may have an incorrect root\"\n return []\n end\n\n mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }\n mailboxes.map! { |mailbox| mailbox.name }\n\n @box_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/\n\n mailboxes.reject! { |mailbox| mailbox !~ @box_re }\n mailboxes = mailboxes.sort_by { |m| m.downcase }\n log \"Found #{mailboxes.length} mailboxes to search:\"\n mailboxes.each { |mailbox| log \"\\t#{mailbox}\" } if @verbose\n return mailboxes\n end",
"def emails\n email.split(/[, ]/)\n end",
"def all_applications_emails\n apply_forms.accepted.select(:email).map(&:email).join(', ')\n end",
"def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end",
"def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end",
"def find_newly_added_collaborators\n emails = find_folder_members.collect{|m| m.email}\n @member_emails =[]\n params[:already_added_users] = params[:already_added_users].split(\",\").uniq - params[:deleted_users].split(\",\").uniq\n owner=find_folder_owner(params[:folder_id])\n params[:already_added_users].each do |m|\n @member_emails << m.strip if !emails.include?(m.strip) && m.strip != owner\n end\n end",
"def recipients\n notified_users.collect(&:mail)\n end",
"def list_shares_anonymous\n file = Tempfile.new('ruby_smbclient')\n success = system(\"#{@smbclient} -L #{@host} -p #{@port} -N > #{file.path} 2>&1\")\n if success\n res = File.open(file.path).readlines\n if res.join(\"\\n\") =~ /Domain=(.+)\\sOS/\n $domain=$1.sub(/^\\[/, '').sub(/\\]$/, '')\n end\n if res.join(\"\\n\") =~ /Server=(.+)\\s+/\n server=$1.sub(/^\\[/, '').sub(/\\]$/, '')\n end\n if res.join(\"\\n\") =~ /Domain=.+\\sOS=(.+)\\sServer=/\n $os=$1.sub(/^\\[/, '').sub(/\\]$/, '') + ' (' + server + ')'\n end\n if res.join(\"\\n\") =~ /Error returning browse list: (.+)/i\n file.unlink\n return false, \"Unable to enumerate shares anonymously: #{$1}\"\n else\n if res =~ /Domain=\\[.+\\]\\s+Sharename\\s+Type\\s+Comment\\s+[-]{1,}\\s+[-]{1,}\\s+[-]{1,}\\s+(.+)\\s+Domain/m and not rez =~ /Error returning browse list: .+/i\n results=$1\n shares = [[\"Sharename\", \"Type\", \"Comment\"]]\n results.split(\"\\n\").each do |share|\n row = share.strip.chomp.split(' ')\n shares << [ row[0], row[1], row[2..-1].join(' ') ]\n end\n file.unlink\n table = t.to_table(:first_row_is_head => true)\n return true, table.to_s\n else\n return false, \"Unable to enumerate shares anonymously!\"\n end\n end\n else\n return false, \"Unable to enumerate shares anonymously!\" \n end\n end",
"def get_attachments()\n\t\t\n\t\tmessages = list_of_messages()\n\n\t\t#Initializing Nested Hash so that we can store message_id, file_name and attachemnt id\n\t\tfiles= Hash.new { |l, k| l[k] = Hash.new(&l.default_proc) }\n\t\tmessages.each do |message_id|\n\t\t\n\t\t\t#Create a new request\n\t\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages/#{message_id}?access_token=#{@access_token}\"\n\n\t\t\t#GET REQUEST\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\n\t\t\t#Getting list of attachments based on message id\n\t\t\ttemp = response_body['payload']['parts']\n\t\t\ttemp.each do |item|\n\t\t\t\tif item['filename'] !=''\n\t\t\t\t\tfiles[message_id][item['filename']]=item['body']['attachmentId']\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\t\treturn files\n\tend",
"def imapAccounts\n @imap_accounts = @entourage.IMAPAccounts\n puts @imap_accounts\n end",
"def admin_1099_received_list\n %w( tt_1099_received_list@booktrope.com )\n end",
"def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end",
"def shares\n @users.map { |u| u.share }.uniq\n end",
"def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end",
"def get_to_addresses\n\n return [] if self.to_addresses.nil?\n return self.to_addresses.split(Email::ADDRESS_SEPARATOR)\n end",
"def get_uri_hosts(tweet)\n list = []\n #tweet.uris.each { |uri| list << uri.expanded_uri.host.downcase } if tweet.uris?\n\n # Remove subdomains (e.g.: www.example.org => example.org)\n regex = '[[:word:]]{1,}\\.[[:word:]]{1,}\\z'\n tweet.uris.each do |uri|\n m = /#{regex}/.match(uri.expanded_uri.host.downcase)\n list << m[0]\n end\n\n list\n end",
"def attachments\n names = []\n frm.ul(:class=>\"attachList indnt1\").links.each { |link| names << link.text }\n return names\n end",
"def attachments\n names = []\n frm.ul(:class=>\"attachList indnt1\").links.each { |link| names << link.text }\n return names\n end"
] |
[
"0.6385268",
"0.63238657",
"0.62550944",
"0.61532986",
"0.61196524",
"0.6103077",
"0.6078206",
"0.60718364",
"0.6052476",
"0.5974436",
"0.5963796",
"0.5943543",
"0.5941283",
"0.5931614",
"0.59308434",
"0.58817184",
"0.5877269",
"0.5874378",
"0.5814281",
"0.5814281",
"0.5800103",
"0.5789253",
"0.57730585",
"0.57625765",
"0.57565993",
"0.5745042",
"0.57362723",
"0.5720124",
"0.5713666",
"0.57125205",
"0.5710563",
"0.5707079",
"0.56828743",
"0.56712556",
"0.5640844",
"0.56386507",
"0.56253004",
"0.56227493",
"0.5616911",
"0.56119263",
"0.5611433",
"0.55986995",
"0.55817574",
"0.5572486",
"0.557111",
"0.556607",
"0.555491",
"0.5544605",
"0.55352104",
"0.55292636",
"0.5522786",
"0.5514713",
"0.5510259",
"0.5504802",
"0.5497035",
"0.546544",
"0.5464167",
"0.545633",
"0.545633",
"0.5454228",
"0.5453404",
"0.54504997",
"0.54456586",
"0.54427075",
"0.54303116",
"0.5426798",
"0.5421592",
"0.54074436",
"0.5402458",
"0.5394555",
"0.5386745",
"0.53765804",
"0.5376299",
"0.5362587",
"0.53587663",
"0.53587663",
"0.5358179",
"0.5338212",
"0.5330868",
"0.53294945",
"0.53254926",
"0.53183615",
"0.5314306",
"0.53001964",
"0.5294651",
"0.5292305",
"0.52900666",
"0.5284587",
"0.5278421",
"0.527813",
"0.527141",
"0.5270007",
"0.52638716",
"0.5263397",
"0.5263309",
"0.5263105",
"0.52622384",
"0.525794",
"0.5253597",
"0.5253597"
] |
0.7708128
|
0
|
Calculates the total size of all assets in the current folder and subfolders (recursive)
|
def total_size
self._total_size(self, 0)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _total_size(folder, size)\n folder.assets.each do |a|\n size = size + a.file_size\n end\n folder.children.each do |f|\n size = _total_size(f,size)\n end\n return size\n end",
"def calculate_tree_size(folder)\n\t\ttotal_size = 0\n\t\t@files.each do |name, size|\n\t\t\tbegin\n\t\t\t\tif name.include? folder\n\t\t\t\t\tlocal_size = Integer(size)\n\t\t\t\t\ttotal_size = total_size + local_size\n\t\t\t\tend\n\t\t\trescue TypeError\n\t\t\tend\n\t\tend\n\t\treturn total_size\n\tend",
"def get_all_size\n s_old = 0\n Dir.glob($dir + '/**/*').each { | a_file |\n dn = File.dirname(a_file)\n s = File.lstat(a_file).size.to_i\n $file_size[ a_file ] = s\n $dir_size[ dn ] = (s_old = $dir_size[ dn ]) ? s_old + s : s\n }\nend",
"def compute_all_dir_sizes(directory:, answer:)\n directory.size = directory.files.sum(&:size) if directory.directories.empty?\n\n directory.directories.each do |child_directory|\n compute_all_dir_sizes(directory: child_directory, answer:)\n end\n\n directory.set_size\n answer.push(directory.size) if directory.size <= 100_000\n answer\nend",
"def run\n\t\twalk_tree(@folder)\n\t\t@total_size = calculate_tree_size(@folder)\n\t\t@sub_folders.each do |key, value|\n\t\t\t\t@sub_folders[key] = calculate_tree_size(key)\n\t\tend\n\tend",
"def getFolderSize(folder)\n total_size=0\n @files = Dir.glob(folder+\"**/**\")\n for file in @files\n total_size=total_size+File.size(file)\n end \n return total_size\nend",
"def test_calculate_tree_size_many_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(2705,f.calculate_tree_size(\"./TestFolders/Folder1/\"))\n\tend",
"def sizeOnDisk(someFile)\n #get directory\n #size of file in directories\n #add\n return Dir.glob(File.join(someFile, '**', '*')).map{|f| File.size(f)}.inject(:+)\nend",
"def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end",
"def recalculate_filesize\n @filesize = @collection.reduce(0) {|sum,asset| sum + asset.size}\n end",
"def test_calculate_tree_size_one_file\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(391,f.calculate_tree_size(\"./TestFolders/Folder3/\"))\n\tend",
"def size\n size_helper(@root)\n end",
"def dir_size(dir)\n total_size = 0\n dir_list(dir).each do |name, size|\n total_size += (size == '/' ? dir_size(dir + '/' + name) : size.to_i)\n end\n total_size\n end",
"def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # to_i handles any nil file sizes\n end",
"def directory_size(path)\n\ta = get_dir_size(path)\n\tdisplay(a)\n\t@calls = 0\n\treturn a\nend",
"def get_dir_size(path)\n\t#get the contents of the directory\n\tmetadata = @client.metadata(path) #a Hash\n\tcontents = metadata['contents'] #an array of Hashs\n\n\t@calls += 1\n\tputs @calls\n\n\t#create list of subdirectory paths\n\tsubdirs_list = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdirs_list << i['path']\n\t\tend\n\tend\n\n\t#size the directory\n\tsize = 0\n\tcontents.each { |entry| size += entry['bytes'] }\n\n\tif subdirs_list == []\n\t\treturn size\n\telse\n\t\tadditional_sizes = []\n\t\tsubdirs_list.each { |dir| additional_sizes << get_dir_size(dir) }\n\t\tsum = 0\n\t\tadditional_sizes.each { |i| sum += i.to_i }\n\t\treturn size + sum\n\tend\nend",
"def size(children: true)\n c_size = 0\n request = $postgres.exec_prepared('wsfile_size', [self.id])\n c_size += request[0].map{|k,v| v.to_i }.inject(:+)\n c_size += self.children.map{|child| child.size}.inject(:+) || 0 if children\n c_size\n end",
"def calcDirSize(path)\n if !File.directory?(path)\n return File.size(path)\n end\n list = Dir.entries(path);\n sizeToReturn = 0\n for index in 0 ... list.size\n if list[index] != '.' && list[index] != '..'\n if File.directory?(path + \"\\\\\" + list[index])\n sizeToReturn += calcDirSize (path + \"\\\\\" + list[index])\n else\n sizeToReturn += File.size(path + \"\\\\\" + list[index])\n end\n end\n end\n return sizeToReturn\nend",
"def size\n children_size + my_size\n end",
"def calculate_disk_usage\n user_own_maps = self.own_maps #saves 4 calls\n\n files = user_own_maps.map{|m| m.unwarped_filename if File.exist? m.unwarped_filename} + user_own_maps.map{| m | m.masked_src_filename if File.exist? m.masked_src_filename} + user_own_maps.map{|m | m.warped_filename if File.exist? m.warped_filename} + user_own_maps.map{|m| m.warped_png_filename if File.exist? m.warped_png_filename}\n files.compact!\n\n total_size = files.inject(0) {| result, file | result + File.size(file) }\n\n return total_size\n end",
"def total_filesize_count(folder_name)\n\n # You will fill in something here. Remember that the method only\n # gets the folder name, not the folder handle. So the method needs\n # to first create the corresponding handle object.\n\nend",
"def total_size\n return @total_size if @total_size\n if @structure.instance_of? Array\n return 0 if @structure.empty?\n @total_size = strip(:size).flatten.inject { |sum, i| sum + i }\n else\n @total_size = size\n end\n end",
"def total_upload_mass\n number_to_human_size(self.works.all.sum(:file_size))\n end",
"def size(full_path)\n\t\t`du -s #{Rush.quote(full_path)}`.match(/(\\d+)/)[1].to_i\n\tend",
"def size_all\n\t\tfname=\"Node:#{__method__}\"\n\t\tret=0\n\t\tlevel=0\n\t\tbegin\n\t\t\tret=self.size_all_(ret, level)\n\t\trescue Exception=>e\n\t\t\tLOG.error(fname){\"EXCEPTION during nodes size calculation: #{e} \"}\n\t\tret=-1\n\t\tend\n\t\tret\n\tend",
"def total_size\n object_versions.inject(0) { |sum, obj| sum += obj.size }\n end",
"def size(full_path)\n\t\t`du -sb #{full_path}`.match(/(\\d+)/)[1].to_i\n\tend",
"def get_work_aggregate_size( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += fs.file_size\n }\n return sum\n end",
"def number_of_files\n\t\tassets.length\n\tend",
"def print_tree_size()\n\t\tputs \"Total size for #{@folder_walker.folder} is #{commify(@folder_walker.total_size)}\"\n\tend",
"def children_size\n size = locations.size\n locations.each{|location|\n locations = location.locations\n if locations.present?\n size += location.children_size\n end\n }\n return size\n end",
"def fast_size\n c_size = 0\n ids = self.child_ids\n q = \"SELECT octet_length(data), octet_length(body) AS octet_length2 FROM ws_files WHERE id in (#{ ids.join(\", \")})\"\n request = $postgres.exec(q)\n request.each do |req|\n c_size += req.map{|k,v| v.to_i }.inject(:+)\n end\n c_size\n end",
"def test_calculate_tree_size_no_files\n\t\tf = FolderWalker.new(\"./TestFolders/\")\n\t\tf.run\n\t\tassert_equal(0,f.calculate_tree_size(\"./TestFolders/Folder2/\"))\n\tend",
"def as_size children: true\n WSFile.human_size(optimal_size)\n end",
"def showSizes(filename)\n if File.exists?(filename)\n puts(File.stat(filename).size)\n elsif File.directory?(filename)\n puts(Dir.entries(filename).select {|f| !File.directory? f}.size)\n end\nend",
"def calculate_storage(user_id)\n storage = 0\n @assets = User.find(user_id).assets.all\n @assets.each do |asset|\n storage += asset.asset.size\n end\n return storage\n end",
"def byte_size\n inject(0){ |sum, path| sum + FileTest.size(path) }\n end",
"def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end",
"def upd_folder_size\n \n @t1 = Thread.new{ \n \n @time_samples = []\n \n puts \"in upd_folder_size...\"\n prev_size = 0\n loop {\n puts \"in loop each 2 secs\"\n this_size = 0\n @fen_d.children.each { |pn|\n this_size += (pn.size? || 0) if pn.file?\n }\n @time_samples << (this_size - prev_size).abs\n puts \"upd, @time_samples: #{@time_samples.inspect}\"\n sleep @sleep_sample\n prev_size = this_size\n }\n\n }\n \n end",
"def upd_folder_size\n \n @t1 = Thread.new{ \n \n @time_samples = []\n \n puts \"in upd_folder_size...\"\n prev_size = 0\n loop {\n puts \"in loop each 2 secs\"\n this_size = 0\n @fen_d.children.each { |pn|\n this_size += (pn.size? || 0) if pn.file?\n }\n @time_samples << (this_size - prev_size).abs\n puts \"upd, @time_samples: #{@time_samples.inspect}\"\n sleep @sleep_sample\n prev_size = this_size\n }\n\n }\n \n end",
"def summary(recursive=false)\n failures = failures(recursive)\n successes = successes(recursive)\n newfiles = new_files(recursive)\n total = failures.size + successes.size + newfiles.size\n summary = \"#{@dir} #{recursive ? \" and sub-directories\" : \"\"} contains #{total} files: #{successes.size} stored, #{failures.size} failed, #{newfiles.size} new\"\n return summary \n end",
"def size\n @files.size\n end",
"def repo_size\n Dir.glob(File.join(repo.path, '**', '*'), File::FNM_DOTMATCH).reject do |f|\n f.include?('..')\n end.map do |f|\n File.expand_path(f)\n end.uniq.map do |f|\n File.stat(f).size.to_i\n end.reduce(:+)\n end",
"def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end",
"def size\n File.size( fullpath )\n end",
"def total(fs = ?/.freeze)\n\t\t\t\ts = stat_raw(fs)\n\t\t\t\treturn nil if s.empty?\n\t\t\t\ts.default = 0\n\t\t\t\ts[:block_size] * s[:blocks]\n\t\t\tend",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend",
"def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end",
"def analyze_dirs(dir_to_analyze, parent)\n\n\n # bootstrap case\n # don't create an entry for the root because there's nothing to link to yet, scan the subdirs\n if (dir_to_analyze == self.target_volume)\n # puts \"Dir to analyze is the target volume\"\n # run on all child dirs, not this dir\n Dir.entries(dir_to_analyze).reject {|d| d.start_with?('.')}.each do |name|\n # puts \"\\tentry: >#{file}<\"\n full_path = File.join(dir_to_analyze, name)\n if (Dir.exist?(full_path) && !File.symlink?(full_path))\n # puts \"Contender: >#{full_path}<\"\n analyze_dirs(full_path, self.dir_tree)\n end\n end\n return\n end\n\n # use \"P\" to help prevent following any symlinks\n cmd = \"du -sxkP \\\"#{dir_to_analyze}\\\"\"\n puts \"\\trunning #{cmd}\"\n output = `#{cmd}`.strip().split(\"\\t\")\n # puts \"Du output:\"\n # pp output\n size = output[0].to_i \n size_gb = \"#{'%.0f' % (size.to_f / 1024 / 1024)}\"\n # puts \"Size: #{size}\\nCapacity: #{self.diskhash['/']['capacity']}\"\n\n # Occupancy as a fraction of total space\n # occupancy = (size.to_f / self.capacity.to_f)\n\n # Occupancy as a fraction of USED space\n occupancy = (size.to_f / self.used.to_f)\n\n occupancy_pct = \"#{'%.0f' % (occupancy * 100)}\"\n capacity_gb = \"#{'%.0f' % (self.capacity.to_f / 1024 / 1024)}\"\n \n # if this dir contains more than 5% of disk space, add it to the tree\n\n if (dir_to_analyze == self.target_dir)\n # puts \"Dir to analyze is the target dir, space used outside this dir..\"\n # account for space used outside of target dir\n other_space = self.used - size\n other_space_gb = \"#{'%.0f' % (other_space / 1024 / 1024)}\"\n parent.children.push(DirNode.new(parent, self.target_volume, 'Other Space', other_space_gb))\n end\n \n \n if (occupancy > self.threshold_pct)\n # puts \"Dir contains more than 5% of disk space: #{dir_to_analyze} \\n\\tsize:\\t#{size_gb} / \\ncapacity:\\t#{capacity_gb} = #{occupancy_pct}%\"\n puts \"Dir contains more than 5% of used disk space: #{dir_to_analyze} \\n\\tsize:\\t\\t#{size_gb} / \\n\\toccupancy:\\t#{self.used_gb} = #{occupancy_pct}% of used space\"\n\n # puts \"Dir to analyze (#{dir_to_analyze}) is not the target dir (#{self.target_dir})\"\n dirs = dir_to_analyze.split('/')\n \n short_dir = dirs.pop().gsub(\"'\",\"\\\\\\\\'\")\n full_parent = dirs.join('/')\n if (dir_to_analyze == self.target_dir || full_parent == self.target_volume)\n # puts \"Either this dir is the target dir, or the parent is the target volume, make parent the full target volume\"\n short_parent = self.target_volume.gsub(\"'\",\"\\\\\\\\'\")\n else\n # puts \"Neither this dir or parent is the target dir, making parent short\"\n short_parent = dirs.pop().gsub(\"'\",\"\\\\\\\\'\")\n end\n \n\n this_node = DirNode.new(parent, dir_to_analyze, short_dir, size_gb)\n parent.children.push(this_node)\n\n # run on all child dirs\n Dir.entries(dir_to_analyze).reject {|d| d.start_with?('.')}.each do |name|\n full_path = File.join(dir_to_analyze, name)\n # don't follow any symlinks\n if (Dir.exist?(full_path) && !File.symlink?(full_path))\n # puts \"Contender: >#{full_path}<\"\n analyze_dirs(full_path, this_node)\n end\n end\n \n end # occupancy > threshold\n \n end",
"def total_size(bucket)\n # check for saved value\n return @bucket_size[bucket] if @bucket_size[bucket]\n @log.debug \"Computing size for #{bucket.tracker_description}\"\n total_bytes = 0\n bucket.files.each {|object| total_bytes += object.content_length}\n @log.debug \"total bytes = #{total_bytes}\"\n # save the total size for later\n @bucket_size[bucket] = total_bytes / BYTES_PER_GB.to_f\n end",
"def path_size (path)\n if Dir.exist? path\n o, e, s = Open3.capture3('du', '-s', '-b', path)\n o.split('/')[0].to_i\n end\n end",
"def size\n size = popen(%W(du -s), full_path).first.strip.to_i\n (size.to_f / 1024).round(2)\n end",
"def size\n ::File.size(@path)\n end",
"def numImages(path)\n\t\tDir.entries(path).size\n\tend",
"def bytes\n @bytes = 0\n @files.each do |file|\n @bytes += File.new(\"#{file}\").size\n end\n @bytes\n end",
"def recursively_optimise(path,depth=0)\r\n raise ArgumentError, \"Argument must be a directory\" unless File.directory?(path)\r\n puts \"Called with #{path}\"\r\n total_before = 0\r\n total_after = 0\r\n total_before_types = {}\r\n total_after_types = {}\r\n total_time_types = {}\r\n begin\r\n # Call ourself on any directories in this path\r\n Dir.foreach(path) do |entry|\r\n next if entry == \".\"\r\n next if entry == \"..\"\r\n fullpath = File.join(path, entry)\r\n if File.directory?(fullpath)\r\n res = self.recursively_optimise(fullpath, (depth+1))\r\n total_before += res[:before]\r\n total_after += res[:after]\r\n #if res[:before_types] and res[:after_types]\r\n res[:before_types].each_pair do |k,v|\r\n total_before_types[k] = 0 unless total_before_types[k]\r\n total_before_types[k] += v\r\n end\r\n res[:after_types].each_pair do |k,v|\r\n total_after_types[k] = 0 unless total_after_types[k]\r\n total_after_types[k] += v\r\n end\r\n res[:time_types].each_pair do |k,v|\r\n total_time_types[k] = 0 unless total_time_types[k]\r\n total_time_types[k] += v\r\n end\r\n #end\r\n else\r\n res = @optimiser.optimise_image(fullpath)\r\n total_before += res[:before]\r\n total_after += res[:after]\r\n total_before_types[res[:type]] = 0 unless total_before_types[res[:type]]\r\n total_before_types[res[:type]] += res[:before]\r\n total_after_types[res[:type]] = 0 unless total_after_types[res[:type]]\r\n total_after_types[res[:type]] += res[:after]\r\n total_time_types[res[:type]] = 0 unless total_time_types[res[:type]]\r\n total_time_types[res[:type]] += res[:time]\r\n end\r\n end\r\n rescue Exception => e\r\n puts \"Got exception #{e.inspect} while processing!\"\r\n puts e.backtrace\r\n end\r\n if depth == 0\r\n puts \"\\n\\nDone optimising everything!\"\r\n puts \"I started with a total size of #{Rarity::to_human total_before}\"\r\n puts \"I finished with a total size of #{Rarity::to_human total_after}, a reduction of #{Rarity::to_human (total_before-total_after).abs}\"\r\n\r\n puts\"\\nType breakdowns:\"\r\n total_before_types.each_pair do |k,v|\r\n a = total_after_types[k]\r\n t = total_time_types[k]\r\n puts \"#{k.to_s.upcase}: #{Rarity::to_human v} before, #{Rarity::to_human a} after, reduction of #{Rarity::to_human (v-a).abs} or #{Rarity::to_human (((v-a).abs)/t.abs)} per second saved\"\r\n end\r\n end\r\n return {:before => total_before, :after => total_after, :before_types => total_before_types, :after_types => total_after_types, :time_types => total_time_types}\r\n end",
"def size\n @size = File.size(self.path) unless @size\n @size\n end",
"def file_total_size_gb\n ((total_ram_mb.to_f * 2).to_f / 1024).ceil\n end",
"def size\n File.stat(@repo.join(@path)).size\n end",
"def calculate_size(show)\n print \"\\rcalculating size for #{show}\".ljust(120)\n size = directory_size \"#{PATH}/#{show}\"\n if SHOWS.include? show\n anime = SHOWS[show]\n anime.bytes += size\n else\n anime = Anime.new(show, size)\n RESULTS << anime\n SHOWS[anime.name] = anime\n end\nend",
"def CountFiles\n\t\tchildrenFiles = []\n\t\tcwd = File.dirname(__FILE__) # get parent directory from our script\n\t\tchildrenFiles = Dir.glob(cwd + '/**/*').select{ |e| File.file? e }\n\n\t\tchildrenFiles.each do |file|\n\t\t\tif File.extname(file).empty?\n\t\t\t\t@count += 1\n\t\t\t\t@files.push(file)\n\t\t\tend\n\t\tend\n\tend",
"def s3_storage_used\n bytes = contents.sum(:size)\n backup_sources.gmail.each do |gmail|\n bytes += gmail.backup_emails.sum(:size)\n end\n # TODO: move size calculations to each source\n backup_sources.blog.each do |blog|\n blog.feed.entries.each do |entry|\n\tif entry.feed_content\n\t bytes += entry.feed_content.size\n\tend\n end\n end\n bytes\n end",
"def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end",
"def recursive_loc_count(dir, tree_or_blob, total_count=nil)\n total_count ||= Hash.new{|h,k| h[k]=0 }\n if tree_or_blob.is_a?(Grit::Tree) # directory\n tree_or_blob.contents.each do |tob|\n dname = dir ? File.join(dir, tree_or_blob.name) : tree_or_blob.name\n recursive_loc_count(dname, tob, total_count)\n end\n elsif tree_or_blob.is_a?(Grit::Blob) # file\n file = dir ? File.join(dir, tree_or_blob.name) : tree_or_blob.name\n matcher.each do |glob, block|\n if File.fnmatch?(glob, file)\n tree_or_blob.data.lines.each do |line|\n group = block.call(file, line)\n if group\n total_count[group] += 1\n end\n #total_count['Total'] += 1\n end\n end\n end\n else\n # what is it then?\n end\n total_count\n end",
"def optimal_size\n if !children\n self.size children: false\n else\n self.fast_size\n end\n end",
"def archive_file_count\n Dir.glob('*', base: mounted_path).length\n end",
"def volume_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.directory?(file)\n end\n end",
"def size\n @errors.size + @children.each_value.reduce(0) do |total, child|\n total + child.size\n end\n end",
"def calc_size\n @input_size = File.size(@original_filepath)\n @output_size = File.size(@min_filepath)\n @diff_size = @input_size - @output_size\n end",
"def size\n @file_list.size\n end",
"def size\n File.size(path)\n end",
"def calculate_disk_space(data)\n sum_sizes = 0\n\n data.each do |disk_name, disk|\n\n unless disk_name =~ %r{^sr}\n if disk.has_key?('size_bytes')\n sum_sizes = sum_sizes + disk['size_bytes']\n end\n end\n end\n\n sum_sizes = sum_sizes / 1024 / 1024 / 1024\n\n sum_sizes\n end",
"def fast_size2\n c_size = 0\n $postgres.exec_prepared('wsfile_size_multi', [self.id]).each do |row|\n c_size += row.except('id').map{|k,v| v.to_i}.inject(:+)\n end\n c_size\n end",
"def actual_path_length\n folders.count\n end",
"def count_objects\n\n count = 0\n\n Find.find(@basepath) do |path|\n\n next unless File.exist? path\n next if File.stat(path).directory?\n\n count += 1 if path[-5..-1] == '.yaml'\n end\n\n count\n end",
"def count_number_of_lines(change_to_dir)\n Dir.chdir(change_to_dir)\n puts Dir.pwd.blue \n content = Dir.glob(\"*\")\n cur_dirs = []\n content.each do |file|\n file = \"#{Dir.pwd}/#{file}\"\n\n if File.directory?(file)\n cur_dirs << file\n else\n n = File.readlines(file).size\n print \"#{file} \"\n print \" #{n} lines\\n\".green\n end\n end\n cur_dirs.each do |dir| \n count_number_of_lines(dir)\n end\n\nend",
"def size\n\t\treturn 0 if @setup.secure or @setup['no_cache'] or not FileTest::exist?( @setup['cache_path'] )\n\n\t\tFileTest.size( @setup['cache_path'] )\n\tend",
"def children_size\n leaf? ? 0 : children.map(&:size).reduce(:+)\n end",
"def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end",
"def size\n File.size(self)\n end",
"def size\n File.size(self)\n end",
"def size\n File.size(self)\n end",
"def size\n File.size(self)\n end",
"def perform_update_storage_size_from_s3\n total_size = 0\n if self.final_file_key\n total_size += fetch_object_size(self.final_file_key)\n else\n total_size += fetch_object_size(self.original_file_key)\n end\n self.update_column(:storage_size, total_size)\n recalculate_storage_size\n end",
"def size\n if is_path?\n exists? ? File.size(path) : 0\n elsif @file.respond_to?(:size)\n @file.size\n elsif path\n exists? ? File.size(path) : 0\n else\n 0\n end\n end",
"def get_size(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if file.is_dir\n file.info[:size]\n end",
"def list_files(configs, a)\n puts \"Files for #{a}:\"\n\n count = 0\n sum_fs = 0\n Dir.foreach(configs[a]).each{|f|\n if not IGNORE.include?(f) then\n full_path = File.join(configs[a], f)\n puts \" #{count+=1}. #{f}#{File.directory?(full_path)? '/':''}\"\n sum_fs += File.size(full_path)\n end\n }\n \n puts \"#{count} file#{(count==1)?'':'s'}, sum #{sum_fs}B.\"\nend",
"def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end",
"def get_size(folder,hash)\n \n size_command = 'du -sh '+folder+' | cut -f 1'\n\n job_size = `#{size_command}`\n job_size = job_size.chomp\n\n hash['job_size']=job_size\n\n\nend",
"def file_size\n number_to_human_size(super)\n end",
"def resources_cost_from_children\n\t\tif !has_children?\n\t\t\tresources_cost\n\t\telse\n\t\t\tsuma = 0\n\t\t\tchildren.each do |c|\n\t\t\t\tsuma += c.resources_cost_from_children\n\t\t\tend\n\n\t\t\treturn suma \n\t\tend\n\tend",
"def size\n return @tree.size\n end",
"def size\n @children.size\n end",
"def local_size\n return @local_size if defined?(@local_size)\n @local_size = File.size(\"#{resource[:name]}\")\n end",
"def total_disk_size\n if @partition_layout.find { |p| !p.size_mb.is_a?(Integer) }\n raise RuntimeError, \"Some partition sizes unspecified, cannot infer \"\\\n \"total size of all partitions\"\n end\n\n @partition_layout.inject(0) { |memo, elem| memo + elem.size_mb } \\\n + FIRST_PARTITION_OFFSET \\\n + 1\n end",
"def child_size_memoized(child)\n if child\n child.size_memoized\n else\n 0\n end\n end",
"def du\n `du -s -b #{path}`.to_i\n end",
"def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end",
"def calculate_size\n @size = unit_count + holidays_count\n end"
] |
[
"0.829445",
"0.72857094",
"0.7185559",
"0.7073568",
"0.69653904",
"0.6935364",
"0.6879986",
"0.68090516",
"0.6802159",
"0.6644254",
"0.6644246",
"0.6589682",
"0.64592",
"0.64574033",
"0.6390974",
"0.6340066",
"0.633595",
"0.6335036",
"0.6314683",
"0.62634754",
"0.62321705",
"0.62135303",
"0.6190191",
"0.6141965",
"0.6136122",
"0.61043084",
"0.61032516",
"0.6080739",
"0.60629594",
"0.6058673",
"0.6030308",
"0.59987175",
"0.5982187",
"0.5978226",
"0.5956833",
"0.59540683",
"0.59537184",
"0.5927427",
"0.5908235",
"0.5908235",
"0.58948344",
"0.58910954",
"0.587822",
"0.58751285",
"0.58549196",
"0.5845188",
"0.584386",
"0.584386",
"0.5840266",
"0.58322906",
"0.5814732",
"0.5806472",
"0.58051735",
"0.57499653",
"0.5749822",
"0.5748776",
"0.57347333",
"0.5732023",
"0.57276237",
"0.57240224",
"0.571999",
"0.57177013",
"0.5717077",
"0.5685474",
"0.5680985",
"0.5679636",
"0.5676719",
"0.56748015",
"0.5636921",
"0.5627739",
"0.55943376",
"0.55938363",
"0.55780107",
"0.55710953",
"0.5565382",
"0.556434",
"0.5552963",
"0.5550604",
"0.55503714",
"0.554786",
"0.55465144",
"0.55465144",
"0.55465144",
"0.55465144",
"0.55102545",
"0.5508478",
"0.5478666",
"0.54749614",
"0.5473609",
"0.5471581",
"0.54690045",
"0.5456805",
"0.5442068",
"0.5441855",
"0.54377675",
"0.543546",
"0.5423413",
"0.54145914",
"0.5402961",
"0.5396582"
] |
0.61649466
|
23
|
Creates a zip file and saves the location and creation time if the zip file location hasn't been saved or the contents of the folder has changed. (needs to be recursive)
|
def zip
if !FileTest::directory?("/mnt/filebox/assets/zipfile_repository")
Dir::mkdir("/mnt/filebox/assets/zipfile_repository")
end
if self.zipped_file.nil? or !File.file?(self.zipped_file)
logger.info("[ZIP] Creating zipfile for #{self.name}")
self.zipped_file = "/mnt/filebox/assets/zipfile_repository/#{SecureRandom.hex(32)}.zip"
self.zipped_at = Time.now
self.save!
self._zip
else
# Check for modifications and rebuild if newer
unless self.updated_at >= self.zipped_at
logger.info("[ZIP] Rebuilding zipfile for #{self.name}")
self._zip
end
end
return self.zipped_file
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def assure_created_zip\n FileCreator::createNewZip(self)\n raise \"No file created\" unless File.exists? zip_path\n end",
"def create_zip\n require 'zip'\n zip_files = [self.ground_truth, self.image_sequence, self.config_file]\n if self.acceptable_segmentation_region.present?\n zip_files.push(self.acceptable_segmentation_region)\n end\n zip_filename = Rails.root.join(dir_path, \"#{self.name}.zip\")\n Zip::File.open(zip_filename, Zip::File::CREATE) do |zipfile|\n zip_files.each do |file|\n zipfile.add(file, \"#{dir_path}/#{file}\")\n end\n end\n end",
"def zipped!\n return if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system \"zip #{zip_path} #{path}/*\"\n end",
"def create_zip(name,url)\n @outputFile = (Rails.root.to_s+\"/tmp/cache/downloads/\"+name+\".zip\")\n if File.exist?(@outputFile)\n FileUtils.rm_rf (@outputFile)\n end\n @inputDir = url\n entries = Dir.entries(@inputDir)\n entries.delete(\".\")\n entries.delete(\"..\")\n io = Zip::ZipFile.open(@outputFile, Zip::ZipFile::CREATE)\n writeEntries(entries, \"\", io) #calling recursive write entries method\n io.close();\n return @outputFile\n end",
"def create_dirs_in_zipfile(created_dirs, entry_path, output_stream); end",
"def assure_zip_path\n assure_created_zip\n zip_path\n end",
"def zip(path)\n FileUtils.mkdir_p(path)\n zip_file_path = File.join(path, \"#{self.to_param}.zip\")\n if File.exists?(zip_file_path)\n File.delete(zip_file_path)\n end\n \n # open or create the zip file\n Zip::ZipFile.open(zip_file_path, Zip::ZipFile::CREATE) do |zip_file|\n \n # Add data files\n project_for_zip(zip_file, 'project.js')\n tags_for_zip(zip_file, 'category.js')\n\n app_maps.each do |map|\n map.facts_for_zip(zip_file, \"map_#{map.id}_project.js\")\n map.tags_for_zip(zip_file, \"map_#{map.id}_category.js\")\n end\n \n # Add images\n images_dir = 'images'\n zip_file.mkdir(images_dir) unless zip_file.find_entry(images_dir)\n self.facts.collect do |fact|\n# begin\n zip_file.add(fact.image, fact.photo.path(:thumb)) unless fact.photo_file_name.nil? || zip_file.find_entry(fact.image)\n # rescue => ex\n # # Need a way to output these errors\n # end\n end\n \n end\n File.chmod(0644, zip_file_path)\n zip_file_path\n end",
"def zip_file\n path = Dir.mktmpdir\n File.join(path, 'deploy.zip').tap do |path|\n Zip::File.open(path, Zip::File::CREATE) do |zip|\n Dir[\"#{@path}/**/**\"].each do |file|\n zip.add(file.sub(\"#{File.dirname(@path)}/\", ''), file)\n end\n end\n end\n end",
"def create_file(filename)\n # See zipfile branch in repository for zip file creation code.\n Dir.mkdir filename\n # TODO: Handle case where directory can't be created.\n end",
"def zip(dir, filename)\n Dir.chdir( File.join(options.logdir) ) do\n unless File.exists?(\"#{filename}.zip\")\n Zip::Archive.open(\"#{filename}.zip\", Zip::CREATE) do |ar|\n Dir.glob(\"#{dir}/**/*\").each do |path|\n if File.directory?(path)\n ar.add_dir(path)\n else\n ar.add_file(path, path)\n end\n end\n end\n end\n end\n end",
"def create_zip( ctx, file:, upload_dir:, archive_dir:, ** ) #File::Twin\n source_files = file.records\n\n zip_file = File.join( archive_dir, \"#{file.identifier}.zip\" )\n\n return false if File.exists?(zip_file)\n\n Zip::File.open(zip_file, Zip::File::CREATE) do |zip|\n source_files.each do |record|\n raise \"error with #{record.inspect}\" unless record.file_path # TODO: remove me\n\n name_in_zip = \"#{record.index}-#{File.basename(record.file_path)}\"\n\n zip.add( name_in_zip, File.join(upload_dir, record.file_path) ) # FIXME: this could break\n end\n end\n\n\n\n ctx[:zip] = zip_file\n end",
"def generate_zip_file!(sheet_scope)\n temp_dir = Dir.mktmpdir\n\n\n filename = \"#{name.gsub(/[^a-zA-Z0-9_-]/, \"_\")}_#{created_at.strftime(\"%H%M\")}\"\n all_files = generate_all_files(sheet_scope, temp_dir, filename)\n\n return if all_files.empty?\n\n # Create a zip file\n zipfile_name = File.join(temp_dir, \"#{filename}.zip\")\n Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|\n all_files.uniq.each do |location, input_file|\n # Two arguments:\n # - The name of the file as it will appear in the archive\n # - The original file, including the path to find it\n zipfile.add(location, input_file) if File.exist?(input_file) && File.size(input_file) > 0\n end\n end\n zipfile_name\n\n if File.exist?(zipfile_name)\n export_succeeded(zipfile_name)\n else\n export_failed(failure_details)\n end\n ensure\n # Remove the directory.\n FileUtils.remove_entry temp_dir\n end",
"def call\n create_zip if zipfile.stale?\n zipfile.file.to_s\n end",
"def generate_zip folder, zip_path\n FileUtils.rm zip_path if File.file? zip_path\n\n scan_path = File.join(folder, '*')\n puts \"Zipping up: #{scan_path}\"\n input_files = Dir.glob(scan_path)\n\n Zip::File.open(zip_path, Zip::File::CREATE) do |zipfile|\n input_files.each do |file|\n # Two arguments:\n # - The name of the file as it will appear in the archive\n # - The original file, including the path to find it\n zipfile.add(File.basename(file), file)\n end\n end\n end",
"def zipfile(list, newer_than, zipdir = '/tmp')\n\n str_newer = newer_than.to_s.split(%r{T})[0]\n\n zipfile_fn = File.join(zipdir, \"calibre-#{str_newer}.zip\")\n if File.exists?(zipfile_fn)\n File.unlink(zipfile_fn)\n end\n\n # Write the output zip\n #\n Dir.chdir(@library_path) do\n\n Zip.continue_on_exists_proc = true\n Zip.sort_entries = true\n Zip.unicode_names = true\n #\n # Try to avoid registering local paths\n #\n begin\n Zip::File.open(zipfile_fn, Zip::File::CREATE) do |zfh|\n #\n # For each book, gather the list of files\n #\n list.each do |bk|\n authr_base = bk['authors'].split(/,/)[0]\n all_files = File.join(authr_base, \"#{bk['title']}*\", '*')\n begin\n Dir[all_files].sort.each do |file|\n zfh.add(file, file)\n end\n rescue => msg\n $stderr.puts(\"Error: #{msg} : #{full} : #{file}\")\n end\n end # -- list\n end # -- Zip::File\n rescue => msg\n $stderr.puts(\"Error creating zip: #{msg}\")\n end\n end # -- chdir\n zipfile_fn\nend",
"def write\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n @folders.each do |input_dir, src, dest|\n src = '' if src == '/**' # the whole src directory could be specified by /**\n path = source_dir(File.join(input_dir, src))\n write_entries(path, entries(src, input_dir), dest, io)\n end\n end\n\n @output_file\n end",
"def zip_file(temp_number)\n zipfile_name = \"public/temp/builder_theme#{temp_number}.zip\"\n\n Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|\n Dir[File.join(@base_theme_directory, '**', '**')].each do |file|\n zipfile.add(file.sub(@base_theme_directory, ''), file)\n end\n end\n end",
"def zip_result_directory\n end",
"def add_files(zip)\n ZipFileGenerator.new(@manifest.base_dir, zip).write\n end",
"def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end",
"def zipfile; end",
"def _zip\n Zip::ZipFile.open(self.zipped_file, Zip::ZipFile::CREATE) do |z|\n self._zip_decender(z,self,nil)\n end\n end",
"def write()\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::ZipFile.open(@output_file, Zip::ZipFile::CREATE);\n write_entries(entries, \"\", io)\n io.close();\n end",
"def compress_file\n folder = \"./\"\n zipfile_name = \"./test_file.zip\"\n\n Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|\n zipfile.add(@file_name, File.join(folder, @file_name))\n end\n\n zipped_size = File.size('test_file.zip')\n @zip_test_ratio = (zipped_size * 1.0) / @file_size\n @zip_test_ratio = -1 if @file_size < 1000\n\n File.delete(\"./test_file.zip\")\n end",
"def make_zipfile dir, options={}\n zipfile = options[:filename] || \"#{dir}.zip\"\n excludes = ['-x', '*/.git/*', '-x', '*/.gitignore']\n exclude_each options[:excludes] do |exclude|\n excludes.push '-x', exclude\n end\n run 'zip', '-r', zipfile, dir, *excludes\n release zipfile, :cd => 1\nend",
"def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def inizializza_zip_path\n case nome_controllo\n when \"Autorizzazioni\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_0.zip\")\n when \"MGP_Validate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_1.zip\")\n when \"MGP_Esitate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_2.zip\")\n when \"MI_Form\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_3.zip\")\n when \"MI_Form_D\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_10.zip\")\n when \"MI_Validate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_4.zip\")\n when \"MI_Validate_D\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_11.zip\")\n when \"MI_Esitate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_5.zip\")\n when \"MI_Esitate_D\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_12.zip\")\n when \"Estero_Validate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/FRANCIA/SOA FRANCIA/03 File Zip/#{$day} #{$monthtext} #{$year}_6.zip\")\n when \"Estero_Esitate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/FRANCIA/SOA FRANCIA/03 File Zip/#{$day} #{$monthtext} #{$year}_7.zip\")\n when \"Vpp\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/VPP_#{$day}#{$monthtext}#{$year_short}_week_#{$week}.zip\")\n else @zip = nil\n end\n end",
"def write\r\n entries = Dir.entries(@input_dir) - %w[. ..]\r\n\r\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\r\n write_entries entries, '', zipfile\r\n end\r\n end",
"def zip\n raise \"No tracks in album #{name}\" if songs.empty? \n bundle_filename = \"#{RmedialSetting.default.static_file_path}/zip/#{artist.name} - #{name}.zip\"\n raise \"Unable to create zip file\" if !Medium.path_is_writeable?(bundle_filename)\n \n # check to see if the file exists already, and if it does, delete it.\n File.delete(bundle_filename) if File.file?(bundle_filename) \n\n # open or create the zip file\n Zip::ZipFile.open(bundle_filename, Zip::ZipFile::CREATE) { |zipfile|\n # collect the album's tracks\n self.songs.collect { |song|\n # add each track to the archive, names using the track's attributes\n zipfile.add(song.ideal_file_name, song.file_name)\n }\n }\n\n # set read permissions on the file\n File.chmod(0644, bundle_filename)\n\n return bundle_filename\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\"); entries.delete(\"yamproject.json\"); entries.delete(\".DS_Store\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def write_zip(destination)\n Zip::File.open(destination, Zip::File::CREATE) do |zip|\n @crate.payload.each do |path, entry|\n next if entry.directory?\n if entry.symlink?\n zip.add(path, entry.path) if entry.path\n else\n zip.get_output_stream(path) { |s| entry.write_to(s) }\n end\n end\n end\n end",
"def _zip_decender(zipstream, folder, path)\n if path.nil?\n path = folder.name\n else\n path = path + \"/\" + folder.name\n end\n zipstream.dir.mkdir(path)\n \n folder.assets.each do |a|\n logger.info(\"[ZIP] Adding #{a.file_name} in #{a.uploaded_file.path}\")\n zipstream.add(\"#{path}/#{a.file_name}\", a.uploaded_file.path)\n end\n folder.children.each do |f|\n _zip_decender(zipstream, f, path)\n end\n end",
"def recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n zipfile.mkdir(zipfile_path)\n subdir = Dir.entries(disk_file_path) - blacklisted_dir_entries\n write_entries(subdir, zipfile_path, zipfile)\n end",
"def zipIt\r\n puts \"Creating EPUB package:\"\r\n STDOUT.flush\r\n path = @dirs[:tmp]\r\n FileUtils.rm @epub, :force=>true\r\n Zip::ZipFile.open(@epub, 'w') do |zipfile|\r\n progress = ProgressBar.new(\"Compressing\", Dir[\"#{path}/**/**\"].length)\r\n Dir[\"#{path}/**/**\"].each do |file|\r\n zipfile.add(file.sub(path+'/', ''), file)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end\r\n end",
"def create\n output_path = ''\n\n CustomUtils.mktmpdir('knowings_api_file', \"/nfs/tmp/knowings/\") do |dir|\n metapath = create_meta(dir)\n basename = ::File.basename(@file_name, '.pdf')\n output_path = ::File.join(dir, \"#{basename}#{EXTENSION}\")\n\n POSIX::Spawn.system \"zip -j #{output_path} #{metapath} #{@filepath}\"\n end\n\n output_path\n end",
"def output_zipfile_path\n Pathname.new(output_final_directory_path).dirname.to_s + '/' + zip_filename\n end",
"def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end",
"def genDataZip(dir='generated', file_name='OdinSampleDataSet.zip', zip_dir='generated')\n # make sure the target file does not already exist\n # if it does, rename it to a tmp file\n runShellCommand(\"zip -j #{dir}/#{file_name} #{zip_dir}/*.xml #{zip_dir}/*.ctl\")\nend",
"def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Validate info.plist\n validateInfoPlist(path+\"info.plist\")\n \n #4 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #5 Copy balloons folder\n copyZipContents(\"balloons_images.zip\", @book_prod_folder+\"images/\")\n copyZipContents(\"balloons_script.zip\", @book_prod_folder+\"script/\") \n if !File::directory?(@book_prod_folder+\"icons/\")\n if File::directory?(path+\"/icons/\")\n Dir.mkdir(@book_prod_folder+\"icons/\")\n end\n end\n copyFolderContents(path+\"icons/\",@book_prod_folder+\"icons/\");\n \n #6 Verify Folders\n verifyFolders(@book_prod_folder)\n \n #7 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #8 Create Zip\n createZip(@book_prod_folder,@book_zip_generated_folder+@book_full_name+\".zip\",1)\n \n puts \"New Book Generated -\"+@book_full_name\nend",
"def zip_path\n \"/tmp/play-zips/#{zip_name}\"\n end",
"def zip(path_to_files, files_to_zip, zip_filepath, force_new_file = true)\n return unless files_to_zip\n # remove zip file, if existing already\n File.delete zip_filepath if force_new_file and File.file? zip_filepath\n\n directories = []\n\n # open or create the zip file\n Zip::ZipFile.open(zip_filepath, Zip::ZipFile::CREATE) do |zipfile|\n files_to_zip.each do |filename|\n file_path = path_to_files + '/' + filename\n logger.debug \"\\n===> adding '#{filename}' from '#{file_path}'\"\n zipfile.add(filename, file_path)\n\n directories << { :path => path_to_files, :name => filename } if File.directory? file_path\n end\n end\n \n # recursively adding directories, skipped but remembered before\n directories.each do |dir|\n get_dir_list(dir[:path] + '/' + dir[:name]).each do |sub_element|\n sub_filename = dir[:name] + '/' + sub_element\n zip(dir[:path], [ sub_filename ], zip_filepath, false)\n end\n end\n \n # set read permissions on the file\n File.chmod(0644, zip_filepath) \n end",
"def generate_output_file(zip_out, contents); end",
"def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #4 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #5 Create Zip\n createZip(@book_prod_folder,@book_prod_final_zip_folder+@book_full_name+\".zip\")\nend",
"def zipfiles\n @zipfile_name = \"#{$zip_folder}#{$testcase}.zip\"\n Zip::File.open(\"#{@zipfile_name}\", Zip::File::CREATE) do |zipfile|\n Dir.glob(\"#{$image_folder}#{$testcase}*\").each do |filename|\n file = File.basename(\"#{filename}\")\n zipfile.add(file, \"#{$image_folder}\" + file)\n end\n end\n end",
"def write_entries(entries, path, zipfile, root_dir)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(root_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path, root_dir)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def createFolders(path)\n update_ts=@update_timestamp.to_s()\n update_ts = update_ts.gsub(\":\",\"-\");\n update_ts = update_ts.gsub(\" \",\"_\");\n current_ts = Time.now.to_s()\n current_ts = current_ts.gsub(\":\",\"-\");\n current_ts = current_ts.gsub(\" \",\"_\");\n\n # Create root diff folder\n difFolder=path+\"diff_folder/\"\n if File.exists?(difFolder)\n if !(File.directory?(difFolder))\n Dir.mkdir(difFolder)\n end\n else\n Dir.mkdir(difFolder)\n end\n # Create book diff folder\n @book_diff_folder=difFolder+update_ts\n if File.exists?(@book_diff_folder) && File.directory?(@book_diff_folder)\n File.rename(@book_diff_folder, @book_diff_folder+\"-OLD_\"+current_ts)\n end\n Dir.mkdir(@book_diff_folder)\n \n # Create update root folder\n updateFolder=path+\"book_update/\"\n if File.exists?(updateFolder)\n if !(File.directory?(updateFolder))\n Dir.mkdir(updateFolder)\n end\n else\n Dir.mkdir(updateFolder)\n end\n \n # Create update book folder\n @book_update_folder=updateFolder+@book_full_name+\"_\"+update_ts\n if File.exists?(@book_update_folder) && File.directory?(@book_update_folder)\n File.rename(@book_update_folder, @book_update_folder+\"-OLD_\"+current_ts) \n end \n Dir.mkdir(@book_update_folder)\n\n #Create final book update folder\n @book_prod_final_update_folder=@book_zip_generated_folder+\"update_\"+update_ts+\"/\"\n if (File.exists?(@book_prod_final_update_folder) && File.directory?(@book_prod_final_update_folder))\n puts \"Book Update Prod folder exists\"\n else\n Dir.mkdir(@book_prod_final_update_folder)\n end\n @book_diff_folder=@book_diff_folder+\"/\"\n @book_update_folder=@book_update_folder+\"/\"\nend",
"def write\n entries = Dir.entries(@input_dir) - %w(. ..)\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n write_entries(entries, '', io)\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n # relative path of file being added to the zip\n relative_path = path == '' ? e : File.join(path, e)\n # full path\n full_path = File.join(@input_dir, relative_path)\n\n if File.directory? full_path\n recursively_zip_directory(full_path, zipfile, relative_path)\n else\n put_into_archive(full_path, zipfile, relative_path)\n end\n end\n end",
"def create\n comment_file = tmp_comment_file!\n tmp_zipfile = tmp_zipfile!\n\n derivative_files = []\n\n Zip::File.open(tmp_zipfile.path, Zip::File::CREATE) do |zipfile|\n # Add attribution as file and zip comment text\n zipfile.comment = comment_text\n zipfile.add(\"about.txt\", comment_file)\n\n members_to_include.each_with_index do |member, index|\n filename = \"#{format '%03d', index+1}-#{DownloadFilenameHelper.filename_base_from_parent(member)}.jpg\"\n\n uploaded_file = file_to_include(member.leaf_representative)\n\n # While it would be nice to stream directly from remote storage into the zip, we couldn't\n # get this to work with the combo of ruby-zip and shrine api's without downloading it\n # to local disk first. There may be a way we haven't figured out. May be able\n # to pass derivative.file.open to it instead for slightly better perf\n # once https://github.com/janko/down/issues/26\n file_obj = uploaded_file.download\n derivative_files << file_obj\n\n\n # We want to add to zip as \"STORED\", not \"DEFLATE\", since our JPGs\n # won't compress under DEFLATE anyway, save the CPU. Ruby zip does not\n # give us a GREAT api to do that, but it gives us a way.\n #\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/file.rb#L271\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/entry.rb#L53\n entry = ::Zip::Entry.new(zipfile.name, filename, nil, nil, nil, nil, ::Zip::Entry::STORED)\n zipfile.add(entry, file_obj)\n\n # We don't really need to update on every page, the front-end is only polling every two seconds anyway\n if callback && (index % 3 == 0 || index >= members_to_include.count - 1)\n callback.call(progress_total: members_to_include.count, progress_i: index + 1)\n end\n end\n end\n\n # tell the Tempfile to (re)open so it has a file handle open that can see what ruby-zip wrote\n tmp_zipfile.open\n\n return tmp_zipfile\n ensure\n (derivative_files || []).each do |tmp_file|\n tmp_file.close\n tmp_file.unlink\n end\n\n if comment_file\n comment_file.close\n comment_file.unlink\n end\n end",
"def zip(input_dir, output_file)\n entries = Dir.entries(input_dir) - %w(. ..)\n\n Zip::File.open(output_file, Zip::File::CREATE) do |zipfile|\n write_entries input_dir, entries, '', zipfile\n end\n end",
"def zip_file\n \"#{package_name}.zip\"\n end",
"def zip_create(for_server: true, include_files: true, md5sums: {},\n size_exams: -1, files_added: nil)\n pre = for_server ? center.login_name + '_' : ''\n dir = \"exa-#{pre}#{name}\"\n file = \"#{pre}#{name}.zip\"\n tmp_file = \"/tmp/#{file}\"\n dputs(2) { \"for_server:#{for_server} - include_files:#{include_files} \" +\n \"md5sums:#{md5sums.inspect} - size_exams:#{size_exams.inspect}\" }\n\n if students and students.size > 0\n File.exists?(tmp_file) and FileUtils.rm(tmp_file)\n Zip::File.open(tmp_file, Zip::File::CREATE) { |z|\n z.mkdir dir\n dputs(3) { \"Students is #{students.inspect}\" }\n files_excluded = []\n students.sort.each { |s|\n p = \"#{dir}/#{pre}#{s}\"\n dputs(3) { \"Creating #{p}\" }\n z.mkdir(p)\n if include_files\n dputs(3) { \"Searching in #{dir_exams}/#{s}\" }\n Dir.glob(\"#{dir_exams}/#{s}/*\").sort.each { |exa_f|\n exa_md5 = Digest::MD5.file(exa_f).hexdigest\n file_add = true\n filename = exa_f.sub(/.*\\//, '')\n if md5sums.has_key?(s)\n md5sums[s].each { |f, md5|\n if (f == filename) && (md5 == exa_md5)\n dputs(3) { \"Found file #{filename} to be excluded\" }\n file_add = false\n files_excluded.push exa_f.sub(/^#{dir_exams}\\//, '')\n end\n }\n end\n if file_add and size_exams != 0\n dputs(3) { \"Adding file #{exa_f} with size #{size_exams}\" }\n files_added and files_added.push [s, File.basename(exa_f), exa_md5]\n z.file.open(\"#{p}/#{exa_f.sub(/.*\\//, '')}\", 'w') { |f|\n f.write File.open(exa_f) { |ef|\n content = ef.read\n dputs(3) { \"Size of file is #{content.size}\" }\n size_exams -= [content.size, size_exams.abs].min\n content\n }\n }\n end\n }\n end\n }\n dputs(3) { \"Files_excluded are #{files_excluded.inspect}\" }\n z.file.open(\"#{dir}/files_excluded\", 'w') { |f|\n f.write files_excluded.to_json\n }\n }\n return file\n end\n return nil\n end",
"def create_zip_file(file_paths, zip_path)\n\n # Delete the file if it exists\n File.delete(zip_path) if File.exist?(zip_path)\n\n # Do not compress and dont store file paths\n cmd = \"zip -Z store -j \\\"#{zip_path}\\\" \"\n file_paths.each { |file| cmd += \"\\\"#{file}\\\" \" }\n\n # Execute the command\n puts cmd\n result_text = `#{cmd} 2>&1`\n #puts result_text\n\n # Return the op result\n return CmdResult.new( $?.success? ? :success : :error , result_text )\n\nend",
"def write_entries(entries, path, zipfile)\r\n entries.each do |e|\r\n zipfile_path = path == '' ? e : File.join(path, e)\r\n disk_file_path = File.join(@input_dir, zipfile_path)\r\n\r\n if File.directory? disk_file_path\r\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\r\n else\r\n put_into_archive(disk_file_path, zipfile, zipfile_path)\r\n end\r\n end\r\n end",
"def write\n @zip.write [@input_dir.basename], @input_dir.parent, ''\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\n \n #Create book zip folder\n @book_prod_final_zip_folder=@book_zip_generated_folder+\"book/\"\n if (File.exists?(@book_prod_final_zip_folder) && File.directory?(@book_prod_final_zip_folder))\n puts \"Book Prod Zip folder exists\"\n else\n Dir.mkdir(@book_prod_final_zip_folder)\n end\nend",
"def zip_dump\n\t system(\"mongodump --host localhost --db #{@mongo_database} --out #{@base_path}\")\n\t Dir[@base_path + '*.zip'].select { |e| File.delete(e) }\n\t Zip::File.open(@zipfile_name, Zip::File::CREATE) do |zipfile|\n\t Dir[File.join(@directory, '**', '**')].each do |file|\n\t\t zipfile.add(file.sub(@directory + '/', ''), file)\n\t end\n\t end\n\t end",
"def write\n FileUtils.rm @out_file if File.exists? @out_file\n in_progress \"Writing archive #{@out_file} from #{@input_dir}\" do\n Zip::File.open @out_file, Zip::File::CREATE do |zipfile|\n Dir[\"#{@input_dir}/**/**\"].reject{ |f| f == @out_file || !@filter.call(f) }.each do |file|\n progress \"deflating #{file}\"\n zipfile.add(file.sub(@input_dir + '/', ''), file)\n end\n end\n end\n end",
"def write\n File.delete(@output_file) if File.exist?(@output_file)\n\n Zip::File.open(@output_file, Zip::File::CREATE) do |zipfile|\n zipfile.add(mimetype_entry(zipfile), \"#{@input_dir}/mimetype\")\n\n all_entries.each do |file|\n zipfile.add(file, \"#{@input_dir}/#{file}\")\n end\n end\n end",
"def zip(filename=nil)\n filename = filename || File.basename(@project.root)\n project_base = File.basename(@project.root)\n\n zip_filename = File.join(File.basename(@package_path), \"#{filename}.zip\")\n # Create a temporary file for RubyZip to write to\n temp_filename = \"#{zip_filename}.tmp\"\n\n File.delete(temp_filename) if File.exists?(temp_filename)\n\n # Wrapping the zip creation in Thor's create_file to get \"overwrite\" prompts\n # Note: I could be overcomplicating this\n @task.create_file(zip_filename) do\n Zip::ZipFile.open(temp_filename, Zip::ZipFile::CREATE) do |zip|\n # Get all filenames in the build directory recursively\n filenames = Dir[File.join(@project.build_path, '**', '*')]\n\n # Remove the build directory path from the filename\n filenames.collect! {|path| path.gsub(/#{@project.build_path}\\//, '')}\n\n # Add each file in the build directory to the zip file\n filenames.each do |filename|\n zip.add File.join(project_base, filename), File.join(@project.build_path, filename)\n end\n end\n\n # Give Thor contents of zip file for \"overwrite\" prompt\n File.open(temp_filename, 'rb') { |f| f.read }\n end\n\n # Clean up the temp file\n File.delete(temp_filename)\n end",
"def pack(directory, name=nil)\n tmp_file = Tempfile.new(name || File.basename(directory))\n file_path = \"#{tmp_file.path}.zip\"\n tmp_file.delete\n entries = Hash[\n Dir.glob(File.join(directory, '**', '{*,.*}')).map do |path|\n next if path.end_with?('.')\n [path.sub(%r{#{Regexp.escape(directory)}/?}, ''), path]\n end\n ]\n Zip::File.open(file_path, Zip::File::CREATE) do |zipfile|\n entries.keys.sort.each do |entry|\n path = entries[entry]\n if(File.directory?(path))\n zipfile.mkdir(entry.dup)\n else\n zipfile.add(entry, path)\n end\n end\n end\n file = File.open(file_path, 'rb')\n file\n end",
"def save\n Tempfile.open([file_name, FILE_EXTENSION], type: 'application/zip') do |output_file|\n Zip::File.open(@template_path) do |template_zip|\n Zip::OutputStream.open(output_file.path) do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name]\n out.write(@replaceable_files[entry.name])\n else\n out.write(template_zip.read(entry.name))\n end\n end\n end\n end\n output_file\n end\n end",
"def make_zip(filename)\n filename = basename(filename)\n zip = result_location + filename\n Util::Zip.compress(base_location, zip)\n return zip\n end",
"def createAndSendZip(name)\n\n #Attachment name\n filename = \"#{name}.zip\"\n temp_file = Tempfile.new(filename)\n\n begin\n #This is the tricky part\n #Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |zos|}\n\n #Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zipfile|\n #Put files in here\n\n n1 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.shp\"\n n2 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.dbf\"\n n3 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.prj\"\n n4 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.shx\"\n\n\n\n zipfile.add(\"#{name}/#{name}.shp\", n1)\n zipfile.add(\"#{name}/#{name}.dbf\", n2)\n zipfile.add(\"#{name}/#{name}.prj\", n3)\n zipfile.add(\"#{name}/#{name}.shx\", n4)\n end\n\n #Read the binary data from the file\n zip_data = File.read(temp_file.path)\n\n #Send the data to the browser as an attachment\n #We do not send the file directly because it will\n #get deleted before rails actually starts sending it\n send_data(zip_data, :type => 'application/zip', :filename => filename, data: { turbolinks: false })\n ensure\n #Close and delete the temp file\n temp_file.close\n temp_file.unlink\n end\n end",
"def zip_files\n time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Archive::Zip.archive(File.join(ARCHIVE[0], ARCHIVE[1], time, ARCHIVE[2]), File.join(LOCAL_DIR, '.'))\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each { |file| File.delete(file) }\n end",
"def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end",
"def create\n @zip_file = ZipFile.new(zip_file_params)\n @zip_file.save!\n redirect_to admin_zip_files_path\n #respond_to do |format|\n # if @zip_file.save\n # format.html { redirect_to @zip_file, notice: 'Zip file was successfully created.' }\n # format.json { render :show, status: :created, location: @zip_file }\n # else\n # format.html { render :new }\n # format.json { render json: @zip_file.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def zip_automated_test_files(user)\n zip_name = \"#{self.short_identifier}-testfiles-#{user.user_name}\"\n zip_path = File.join('tmp', zip_name + '.zip')\n FileUtils.rm_rf zip_path\n files_dir = Pathname.new self.autotest_files_dir\n Zip::File.open(zip_path, Zip::File::CREATE) do |zip_file|\n self.autotest_files.map do |file|\n path = File.join zip_name, file\n abs_path = files_dir.join(file)\n if abs_path.directory?\n zip_file.mkdir(path)\n else\n zip_file.get_output_stream(path) { |f| f.print File.read(abs_path.to_s, mode: 'rb') }\n end\n end\n end\n zip_path\n end",
"def write\n entries = @input_dir.children(false)\n @zip.write entries, @input_dir, ''\n end",
"def bundleTimestampNone(dest_folder,new_timestamp)\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n File.utime(new_timestamp, new_timestamp, file)\n if !(File::directory?(file))\n # Add to zip bundle \n archive=zipBundle(file,new_timestamp)\n end \n end\n generateZipBundle() \n @latest_ts=new_timestamp+60\nend",
"def to_zip\n tmpdir = Dir.mktmpdir\n dir = path = nil\n timed_section(Rails.logger, 'app_to_zip') do\n dir = unpack_upload\n synchronize_pool_with(dir)\n path = AppPackage.repack_app_in(dir, tmpdir, :zip)\n zip_path = save_package(path) if path\n end\n ensure\n FileUtils.rm_rf(tmpdir)\n FileUtils.rm_rf(dir) if dir\n FileUtils.rm_rf(File.dirname(path)) if path\n end",
"def zip(data)\n zipfile = \"rubyzip-#{rand 32768}\" \n Zip::ZipOutputStream::open(zipfile) do |io|\n count = 0\n data.each do |d, n|\n io.put_next_entry((\"#{n}\" or \"#{count += 1}.txt\"))\n io.write d\n end\n end\n zippy = File.open(zipfile).read\n #File.delete(zipfile)\n zippy \n end",
"def configure_redist_zip(zip, zip_file_name)\n\tzip.directories_to_zip File.join(RedistDirName, zip_file_name)\n\tzip.output_file = zip_file_name + \".zip\"\n\tzip.output_path = RedistDirName\nend",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n next\n end\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end",
"def write_entries(input_dir, entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(input_dir, disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_zip(out_path)\n CrxMake.zip(\n :ex_dir => @build_dir,\n :pkey => full_key_path,\n :zip_output => out_path,\n :verbose => false\n )\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n puts \"Deflating #{disk_file_path}\"\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |entry|\n zipfile_path = path == '' ? entry : File.join(path, entry)\n disk_file_path = File.join(src_path, zipfile_path)\n\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\nend",
"def zip_file_directory\n \"#{File.dirname(filename)}/#{File.basename(filename, '.zip')}\"\n end",
"def create\n zip.attributes = zip_params\n\n respond_to do |format|\n if zip.save\n format.html { redirect_to admin_zips_path, notice: 'Zip was successfully created.' }\n format.json { render :show, status: :created, location: zip }\n else\n format.html { render :new }\n format.json { render json: zip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n FileUtils.mkdir_p path\n end",
"def create\n @zip = Zip.new(params[:zip])\n\n respond_to do |format|\n if @zip.save\n flash[:notice] = 'Zip was successfully created.'\n format.html { redirect_to(@zip) }\n format.xml { render :xml => @zip, :status => :created, :location => @zip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @zip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def touch(filename)\n unless in_zip?\n FileUtils.touch current_dir.join(filename)\n else\n Zip::File.open(current_zip) do |zip|\n # zip.file.open(filename, 'w') {|_f| } #HAXX this code creates an unneeded temporary file\n zip.instance_variable_get(:@entry_set) << Zip::Entry.new(current_zip, filename)\n end\n end\n\n ls\n move_cursor items.index {|i| i.name == filename}\n end",
"def add_file( zipfile, f )\n if File.exists?(f)\n puts \"Writing #{f} at #{@dest_dir}\" if verbose\n zipfile.add(f, \"#{@dest_dir}/#{f}\")\n else\n puts \"Ignoring missing file #{f} at #{@dest_dir}\"\n end\n end",
"def create_backup_path\n if File.exist?(@new_path)\n if !File.directory?(@new_path)\n #TODO: error properly\n abort\n end\n else\n FileUtils.mkdir_p @new_path\n end\n end",
"def zip(folder, file=nil, options={})\n raise ArgumentError if folder == '.*'\n file ||= File.basename(File.expand_path(folder)) + '.zip'\n cmd = \"zip -rqu #{file} #{folder}\"\n puts cmd if options[:dryrun] or options[:verbose]\n system cmd unless options[:dryrun] or options[:noop]\n return File.expand_path(file)\n end",
"def write\n entries = Dir.entries(@input_dir)\n entries.delete('.')\n entries.delete('..')\n # TODO: delete config file\n io = Zip::File.open(@output_file, Zip::File::CREATE)\n write_entries(entries, '', io)\n io.close\n end",
"def extract_zip\n # FileUtils.rmtree(@extract_folder)\n zip_files = Dir[\"#{@download_folder}/*.zip\"]\n\n zip_files.each do |zip|\n Zip::File.open(zip) do |zip_file|\n zip_file.each do |f|\n file_name = f.name\n FileUtils.mkdir_p(\"#{@extract_folder}/#{File.dirname(file_name)}\")\n\n # doesn't extract empty files or files with fake locale\n if f.size && f.size != 0\n # if true overwrite existing files with same name\n zip_file.extract(f, \"#{@extract_folder}/#{f.name}\") { true }\n end\n end\n end\n delete_zip(zip)\n end\n end",
"def create_archive\n created = false\n empty = true\n Dir.mktmpdir do |tmpdir|\n # create manifest\n tmpmf = File.join(tmpdir, DulHydra.export_set_manifest_file_name)\n # create the zip archive\n zip_name = \"export_set_#{Time.now.strftime('%Y%m%d%H%M%S')}.zip\"\n zip_path = File.join(tmpdir, zip_name)\n Zip::ZipFile.open(zip_path, Zip::ZipFile::CREATE) do |zip_file|\n CSV.open(tmpmf, 'wb') do |manifest|\n manifest << archive_manifest_header\n pids.each do |pid|\n # get Fedora object\n begin\n object = ActiveFedora::Base.find(pid, :cast => true) \n # skip if object is not content-bearing or user lacks :read permission\n next unless object.has_content? and user.can?(:read, object)\n content_ds = object.datastreams[DulHydra::Datastreams::CONTENT]\n # use guaranteed unique file name based on PID and dsID \n temp_file_path = File.join(tmpdir, content_ds.default_file_name)\n # write content to file\n File.open(temp_file_path, 'wb', :encoding => 'ascii-8bit') do |f|\n content_ds.write_content(f)\n end\n # Use original source file name, if available; otherwise the generated file name\n # Note that we keep the path of the source file in order to reduce likelihood\n # name conflicts, and since it is easy to flatten zip contents on extraction.\n # However, we don't want the path of the generated temp file, just the basename.\n file_name = object.source.first || File.basename(temp_file_path)\n # discard leading slash, if present\n file_name = file_name[1..-1] if file_name.start_with? '/'\n # add file to archive\n zip_file.add(file_name, temp_file_path)\n # add row to manifest\n manifest << archive_manifest_row(file_name, object)\n rescue ActiveFedora::ObjectNotFoundError => e\n logger.error e\n next\n end\n end # document_list\n end # manifest\n # check if the zip file is emtpy\n empty = (zip_file.size == 0)\n # write manifest \n zip_file.add(DulHydra.export_set_manifest_file_name, tmpmf) unless empty\n end # zip_file\n # update_attributes seems to be the way to get paperclip to work \n # when not using file upload form submission to create the attachment\n created = !empty && update_attributes({:archive => File.new(zip_path, \"rb\")})\n end # tmpdir is removed\n created\n end",
"def compress_done_files(task)\n task_dir = student_work_dir(:done, task, false)\n zip_file = zip_file_path_for_done_task(task)\n return if (zip_file.nil?) || (not Dir.exists? task_dir)\n\n FileUtils.rm(zip_file) if File.exists? zip_file\n\n input_files = Dir.entries(task_dir).select { | f | (f =~ /^\\d{3}\\.(cover|document|code|image)/) == 0 }\n\n Zip::File.open(zip_file, Zip::File::CREATE) do | zip |\n zip.mkdir \"#{task.id}\"\n input_files.each do |in_file|\n zip.add \"#{task.id}/#{in_file}\", \"#{task_dir}#{in_file}\"\n end\n end\n\n FileUtils.rm_rf(task_dir)\n end",
"def output_final_directory_path\n unless instance_variable_defined? :@output_final_directory_path\n tmp_path = Dir.mktmpdir(TEMP_ZIP_PATH_PREFIX)\n @output_final_directory_path = File.join(tmp_path, output_final_subdirectory_name)\n FileUtils.mkdir_p @output_final_directory_path\n end\n @output_final_directory_path\n end",
"def compress(path, archive)\n require 'zip/zip'\n require 'zip/zipfilesystem'\n\n path.sub!(%r[/$], '')\n ::Zip::ZipFile.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject { |f| f==archive }.each do |file|\n print_line(\"Adding #{file} to archive\")\n zipfile.add(file.sub(path+'/', ''), file)\n end\n end\n print_line(\"All files saved to #{archive}\")\n end",
"def write\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete('..')\n io = Zip::File.open(@server_pack_file, Zip::File::CREATE)\n write_entries(entries, '', io)\n io.close\n end",
"def create_folder_lock (backup_path, backup_date)\n #create backup time directory\n FileUtils.mkdir_p \"#{backup_path}#{backup_date}\"\n #create backup time lockfile\n lockfile = File.new(\"#{backup_path}\" + \"#{backup_date}.flock\", \"w+\").flock(File::LOCK_EX)\nend"
] |
[
"0.7239472",
"0.70792025",
"0.7024762",
"0.68274707",
"0.67925406",
"0.6727761",
"0.66748667",
"0.6664948",
"0.6545483",
"0.64875376",
"0.6445687",
"0.6422431",
"0.63944566",
"0.63851357",
"0.63158125",
"0.63017666",
"0.62593544",
"0.62373346",
"0.621697",
"0.6214626",
"0.620333",
"0.6195635",
"0.6186659",
"0.61816466",
"0.6172851",
"0.61684537",
"0.61684537",
"0.615831",
"0.6145521",
"0.61422557",
"0.6107992",
"0.60926485",
"0.6078385",
"0.60689276",
"0.6050939",
"0.6034258",
"0.6025785",
"0.60111624",
"0.60021615",
"0.60012996",
"0.5962093",
"0.5957301",
"0.59557337",
"0.5952585",
"0.59517425",
"0.59435254",
"0.59410655",
"0.5940394",
"0.5928681",
"0.59213644",
"0.59186316",
"0.5908584",
"0.59073997",
"0.590357",
"0.5888643",
"0.5871491",
"0.5860715",
"0.5857636",
"0.58483136",
"0.58483136",
"0.58405495",
"0.583998",
"0.5834393",
"0.58153415",
"0.5808554",
"0.58058584",
"0.5795354",
"0.5789031",
"0.575713",
"0.5754855",
"0.57507086",
"0.5734409",
"0.5733613",
"0.5729184",
"0.57150716",
"0.57094204",
"0.57087314",
"0.5703652",
"0.56882906",
"0.5685938",
"0.56815946",
"0.5680499",
"0.5677343",
"0.56579953",
"0.56558967",
"0.56490946",
"0.56359416",
"0.5614305",
"0.56007355",
"0.5596927",
"0.55859625",
"0.55840844",
"0.55834055",
"0.5550947",
"0.5547251",
"0.5543902",
"0.55348337",
"0.5526431",
"0.55231947",
"0.5518394"
] |
0.74767613
|
0
|
Helper for the total size method which recursively calculates the size
|
def _total_size(folder, size)
folder.assets.each do |a|
size = size + a.file_size
end
folder.children.each do |f|
size = _total_size(f,size)
end
return size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def size\n children_size + my_size\n end",
"def total_size\n return @total_size if @total_size\n if @structure.instance_of? Array\n return 0 if @structure.empty?\n @total_size = strip(:size).flatten.inject { |sum, i| sum + i }\n else\n @total_size = size\n end\n end",
"def size\n size_helper(@root)\n end",
"def total_size\n self._total_size(self, 0)\n end",
"def size_all\n\t\tfname=\"Node:#{__method__}\"\n\t\tret=0\n\t\tlevel=0\n\t\tbegin\n\t\t\tret=self.size_all_(ret, level)\n\t\trescue Exception=>e\n\t\t\tLOG.error(fname){\"EXCEPTION during nodes size calculation: #{e} \"}\n\t\tret=-1\n\t\tend\n\t\tret\n\tend",
"def size\n @errors.size + @children.each_value.reduce(0) do |total, child|\n total + child.size\n end\n end",
"def optimal_size\n if !children\n self.size children: false\n else\n self.fast_size\n end\n end",
"def size\n @size \n end",
"def size\n @size \n end",
"def child_size_memoized(child)\n if child\n child.size_memoized\n else\n 0\n end\n end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size\n size_support(self.root)\n end",
"def size!\n @elements.values.map(&:size!).inject(0) {|total,size| total + size}\n end",
"def size; @size end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size\n\t\t#puts \"size of #{name}: #{super()}\"\n\t\t103\n\tend",
"def size(*) end",
"def size(*) end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n @size.size\n end",
"def size\n\n end",
"def size\n # return the value of the instance variable @size\n @size\n # end size method\n end",
"def children_size\n size = locations.size\n locations.each{|location|\n locations = location.locations\n if locations.present?\n size += location.children_size\n end\n }\n return size\n end",
"def get_size\n\t\tend",
"def size\n @children.size\n end",
"def recalculate_filesize\n @filesize = @collection.reduce(0) {|sum,asset| sum + asset.size}\n end",
"def size\nend",
"def compute_all_dir_sizes(directory:, answer:)\n directory.size = directory.files.sum(&:size) if directory.directories.empty?\n\n directory.directories.each do |child_directory|\n compute_all_dir_sizes(directory: child_directory, answer:)\n end\n\n directory.set_size\n answer.push(directory.size) if directory.size <= 100_000\n answer\nend",
"def total_size\n object_versions.inject(0) { |sum, obj| sum += obj.size }\n end",
"def size\n\n\n end",
"def size\n @root and @root.size or 0\n end",
"def calc_size(size)\n eax = size\n edx = size + 0xf\n eax = 0x10\n eax -= 1\n eax += edx\n var_390 = 0x10\n edx = 0\n eax = eax / var_390\n eax *= 0x10\n\n return eax + 0x1c\nend",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n value.map(&:size).inject(0, :+)\n end",
"def size\n return @tree.size\n end",
"def size\n if @size.nil?\n @size = @mset.inject(0) do |total, pair|\n value = pair[1]\n if value.is_a? Array\n total + value.size\n else\n total + 1\n end\n end\n end\n\n @size\n end",
"def calculate_tree_size(folder)\n\t\ttotal_size = 0\n\t\t@files.each do |name, size|\n\t\t\tbegin\n\t\t\t\tif name.include? folder\n\t\t\t\t\tlocal_size = Integer(size)\n\t\t\t\t\ttotal_size = total_size + local_size\n\t\t\t\tend\n\t\t\trescue TypeError\n\t\t\tend\n\t\tend\n\t\treturn total_size\n\tend",
"def print_tree_size()\n\t\tputs \"Total size for #{@folder_walker.folder} is #{commify(@folder_walker.total_size)}\"\n\tend",
"def children_size\n leaf? ? 0 : children.map(&:size).reduce(:+)\n end",
"def used_bytes\n size = 0\n unless empty?\n actual_node = @tail_node\n while actual_node != nil do\n size += actual_node.value.value.length\n actual_node = actual_node.next_node\n end\n end\n size\n end",
"def size\n # returns the value of the instance var @size\n @size\n # end of size method\n end",
"def size\n \t@size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def size\n @size\n end",
"def calculate_size\n @size = unit_count + holidays_count\n end"
] |
[
"0.7724895",
"0.76796305",
"0.7535288",
"0.74847823",
"0.7309639",
"0.6985883",
"0.695644",
"0.69502586",
"0.69502586",
"0.69447035",
"0.68877506",
"0.68877506",
"0.68877506",
"0.68877506",
"0.68877506",
"0.68877506",
"0.6882301",
"0.68258035",
"0.67993736",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6797387",
"0.6793981",
"0.67744786",
"0.67744786",
"0.6770665",
"0.6770665",
"0.6770665",
"0.67431587",
"0.6742975",
"0.6742224",
"0.67395896",
"0.67359054",
"0.6735146",
"0.67219657",
"0.67213964",
"0.6717202",
"0.67001754",
"0.6692905",
"0.667535",
"0.6657301",
"0.6653834",
"0.6653834",
"0.6653834",
"0.6653834",
"0.6653834",
"0.6653834",
"0.6653834",
"0.66503114",
"0.6635388",
"0.6631181",
"0.66276383",
"0.66248494",
"0.6620587",
"0.66020626",
"0.66011757",
"0.66004574",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.6591203",
"0.65870434"
] |
0.69120634
|
10
|
Helper for the zip method which creates the zip stream and calls the zip decender
|
def _zip
Zip::ZipFile.open(self.zipped_file, Zip::ZipFile::CREATE) do |z|
self._zip_decender(z,self,nil)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def zip\n end",
"def zip\n end",
"def zip_contents; end",
"def zip\n @zip\n end",
"def export_zip\n stringio = Zip::ZipOutputStream::write_buffer do |zip|\n @zip = zip\n export\n end\n @zip = nil\n stringio.rewind\n stringio.sysread\n end",
"def zipfile; end",
"def generate_output_file(zip_out, contents); end",
"def zipped_stream(entry)\n Zlib::GzipReader.new entry\n end",
"def create\n comment_file = tmp_comment_file!\n tmp_zipfile = tmp_zipfile!\n\n derivative_files = []\n\n Zip::File.open(tmp_zipfile.path, Zip::File::CREATE) do |zipfile|\n # Add attribution as file and zip comment text\n zipfile.comment = comment_text\n zipfile.add(\"about.txt\", comment_file)\n\n members_to_include.each_with_index do |member, index|\n filename = \"#{format '%03d', index+1}-#{DownloadFilenameHelper.filename_base_from_parent(member)}.jpg\"\n\n uploaded_file = file_to_include(member.leaf_representative)\n\n # While it would be nice to stream directly from remote storage into the zip, we couldn't\n # get this to work with the combo of ruby-zip and shrine api's without downloading it\n # to local disk first. There may be a way we haven't figured out. May be able\n # to pass derivative.file.open to it instead for slightly better perf\n # once https://github.com/janko/down/issues/26\n file_obj = uploaded_file.download\n derivative_files << file_obj\n\n\n # We want to add to zip as \"STORED\", not \"DEFLATE\", since our JPGs\n # won't compress under DEFLATE anyway, save the CPU. Ruby zip does not\n # give us a GREAT api to do that, but it gives us a way.\n #\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/file.rb#L271\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/entry.rb#L53\n entry = ::Zip::Entry.new(zipfile.name, filename, nil, nil, nil, nil, ::Zip::Entry::STORED)\n zipfile.add(entry, file_obj)\n\n # We don't really need to update on every page, the front-end is only polling every two seconds anyway\n if callback && (index % 3 == 0 || index >= members_to_include.count - 1)\n callback.call(progress_total: members_to_include.count, progress_i: index + 1)\n end\n end\n end\n\n # tell the Tempfile to (re)open so it has a file handle open that can see what ruby-zip wrote\n tmp_zipfile.open\n\n return tmp_zipfile\n ensure\n (derivative_files || []).each do |tmp_file|\n tmp_file.close\n tmp_file.unlink\n end\n\n if comment_file\n comment_file.close\n comment_file.unlink\n end\n end",
"def zipped!\n return if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system \"zip #{zip_path} #{path}/*\"\n end",
"def zip(data)\n zipfile = \"rubyzip-#{rand 32768}\" \n Zip::ZipOutputStream::open(zipfile) do |io|\n count = 0\n data.each do |d, n|\n io.put_next_entry((\"#{n}\" or \"#{count += 1}.txt\"))\n io.write d\n end\n end\n zippy = File.open(zipfile).read\n #File.delete(zipfile)\n zippy \n end",
"def call\n zip_content!\n\n swatches_path\n end",
"def _zip_decender(zipstream, folder, path)\n if path.nil?\n path = folder.name\n else\n path = path + \"/\" + folder.name\n end\n zipstream.dir.mkdir(path)\n \n folder.assets.each do |a|\n logger.info(\"[ZIP] Adding #{a.file_name} in #{a.uploaded_file.path}\")\n zipstream.add(\"#{path}/#{a.file_name}\", a.uploaded_file.path)\n end\n folder.children.each do |f|\n _zip_decender(zipstream, f, path)\n end\n end",
"def stream_zip(ignore_part_exceptions=false)\n PackageStreamer.new(self, ignore_part_exceptions)\n end",
"def zipfile=(_arg0); end",
"def call\n create_zip if zipfile.stale?\n zipfile.file.to_s\n end",
"def stream\n update\n stream = Zip::OutputStream.write_buffer do |out|\n zip.each do |entry|\n next unless entry.file?\n\n out.put_next_entry(entry.name)\n\n if @replace[entry.name]\n out.write(@replace[entry.name])\n else\n out.write(zip.read(entry.name))\n end\n end\n end\n\n stream.rewind\n stream\n end",
"def zip_roundtrip(args = nil)\n cleanup(args)\n zip = generate_cat1_zip(args)\n upload_cat1_zip(zip, args)\n ids = kickoff_calculation(args)\n xml = get_pophealth_xml(ids, args)\n upload_cypress_xml(xml, args)\n end",
"def zipIt\r\n puts \"Creating EPUB package:\"\r\n STDOUT.flush\r\n path = @dirs[:tmp]\r\n FileUtils.rm @epub, :force=>true\r\n Zip::ZipFile.open(@epub, 'w') do |zipfile|\r\n progress = ProgressBar.new(\"Compressing\", Dir[\"#{path}/**/**\"].length)\r\n Dir[\"#{path}/**/**\"].each do |file|\r\n zipfile.add(file.sub(path+'/', ''), file)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end\r\n end",
"def zip(data)\n Zip::OutputStream.write_buffer{ |zip|\n data.each{ |name, content|\n zip.put_next_entry(name)\n zip.write(content)\n }\n }.string\nend",
"def add_buffer\n io = ::StringIO.new('')\n zf = ::Zip::File.new(io, true, true)\n yield zf\n zf.write_buffer(io)\n end",
"def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end",
"def genDataZip(dir='generated', file_name='OdinSampleDataSet.zip', zip_dir='generated')\n # make sure the target file does not already exist\n # if it does, rename it to a tmp file\n runShellCommand(\"zip -j #{dir}/#{file_name} #{zip_dir}/*.xml #{zip_dir}/*.ctl\")\nend",
"def create_zip\n require 'zip'\n zip_files = [self.ground_truth, self.image_sequence, self.config_file]\n if self.acceptable_segmentation_region.present?\n zip_files.push(self.acceptable_segmentation_region)\n end\n zip_filename = Rails.root.join(dir_path, \"#{self.name}.zip\")\n Zip::File.open(zip_filename, Zip::File::CREATE) do |zipfile|\n zip_files.each do |file|\n zipfile.add(file, \"#{dir_path}/#{file}\")\n end\n end\n end",
"def with_tmp_zip_file\n file = Tempfile.new('retrieve')\n begin\n file.binmode\n file.write(zip_file)\n file.rewind\n yield file\n ensure\n file.close\n file.unlink\n end\n end",
"def create_zip( ctx, file:, upload_dir:, archive_dir:, ** ) #File::Twin\n source_files = file.records\n\n zip_file = File.join( archive_dir, \"#{file.identifier}.zip\" )\n\n return false if File.exists?(zip_file)\n\n Zip::File.open(zip_file, Zip::File::CREATE) do |zip|\n source_files.each do |record|\n raise \"error with #{record.inspect}\" unless record.file_path # TODO: remove me\n\n name_in_zip = \"#{record.index}-#{File.basename(record.file_path)}\"\n\n zip.add( name_in_zip, File.join(upload_dir, record.file_path) ) # FIXME: this could break\n end\n end\n\n\n\n ctx[:zip] = zip_file\n end",
"def zip(data, file)\n f = File.open(file, 'w+')\n gz_writer = Zlib::GzipWriter.new(f)\n gz_writer.orig_name=('test.i')\n gz_writer.write(data)\n gz_writer.close\n # MRI GzipWriter closes f TOOD: test f is closed...\nend",
"def zip(data, file)\n f = File.open(file, 'w+')\n gz_writer = Zlib::GzipWriter.new(f)\n gz_writer.orig_name=('test.i')\n gz_writer.write(data)\n gz_writer.close\n # MRI GzipWriter closes f TOOD: test f is closed...\nend",
"def unpack_using_seven_zip(tmpdir)\n if new_resource.absolute_path =~ /\\.t(ar\\.)?(gz|bz(2)?|xz)$/\n # 7-Zip doesn't know to unpack both levels of the archive on its own\n # so we need to handle this more explicitly.\n shell_out!(\"#{seven_zip_home}\\\\7z.exe x -so \\\"#{windows_path(new_resource.absolute_path)}\\\" | #{seven_zip_home}\\\\7z.exe x -si -ttar -o\\\"#{windows_path(tmpdir)}\\\"\")\n else\n shell_out!(\"#{seven_zip_home}\\\\7z.exe x -o\\\"#{windows_path(tmpdir)}\\\" \\\"#{windows_path(new_resource.absolute_path)}\\\"\")\n end\n end",
"def write_zip64_support=(_arg0); end",
"def compress(entries)\n puts \"\\nadding the following entries into zip package\"\n puts \"#{ entries.map{ |x| x.name }.join(\"\\n\")}\"\n buffer = Zip::File.add_buffer do |zio|\n entries.each do |file|\n if file.is_a? FileEntry\n zio.add(file.path == nil ? file.name : file.path, file.name)\n else\n zio.get_output_stream(file.name) { |os| os.write file.buffer.string }\n end\n end\n end\n end",
"def create_dirs_in_zipfile(created_dirs, entry_path, output_stream); end",
"def process_and_create_zip_file\n @project = Project.find(params[:format].to_i)\n compressed_filestream = Zip::OutputStream.write_buffer do |zos|\n @project.testcases.each do |p|\n zos.put_next_entry p.testfile_file_name\n zos.print(Paperclip.io_adapters.for(p.testfile).read)\n\n\n zos.put_next_entry p.output_file_name\n zos.print(Paperclip.io_adapters.for(p.output).read)\n\n end\n end\n compressed_filestream.rewind\n send_data compressed_filestream.read, filename: \"testcases.zip\"\n end",
"def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end",
"def add_files(zip)\n ZipFileGenerator.new(@manifest.base_dir, zip).write\n end",
"def create_zip_file(file_paths, zip_path)\n\n # Delete the file if it exists\n File.delete(zip_path) if File.exist?(zip_path)\n\n # Do not compress and dont store file paths\n cmd = \"zip -Z store -j \\\"#{zip_path}\\\" \"\n file_paths.each { |file| cmd += \"\\\"#{file}\\\" \" }\n\n # Execute the command\n puts cmd\n result_text = `#{cmd} 2>&1`\n #puts result_text\n\n # Return the op result\n return CmdResult.new( $?.success? ? :success : :error , result_text )\n\nend",
"def zipSequenceFiles()\n puts \"Zipping sequence files\"\n zipCmd = \"bzip2 *sequence.txt\"\n `#{zipCmd}`\n end",
"def zipSequenceFiles()\n puts \"Zipping sequence files\"\n zipCmd = \"bzip2 *sequence.txt\"\n `#{zipCmd}`\n end",
"def zip\n if !FileTest::directory?(\"/mnt/filebox/assets/zipfile_repository\")\n Dir::mkdir(\"/mnt/filebox/assets/zipfile_repository\")\n end\n if self.zipped_file.nil? or !File.file?(self.zipped_file)\n logger.info(\"[ZIP] Creating zipfile for #{self.name}\")\n self.zipped_file = \"/mnt/filebox/assets/zipfile_repository/#{SecureRandom.hex(32)}.zip\"\n self.zipped_at = Time.now\n self.save!\n self._zip\n else\n # Check for modifications and rebuild if newer\n unless self.updated_at >= self.zipped_at\n logger.info(\"[ZIP] Rebuilding zipfile for #{self.name}\")\n self._zip\n end\n end\n \n return self.zipped_file\n end",
"def write_zip64_support; end",
"def close\n contents_size = 0\n @entries.each do |e|\n e.local_header_offset = contents_size\n contents_size += 30 + e.name.length + e.compressed_size\n end\n\n io = StringIO.new\n io.instance_eval \"@offset = #{contents_size}\"\n def io.tell\n super + @offset\n end\n Zip::CentralDirectory.new(@entries).write_to_stream io\n io.rewind\n tail = io.read\n tail.force_encoding 'ASCII-8BIT'\n @data += tail\n contents_size\n end",
"def zipfile(list, newer_than, zipdir = '/tmp')\n\n str_newer = newer_than.to_s.split(%r{T})[0]\n\n zipfile_fn = File.join(zipdir, \"calibre-#{str_newer}.zip\")\n if File.exists?(zipfile_fn)\n File.unlink(zipfile_fn)\n end\n\n # Write the output zip\n #\n Dir.chdir(@library_path) do\n\n Zip.continue_on_exists_proc = true\n Zip.sort_entries = true\n Zip.unicode_names = true\n #\n # Try to avoid registering local paths\n #\n begin\n Zip::File.open(zipfile_fn, Zip::File::CREATE) do |zfh|\n #\n # For each book, gather the list of files\n #\n list.each do |bk|\n authr_base = bk['authors'].split(/,/)[0]\n all_files = File.join(authr_base, \"#{bk['title']}*\", '*')\n begin\n Dir[all_files].sort.each do |file|\n zfh.add(file, file)\n end\n rescue => msg\n $stderr.puts(\"Error: #{msg} : #{full} : #{file}\")\n end\n end # -- list\n end # -- Zip::File\n rescue => msg\n $stderr.puts(\"Error creating zip: #{msg}\")\n end\n end # -- chdir\n zipfile_fn\nend",
"def test_0300_zip\n @@log.debug \"test_0300_zip starts\" if @@log.debug?\n assert_respond_to(@list, :zip, \"test_0300_zip_respond\")\n # Basic example\n a = [1]\n b = [2,3]\n c = [4,5,6]\n ta = @list.zip(a, b, c)\n #\n te = [[@aen, 1, 2, 4], \n [@bsb, nil, 3, 5], \n [@cab, nil, nil, 6], \n [@dad, nil, nil, nil]]\n #\n assert_equal(te, ta, \"test_0300_zip_basic\")\n # TODO: A practical example ??? What could this possibly be used for??\n @@log.debug \"test_0300_zip ends\" if @@log.debug?\n end",
"def zip_docx(zip_data)\n\t\tdocx = Rex::Zip::Archive.new\n\t\tzip_data.each_pair do |k,v|\n\t\t\tdocx.add_file(k,v)\n\t\tend\n\t\tfile_create(docx.pack)\n\tend",
"def zip_result_directory\n end",
"def createAndSendZip(name)\n\n #Attachment name\n filename = \"#{name}.zip\"\n temp_file = Tempfile.new(filename)\n\n begin\n #This is the tricky part\n #Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |zos|}\n\n #Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zipfile|\n #Put files in here\n\n n1 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.shp\"\n n2 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.dbf\"\n n3 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.prj\"\n n4 = \"#{Rails.public_path}/shp_to_download/#{name}/#{name}.shx\"\n\n\n\n zipfile.add(\"#{name}/#{name}.shp\", n1)\n zipfile.add(\"#{name}/#{name}.dbf\", n2)\n zipfile.add(\"#{name}/#{name}.prj\", n3)\n zipfile.add(\"#{name}/#{name}.shx\", n4)\n end\n\n #Read the binary data from the file\n zip_data = File.read(temp_file.path)\n\n #Send the data to the browser as an attachment\n #We do not send the file directly because it will\n #get deleted before rails actually starts sending it\n send_data(zip_data, :type => 'application/zip', :filename => filename, data: { turbolinks: false })\n ensure\n #Close and delete the temp file\n temp_file.close\n temp_file.unlink\n end\n end",
"def zip_download\n download_zip_file if request.post?\n end",
"def zip(path)\n FileUtils.mkdir_p(path)\n zip_file_path = File.join(path, \"#{self.to_param}.zip\")\n if File.exists?(zip_file_path)\n File.delete(zip_file_path)\n end\n \n # open or create the zip file\n Zip::ZipFile.open(zip_file_path, Zip::ZipFile::CREATE) do |zip_file|\n \n # Add data files\n project_for_zip(zip_file, 'project.js')\n tags_for_zip(zip_file, 'category.js')\n\n app_maps.each do |map|\n map.facts_for_zip(zip_file, \"map_#{map.id}_project.js\")\n map.tags_for_zip(zip_file, \"map_#{map.id}_category.js\")\n end\n \n # Add images\n images_dir = 'images'\n zip_file.mkdir(images_dir) unless zip_file.find_entry(images_dir)\n self.facts.collect do |fact|\n# begin\n zip_file.add(fact.image, fact.photo.path(:thumb)) unless fact.photo_file_name.nil? || zip_file.find_entry(fact.image)\n # rescue => ex\n # # Need a way to output these errors\n # end\n end\n \n end\n File.chmod(0644, zip_file_path)\n zip_file_path\n end",
"def get_zip(link, file, referer = nil, load_referer = false)\n\t\tbegin\n\t\t\t# Récupération du zip\n\t\t\tfull_path = get_file(link, :referer => referer, :zip => true, :load_referer => load_referer)\n\n\t\t\t# Extraction du zip\n\t\t\tif file == \"None\"\n\t\t\t\t# 1 seul fichier dans le zip\n\t\t\t\tsystem(\"/usr/bin/unzip -c -qq #{full_path} > /tmp/Sub.srt\")\n\t\t\telse\n\t\t\t\t# Sélection du fichier dans le zip\n\t\t\t\tsystem(\"/usr/bin/unzip -c -qq #{full_path} '#{file}' > /tmp/Sub.srt\")\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tTools.logger.error \"# SubsMgr Error # get_zip [#{file}] : #{e.inspect}\\n#{e.backtrace.join('\\n')}\"\n\t\t\t@current.comment = \"Pb dans la récupération du zip\"\n\t\tend\n\tend",
"def extract\n zip_file_path = \"#{Rails.root}/public/tmp/#{self.id}/#{self.zip_file_name}\"\n # 100.times { p File.exist?(zip_file_path) }\n\n Zip::ZipFile.open(zip_file_path) do |zipfile|\n zipfile.each do |file|\n export_path = \"#{Rails.root}/public/tmp/#{self.id}_2/\"\n zip_path = File.join(export_path, zip_file_name)\n\n 100.times do\n p zip_path\n end\n\n # export_path = \"#{Rails.root}/public/tmp/#{self.id}_2/\"\n # zip_path = File.join(export_path, zip_file_name)\n # FileUtils.mkdir_p(File.dirname(export_path))\n\n # unless File.exist?(zip_file_path)\n # zipfile.extract(file, zip_path)\n # # # ..stuff that it does..\n # end\n # 100.times do\n # p image_path\n # end\n # FileUtils.mkdir_p(File.dirname(image_path))\n # unless File.exist?(image_path)\n # zip_file.extract(image, image_path)\n # # ..stuff that it does..\n # end\n end\n end\n end",
"def process_zip(zip_io)\n # TODO(pwnall): zip_io.read -> zip_io after rubyzip releases 1.1.8\n Zip::File.open_buffer zip_io.read do |zip|\n zip.each do |zip_entry|\n file_name = zip_entry.name\n if zip_entry.directory?\n @_zip_contents[file_name] = :directory\n elsif zip_entry.file?\n if file_name == 'mapreduced.yml'\n read_definition zip_entry.get_input_stream\n next\n end\n @_zip_contents[file_name] = zip_entry.get_input_stream.read\n end\n end\n end\n @_zip_contents.freeze\n end",
"def assure_zip_path\n assure_created_zip\n zip_path\n end",
"def deflate(string)\n tmp.write(string.force_encoding(\"utf-8\"))\n ::Zip::ZipFile.new(tmp)\n end",
"def zip(file, options = Hash.new)\n if options[:output_path]\n output_path = options[:output_path]\n else \n output_path = File.dirname(File.expand_path(file))\n end\n \n options[:remove_original] = true if options[:remove_original].nil?\n \n decompressed_filename = File.expand_path(file)\n compressed_filename = File.join(output_path, File.basename(file) + '.bz2')\n puts \"Compressing #{decompressed_filename} to #{compressed_filename}\"\n Bzip2::Writer.open(compressed_filename, 'w') do |compressed_file|\n File.open(decompressed_filename, 'r') do |decompressed_file|\n compressed_file << decompressed_file.read\n end\n end\n\n if File.exist?(compressed_filename)\n File.delete(decompressed_filename) if options[:remove_original]\n end\n \n return compressed_filename\n end",
"def make_zip(filename)\n filename = basename(filename)\n zip = result_location + filename\n Util::Zip.compress(base_location, zip)\n return zip\n end",
"def create_zip(name,url)\n @outputFile = (Rails.root.to_s+\"/tmp/cache/downloads/\"+name+\".zip\")\n if File.exist?(@outputFile)\n FileUtils.rm_rf (@outputFile)\n end\n @inputDir = url\n entries = Dir.entries(@inputDir)\n entries.delete(\".\")\n entries.delete(\"..\")\n io = Zip::ZipFile.open(@outputFile, Zip::ZipFile::CREATE)\n writeEntries(entries, \"\", io) #calling recursive write entries method\n io.close();\n return @outputFile\n end",
"def to_zip\n tmpdir = Dir.mktmpdir\n dir = path = nil\n timed_section(Rails.logger, 'app_to_zip') do\n dir = unpack_upload\n synchronize_pool_with(dir)\n path = AppPackage.repack_app_in(dir, tmpdir, :zip)\n zip_path = save_package(path) if path\n end\n ensure\n FileUtils.rm_rf(tmpdir)\n FileUtils.rm_rf(dir) if dir\n FileUtils.rm_rf(File.dirname(path)) if path\n end",
"def create_zip(entries, ignore_entries)\n compress(entries.map { |x|\n if x.is_a? String\n get_entries(x, nil, ignore_entries)\n elsif x[JsonConfigKey::Type].nil? || x[JsonConfigKey::Type].casecmp(FileEntryType::FILE) == 0\n get_entries(x[JsonConfigKey::Name], x[JsonConfigKey::Path], ignore_entries)\n elsif x[JsonConfigKey::Type].casecmp(FileEntryType::ZIP) == 0\n ZipEntry.new(x[JsonConfigKey::Name], create_zip(x[JsonConfigKey::Entries], x[JsonConfigKey::IgnoreEntries]))\n end\n }.flatten.select{ |f| f.is_a?(ZipEntry) || filter_entries(f.name, FileEntryType::FILE, ignore_entries) }.uniq{ |f| f.name })\n end",
"def zip_file\n \"#{package_name}.zip\"\n end",
"def unzip_package(zip_file)\n @log.info 'Unzipping ' + zip_file\n\n unless File.exist?(zip_file)\n @log.error zip_file + ' not found.'\n return nil\n end\n\n # create a new directory\n file_dir = File.join(@output_dir, File.basename(zip_file, '.zip'))\n Dir.mkdir file_dir unless Dir.exist?(file_dir)\n\n # extract contents of zip file\n Zip::File.open(zip_file) do |zipfile|\n zipfile.each do |f|\n fpath = File.join(file_dir, f.name)\n zipfile.extract(f, fpath) unless File.exist?(fpath)\n end\n end\n\n file_dir\nend",
"def create_zip_of(uploader)\n compressed_filestream = Zip::OutputStream.write_buffer do |zos|\n @game.users.each do |user|\n next unless (file_contents = user.send(uploader).read)\n\n zos.put_next_entry \"#{uploader.pluralize}/#{user.team_id}/#{user.full_name}.pdf\"\n zos.write file_contents\n end\n end\n\n compressed_filestream.rewind\n compressed_filestream\n end",
"def zip_docx(zip_data)\n\t\tdocx = Rex::Zip::Archive.new\n\t\tzip_data.each_pair do |k,v|\n\t\t\tdocx.add_file(k,v)\n\t\tend\n\t\treturn docx.pack\n\tend",
"def assure_created_zip\n FileCreator::createNewZip(self)\n raise \"No file created\" unless File.exists? zip_path\n end",
"def each(&block)\n fake_stream = Zipline::FakeStream.new(&block)\n Zipline::OutputStream.open(fake_stream) do |zip|\n @package.parts.each do |name, part|\n begin\n if part.respond_to?(:stream) && part.respond_to?(:size)\n zip.put_next_entry name, part.size\n part.stream zip\n else\n data = @package.marshal_part(name)\n zip.put_next_entry name, data.size\n zip << data\n end\n rescue => e\n raise e unless @ignore_part_exceptions\n end\n end\n end\n end",
"def extract\n Dir.mktmpdir do |dir|\n open_zip do |zip_file|\n zip_file.each do |entry|\n entry.extract(File.join(dir, File.basename(entry.name))) unless entry.name_is_directory?\n end\n\n yield dir\n end\n end\n end",
"def extract\n Dir.mktmpdir do |dir|\n open_zip do |zip_file|\n zip_file.each do |entry|\n unless entry.name_is_directory?\n entry.extract(File.join(dir, File.basename(entry.name)))\n end\n end\n\n yield dir\n end\n end\n end",
"def write\n @zip.write [@input_dir.basename], @input_dir.parent, ''\n end",
"def foreach(zip_file_name, &block); end",
"def decompressor; end",
"def close\n close_buffers\n # Zip it all up using the zip command for now :p\n pwd = Dir.pwd\n Dir.cd(realdir)\n exec(\"zip -r #{filename} *\")\n Dir.cd(pwd)\n FileUtils.rm_r(realdir)\n end",
"def update_content\n @buffer = Zip::OutputStream.write_buffer do |out|\n @output_stream = out\n yield self\n end\n end",
"def extract_zip(site)\n Zip::File.open(ZIP_FILE) do |zipfile|\n # Create the output directories\n FileUtils.mkdir_p(\"#{@output_fonts}\")\n FileUtils.mkdir_p(\"#{@output_styles}\")\n\n # Extract the relevant files from the .zip\n zipfile.each do |file|\n filename = File.basename(file.name)\n case File.extname file.name\n when '.woff', '.svg', '.ttf', '.eot', '.woff2'\n site.static_files << Jekyll::StaticFile.new(site, site.source, @output_fonts, filename)\n file.extract(\"#{@output_fonts}/#{filename}\")\n when '.css'\n case @preprocessor\n when 'none'\n file.extract(\"#{@output_styles}/#{filename}\")\n when 'less'\n file.extract(\"#{@output_styles}/#{filename.sub('.css', '.less')}\")\n when 'scss'\n file.extract(\"#{@output_styles}/_#{filename.sub('.css', '.scss')}\")\n else\n raise \"unknown preprocessor #{@preprocessor}, should be any of \\\"none\\\", \\\"less\\\" or \\\"scss\\\"\"\n end\n end\n end\n end\n end",
"def import_msfx_zip(args={}, &block)\n\t\tdata = args[:data]\n\t\twpsace = args[:wspace] || workspace\n\t\tbl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []\n\n\t\tnew_tmp = File.join(Dir::tmpdir,\"msfx\",@import_filedata[:zip_basename])\n\t\tif File.exists? new_tmp\n\t\t\tunless (File.directory?(new_tmp) && File.writable?(new_tmp))\n\t\t\t\traise DBImportError.new(\"Could not extract zip file to #{new_tmp}\")\n\t\t\tend\n\t\telse\n\t\t\tFileUtils.mkdir_p(new_tmp)\n\t\tend\n\t\t@import_filedata[:zip_tmp] = new_tmp\n\n\t\t@import_filedata[:zip_tmp_subdirs] = @import_filedata[:zip_entry_names].map {|x| File.split(x)}.map {|x| x[0]}.uniq.reject {|x| x == \".\"}\n\n\t\t@import_filedata[:zip_tmp_subdirs].each {|sub|\n\t\t\ttmp_subdirs = File.join(@import_filedata[:zip_tmp],sub)\n\t\t\tif File.exists? tmp_subdirs\n\t\t\t\tunless (File.directory?(tmp_subdirs) && File.writable?(tmp_subdirs))\n\t\t\t\t\traise DBImportError.new(\"Could not extract zip file to #{tmp_subdirs}\")\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tFileUtils.mkdir(tmp_subdirs)\n\t\t\tend\n\t\t}\n\n\t\tdata.entries.each do |e|\n\t\t\ttarget = File.join(@import_filedata[:zip_tmp],e.name)\n\t\t\tFile.unlink target if File.exists?(target) # Yep. Deleted.\n\t\t\tdata.extract(e,target)\n\t\t\tif target =~ /^.*.xml$/\n\t\t\t\t@import_filedata[:zip_extracted_xml] = target\n\t\t\tend\n\t\tend\n\n\t\t# This will kick the newly-extracted XML file through\n\t\t# the import_file process all over again.\n\t\tif @import_filedata[:zip_extracted_xml]\n\t\t\tnew_args = args.dup\n\t\t\tnew_args[:filename] = @import_filedata[:zip_extracted_xml]\n\t\t\tnew_args[:data] = nil\n\t\t\tnew_args[:ifd] = @import_filedata.dup\n\t\t\tif block\n\t\t\t\timport_file(new_args, &block)\n\t\t\telse\n\t\t\t\timport_file(new_args)\n\t\t\tend\n\t\tend\n\n\t\t# Kick down to all the MSFX ZIP specific items\n\t\tif block\n\t\t\timport_msfx_collateral(new_args, &block)\n\t\telse\n\t\t\timport_msfx_collateral(new_args)\n\t\tend\n\tend",
"def zip_archive_zip_create(input_file1, opts = {})\n data, _status_code, _headers = zip_archive_zip_create_with_http_info(input_file1, opts)\n data\n end",
"def zip_path\n \"/tmp/play-zips/#{zip_name}\"\n end",
"def unarchive\n unless in_zip?\n zips, gzs = selected_items.partition(&:zip?).tap {|z, others| break [z, *others.partition(&:gz?)]}\n zips.each do |item|\n FileUtils.mkdir_p current_dir.join(item.basename)\n Zip::File.open(item) do |zip|\n zip.each do |entry|\n FileUtils.mkdir_p File.join(item.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(item.basename, entry.to_s)) { true }\n end\n end\n end\n gzs.each do |item|\n Zlib::GzipReader.open(item) do |gz|\n Gem::Package::TarReader.new(gz) do |tar|\n dest_dir = current_dir.join (gz.orig_name || item.basename).sub(/\\.tar$/, '')\n tar.each do |entry|\n dest = nil\n if entry.full_name == '././@LongLink'\n dest = File.join dest_dir, entry.read.strip\n next\n end\n dest ||= File.join dest_dir, entry.full_name\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n FileUtils.mkdir_p dest_dir\n File.open(dest, 'wb') {|f| f.print entry.read}\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n unless Dir.exist? dest_dir\n FileUtils.mkdir_p dest_dir\n File.open(File.join(dest_dir, gz.orig_name || item.basename), 'wb') {|f| f.print gz.read}\n end\n end\n end\n end\n end\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n FileUtils.mkdir_p File.join(current_zip.dir, current_zip.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(current_zip.dir, current_zip.basename, entry.to_s)) { true }\n end\n end\n end\n ls\n end",
"def write\r\n entries = Dir.entries(@input_dir) - %w[. ..]\r\n\r\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\r\n write_entries entries, '', zipfile\r\n end\r\n end",
"def call(zipfile:, datadir:)\n datapath = Pathname.new(datadir) + \"xml\"\n datapath.mkpath\n\n raise ArgumentError.new(\"Zipfile #{zipfile} not found\") unless Pathname.new(zipfile).exist?\n raise ArgumentError.new(\"Zipfile #{zipfile} not readable\") unless Pathname.new(zipfile).readable?\n raise ArgumentError.new(\"Zipfile #{zipfile} not readable\") unless Pathname.new(zipfile).readable?\n\n logger.info \"Extract: read from #{zipfile}, target #{datapath}\"\n Dir.mktmpdir do |tmpdir|\n zpath = Pathname.new(tmpdir) + \"med\"\n zpath.mkpath\n\n matches_zipfile_for_entries = /MED_(.*?)\\.zip\\Z/\n\n Zip::File.open(zipfile) do |zip_file|\n zip_file.each do |entry|\n basename = entry.name.split(\"/\").last\n\n case basename\n when matches_zipfile_for_entries\n m = matches_zipfile_for_entries.match(basename)\n first_letter_of_dir = m[1]\n extract_entries(basename, datapath, entry, first_letter_of_dir, zpath)\n when \"LINKS_done.zip\"\n extract_links(basename, datapath, zpath, entry)\n else\n logger.debug \"Putting #{basename} in #{datapath}\"\n entry.extract((datapath + basename).to_s)\n end\n end\n end\n end\n end",
"def content_encoding_gunzip(body_io); end",
"def initialize(file_name, stream: false, encrypter: nil)\n super()\n @file_name = file_name\n @output_stream = if stream\n iostream = Zip::RUNNING_ON_WINDOWS ? @file_name : @file_name.dup\n iostream.reopen(@file_name)\n iostream.rewind\n iostream\n else\n ::File.new(@file_name, 'wb')\n end\n @cdir = ::Zip::CentralDirectory.new\n @compressor = ::Zip::NullCompressor.instance\n @encrypter = encrypter || ::Zip::NullEncrypter.new\n @closed = false\n @current_entry = nil\n end",
"def write\n entries = Dir.entries(@input_dir) - %w(. ..)\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n write_entries(entries, '', io)\n end\n end",
"def process_zipfile(zipfilename, zip, path='')\n @sheet_files = []\n Zip::ZipFile.open(zipfilename) {|zf|\n zf.entries.each {|entry|\n #entry.extract\n if entry.to_s.end_with?('workbook.xml')\n open(@tmpdir+'/'+@file_nr.to_s+'_roo_workbook.xml','wb') {|f|\n f << zip.read(entry)\n }\n end\n if entry.to_s.end_with?('sharedStrings.xml')\n open(@tmpdir+'/'+@file_nr.to_s+'_roo_sharedStrings.xml','wb') {|f|\n f << zip.read(entry)\n }\n end\n if entry.to_s.end_with?('styles.xml')\n open(@tmpdir+'/'+@file_nr.to_s+'_roo_styles.xml','wb') {|f|\n f << zip.read(entry)\n }\n end\n if entry.to_s =~ /sheet([0-9]+).xml$/\n nr = $1\n open(@tmpdir+'/'+@file_nr.to_s+\"_roo_sheet#{nr}\",'wb') {|f|\n f << zip.read(entry)\n }\n @sheet_files[nr.to_i-1] = @tmpdir+'/'+@file_nr.to_s+\"_roo_sheet#{nr}\"\n end\n }\n }\n return\n end",
"def add_to_zip(zout, eadid, file)\n zout.put_next_entry(java.util.zip.ZipEntry.new(\"#{eadid}.xml\"))\n file.binmode\n file.each_line do |line|\n bytes = line.to_java_bytes\n zout.write(bytes, 0, bytes.length)\n end\n file.close\n end",
"def get_task_resources_zip()\n # Get a temp file path\n filename = FileHelper.sanitized_filename(\"task-resources-#{self.code}.zip\")\n result = Tempfile.new(filename)\n # Create a new zip\n Zip::File.open(result.path, Zip::File::CREATE) do | zip |\n task_definitions.each do |td|\n if td.has_task_pdf?\n dst_path = FileHelper.sanitized_path( \"#{td.abbreviation}\") + \".pdf\"\n zip.add(dst_path, td.task_sheet)\n end\n\n if td.has_task_resources?\n dst_path = FileHelper.sanitized_path( \"#{td.abbreviation}\") + \".zip\"\n zip.add(dst_path, td.task_resources)\n end\n end\n end #zip\n result\n end",
"def zip(*rest) end",
"def expect_no_zip\n Dir.mktmpdir(\"datasets_test\") do |dir|\n dest_path = Pathname.new(dir) + \"out.zip\"\n begin\n ZipWriter.new.write(src_path, dest_path) do |input_zip, output_zip|\n yield input_zip, output_zip\n end\n rescue\n # don't care if there are weird errors, just need to make sure the temp\n # zip is cleaned up properly\n end\n expect(dest_path).not_to exist\n end\n end",
"def initialize(zip)\n @zip = zip\n end",
"def zip_url; end",
"def safe_zlib_unzip\n Zip::File.open_buffer(file)\n end",
"def zip( *other_arrays, & block )\n\n load_parent_state\n \n return super\n \n end",
"def zip_file(filename, &_block)\n temp_file = Tempfile.new(filename)\n zip_contents = []\n\n begin\n # This is the tricky part\n # Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |_zos| }\n\n # Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|\n competition.heat_numbers.each do |heat_number|\n heat_file = Tempfile.new(\"temp_#{heat_number}\", Rails.root.join('tmp')).tap do |f|\n f.write(heat_data_csv(heat_number))\n f.close\n end\n zip_contents << heat_file\n zip.add(create_filename(heat_number), heat_file)\n end\n end\n\n # Read the binary data from the file\n zip_data = File.read(temp_file.path)\n\n # Send the data to the browser as an attachment\n # We do not send the file directly because it will\n # get deleted before rails actually starts sending it\n yield zip_data\n ensure\n zip_contents.each do |file|\n file.close\n file.unlink\n end\n # Close and delete the temp file\n temp_file.close\n temp_file.unlink\n end\n end",
"def zipfile\n @zipfile ||= Zip::File.open( @file_path )\n end",
"def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end",
"def show\n respond_to do |format|\n format.html\n format.zip do\n Tempfile.open(\"zipfile\") do |tempfile|\n @product.create_zip(tempfile)\n send_file tempfile, filename: \"#{@product.name}.zip\"\n end\n end\n end\n end",
"def inflate2(data)\n zlib = Zlib::Inflate.new(15)\n buff = zlib.inflate(data)\n zlib.finish\n zlib.close\n buff\nend",
"def ext_zip(values, options = {})\n zip_to_hash(self, values, options)\n end",
"def zipfile metadata\n cmd = \"cd #{Myreplicator.configs[@export_obj.source_schema][\"export_stg_dir\"]}; gzip #{@export_obj.filename}\"\n\n puts cmd\n\n zip_result = metadata.ssh.exec!(cmd)\n\n unless zip_result.nil?\n raise Exceptions::ExportError.new(\"Export Error\\n#{zip_result}\") if zip_result.length > 0\n end\n\n metadata.zipped = true\n\n return zip_result\n end",
"def zip\n raise \"No tracks in album #{name}\" if songs.empty? \n bundle_filename = \"#{RmedialSetting.default.static_file_path}/zip/#{artist.name} - #{name}.zip\"\n raise \"Unable to create zip file\" if !Medium.path_is_writeable?(bundle_filename)\n \n # check to see if the file exists already, and if it does, delete it.\n File.delete(bundle_filename) if File.file?(bundle_filename) \n\n # open or create the zip file\n Zip::ZipFile.open(bundle_filename, Zip::ZipFile::CREATE) { |zipfile|\n # collect the album's tracks\n self.songs.collect { |song|\n # add each track to the archive, names using the track's attributes\n zipfile.add(song.ideal_file_name, song.file_name)\n }\n }\n\n # set read permissions on the file\n File.chmod(0644, bundle_filename)\n\n return bundle_filename\n end",
"def write\n File.delete(@output_file) if File.exist?(@output_file)\n\n Zip::File.open(@output_file, Zip::File::CREATE) do |zipfile|\n zipfile.add(mimetype_entry(zipfile), \"#{@input_dir}/mimetype\")\n\n all_entries.each do |file|\n zipfile.add(file, \"#{@input_dir}/#{file}\")\n end\n end\n end",
"def inizializza_zip_path\n case nome_controllo\n when \"Autorizzazioni\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_0.zip\")\n when \"MGP_Validate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_1.zip\")\n when \"MGP_Esitate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_2.zip\")\n when \"MI_Form\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_3.zip\")\n when \"MI_Form_D\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_10.zip\")\n when \"MI_Validate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_4.zip\")\n when \"MI_Validate_D\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_11.zip\")\n when \"MI_Esitate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_5.zip\")\n when \"MI_Esitate_D\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/#{$day} #{$monthtext} #{$year}_12.zip\")\n when \"Estero_Validate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/FRANCIA/SOA FRANCIA/03 File Zip/#{$day} #{$monthtext} #{$year}_6.zip\")\n when \"Estero_Esitate\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/FRANCIA/SOA FRANCIA/03 File Zip/#{$day} #{$monthtext} #{$year}_7.zip\")\n when \"Vpp\" then @zip = Pathname.new(\"#{$F}PROGRAMMAZIONE #{$year}/ITALIA/Report/SOA Italia/File Zip/VPP_#{$day}#{$monthtext}#{$year_short}_week_#{$week}.zip\")\n else @zip = nil\n end\n end"
] |
[
"0.7783591",
"0.77181405",
"0.74728733",
"0.74325013",
"0.7145656",
"0.7026272",
"0.69303775",
"0.6875973",
"0.6838081",
"0.6752139",
"0.67381424",
"0.6706411",
"0.6667544",
"0.665464",
"0.6574031",
"0.65219456",
"0.6328092",
"0.6303474",
"0.62976485",
"0.6291506",
"0.62912685",
"0.6282236",
"0.62666",
"0.6265909",
"0.62618667",
"0.62357914",
"0.623015",
"0.623015",
"0.6158254",
"0.615397",
"0.6134335",
"0.6118675",
"0.6090678",
"0.60823905",
"0.6055256",
"0.6042679",
"0.60251635",
"0.60251635",
"0.6002772",
"0.5985189",
"0.59830797",
"0.59809685",
"0.59763885",
"0.5965026",
"0.59553206",
"0.59440035",
"0.5940933",
"0.59301275",
"0.5924666",
"0.5924623",
"0.5909405",
"0.58958465",
"0.58907986",
"0.58747864",
"0.5873803",
"0.58531636",
"0.58518577",
"0.5842976",
"0.584134",
"0.58389825",
"0.5834045",
"0.5811911",
"0.58028275",
"0.5801867",
"0.57999444",
"0.5780844",
"0.5754458",
"0.5748728",
"0.5738073",
"0.57366323",
"0.5736528",
"0.57253367",
"0.5721438",
"0.5715992",
"0.57126445",
"0.5701823",
"0.56846017",
"0.56845856",
"0.56839395",
"0.5683271",
"0.56812024",
"0.56791925",
"0.5674039",
"0.5671716",
"0.56648076",
"0.5662975",
"0.565678",
"0.56531656",
"0.56513697",
"0.5647836",
"0.56453687",
"0.5639753",
"0.56349933",
"0.56347364",
"0.5630541",
"0.5629271",
"0.5628319",
"0.56233686",
"0.5621235",
"0.56173486"
] |
0.77858925
|
0
|
Adds folder assets to the zip object and decends into the subfolders recursively adding their assets as well.
|
def _zip_decender(zipstream, folder, path)
if path.nil?
path = folder.name
else
path = path + "/" + folder.name
end
zipstream.dir.mkdir(path)
folder.assets.each do |a|
logger.info("[ZIP] Adding #{a.file_name} in #{a.uploaded_file.path}")
zipstream.add("#{path}/#{a.file_name}", a.uploaded_file.path)
end
folder.children.each do |f|
_zip_decender(zipstream, f, path)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_files(zip)\n ZipFileGenerator.new(@manifest.base_dir, zip).write\n end",
"def run\n assets.each do |asset|\n next if ::File.directory?(asset)\n\n compress(asset)\n checksum(asset)\n end\n\n generate_manifest\n end",
"def recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n zipfile.mkdir(zipfile_path)\n subdir = Dir.entries(disk_file_path) - blacklisted_dir_entries\n write_entries(subdir, zipfile_path, zipfile)\n end",
"def each_asset\n assets.each do |(path, destination)|\n path = path.to_s\n if destination == :root\n yield path, File.join(output_directory.to_s, File.basename(path))\n else\n yield path, File.join(output_directory.to_s, destination.to_str)\n end\n end\n end",
"def zipfiles\n @zipfile_name = \"#{$zip_folder}#{$testcase}.zip\"\n Zip::File.open(\"#{@zipfile_name}\", Zip::File::CREATE) do |zipfile|\n Dir.glob(\"#{$image_folder}#{$testcase}*\").each do |filename|\n file = File.basename(\"#{filename}\")\n zipfile.add(file, \"#{$image_folder}\" + file)\n end\n end\n end",
"def write\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n @folders.each do |input_dir, src, dest|\n src = '' if src == '/**' # the whole src directory could be specified by /**\n path = source_dir(File.join(input_dir, src))\n write_entries(path, entries(src, input_dir), dest, io)\n end\n end\n\n @output_file\n end",
"def run\n assets.each do |path|\n unless File.directory?(path)\n configuration = _configuration_for(path)\n process(Asset.new(path, configuration))\n end\n end\n\n write_manifest_file\n end",
"def zip(path)\n FileUtils.mkdir_p(path)\n zip_file_path = File.join(path, \"#{self.to_param}.zip\")\n if File.exists?(zip_file_path)\n File.delete(zip_file_path)\n end\n \n # open or create the zip file\n Zip::ZipFile.open(zip_file_path, Zip::ZipFile::CREATE) do |zip_file|\n \n # Add data files\n project_for_zip(zip_file, 'project.js')\n tags_for_zip(zip_file, 'category.js')\n\n app_maps.each do |map|\n map.facts_for_zip(zip_file, \"map_#{map.id}_project.js\")\n map.tags_for_zip(zip_file, \"map_#{map.id}_category.js\")\n end\n \n # Add images\n images_dir = 'images'\n zip_file.mkdir(images_dir) unless zip_file.find_entry(images_dir)\n self.facts.collect do |fact|\n# begin\n zip_file.add(fact.image, fact.photo.path(:thumb)) unless fact.photo_file_name.nil? || zip_file.find_entry(fact.image)\n # rescue => ex\n # # Need a way to output these errors\n # end\n end\n \n end\n File.chmod(0644, zip_file_path)\n zip_file_path\n end",
"def create_dirs_in_zipfile(created_dirs, entry_path, output_stream); end",
"def write_entries(entries, path, zipfile, root_dir)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(root_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path, root_dir)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end",
"def write\n entries = @input_dir.children(false)\n @zip.write entries, @input_dir, ''\n end",
"def add_compressed_routes!\n assets.packages.each do |name, package|\n get package.route_regex do\n if defined?(settings.assets.app.clear_tilt_cache) && settings.assets.app.clear_tilt_cache\n AssetPack.clear_tilt_cache!(@template_cache, settings.assets.app)\n end\n\n mtime, contents = @template_cache.fetch(package.path) {\n [ package.mtime, package.minify ]\n }\n\n content_type package.type\n last_modified mtime\n assets_expires\n contents\n end\n end\n end",
"def zipIt\r\n puts \"Creating EPUB package:\"\r\n STDOUT.flush\r\n path = @dirs[:tmp]\r\n FileUtils.rm @epub, :force=>true\r\n Zip::ZipFile.open(@epub, 'w') do |zipfile|\r\n progress = ProgressBar.new(\"Compressing\", Dir[\"#{path}/**/**\"].length)\r\n Dir[\"#{path}/**/**\"].each do |file|\r\n zipfile.add(file.sub(path+'/', ''), file)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end\r\n end",
"def add_dir( zipfile, d )\n FileList.new(\"#{d}/**/*\").each { |f| add_file(zipfile, f) if File.file?(f) }\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |entry|\n zipfile_path = path == '' ? entry : File.join(path, entry)\n disk_file_path = File.join(src_path, zipfile_path)\n\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def compress(path, archive)\n require 'zip/zip'\n require 'zip/zipfilesystem'\n\n path.sub!(%r[/$], '')\n ::Zip::ZipFile.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject { |f| f==archive }.each do |file|\n print_line(\"Adding #{file} to archive\")\n zipfile.add(file.sub(path+'/', ''), file)\n end\n end\n print_line(\"All files saved to #{archive}\")\n end",
"def copy_assets\n Dir.glob dir(\"templates/assets/**/*\") do |item|\n next if File.directory? item\n d = undir item\n d = d[10..-1] # Cut off \"templates/\" at beginning\n copy_file_to_output item, d\n end\n end",
"def write_entries(input_dir, entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(input_dir, disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, zipfile)\r\n entries.each do |e|\r\n zipfile_path = path == '' ? e : File.join(path, e)\r\n disk_file_path = File.join(@input_dir, zipfile_path)\r\n\r\n if File.directory? disk_file_path\r\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\r\n else\r\n put_into_archive(disk_file_path, zipfile, zipfile_path)\r\n end\r\n end\r\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def generate_zip folder, zip_path\n FileUtils.rm zip_path if File.file? zip_path\n\n scan_path = File.join(folder, '*')\n puts \"Zipping up: #{scan_path}\"\n input_files = Dir.glob(scan_path)\n\n Zip::File.open(zip_path, Zip::File::CREATE) do |zipfile|\n input_files.each do |file|\n # Two arguments:\n # - The name of the file as it will appear in the archive\n # - The original file, including the path to find it\n zipfile.add(File.basename(file), file)\n end\n end\n end",
"def add_assets(paths)\n copy_assets(paths)\n characterize_assets\n create_or_update_assets\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n next\n end\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end",
"def stage\n\n @tempdir = Dir.mktmpdir\n\n begin\n\n # Copy the assets into the temp dir.\n files = Dir.glob(\"#{File.dirname(@file_path)}/#{@file_base}.*\")\n FileUtils.cp(files, @tempdir)\n\n # Change into the temp dir.\n FileUtils.cd(@tempdir) do yield end\n\n ensure\n\n # Delete the copies.\n FileUtils.remove_entry @tempdir\n\n end\n\n end",
"def write_entries(input_dir, entries, path, io)\n entries.each do |e|\n disk_file_path = File.join(input_dir, e)\n zip_file_path = zip_file_path(path, e, input_dir)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, io, zip_file_path)\n else\n put_into_archive(disk_file_path, io, zip_file_path)\n end\n end\n end",
"def bundle!(export_dir= Rails.configuration.gtdinbox_export_dir)\n @bundle_filename = \"#{export_dir}/#{@bundle_id}-translation-export.zip\"\n\n\n Zip::ZipFile.open(@bundle_filename, Zip::ZipFile::CREATE) do |zipfile|\n pp @dir_names\n @dir_names.each {|dirname|zipfile.mkdir(dirname)}\n @dir_files.each do |dir_file|\n dirname, file = dir_file\n zip_filepath = File.basename(file.path).gsub(\"#{dirname}-#{@bundle_id}-\",'')\n zipfile.add([dirname, zip_filepath].join('/'), file.path)\n end\n end\n\n File.chmod(0644, @bundle_filename)\n clean_up\n\n @bundle_filename\n end",
"def add_folders_to_folder(package_folder, folders, included_files=['*'], excluded_files=[])\n folders.each do |folder|\n included_files = Utils.ensure_array(included_files).collect{|f| File.join('**',f)}\n file_list = Utils.expand_file_list(included_files, excluded_files, folder)\n package_file_list = file_list.collect{ |f| File.join(package_dir_path, package_folder, get_relative_path(folder,f)) }\n @origin_files += file_list\n @destination_files += package_file_list\n end\n end",
"def zip_result_directory\n end",
"def add_directory(directory)\n @zip.put_next_entry(::File.join(directory.path, ''))\n end",
"def copy_folders\r\n %w{_includes _layouts _posts _sass assets}.each do |dir|\r\n directory dir\r\n end\r\n end",
"def unpack\n self.dir = Rails.root + 'tmp' + SecureRandom.hex(20)\n FileUtils.mkdir(dir)\n\n dirs = []\n files = []\n\n Zip::Archive.open(file_path) do |archive|\n archive.each do |file|\n next if file.name =~ /__MACOSX/ or file.name =~ /\\.DS_Store/\n destination = dir + file.name\n name = Pathname.new(file.name).cleanpath.to_s\n\n if file.directory?\n FileUtils.mkdir_p(destination)\n dirs << name\n else\n dirname = File.dirname(file.name)\n FileUtils.mkdir_p(dirname) unless File.exist?(dirname)\n open(destination, 'wb') {|f| f << file.read}\n files << name\n end\n end\n end\n\n [dirs, files]\n end",
"def folder_asset_ingest(args = { })\n parameters = api_method_parameters(__method__)\n _args = process_parameters(parameters, args.dup)\n\n folder_to_ingest = _args.delete(:folder_to_ingest) { }\n\n raise ArgumentError, ':folder_to_ingest is a required argument.' unless folder_to_ingest\n\n folder_to_ingest = File.join(folder_to_ingest, '*') if File.directory?(folder_to_ingest)\n\n file_paths = Dir.glob(folder_to_ingest)\n\n file_paths.map { |file_path| asset_ingest_any( _args.merge( :file_to_ingest => file_path ) ) }\n end",
"def compress(path)\r\n gem 'rubyzip'\r\n require 'zip/zip'\r\n require 'zip/zipfilesystem'\r\n path.sub!(%r[/$],'')\r\n archive = File.join(path,File.basename(path))+'.zip'\r\n FileUtils.rm archive, :force=>true\r\n\r\n Zip::ZipFile.open(archive, 'w') do |zipfile|\r\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\r\n zipfile.add(file.sub(path+'/',''),file)\r\n end\r\n end\r\n end",
"def assets\n @assets ||= Dir[File.join(@resources_path, \"assets\", \"*.{js,css,ttf,eot,svg,woff,png,jpeg}\")]\n @assets << Dir[File.join(Emoji.images_path, \"emoji\", \"*.png\")]\n @assets\n end",
"def write\n @zip.write [@input_dir.basename], @input_dir.parent, ''\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n # relative path of file being added to the zip\n relative_path = path == '' ? e : File.join(path, e)\n # full path\n full_path = File.join(@input_dir, relative_path)\n\n if File.directory? full_path\n recursively_zip_directory(full_path, zipfile, relative_path)\n else\n put_into_archive(full_path, zipfile, relative_path)\n end\n end\n end",
"def copy_assets(target_dir)\n FileUtils.mkdir_p target_dir\n\n self.class.assets.map do |asset|\n asset_path = self.class.find asset\n asset_dir = File.join target_dir, File.dirname(asset)\n FileUtils.mkdir_p asset_dir unless File.exists? asset_dir\n FileUtils.cp_r asset_path, asset_dir\n end\n end",
"def add_files(zip, path, recursive = nil)\n\n\tif (not add_file(zip, path))\n\t\treturn nil\n\tend\n\n\tif (recursive and File.stat(path).directory?)\n\t\tbegin\n\t\t\tdir = Dir.open(path)\n\t\trescue\n\t\t\t# skip this file\n\t\t\treturn nil\n\t\tend\n\n\t\tdir.each { |f|\n\t\t\tnext if (f == '.')\n\t\t\tnext if (f == '..')\n\n\t\t\tfull_path = path + '/' + f\n\t\t\tst = File.stat(full_path)\n\t\t\tif (st.directory?)\n\t\t\t\tputs \"adding dir #{full_path}\"\n\t\t\t\tadd_files(zip, full_path, recursive)\n\t\t\telsif (st.file?)\n\t\t\t\tputs \"adding file #{full_path}\"\n\t\t\t\tadd_file(zip, full_path)\n\t\t\tend\n\t\t}\n\tend\nend",
"def bootstrap_folder\n FileUtils.mkdir_p folder_path\n end",
"def create_assets(groups, paths)\n paths.map do |path|\n file = File.open(dir + path)\n asset = Asset.choose_type(path.split('.').last)\n if path.include?('/')\n path, name = path_and_name(path)\n group = groups[path]\n else\n group = parent_group\n end\n asset.updater = Thread.current[:current_user]\n asset.creator = Thread.current[:current_user]\n asset.update_attributes(:file => file, :name => name, :asset_group_id => group.id)\n asset\n end\n end",
"def write\r\n entries = Dir.entries(@input_dir) - %w[. ..]\r\n\r\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\r\n write_entries entries, '', zipfile\r\n end\r\n end",
"def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end",
"def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n puts \"Deflating #{disk_file_path}\"\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end",
"def write_entries(entries, path, io)\n entries.each do |e|\n zip_file_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zip_file_path)\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, io, zip_file_path)\n elsif include_filename?(zip_file_path)\n put_into_archive(disk_file_path, io, zip_file_path)\n end\n end\n end",
"def write\n entries = Dir.entries(@input_dir) - %w(. ..)\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n write_entries(entries, '', io)\n end\n end",
"def zipped!\n return if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system \"zip #{zip_path} #{path}/*\"\n end",
"def write_images\n # Enumerate all the files in the zip and write any that are in the media directory to the output buffer (which is used to generate the new zip file)\n @file.read_files do |entry| # entry is a file entry in the zip\n if entry.name.include? IMAGE_DIR_NAME\n # Check if this is an image being replaced\n current_image = @images.select { |image| !@relationship_manager.get_relationship(image.id).nil? and entry.name.include? @relationship_manager.get_relationship(image.id)[:target] }.first\n\n unless current_image.nil?\n replacement_path = current_image.path\n data = ::File.read(replacement_path)\n else\n entry.get_input_stream { |is| data = is.sysread }\n end\n\n @file.output_stream.put_next_entry(entry.name)\n @file.output_stream.write data\n end\n end\n\n # Create any new images\n @unique_image_paths = []\n @images.select { |image| image.is_new }.each do |new_image|\n next if @unique_image_paths.include? new_image.target # we only want to write each image once\n @unique_image_paths << new_image.target\n @file.output_stream.put_next_entry(\"word/#{new_image.target}\")\n @file.output_stream.write ::File.read(new_image.path)\n end\n end",
"def create_or_update_assets\n # All files in assets folder\n glob_path = File.join(clone_location, assets_subdirectory, \"*.{#{file_extensions.join(',')}}\")\n assets_paths = Dir.glob(glob_path) # full paths\n\n # Get jhove output in order to get the mime type and size for each asset.\n version_control_agent.get({ location: File.join(metadata_subdirectory, JHOVE_OUTPUT_FILENAME) }, clone_location)\n jhove_output = Bulwark::JhoveOutput.new(File.join(clone_location, metadata_subdirectory, JHOVE_OUTPUT_FILENAME))\n\n # Updating or creating asset record for each asset file\n assets_paths.each do |asset_path|\n filename = File.basename(asset_path)\n asset = assets.find_or_initialize_by(filename: filename)\n asset.original_file_location = version_control_agent.look_up_key(File.join(assets_subdirectory, filename), clone_location)\n asset.size = jhove_output.size_for(filename) # In bytes\n asset.mime_type = MIME::Type.simplified(jhove_output.mime_type_for(filename))\n asset.save!\n end\n\n # Removing references to files that have been removed.\n asset_filenames = assets_paths.map { |a| File.basename(a) }\n assets.each do |asset|\n asset.destroy unless asset_filenames.include?(asset.filename)\n end\n end",
"def zip\n raise \"No tracks in album #{name}\" if songs.empty? \n bundle_filename = \"#{RmedialSetting.default.static_file_path}/zip/#{artist.name} - #{name}.zip\"\n raise \"Unable to create zip file\" if !Medium.path_is_writeable?(bundle_filename)\n \n # check to see if the file exists already, and if it does, delete it.\n File.delete(bundle_filename) if File.file?(bundle_filename) \n\n # open or create the zip file\n Zip::ZipFile.open(bundle_filename, Zip::ZipFile::CREATE) { |zipfile|\n # collect the album's tracks\n self.songs.collect { |song|\n # add each track to the archive, names using the track's attributes\n zipfile.add(song.ideal_file_name, song.file_name)\n }\n }\n\n # set read permissions on the file\n File.chmod(0644, bundle_filename)\n\n return bundle_filename\n end",
"def add_static_files(site, assets_dir)\n relative_assets_dir = assets_dir.relative_path_from(site.source).to_s\n vite_static_files = Dir.chdir(assets_dir.to_s) {\n Dir.glob('**/*').select { |f| File.file?(f) }\n }.map { |file|\n ViteAssetFile.new(site, site.source, relative_assets_dir, file)\n }\n site.static_files.concat(vite_static_files)\n end",
"def write\n FileUtils.rm @out_file if File.exists? @out_file\n in_progress \"Writing archive #{@out_file} from #{@input_dir}\" do\n Zip::File.open @out_file, Zip::File::CREATE do |zipfile|\n Dir[\"#{@input_dir}/**/**\"].reject{ |f| f == @out_file || !@filter.call(f) }.each do |file|\n progress \"deflating #{file}\"\n zipfile.add(file.sub(@input_dir + '/', ''), file)\n end\n end\n end\n end",
"def compress(path)\n path.sub!(%r[/$],'')\n archive = File.join(path,File.basename(path))+'.zip'\n FileUtils.rm archive, :force=>true\n Zip::File.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\n zipfile.add(file.sub(path+'/',''),file)\n end\n end\n archive\n end",
"def zip_file(temp_number)\n zipfile_name = \"public/temp/builder_theme#{temp_number}.zip\"\n\n Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|\n Dir[File.join(@base_theme_directory, '**', '**')].each do |file|\n zipfile.add(file.sub(@base_theme_directory, ''), file)\n end\n end\n end",
"def extract\n Dir.mktmpdir do |dir|\n open_zip do |zip_file|\n zip_file.each do |entry|\n unless entry.name_is_directory?\n entry.extract(File.join(dir, File.basename(entry.name)))\n end\n end\n\n yield dir\n end\n end\n end",
"def prepare_asset(assets, asset, name, subname = nil)\n return if asset.start_with?(asset_root)\n\n if subname.nil?\n assets[name] = \"#{asset_root}/#{asset}\"\n else\n assets[name][subname] = \"#{asset_root}/#{asset}\"\n end\n end",
"def push_assets\n PUSH_ASSETS\n end",
"def compress_source_zip(path)\n require \"zip\"\n zipfile = Tempfile.create([\"vagrant\", \".zip\"])\n zipfile.close\n if File.file?(path)\n source_items = [path]\n else\n source_items = Dir.glob(File.join(path, \"**\", \"**\", \"*\"))\n end\n c_dir = nil\n Zip::File.open(zipfile.path, Zip::File::CREATE) do |zip|\n source_items.each do |source_item|\n next if File.directory?(source_item)\n trim_item = source_item.sub(path, \"\").sub(%r{^[/\\\\]}, \"\")\n dirname = File.dirname(trim_item)\n zip.mkdir dirname if c_dir != dirname\n c_dir = dirname\n zip.get_output_stream(trim_item) do |f|\n source_file = File.open(source_item, \"rb\")\n while data = source_file.read(2048)\n f.write(data)\n end\n end\n end\n end\n zipfile.path\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def zip_app_export_migrations\n temp_file = Tempfile.new([ZipTempFilePrefix, '.zip'])\n # This is the tricky part\n # Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |zos| }\n\n # Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|\n Dir.glob(\"#{app_export_dir}/*.rb\").each do |path|\n filename = path.split('/').last\n zip.add(filename, path)\n end\n end\n temp_file\n end",
"def create\n comment_file = tmp_comment_file!\n tmp_zipfile = tmp_zipfile!\n\n derivative_files = []\n\n Zip::File.open(tmp_zipfile.path, Zip::File::CREATE) do |zipfile|\n # Add attribution as file and zip comment text\n zipfile.comment = comment_text\n zipfile.add(\"about.txt\", comment_file)\n\n members_to_include.each_with_index do |member, index|\n filename = \"#{format '%03d', index+1}-#{DownloadFilenameHelper.filename_base_from_parent(member)}.jpg\"\n\n uploaded_file = file_to_include(member.leaf_representative)\n\n # While it would be nice to stream directly from remote storage into the zip, we couldn't\n # get this to work with the combo of ruby-zip and shrine api's without downloading it\n # to local disk first. There may be a way we haven't figured out. May be able\n # to pass derivative.file.open to it instead for slightly better perf\n # once https://github.com/janko/down/issues/26\n file_obj = uploaded_file.download\n derivative_files << file_obj\n\n\n # We want to add to zip as \"STORED\", not \"DEFLATE\", since our JPGs\n # won't compress under DEFLATE anyway, save the CPU. Ruby zip does not\n # give us a GREAT api to do that, but it gives us a way.\n #\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/file.rb#L271\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/entry.rb#L53\n entry = ::Zip::Entry.new(zipfile.name, filename, nil, nil, nil, nil, ::Zip::Entry::STORED)\n zipfile.add(entry, file_obj)\n\n # We don't really need to update on every page, the front-end is only polling every two seconds anyway\n if callback && (index % 3 == 0 || index >= members_to_include.count - 1)\n callback.call(progress_total: members_to_include.count, progress_i: index + 1)\n end\n end\n end\n\n # tell the Tempfile to (re)open so it has a file handle open that can see what ruby-zip wrote\n tmp_zipfile.open\n\n return tmp_zipfile\n ensure\n (derivative_files || []).each do |tmp_file|\n tmp_file.close\n tmp_file.unlink\n end\n\n if comment_file\n comment_file.close\n comment_file.unlink\n end\n end",
"def prepare_assets(assets)\n (assets || {}).each do |name, asset|\n if asset.is_a?(Hash)\n (asset || {}).each do |subname, subasset|\n prepare_asset(assets, subasset, name, subname)\n end\n else\n prepare_asset(assets, asset, name)\n end\n end\n end",
"def add_folder_recursive(folder_params)\n folder = browse(folder_params[:foreign_ref])\n\n # prepare file array\n files = []\n\n folder.each do |child|\n # prepare child parameters\n child_params = extract_file_params(child)\n # check if it is a directory or not\n if is_dir?(child)\n # concat merges two arrays, use extract method below\n files.concat(add_folder_recursive(child_params))\n else\n # add new file\n files << add_file(child_params)\n end\n end\n\n # return list of added files\n files\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def write()\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::ZipFile.open(@output_file, Zip::ZipFile::CREATE);\n write_entries(entries, \"\", io)\n io.close();\n end",
"def extract\n zip_file_path = \"#{Rails.root}/public/tmp/#{self.id}/#{self.zip_file_name}\"\n # 100.times { p File.exist?(zip_file_path) }\n\n Zip::ZipFile.open(zip_file_path) do |zipfile|\n zipfile.each do |file|\n export_path = \"#{Rails.root}/public/tmp/#{self.id}_2/\"\n zip_path = File.join(export_path, zip_file_name)\n\n 100.times do\n p zip_path\n end\n\n # export_path = \"#{Rails.root}/public/tmp/#{self.id}_2/\"\n # zip_path = File.join(export_path, zip_file_name)\n # FileUtils.mkdir_p(File.dirname(export_path))\n\n # unless File.exist?(zip_file_path)\n # zipfile.extract(file, zip_path)\n # # # ..stuff that it does..\n # end\n # 100.times do\n # p image_path\n # end\n # FileUtils.mkdir_p(File.dirname(image_path))\n # unless File.exist?(image_path)\n # zip_file.extract(image, image_path)\n # # ..stuff that it does..\n # end\n end\n end\n end",
"def packaging_task(dir_path, pkg_name)\n chdir dir_path do\n sh \"#{ZIP} -9 -r -o ../#{pkg_name} * **/*\"\n end\nend",
"def copy_assets; end",
"def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end",
"def download_assets\n return if @app.assets.blank?\n\n cmds = []\n\n @app.assets.sort_by { |asset| @app.ordered_assets.find_index(asset.dxid) }.each do |asset|\n url = download_asset(asset)\n tar_opts = asset.gzipped? ? \"xzf -\" : \"xf -\"\n cmds << \"RUN curl #{url} | tar #{tar_opts} -C / --no-same-owner --no-same-permissions\"\n end\n\n <<~ASSETS\n # Download app assets\"\n #{cmds.join(\"\\n\")}\n ASSETS\n end",
"def write(path)\n File.unlink(path) if File.exists?(path)\n Zip::Archive.open(path, Zip::CREATE) { |zipfile|\n zipfile.add_buffer(INDEX_PATH, htmlize(index))\n @book.media.each { |mpath|\n zipfile.add_buffer(mpath, @book.read_media(mpath))\n }\n unless @book.cover == COVER_PATH\n zipfile.add_buffer(COVER_PATH, to_png_data(@book.cover))\n end\n }\n path\n end",
"def extract_zip\n # FileUtils.rmtree(@extract_folder)\n zip_files = Dir[\"#{@download_folder}/*.zip\"]\n\n zip_files.each do |zip|\n Zip::File.open(zip) do |zip_file|\n zip_file.each do |f|\n file_name = f.name\n FileUtils.mkdir_p(\"#{@extract_folder}/#{File.dirname(file_name)}\")\n\n # doesn't extract empty files or files with fake locale\n if f.size && f.size != 0\n # if true overwrite existing files with same name\n zip_file.extract(f, \"#{@extract_folder}/#{f.name}\") { true }\n end\n end\n end\n delete_zip(zip)\n end\n end",
"def run_dir(root)\n\tDir.foreach(root) { |fn|\n\t\tnext if fn == \".\" || fn == \"..\"\n\t\tcombined = File.join(root, fn)\n\t\tif File.directory?(combined)\n\t\t\trun_dir(combined)\n\t\telsif File.file?(combined) && (fn[\".dll\"] || fn[\".pdb\"])\n\t\t\tfpath = combined\n\t\t\tfpath = fpath[2..-1] if fpath[0..1] == \"./\"\n\t\t\tfpath = fpath.gsub(\"/\", \"\\\\\")\n\t\t\tprint(\"#{fpath}\\n\")\n\t\t\t`compress -R #{fpath}`\n\t\t\texit(1) if $?.exitstatus != 0\n\t\t\t`del #{fpath}`\n\t\tend\n\t}\t\nend",
"def generate_data_zip(rootdir)\n tmpdir = File.join(rootdir, 'temp')\n logger.debug \"Changing to #{tmpdir}\"\n raise \"package-data: #{bare_druid} is missing #{tmpdir}\" unless File.directory?(tmpdir)\n\n Dir.chdir(tmpdir)\n File.umask(002)\n\n fns = []\n recurse_flag = false\n fn = Dir.glob('*.shp.xml').first\n if fn.nil?\n fn = Dir.glob('*/metadata.xml').first\n if fn.nil?\n fn = Dir.glob('*.tif.xml').first\n raise \"package-data: #{bare_druid} cannot locate metadata in temp\" if fn.nil?\n\n # GeoTIFF\n basename = File.basename(fn, '.tif.xml')\n Dir.glob(\"#{basename}.*\").each do |x|\n fns << x\n recurse_flag = true if File.directory?(x)\n end\n Dir.glob(\"#{basename}-*.xml\").each do |x|\n fns << x\n end\n else # ArcGRID\n fns << File.basename(File.dirname(fn))\n recurse_flag = true\n end\n else # Shapefile\n basename = File.basename(fn, '.shp.xml')\n Dir.glob(\"#{basename}.*\").each do |x|\n fns << x\n recurse_flag = true if File.directory?(x)\n end\n Dir.glob(\"#{basename}-*.xml\").each do |x|\n fns << x\n end\n end\n\n zipfn = File.join(rootdir, 'content', 'data.zip')\n FileUtils.mkdir_p(File.dirname(zipfn)) unless File.directory?(File.dirname(zipfn))\n FileUtils.rm_f(zipfn) if File.size?(zipfn)\n\n logger.debug \"Compressing #{bare_druid} into #{zipfn}\"\n system(\"zip -v#{recurse_flag ? 'r' : ''} '#{zipfn}' #{fns.join(' ')}\")\n end",
"def packaging_task(dir_path, pkg_name)\n chdir dir_path do\n sh \"#{ZIP} #{ZIP_ARGS} -r -o ../#{pkg_name} * **/*\"\n end\nend",
"def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\"); entries.delete(\"yamproject.json\"); entries.delete(\".DS_Store\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end",
"def make_directories!\n @sprites_path.mkpath unless @sprites_path.directory?\n @sources_path.mkpath unless @sources_path.directory?\n end",
"def copy_assets\n FileUtils.cp_r File.join(self.source, '_assets', '.'), self.dest\n end",
"def aggregate_subpaths(asset_aggregator)\n [ subpath ]\n end",
"def create_zip\n require 'zip'\n zip_files = [self.ground_truth, self.image_sequence, self.config_file]\n if self.acceptable_segmentation_region.present?\n zip_files.push(self.acceptable_segmentation_region)\n end\n zip_filename = Rails.root.join(dir_path, \"#{self.name}.zip\")\n Zip::File.open(zip_filename, Zip::File::CREATE) do |zipfile|\n zip_files.each do |file|\n zipfile.add(file, \"#{dir_path}/#{file}\")\n end\n end\n end",
"def zip_xml_files\n logger.debug('ZIPPING ALL FILES.')\n # time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n list_files.push(file)\n end\n puts list_files.length\n list_files.each do |file|\n Archive::Zip.archive((file + ARCHIVE_EXTN), file) if File.extname(file).eql?('.xml')\n end\n list_files.each do |file|\n File.delete(file)\n end\n logger.debug('ALL FILES ZIPPED.')\n end",
"def make_assets_relative!\n @style.gsub! \"url(/assets\", \"url(assets\"\n @style.gsub! \"url(../\", \"url(assets/\"\n end",
"def assets\n if @assets.nil?\n @assets = AssetsTask.define_task(project._(:target, :main, :assets) => [])\n @assets.project = self\n project.task('assets').enhance([@assets])\n project.build.enhance([@assets])\n end\n @assets\n end",
"def generate_assets_yml(node, force = true)\n\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t generate_assets_yml(child, force)\n\t\t\t end\n\t\tend \n\t\n\t\tif force or !File.exists?(\"#{node.source_path}/aaaa-assets.yml\")\n\t\t\n\t\t\taaml = Map.new({ asset_items: [] })\n\n\t\t\timage_subfolder = nil\n\t\t\tif node.source_path?\t\t\n\t\t\t\timage_subfolder = Dir.entries(node.source_path).select {|entry| File.directory? File.join(node.source_path, entry) and (entry == 'images') }\n\t\t\telse\n\t\t\t\t ap node\n\t\t\t\t exit\n\t\t\tend\n\t\t \n\t\t\tif image_subfolder\n\t\t\t\n\t\t\t\timages = []\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.png\")\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.jpg\")\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.jpeg\")\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.gif\")\n\t\t\t\t\t\n\t\t\t\timages.each do |image_path|\n\t\t\t\n\t\t\t\t\tsource = node.full_link + image_path.gsub(/#{node.source_path}/, \"\")\n\t\t\t\t\tfile = source[source.rindex(\"/\") + 1..-1]\n\t\t\t\t\ttitle = file[0..file.rindex(\".\") - 1].gsub(/_/, \" \")\n\t\t\t\t\n\t\t\t\t\titem = Map.new({\n\t\t\t\t\t\ttype: \"image\",\n\t\t\t\t\t\t#source: source,\n\t\t\t\t\t\t#link: \"/images\" + source,\n\t\t\t\t\t\tfile: file,\n\t\t\t\t\t\timg_alt: process_navigation_name(title),\n\t\t\t\t\t\timg_caption: nil,\n\t\t\t\t\t\timg_tooltip_text: nil \n\t\t\t\t\t})\n\t\t\t\t\taaml.asset_items << item\n\t\t\t\tend\n\t\t\t\n\t\t\t\tif images.size > 0\n\t\t\t\t\t\t\t\n\t\t\t\t\taaml_yaml = aaml.to_yaml.gsub(/^(- )/, \"\\n- \")\n\t\t\n\t\t\t\t\t# write out navigation.yml file...\n\t\t\t\t\tFile.open(\"#{node.source_path}/aaaa-assets.yml\", 'w') { |file| file.write(aaml_yaml) }\n\t\t\t\t\n\t\t\t\t\t#ap aaml \n\t\t\t\tend\n\t\t\n\t\t\tend\n\t\tend\n\tend",
"def setup subdirs\n FileUtils.mkdir_p @root\n if subdirs and subdirs.length > 0\n subdirs.each do |subdir|\n FileUtils.mkdir_p \"#{@root}#{@ds}#{subdir}\"\n end\n @subdirs = subdirs\n end\n end",
"def extract\n Dir.mktmpdir do |dir|\n open_zip do |zip_file|\n zip_file.each do |entry|\n entry.extract(File.join(dir, File.basename(entry.name))) unless entry.name_is_directory?\n end\n\n yield dir\n end\n end\n end",
"def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end",
"def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end",
"def add_folder(input_dir, src, dest)\n @folders << [input_dir, src, dest]\n end",
"def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end",
"def pack directory_path\n Dir.chdir directory_path\n name = Dir.pwd.split(@fs).last\n files = Dir.glob \"**#{@fs}*\"\n File.open([name, @ext].join(\".\"), \"wb\") do |tar|\n Minitar.pack(files, tar)\n end\n end",
"def perform\n begin\n Thread.current[:current_user] = creator\n self.parent_group = AssetGroup.find(asset_group_id)\n group_paths, asset_paths = unpack\n ActiveRecord::Base.transaction do\n groups = initialize_groups(group_paths)\n create_assets(groups, asset_paths)\n end\n ensure\n Thread.current[:current_user] = nil\n cleanup\n\n nil\n end\n end",
"def children\n @children ||= assets.map { |asset| asset.key.split('/').first }.uniq.map do |bucket|\n path = \"#{ resource.public_path }/#{ bucket }\"\n Shopidav::Resource.new(path, path, resource.request, resource.response, resource.options)\n end\n end",
"def zipXMLFiles\n logger.debug(\"ZIPPING ALL FILES.\")\n #time = Time.now.strftime(\"%Y-%d-%m_%H-%M-%S\")\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each {\n |file|\n listFiles.push(file)\n }\n puts listFiles.length\n listFiles.each {\n |file|\n if File.extname(file).eql?(\".xml\")\n Archive::Zip.archive((file + ARCHIVE_EXTN), file)\n end\n }\n listFiles.each {\n |file|\n File.delete(file)\n }\n logger.debug(\"ALL FILES ZIPPED.\")\n end",
"def copy_assets\n FileUtils.cp_r 'assets/.', 'output/', :preserve => true\nend",
"def build_assets\n end",
"def zip_files\n time = Time.now.strftime('%Y-%d-%m_%H-%M-%S')\n Archive::Zip.archive(File.join(ARCHIVE[0], ARCHIVE[1], time, ARCHIVE[2]), File.join(LOCAL_DIR, '.'))\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each { |file| File.delete(file) }\n end"
] |
[
"0.61086947",
"0.61060435",
"0.6061464",
"0.6007731",
"0.5917812",
"0.5841199",
"0.58001417",
"0.57991195",
"0.5763088",
"0.57603323",
"0.5631786",
"0.5612169",
"0.55973023",
"0.55808145",
"0.5574935",
"0.557355",
"0.55668014",
"0.55497897",
"0.553511",
"0.5532653",
"0.5510649",
"0.5510649",
"0.5496579",
"0.5491993",
"0.5474911",
"0.5473235",
"0.5460164",
"0.54195935",
"0.541678",
"0.5398695",
"0.5388263",
"0.53874743",
"0.5351943",
"0.53492385",
"0.533547",
"0.5332591",
"0.5329306",
"0.531398",
"0.53122175",
"0.530302",
"0.5294416",
"0.52779645",
"0.5270471",
"0.52681404",
"0.52681404",
"0.5260743",
"0.5259769",
"0.52570826",
"0.5252601",
"0.52388257",
"0.52196866",
"0.5195547",
"0.5186462",
"0.5184905",
"0.5178027",
"0.51772004",
"0.516524",
"0.51633126",
"0.51624876",
"0.51536214",
"0.5149243",
"0.51490605",
"0.5127299",
"0.51252276",
"0.5125027",
"0.5112431",
"0.5101726",
"0.5091858",
"0.5082624",
"0.5054266",
"0.5052072",
"0.5050126",
"0.50445116",
"0.5040709",
"0.5040561",
"0.50364673",
"0.50361645",
"0.5026091",
"0.50243086",
"0.50087667",
"0.50076187",
"0.49967664",
"0.49867514",
"0.49830815",
"0.4981882",
"0.49816754",
"0.49677905",
"0.4956721",
"0.49566442",
"0.49538139",
"0.49538139",
"0.4953022",
"0.4938464",
"0.49313512",
"0.49220067",
"0.49197528",
"0.4902281",
"0.48770362",
"0.48699787",
"0.48664966"
] |
0.72780645
|
0
|
GET /invoicestatuses GET /invoicestatuses.json
|
def index
@invoicestatuses = Invoicestatus.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @invents = Invent.all\n end",
"def show\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def list_inventors\n \tjson_out(Inventor.all)\n\tend",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def index\n # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end",
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def index\n @insumos = Insumo.all\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @identities = Identity.all\n\n render json: @identities\n end",
"def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end",
"def index\n @inventarios = Inventario.all\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 index\n render :json => UserInterest.all\n end",
"def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end",
"def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end",
"def show\n render json: @inciting_incident\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def index\n @invts = Invt.all\n end",
"def index\n @inboxes = Inbox.all\n @inboxes = @inboxes.select { |x| x.umkm_id == params[:umkm_id].to_i }\n render json: {items: @inboxes}\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n @noises = Noise.order(created_at: :desc).limit(50).all\n\n respond_with(:admin, @noises)\n end",
"def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n # first check if user is signed\n if !user_signed_in?\n render :status => 401, :json => {:success => false, :errors => [\"Unauthorized access\"] }\n elsif Invitee.where(:event_id => params[:event_id], :user_id => current_user.id).count <= 0\n # user hasn't been invited to this event, so don't allow them to see informatin about it\n render :status => 401, :json => {:success => false, :errors => [\"Not authorized to view this event\"] }\n else\n render :json => EventTimeUserChoice.joins(:event_time_option => :event)\n .where(:user_id => current_user.id, :events => {:id => params[:event_id]})\n .as_json\n end\n end",
"def index\n # authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n # @venues = Venue.all\n @venues = RawEvent.where(:submitted => nil, :deleted => nil).collect { |raw_event| raw_event.raw_venue ? raw_event.raw_venue.venue : nil }.compact\n @num_raw_events = Hash.new(0)\n @venues.each { |venue| @num_raw_events[venue.id] += 1 }\n @venues.uniq!\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @interruptions = Interruption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interruptions }\n end\n end",
"def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end",
"def index\n @inavailabilities = Inavailability.all\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend",
"def index\n @inflows = Inflow.all\n end",
"def index\n @appointments = Appointment.all \n render json: @appointments\n end",
"def index\n @instances = Instance.all\n render json: @instances\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def index\n @inews = Inews.all\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end",
"def index\n @insumo_platos = InsumoPlato.all\n end",
"def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end",
"def index\n @noises = Noise.search(params).group_by(&:user_id)\n\n respond_with @noises\n end",
"def index\n @ipacks = current_user.ipacks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ipacks }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json{ \n @incidents = Incident.order(\"id desc\")\n\n # We want to show many more if map\n per_page = params[:map].present? ? 500 : 25\n\n @incidents = @incidents.search(params[:q]) if params[:q].present?\n @incidents = @incidents.where(incident_type: \n params[:incident_type]) if params[:incident_type].present?\n @incidents = @incidents.paginate(page: params[:page], per_page: per_page)\n\n render json: {records: @incidents.as_json(methods: [:full_address, :translated_type]), \n types: Incident::TYPES.map{ |x| {value: x, name: Incident.translate_type(x)} },\n total_pages: @incidents.total_pages, total_entries: @incidents.total_entries, \n offset: @incidents.offset, per_page: @incidents.per_page} \n }\n end\n end",
"def index\n\t\t@events = Event.where(\"creator_id = ?\", current_user.id)\n\t\tInvitation.where(\"email = ? and accepted = ?\", current_user.email, true).each do |invitation|\n\t\t\t@events << invitation.event\n\t\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @travel_requests = TravelRequest.where user_id: current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @travel_requests }\n end\n end",
"def index # Essentially the main page of the application proper. This is the discover page.\n #@outlets = Outlet.where(inactive: false).order(:name).paginate(page: params[:page], per_page: 20)\n offset = params[:offset].to_i\n if offset == nil\n offset = 0\n end\n if current_user.trial == true\n puts \"current_user is trial user\"\n fetch_trial_outlets\n else\n fetch_outlets(offset)\n end\n render json: @outlets\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n render json: meeting.all\n end",
"def show\n @outing = Outing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outing }\n end\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n @plays_ins = PlaysIn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @plays_ins }\n end\n end",
"def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end",
"def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def index\n @venues = Venue.all :conditions=>{:display=>true}, :origin=>[params[:lat].to_f, params[:lng].to_f], :within=>30\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render :json => @venues.to_json(:except=>[:display, :user_id, :modified_user_id]), :callback=>params[:callback] }\n end\n end",
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def index\n @stopovers = Stopover.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopovers }\n end\n end",
"def index\n\t\t@recipes = Recipe.where(user_id: session[:user_id])\n\t\tif @recipes\n\t\t\trender json: @recipes.to_json(:include => [:inventories])\n\t\telse\n\t\t\tflash[:error] = \"You haven't saved any recipes yet! Search now :)\"\n\t\t\trender status: 400, nothing: true\n\t\tend\n\tend",
"def index\n @watch_sites = WatchSite.includes(:team, :venue).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_sites }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def index\n render json: @fiestas\n end",
"def index\n @naievents = Naievent.all\n end",
"def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def index\n @event = Event.find(params[:id])\n @users = @event.users\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def index\r\n @attestations = Attestation.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @attestations }\r\n end\r\n end",
"def index\n @instances = Instance.all\n render :json => @instances\n end",
"def index\n @seihinns = Seihinn.all\n end",
"def index\n @assessment_insti_tests = AssessmentInstiTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_insti_tests }\n end\n end"
] |
[
"0.65578556",
"0.63009167",
"0.6275538",
"0.6230005",
"0.62188435",
"0.6171505",
"0.6164612",
"0.6161942",
"0.61527795",
"0.61527795",
"0.61527795",
"0.6145688",
"0.6145688",
"0.6132998",
"0.61025727",
"0.60914516",
"0.6090144",
"0.6076337",
"0.6063787",
"0.6033189",
"0.6018475",
"0.6014878",
"0.6014171",
"0.6013681",
"0.6009476",
"0.6006807",
"0.60039765",
"0.60017157",
"0.59988296",
"0.59559876",
"0.5945461",
"0.59447867",
"0.59437233",
"0.5936592",
"0.5935539",
"0.5935539",
"0.59339386",
"0.59332585",
"0.59253883",
"0.5921624",
"0.591228",
"0.5902775",
"0.5900117",
"0.58992803",
"0.58965945",
"0.5893059",
"0.5890194",
"0.58897823",
"0.5889357",
"0.58741915",
"0.5867259",
"0.58670247",
"0.5865812",
"0.58568245",
"0.58532363",
"0.585171",
"0.5849436",
"0.5849172",
"0.58453554",
"0.58414215",
"0.58375883",
"0.58274084",
"0.5827202",
"0.58224005",
"0.5817956",
"0.58147174",
"0.58124936",
"0.58116853",
"0.58096296",
"0.58088964",
"0.580495",
"0.58041257",
"0.58026457",
"0.5800477",
"0.579937",
"0.57972157",
"0.57928413",
"0.57867837",
"0.5781686",
"0.5769968",
"0.5767033",
"0.5766289",
"0.57661194",
"0.5762103",
"0.57606727",
"0.5759355",
"0.57549363",
"0.5754713",
"0.5754229",
"0.5753607",
"0.575347",
"0.5752215",
"0.5748763",
"0.574823",
"0.5748082",
"0.5740284",
"0.57398397",
"0.5739561",
"0.5739182",
"0.5738547"
] |
0.6782847
|
0
|
GET /invoicestatuses/1 GET /invoicestatuses/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def index\r\n @invoicestatuses = Invoicestatus.all\r\n end",
"def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def 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 show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end",
"def show\n render json: @inciting_incident\n end",
"def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"def show\n @incucai = Incucai.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incucai }\n end\n end",
"def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end",
"def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end",
"def index\n # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end",
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @interruptions = Interruption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interruptions }\n end\n end",
"def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end",
"def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invents = Invent.all\n end",
"def show\n out = Out.find(params[:id])\n respond_to do |format|\n format.json {\n render :json => out, :layout => false\n }\n end\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def show\n @outing = Outing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outing }\n end\n end",
"def index\n @identities = Identity.all\n\n render json: @identities\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\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 @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def index\n @instances = Instance.all\n render json: @instances\n end",
"def show\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend",
"def index\n @inboxes = Inbox.all\n @inboxes = @inboxes.select { |x| x.umkm_id == params[:umkm_id].to_i }\n render json: {items: @inboxes}\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def index\n @appointments = Appointment.all \n render json: @appointments\n end",
"def show\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ongoing }\n end\n end",
"def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def show\n @user = User.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end",
"def index\n @noises = Noise.order(created_at: :desc).limit(50).all\n\n respond_with(:admin, @noises)\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @travel_requests = TravelRequest.where user_id: current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @travel_requests }\n end\n end",
"def index\n render json: meeting.all\n end",
"def show\n @usersevent = Usersevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @usersevent }\n end\n end",
"def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end",
"def show\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @especy }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def index\n @inventarios = Inventario.all\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n render json: Client.all\n end",
"def index\n @watch_sites = WatchSite.includes(:team, :venue).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_sites }\n end\n end",
"def show\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microtask }\n end\n end",
"def index\n render :json => UserInterest.all\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end",
"def index\n @instances = Instance.all\n render :json => @instances\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @insumos = Insumo.all\n end",
"def list_inventors\n \tjson_out(Inventor.all)\n\tend",
"def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end",
"def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end",
"def index\n @assessment_insti_tests = AssessmentInstiTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_insti_tests }\n end\n end",
"def index\n @visits = VisitSearch.new.visits current_physician, params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end",
"def index\n render json: @fiestas\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @vhours = Vhour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vhours }\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 show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def index # Essentially the main page of the application proper. This is the discover page.\n #@outlets = Outlet.where(inactive: false).order(:name).paginate(page: params[:page], per_page: 20)\n offset = params[:offset].to_i\n if offset == nil\n offset = 0\n end\n if current_user.trial == true\n puts \"current_user is trial user\"\n fetch_trial_outlets\n else\n fetch_outlets(offset)\n end\n render json: @outlets\n end",
"def show\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_type }\n end\n end",
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end",
"def show\n @online_service = OnlineService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_service }\n end\n end",
"def show\n @eatvent = Eatvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eatvent }\n end\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def index\n # authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n # @venues = Venue.all\n @venues = RawEvent.where(:submitted => nil, :deleted => nil).collect { |raw_event| raw_event.raw_venue ? raw_event.raw_venue.venue : nil }.compact\n @num_raw_events = Hash.new(0)\n @venues.each { |venue| @num_raw_events[venue.id] += 1 }\n @venues.uniq!\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end"
] |
[
"0.6418771",
"0.64007735",
"0.6248861",
"0.6207175",
"0.6099403",
"0.6074286",
"0.60462457",
"0.603139",
"0.6030851",
"0.5952416",
"0.5917502",
"0.5883167",
"0.587179",
"0.58583546",
"0.5857878",
"0.58458143",
"0.58402264",
"0.5834518",
"0.5822731",
"0.58219105",
"0.5820174",
"0.581717",
"0.58154017",
"0.5807428",
"0.5807428",
"0.5807428",
"0.57989275",
"0.57952285",
"0.57908124",
"0.5785359",
"0.5780073",
"0.5759695",
"0.57535654",
"0.5752087",
"0.5747283",
"0.57467884",
"0.57383054",
"0.5736463",
"0.5735812",
"0.57358074",
"0.5732332",
"0.5731905",
"0.57255703",
"0.5724951",
"0.57229227",
"0.5715668",
"0.5715208",
"0.570913",
"0.5708042",
"0.5703061",
"0.570046",
"0.570046",
"0.56966215",
"0.5695405",
"0.56885123",
"0.5682514",
"0.56822604",
"0.56804746",
"0.5679048",
"0.5671997",
"0.56694126",
"0.5669261",
"0.5668986",
"0.5661905",
"0.5661804",
"0.5660608",
"0.5659202",
"0.5655366",
"0.5655108",
"0.5652165",
"0.5650753",
"0.56440365",
"0.56436086",
"0.5643074",
"0.5640454",
"0.56377715",
"0.5635017",
"0.5634613",
"0.56343985",
"0.5632258",
"0.56284034",
"0.56275684",
"0.56220263",
"0.5621356",
"0.5620075",
"0.561908",
"0.5616716",
"0.56141967",
"0.5603495",
"0.55935806",
"0.5592573",
"0.55880046",
"0.5586581",
"0.5586306",
"0.55847186",
"0.5584444",
"0.5577833",
"0.5573635",
"0.5573635",
"0.5568038",
"0.5565625"
] |
0.0
|
-1
|
POST /invoicestatuses POST /invoicestatuses.json
|
def create
@invoicestatus = Invoicestatus.new(invoicestatus_params)
respond_to do |format|
if @invoicestatus.save
format.html { redirect_to @invoicestatus, notice: 'Invoicestatus was successfully created.' }
format.json { render :show, status: :created, location: @invoicestatus }
else
format.html { render :new }
format.json { render json: @invoicestatus.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def create\n @insumo = Insumo.new(insumo_params)\n\n respond_to do |format|\n if @insumo.save\n format.html { redirect_to insumos_url, notice: 'Insumo was successfully created.' }\n format.json { render :show, status: :created, location: @insumo }\n else\n format.html { render :new }\n format.json { render json: @insumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 index\r\n @invoicestatuses = Invoicestatus.all\r\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 @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 @inews = Inews.new(inews_params)\n\n respond_to do |format|\n if @inews.save\n format.html { redirect_to @inews, notice: 'Inews was successfully created.' }\n format.json { render :show, status: :created, location: @inews }\n else\n format.html { render :new }\n format.json { render json: @inews.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inspection = Inspection.new(inspection_params)\n @clients = @inspection.try(:appointment).try(:insp_request).try(:property).try(:clients)\n create_documents\n respond_to do |format|\n if @inspection.save\n format.html { redirect_to @inspection, notice: 'Inspection was successfully created.' }\n format.json { render json: @inspection }\n else\n format.html { render :new }\n format.json { render json: @inspection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invent = Invent.new(invent_params)\n\n respond_to do |format|\n if @invent.save\n format.html { redirect_to @invent, notice: 'Invent was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invent }\n else\n format.html { render action: 'new' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @users = User.all\n\n @event = current_user.events.build(event_params.except(:invites))\n\n respond_to do |format|\n if @event.save\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def create\n sheeps = params[:sheeps]\n return if params_are_empty(sheeps)\n \n @activity = Activity.new date: convert_date_to_i(params[:date]), comment: params[:comment], a_type: params[:type_of_a], total_costs:params[:total_costs], location: 'farma'\n sheeps.each do |p|\n @vacination = Vacination.new sheep_id:p[:sheep_id], reason: params[:reason], vaccin_name: params[:vaccin_name]\n @activity.vacinations.push(@vacination)\n end\n \n respond_to do |format|\n if @activity.save\n desrtoy_activity(params[:activity_id])\n format.html { redirect_to '/vacinations/'+ @activity.id.to_s, notice: 'Vacination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vacination }\n else\n format.html { render action: 'new' }\n format.json { render json: @vacination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoicestatus_params\r\n params.require(:invoicestatus).permit(:invoicestatus)\r\n end",
"def create\n @cuisine = Cuisine.new(spice_params)\n\n if @cuisine.save\n render json: @cuisine, status: :created\n else\n render json: @cuisine.errors, status: :unprocessable_entity\n end\n end",
"def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end",
"def create\n @inventario = Inventario.new(inventario_params)\n\n respond_to do |format|\n if @inventario.save\n format.html { redirect_to @inventario, notice: 'Inventario was successfully created.' }\n format.json { render :show, status: :created, location: @inventario }\n else\n format.html { render :new }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incucai = Incucai.new(params[:incucai])\n\n respond_to do |format|\n if @incucai.save\n format.html { redirect_to @incucai, notice: 'Incucai was successfully created.' }\n format.json { render json: @incucai, status: :created, location: @incucai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incucai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @invt = Invt.new(invt_params)\n\n respond_to do |format|\n if @invt.save\n format.html { redirect_to @invt, notice: 'El producto fue almacenado exitosamented.' }\n format.json { render :show, status: :created, location: @invt }\n else\n format.html { render :new }\n format.json { render json: @invt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @insumo_plato = InsumoPlato.new(insumo_plato_params)\n\n respond_to do |format|\n if @insumo_plato.save\n format.html { redirect_to @insumo_plato, notice: 'Insumo plato was successfully created.' }\n format.json { render :show, status: :created, location: @insumo_plato }\n else\n format.html { render :new }\n format.json { render json: @insumo_plato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoiceline = Invoiceline.new(params[:invoiceline])\n\n respond_to do |format|\n if @invoiceline.save\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully created.') }\n format.xml { render :xml => @invoiceline, :status => :created, :location => @invoiceline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @instituicao = Instituicao.new(params[:instituicao])\n\n respond_to do |format|\n if @instituicao.save\n format.html { redirect_to @instituicao, notice: 'Instituicao was successfully created.' }\n format.json { render json: @instituicao, status: :created, location: @instituicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instituicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create\n #create venues trought users controller\n end",
"def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n @incident.users << current_user\n format.html { redirect_to incident_path(@incident) }\n format.js { }\n format.json { render incident_path(@incident), status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inscrito = Inscrito.new(params[:inscrito])\n\n respond_to do |format|\n if @inscrito.save\n format.html { redirect_to @inscrito, notice: 'Inscrito was successfully created.' }\n format.json { render json: @inscrito, status: :created, location: @inscrito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inscrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @instituicao_responsavel = InstituicaoResponsavel.new(instituicao_responsavel_params)\n\n respond_to do |format|\n if @instituicao_responsavel.save\n format.html { redirect_to @instituicao_responsavel, notice: 'Instituicao responsavel was successfully created.' }\n format.json { render :show, status: :created, location: @instituicao_responsavel }\n else\n format.html { render :new }\n format.json { render json: @instituicao_responsavel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invent_params\n params.require(:invent).permit(:tipo, :nota)\n end",
"def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.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 create\n interruption_type = -1\n if params[:interruption_type] == \"internal\"\n interruption_type = 1;\n elsif params[:interruption_type] == \"external\"\n interruption_type = 0;\n end\n \n @tomato = Tomato.find(params[:tomato_id])\n @interruption = @tomato.interruptions.create!(params[:interruption].merge(:interruption_type => interruption_type))\n @interruption.user_id = current_user.id\n \n respond_to do |format|\n if @interruption.save\n format.html { redirect_to @tomato, notice: 'Interruption was successfully created.' }\n format.json { render json: @tomato, status: :created, location: @tomato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tomato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inven = Inven.new(inven_params)\n\n respond_to do |format|\n if @inven.save\n format.html { redirect_to @inven, notice: 'Inven was successfully created.' }\n format.json { render :show, status: :created, location: @inven }\n else\n format.html { render :new }\n format.json { render json: @inven.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident = Incident.new(incident_params)\n @incident.status = \"abierto\"\n @incident.user ||= current_user\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incidencia registrada' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #New itinerary\n @newItinerary = Itinerary.new itin_params\n @newItinerary.save\n #new event and event_itinerary\n @eventArray = event_array\n @eventArray.each do |event|\n event = Event.new(event) #iterate through, add event itinerary to each one with itinerary ID from first save.\n event.save\n @newEventItin = EventItinerary.new(:event_id => event[:id],:itinerary_id => @newItinerary[:id])\n @newEventItin.save\n end\n \n respond_to do |format|\n format.json { render :json => [{:event => @eventArray},{ :itineraries => @newItinerary},{:event_itineraries => @newEventItin} ]}\n end\n end",
"def event_params\n params.require(:event).permit(:time, :location, :title, :description, :creator_id, invites: [])\n end",
"def create\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident = Incident.new(params[:incident])\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @innapropiate = Innapropiate.new(innapropiate_params)\n\n respond_to do |format|\n if @innapropiate.save\n format.html { redirect_to @innapropiate, notice: 'Innapropiate was successfully created.' }\n format.json { render :show, status: :created, location: @innapropiate }\n else\n format.html { render :new }\n format.json { render json: @innapropiate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inflow = Inflow.new(inflow_params)\n respond_to do |format|\n if @inflow.save\n format.html { redirect_to @inflow, notice: 'Inflow was successfully created.' }\n format.json { render :show, status: :created, location: @inflow }\n else\n format.html { render :new }\n format.json { render json: @inflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @involvement = Involvement.new(involvement_params)\n\n respond_to do |format|\n if @involvement.save\n format.html { redirect_to @involvement, notice: 'Involvement was successfully created.' }\n format.json { render :show, status: :created, location: @involvement }\n else\n format.html { render :new }\n format.json { render json: @involvement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entrada_inventario = EntradaInventario.new(params[:entrada_inventario])\n\n respond_to do |format|\n if @entrada_inventario.save\n\n\t\t\t\tinventario=@entrada_inventario.inventario\n\t\t\t\tinventario.cantidad+=@entrada_inventario.cantidad\n\t\t\t\tinventario.save\n\n format.html { redirect_to @entrada_inventario, notice: 'Entrada inventario was successfully created.' }\n format.json { render json: @entrada_inventario, status: :created, location: @entrada_inventario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entrada_inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exosuit = Exosuit.new(exosuit_params)\n\n respond_to do |format|\n if @exosuit.save\n format.html { redirect_to @exosuit, notice: 'Exosuit was successfully created.' }\n format.json { render :show, status: :created, location: @exosuit }\n else\n format.html { render :new }\n format.json { render json: @exosuit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inavailability = Inavailability.new(inavailability_params)\n\n respond_to do |format|\n if @inavailability.save\n format.html { redirect_to @inavailability, notice: 'Inavailability was successfully created.' }\n format.json { render :show, status: :created, location: @inavailability }\n else\n format.html { render :new }\n format.json { render json: @inavailability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inscripcion = Inscripcion.new(inscripcion_params)\n\n respond_to do |format|\n if @inscripcion.save\n format.html { redirect_to @inscripcion, notice: 'Inscripcion was successfully created.' }\n format.json { render :show, status: :created, location: @inscripcion }\n else\n format.html { render :new }\n format.json { render json: @inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n runway = qx_take_off_params[:runway].split(\"/\")\n runway.each do |item|\n qx_take_off_params[:runway_id] = Qx::Runway.get_runay_id(qx_take_off_params[:airport_id], item)\n @qx_take_off = Qx::TakeOff.new(qx_take_off_params)\n end\n\n\n p runway\n\n respond_to do |format|\n if @qx_take_off.save\n format.html { redirect_to @qx_take_off, notice: 'Take off was successfully created.' }\n format.json { render :show, status: :created, location: @qx_take_off }\n else\n format.html { render :new }\n format.json { render json: @qx_take_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end",
"def create\n @naievent = Naievent.new(naievent_params)\n\n respond_to do |format|\n if @naievent.save\n format.html { redirect_to @naievent, notice: 'Naievent was successfully created.' }\n format.json { render :show, status: :created, location: @naievent }\n else\n format.html { render :new }\n format.json { render json: @naievent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @situacao_reserva = SituacaoReserva.new(situacao_reserva_params)\n @situacao_reservas = SituacaoReserva.all.paginate(page: params[:page], per_page: 5)\n @action = { title: \"Nova\", button: \"Salvar\"}\n\n respond_to do |format|\n if @situacao_reserva.save\n format.html { redirect_to action: \"new\", notice: 'Situação reserva criada com sucesso..' }\n format.json { render :show, status: :created, location: @situacao_reserva }\n else\n format.html { render :new }\n format.json { render json: @situacao_reserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inscricao = Inscricao.new(inscricao_params)\n\n respond_to do |format|\n if @inscricao.save\n format.html { redirect_to @inscricao, notice: \"Inscricao was successfully created.\" }\n format.json { render :show, status: :created, location: @inscricao }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @inscricao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n\n @pizza.user_id = current_user.id\n\n params[:topping_ids].each do |tid|\n topping = Topping.find_by_id(tid)\n @pizza.toppings << topping\n end\n\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pizza }\n else\n format.html { render action: 'new' }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to root_url, notice: 'Incident was successfully created.' }\n format.json { render action: 'show', status: :created, location: @incident }\n else\n format.html { render action: 'new' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingeniero = Ingeniero.new(ingeniero_params)\n\n respond_to do |format|\n if @ingeniero.save\n format.html { redirect_to @ingeniero, notice: 'Ingeniero was successfully created.' }\n format.json { render :show, status: :created, location: @ingeniero }\n else\n format.html { render :new }\n format.json { render json: @ingeniero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n if(!params[\"venue\"].blank?)\n Venue.save_multiple_venues(@curr_user,params[\"venue\"])\n @status=true\n else\n @status=false\n end\n respond_to do |format|\n if @status\n format.html { redirect_to :action=>:index }\n format.json { render :json => @venues, :status => :created, :location => @venues }\n else\n flash[:error] = 'Please select atleast one checkbox to create venue'\n format.html { redirect_to :action => \"search\"}\n end \n end\n end",
"def create\n @usersevent = Usersevent.new(params[:usersevent])\n\n respond_to do |format|\n if @usersevent.save\n format.html { redirect_to @usersevent, :notice => 'Usersevent was successfully created.' }\n format.json { render :json => @usersevent, :status => :created, :location => @usersevent }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @usersevent.errors, :status => :unprocessable_entity }\n end\n end\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 create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @unova = Unova.new(unova_params)\n\n respond_to do |format|\n if @unova.save\n format.html { redirect_to @unova, notice: 'Unova was successfully created.' }\n format.json { render :show, status: :created, location: @unova }\n else\n format.html { render :new }\n format.json { render json: @unova.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n self.validar_admin\n @inventario = Inventario.new(inventario_params)\n\n respond_to do |format|\n if @inventario.save\n format.html { redirect_to @inventario, notice: 'Inventario was successfully created.' }\n format.json { render :show, status: :created, location: @inventario }\n else\n format.html { render :new }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n #@httparty_tests = HttpartyTest.all\n @httparty_tests = HttpartyTest.new\n #@httparty_tests.create_events\n end",
"def create\n @eventinterest = Eventinterest.new(eventinterest_params)\n\n respond_to do |format|\n if @eventinterest.save\n format.html { redirect_to @eventinterest, notice: 'Eventinterest was successfully created.' }\n format.json { render :show, status: :created, location: @eventinterest }\n else\n format.html { render :new }\n format.json { render json: @eventinterest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vig_params\n params.require(:vig).permit(:name, :date, :test_ids=>[])\n end",
"def create\n @presented_testimony = PresentedTestimony.new(presented_testimony_params)\n\n respond_to do |format|\n if @presented_testimony.save\n format.html { redirect_to @presented_testimony, notice: 'Presented testimony was successfully created.' }\n format.json { render :show, status: :created, location: @presented_testimony }\n else\n format.html { render :new }\n format.json { render json: @presented_testimony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incidentmanagement = Incidentmanagement.new(incidentmanagement_params)\n\n respond_to do |format|\n if @incidentmanagement.save\n format.html { redirect_to @incidentmanagement, notice: 'Incidentmanagement was successfully created.' }\n format.json { render :show, status: :created, location: @incidentmanagement }\n else\n format.html { render :new }\n format.json { render json: @incidentmanagement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proveedor_insumo = ProveedorInsumo.new(proveedor_insumo_params)\n\n respond_to do |format|\n if @proveedor_insumo.save\n format.html { redirect_to @proveedor_insumo, notice: 'Proveedor insumo was successfully created.' }\n format.json { render :show, status: :created, location: @proveedor_insumo }\n else\n format.html { render :new }\n format.json { render json: @proveedor_insumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_kind = IncidentKind.new(params[:incident_kind])\n\n respond_to do |format|\n if @incident_kind.save\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully created.' }\n format.json { render json: @incident_kind, status: :created, location: @incident_kind }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apunte = Apunte.new(params[:apunte])\n\n respond_to do |format|\n if @apunte.save\n format.html { redirect_to @apunte, notice: 'Apunte was successfully created.' }\n format.json { render json: @apunte, status: :created, location: @apunte }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_interest = EventInterest.new(params[:event_interest])\n\n respond_to do |format|\n if @event_interest.save\n format.html { redirect_to @event_interest, notice: 'Event interest was successfully created.' }\n format.json { render json: @event_interest, status: :created, location: @event_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def incident_params\n params.require(:incident).permit(:users_id, :latitude, :longitude, :fecha, :incidenttypes_id, :pmuerte, :nambulancia, :npolicia, :prioridad, :riesgo, :descripcion, :gnbtnpanico, :imagen)\n end",
"def create\n #Makes an innings associated with a given match\n @innings = Innings.new(innings_params)\n\n respond_to do |format|\n if @innings.save\n format.html { redirect_to match_path(@match), notice: 'Innings was successfully created.' }\n format.json { render :show, status: :created, location: @innings }\n else\n format.html { render :new }\n format.json { render json: @innings.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def create\n @inventario.user_id = current_user.id\n respond_to do |format|\n if @inventario.save\n format.html { redirect_to @inventario, notice: 'Inventario was successfully created.' }\n format.json { render :show, status: :created, location: @inventario }\n else\n format.html { render :new }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oiseau = Oiseau.new(oiseau_params)\n\n respond_to do |format|\n if @oiseau.save\n format.html { redirect_to @oiseau, notice: 'Oiseau was successfully created.' }\n format.json { render :show, status: :created, location: @oiseau }\n else\n format.html { render :new }\n format.json { render json: @oiseau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iine = Iine.new(iine_params)\n\n respond_to do |format|\n if @iine.save\n format.html { redirect_to @iine, notice: 'Iine was successfully created.' }\n format.json { render :show, status: :created, location: @iine }\n else\n format.html { render :new }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @myb_evl_intake = MybEvlIntake.new(myb_evl_intake_params)\n\n respond_to do |format|\n if @myb_evl_intake.save\n format.html { redirect_to @myb_evl_intake, notice: 'Myb evl intake was successfully created.' }\n format.json { render :show, status: :created, location: @myb_evl_intake }\n else\n format.html { render :new }\n format.json { render json: @myb_evl_intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n user_from_api_key = User.find_by(api_key: request.headers[:apiKey])\n return render json: {rides: [], message: \"Access denied\"}, status: :unauthorized if user_from_api_key.nil?\n\n departure_place = params[:departure_place]\n departure_threshold = params[:departure_place_threshold].to_i\n destination = params[:destination]\n destination_threshold = params[:destination_threshold].to_i\n if params.has_key?(:departure_time)\n departure_time = Time.zone.parse(params[:departure_time])\n end\n user = User.find_by(api_key: request.headers[:apiKey])\n ride_type = params[:ride_type].to_i\n\n if user.nil?\n return render json: {:message => \"User not found\"}, status: :not_found\n else\n # add this search to table ride_searches which is displayed as a timeline\n user.ride_searches.create!(departure_place: departure_place, destination: destination,\n departure_time: departure_time, ride_type: ride_type)\n end\n\n rides = Ride.rides_nearby departure_place, departure_threshold, destination,\n destination_threshold, departure_time, ride_type\n\n\n if rides.count > 0\n render json: {:rides => rides, each_serializer: RideSerializer}, status: :ok\n else\n render json: {:rides => []}, status: :no_content\n end\n\n end",
"def create\n @indivisual = Indivisual.new(indivisual_params)\n\n respond_to do |format|\n if @indivisual.save\n format.html { redirect_to @indivisual, notice: 'Indivisual was successfully created.' }\n format.json { render :show, status: :created, location: @indivisual }\n else\n format.html { render :new }\n format.json { render json: @indivisual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def create\n @node_incident = NodeIncident.new(params[:node_incident])\n\n respond_to do |format|\n if @node_incident.save\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully created.' }\n format.json { render :json => @node_incident, :status => :created, :location => @node_incident }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def inseminacao_params\n params.require(:inseminacao).permit(:data, :inseminador_id, :bovino_id)\n end",
"def index\n # authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n # @venues = Venue.all\n @venues = RawEvent.where(:submitted => nil, :deleted => nil).collect { |raw_event| raw_event.raw_venue ? raw_event.raw_venue.venue : nil }.compact\n @num_raw_events = Hash.new(0)\n @venues.each { |venue| @num_raw_events[venue.id] += 1 }\n @venues.uniq!\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def create\n @vrsta_inventara = VrstaInventara.new(vrsta_inventara_params)\n\n respond_to do |format|\n if @vrsta_inventara.save\n format.html { redirect_to vrsta_inventaras_url, notice: 'Vrsta inventara je uspješno stvorena.' }\n format.json { render :show, status: :created, location: @vrsta_inventara }\n else\n format.html { render :new }\n format.json { render json: @vrsta_inventara.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trainings_session = TrainingsSession.new(params[:trainings_session])\n\t\t@trainings_session.owner = current_user if current_user\n\t\t@my_exercises = Exercise.liked_by(current_user.id).published\n\t\t\t.concat(Exercise.owned_by(current_user.id).published)\n\t\t\t.concat(Exercise.owned_by(current_user.id).unpublished)\n\n respond_to do |format|\n if @trainings_session.save\n format.html { redirect_to my_sessions_path, notice: 'Trainings session was successfully created.' }\n format.json { render json: @trainings_session, status: :created, location: @trainings_session }\n\t\t\t\tformat.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @trainings_session.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js { render action: \"new\"}\n end\n end\n end",
"def onsen_params\n params.require(:onsen).permit(:name, :prefecture_id, :url, :review, :list_id, :user_id)\n end",
"def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end",
"def new\n #@getinvoicedatum = Getinvoicedatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end",
"def invt_params\n params.require(:invt).permit(:producto, :existencia, :precio, :descripcion, :fecha)\n end"
] |
[
"0.60714495",
"0.57937217",
"0.56855226",
"0.5667705",
"0.56533545",
"0.56297797",
"0.5615217",
"0.55532086",
"0.554624",
"0.55319613",
"0.55209357",
"0.5518754",
"0.5471253",
"0.54645765",
"0.54598886",
"0.5454074",
"0.5452175",
"0.54164785",
"0.54004",
"0.53930575",
"0.5385845",
"0.53727573",
"0.5367542",
"0.533323",
"0.53238136",
"0.5322032",
"0.5308877",
"0.5307141",
"0.530606",
"0.5305529",
"0.52980334",
"0.52938354",
"0.5293392",
"0.52861494",
"0.52762747",
"0.52716124",
"0.5271092",
"0.52706945",
"0.52670485",
"0.5262338",
"0.52512425",
"0.52512425",
"0.52332485",
"0.5217911",
"0.521128",
"0.52082676",
"0.5199692",
"0.519674",
"0.5183682",
"0.5177098",
"0.51650447",
"0.51601195",
"0.51585376",
"0.5154305",
"0.5140587",
"0.5140425",
"0.51388013",
"0.51355976",
"0.51301694",
"0.5124299",
"0.51197183",
"0.51168245",
"0.5115507",
"0.5114465",
"0.5111773",
"0.5111222",
"0.51108444",
"0.51093984",
"0.5098866",
"0.5098334",
"0.5096879",
"0.50957936",
"0.5088876",
"0.50862765",
"0.50789756",
"0.5076795",
"0.50754386",
"0.5074714",
"0.50696313",
"0.5068898",
"0.50638777",
"0.5061385",
"0.50558144",
"0.50556636",
"0.5055386",
"0.5055102",
"0.50549245",
"0.5051877",
"0.5051338",
"0.5049402",
"0.5049332",
"0.5047479",
"0.5046202",
"0.503833",
"0.503295",
"0.50319195",
"0.50318825",
"0.50268596",
"0.502612",
"0.50258166"
] |
0.56026596
|
7
|
PATCH/PUT /invoicestatuses/1 PATCH/PUT /invoicestatuses/1.json
|
def update
respond_to do |format|
if @invoicestatus.update(invoicestatus_params)
format.html { redirect_to @invoicestatus, notice: 'Invoicestatus was successfully updated.' }
format.json { render :show, status: :ok, location: @invoicestatus }
else
format.html { render :edit }
format.json { render json: @invoicestatus.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n\n respond_to do |format|\n if @getinvoicedatum.update_attributes(params[:getinvoicedatum])\n format.html { redirect_to @getinvoicedatum, notice: 'Getinvoicedatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @getinvoicedatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"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!(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_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"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 @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def patch!\n request! :patch\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 UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \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 @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 @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 respond_to do |format|\n if @invent.update(invent_params)\n format.html { redirect_to @invent, notice: 'Invent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caloric_intake.update(caloric_intake_params)\n format.html { redirect_to @caloric_intake, notice: 'Caloric intake was successfully updated.' }\n format.json { render :show, status: :ok, location: @caloric_intake }\n else\n format.html { render :edit }\n format.json { render json: @caloric_intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\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 @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.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 @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 put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\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 if @inciting_incident.update(inciting_incident_params)\n render json: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\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 # PATCH\n raise NotImplementedError\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n if @microtask.update_attributes(params[:microtask])\n format.html { redirect_to @microtask, notice: 'Microtask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microtask.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.html { redirect_to incident_plans_path(@incident) }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\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 put :update\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 respond_to do |format|\n if @iot.update(iot_params)\n format.html { redirect_to @iot, notice: 'Iot was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot }\n else\n format.html { render :edit }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testimonio.update(testimonio_params)\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonio }\n else\n format.html { render :edit }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_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 update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @get_in_touch.update(get_in_touch_params)\n format.html { redirect_to @get_in_touch, notice: 'Get in touch was successfully updated.' }\n format.json { render :show, status: :ok, location: @get_in_touch }\n else\n format.html { render :edit }\n format.json { render json: @get_in_touch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n if @apunte.update_attributes(params[:apunte])\n format.html { redirect_to @apunte, notice: 'Apunte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.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.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.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.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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 save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def update\n respond_to do |format|\n if @insumo.update(insumo_params)\n format.html { redirect_to insumos_url , notice: 'Insumo was successfully updated.' }\n format.json { render :show, status: :ok, location: @insumo }\n else\n format.html { render :edit } \n format.json { render json: @insumo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end",
"def update\n @todo.update(todo_params)\n respond_with(@user, @todo)\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n if @testis.update_attributes(params[:testis])\n format.html { redirect_to @testis, notice: 'Teste was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource @ride, ride_params\n end",
"def update\n @test_appointment = TestAppointment.find(params[:id])\n\n respond_to do |format|\n if @test_appointment.update_attributes(params[:test_appointment])\n format.html { redirect_to @test_appointment, notice: 'Test appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\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 update\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n if @onske.update_attributes(params[:onske])\n format.html { redirect_to @onske, notice: 'Onske was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n if @incident_kind.update_attributes(params[:incident_kind])\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_kind.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 edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def update\n return if auth(\"website_administrator\")\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 :ok }\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 set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @inventario.update(inventario_params)\n format.html { redirect_to @inventario, notice: 'Inventario was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario }\n else\n format.html { render :edit }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario.update(inventario_params)\n format.html { redirect_to @inventario, notice: 'Inventario was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario }\n else\n format.html { render :edit }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @userspec.update(userspec_params)\n format.html { redirect_to root_path, notice: 'Userspec was successfully updated.' }\n format.json { render :show, status: :ok, location: @userspec }\n else\n format.html { render :edit }\n format.json { render json: @userspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node_incident = NodeIncident.find(params[:id])\n\n respond_to do |format|\n if @node_incident.update_attributes(params[:node_incident])\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n if @consensu.update_attributes(params[:consensu])\n format.html { redirect_to @consensu, notice: 'Consensu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consensu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def 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 @intake = Intake.find(params[:id])\n\n respond_to do |format|\n if @intake.update_attributes(params[:intake])\n format.html { redirect_to @intake, notice: 'Intake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inven.update(inven_params)\n format.html { redirect_to @inven, notice: 'Inven was successfully updated.' }\n format.json { render :show, status: :ok, location: @inven }\n else\n format.html { render :edit }\n format.json { render json: @inven.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n respond_to do |format|\n if @myb_evl_intake.update(myb_evl_intake_params)\n format.html { redirect_to @myb_evl_intake, notice: 'Myb evl intake was successfully updated.' }\n format.json { render :show, status: :ok, location: @myb_evl_intake }\n else\n format.html { render :edit }\n format.json { render json: @myb_evl_intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_evento.update(servico_evento_params)\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update\n @calorie_intake = CalorieIntake.find(params[:id])\n\n respond_to do |format|\n if @calorie_intake.update_attributes(params[:calorie_intake])\n format.html { redirect_to(@calorie_intake, :notice => 'CalorieIntake was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calorie_intake.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 @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @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 @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n if @entrada_inventario.update_attributes(params[:entrada_inventario])\n format.html { redirect_to @entrada_inventario, notice: 'Entrada inventario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entrada_inventario.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.61235374",
"0.6058475",
"0.6037367",
"0.6036165",
"0.5956195",
"0.5919987",
"0.59000033",
"0.5894517",
"0.58738905",
"0.58600837",
"0.5836637",
"0.58305115",
"0.5830134",
"0.5823538",
"0.5724849",
"0.57216066",
"0.5706353",
"0.5704588",
"0.5685766",
"0.5683967",
"0.56725687",
"0.56562203",
"0.5652819",
"0.5649323",
"0.5633807",
"0.5631719",
"0.5630212",
"0.5619162",
"0.5607499",
"0.5596472",
"0.55898094",
"0.5578908",
"0.5576367",
"0.5576367",
"0.5571731",
"0.5569638",
"0.5569638",
"0.55626667",
"0.5559968",
"0.5558806",
"0.5547259",
"0.55458397",
"0.5534645",
"0.55310756",
"0.552733",
"0.5527294",
"0.55261",
"0.5525977",
"0.5524616",
"0.5512798",
"0.5503134",
"0.5503134",
"0.5503134",
"0.54964066",
"0.5492496",
"0.5489925",
"0.5489925",
"0.5487974",
"0.54790086",
"0.5476064",
"0.5474882",
"0.54716945",
"0.5462769",
"0.5459432",
"0.5457041",
"0.54516214",
"0.5449316",
"0.5448213",
"0.544808",
"0.54478014",
"0.5447115",
"0.54447186",
"0.54436576",
"0.54414237",
"0.54371226",
"0.54333603",
"0.5432653",
"0.5429083",
"0.5429083",
"0.54287326",
"0.542755",
"0.542558",
"0.542558",
"0.5425064",
"0.54227203",
"0.5418662",
"0.5418395",
"0.5418298",
"0.54169303",
"0.5415787",
"0.5415749",
"0.54141146",
"0.54120463",
"0.5411489",
"0.54104275",
"0.5408306",
"0.5405722",
"0.5388968",
"0.53881556",
"0.5384917"
] |
0.56091034
|
28
|
DELETE /invoicestatuses/1 DELETE /invoicestatuses/1.json
|
def destroy
@invoicestatus.destroy
respond_to do |format|
format.html { redirect_to invoicestatuses_url, notice: 'Invoicestatus was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n @getinvoicedatum.destroy\n\n respond_to do |format|\n format.html { redirect_to getinvoicedata_url }\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_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 @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @invent.destroy\n respond_to do |format|\n format.html { redirect_to invents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @insumo.destroy\n respond_to do |format|\n format.html { redirect_to insumos_url, notice: 'Insumo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @testimonio.destroy\n respond_to do |format|\n format.html { redirect_to testimonios_url, notice: 'Testimonio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @iot.destroy\n respond_to do |format|\n format.html { redirect_to iots_url, notice: 'Iot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entrada_inventario = EntradaInventario.find(params[:id])\n @entrada_inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to entrada_inventarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\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\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(',')})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n render json: Item.delete(params[\"id\"])\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 record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n head :no_content\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :ok }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @nineteen.destroy\n respond_to do |format|\n format.html { redirect_to nineteens_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 @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @caloric_intake.destroy\n respond_to do |format|\n format.html { redirect_to caloric_intakes_url, notice: 'Caloric intake was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_visa.destroy\n respond_to do |format|\n format.html { redirect_to my_visas_url, notice: 'My visa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inven.destroy\n respond_to do |format|\n format.html { redirect_to invens_url, notice: 'Inven was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @evclient = Evclient.find(params[:id])\n @evclient.destroy\n\n respond_to do |format|\n format.html { redirect_to evclients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @instituicao = Instituicao.find(params[:id])\n @instituicao.destroy\n\n respond_to do |format|\n format.html { redirect_to instituicoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myb_evl_intake.destroy\n respond_to do |format|\n format.html { redirect_to myb_evl_intakes_url, notice: 'Myb evl intake was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observ.destroy\n respond_to do |format|\n format.html { redirect_to observs_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete!\n request! :delete\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 @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @out.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @servico_evento.destroy\n respond_to do |format|\n format.html { redirect_to servico_eventos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n @eatvent = Eatvent.find(params[:id])\n @eatvent.destroy\n\n respond_to do |format|\n format.html { redirect_to eatvents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n @especy = Especie.find(params[:id])\n @especy.destroy\n\n respond_to do |format|\n format.html { redirect_to especies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apunte = Apunte.find(params[:id])\n @apunte.destroy\n\n respond_to do |format|\n format.html { redirect_to apuntes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incucai = Incucai.find(params[:id])\n @incucai.destroy\n\n respond_to do |format|\n format.html { redirect_to incucais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find_by(id: params[:id])\n Todo.delete(@todo)\n @@all = Todo.all\n render json: @@all\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n 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 @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end",
"def destroy\n #delete venues trought users controller\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appointment.destroy\n head 204\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n @page_usage_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_usage_events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url, notice: 'Incident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url, notice: 'Incident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url, notice: 'Incident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url, notice: 'Incident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url, notice: 'Incident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end",
"def delete path\n make_request(path, \"delete\", {})\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 @inside.destroy\n respond_to do |format|\n format.html { redirect_to insides_url, notice: 'Inside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.728172",
"0.6891373",
"0.68901175",
"0.6854118",
"0.6853808",
"0.68381846",
"0.682847",
"0.68215257",
"0.68105596",
"0.6803928",
"0.67883587",
"0.67413354",
"0.6728785",
"0.6708859",
"0.669687",
"0.66847605",
"0.66847605",
"0.66743076",
"0.66743076",
"0.66743076",
"0.66743076",
"0.66634935",
"0.66556954",
"0.66550934",
"0.66534656",
"0.66534656",
"0.66354936",
"0.66315544",
"0.6628115",
"0.6616386",
"0.66006404",
"0.6582849",
"0.65782356",
"0.65759504",
"0.6572997",
"0.6571848",
"0.6564197",
"0.6561401",
"0.6560812",
"0.6560671",
"0.65564716",
"0.6551978",
"0.6549522",
"0.6543569",
"0.6538098",
"0.6528665",
"0.65263623",
"0.65249753",
"0.65214175",
"0.65187496",
"0.6516738",
"0.65127385",
"0.651145",
"0.6506648",
"0.65064895",
"0.6505068",
"0.65047044",
"0.6504224",
"0.65013254",
"0.65003073",
"0.64953893",
"0.6492315",
"0.6479319",
"0.6476717",
"0.6472307",
"0.6471301",
"0.64692956",
"0.6466318",
"0.6463834",
"0.6462722",
"0.64615506",
"0.6457447",
"0.6456309",
"0.6451255",
"0.6449375",
"0.6444061",
"0.64433587",
"0.6442344",
"0.6441783",
"0.64385426",
"0.6437442",
"0.642946",
"0.64288026",
"0.64280856",
"0.64251417",
"0.642505",
"0.6424327",
"0.642287",
"0.64192015",
"0.64180714",
"0.6415671",
"0.64151585",
"0.64151585",
"0.64151585",
"0.64151585",
"0.64151585",
"0.6411398",
"0.6409618",
"0.64066774",
"0.6404229"
] |
0.68752426
|
3
|
Use callbacks to share common setup or constraints between actions.
|
def set_invoicestatus
@invoicestatus = Invoicestatus.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_handler\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 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 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 action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; 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 before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def 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 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 action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup_signals; 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 after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = 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",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def invoicestatus_params
params.require(:invoicestatus).permit(:invoicestatus)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def 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 permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
GET /people_terms GET /people_terms.json
|
def index
@people_terms = PeopleTerm.where(["person_id = ?", params[:person_id]]).includes(:term).order("terms.start_date")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def get_terms(params)\n send_get \"get_terms\", params\n end",
"def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end",
"def terms_get(opts = {})\n data, _status_code, _headers = terms_get_with_http_info(opts)\n data\n end",
"def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def terms\n\n end",
"def terms\n\n end",
"def terms\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def terms\n\tend",
"def terms_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_get ...'\n end\n # resource path\n local_var_path = '/terms'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20021')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_terms(params)\n send_get \"add_terms\", params\n end",
"def people_term_params\n params.require(:people_term).permit(:person_id, :term_id)\n end",
"def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end",
"def create\n @people_term = PeopleTerm.new(people_term_params)\n\n respond_to do |format|\n if @people_term.save\n format.html { redirect_to @people_term, notice: 'People term was successfully created.' }\n format.json { render :show, status: :created, location: @people_term }\n else\n format.html { render :new }\n format.json { render json: @people_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def search\n\n # extract the terms from params\n terms = params[:search_terms]\n\n # redirect to root in case of missing terms\n redirect_to root_path && return if terms.blank?\n\n # extract the terms to an array\n # delete('-') because phones are saved without '-' (numbers only)\n terms_array = params[:search_terms].delete('-').split(' ')\n\n # extract the params using private methods\n age = age_param(terms_array)\n phone = phone_param(terms_array)\n names_array = name_param_array(terms)\n\n # find the people available for the search terms\n @peoples = People.search_by_terms(names_array, phone, age)\n\n # renders 'search.js'\n end",
"def glossary_terms_list_with_http_info(account_id, glossary_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_terms_list ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<GlossaryTerm>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_terms_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def terms\n @term_hash.values\n end",
"def index\n @terms_of_services = TermsOfService.all\n end",
"def terms\n @terms ||= Net::HTTP.get(\"rafb.net\", \"/paste/terms.html\")\n # return text inside the div with class \"content_body\", without HTML tags.\n @terms[%r{<div class=\"content_body\">.*?</div>}m].gsub(%r{<.*?>}m, \"\").strip\n end",
"def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"def get_terms(retina_name=nil, term=nil, get_fingerprint=nil, start_index=0, max_results=10)\n resource_path = '/terms'\n verb = 'GET'\n query_params = { 'retina_name' => retina_name, 'term' => term, 'start_index' => start_index,\n 'max_results' => max_results, 'get_fingerprint' => get_fingerprint }\n post_data = nil\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n JSON.parse(response.body, symbolize_names: true).map { |r| RetinaSDK::Model::Term.new(r) }\n end",
"def show\n @privacy_term = PrivacyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @privacy_term }\n end\n end",
"def show\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term }\n end\n end",
"def terms_agreement\n # @user instantiated by authentication before filter and matched to current user\n if request.post? && params[:commit_agreed]\n alter_current_user do |user|\n user.agreed_with_terms = true\n end\n redirect_back_or_default(user_path(current_user))\n else\n # FIXME: is this the right content for terms agreement and the right call for it?\n # FIXME: this seems flakey, do we have unique machine names for content rather than page name?\n page = ContentPage.find_by_page_name('Terms Of Use')\n @terms = TranslatedContentPage.find_by_content_page_id_and_language_id(page, @user.language_id) unless page.nil?\n end\n end",
"def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end",
"def terms\n [self]\n end",
"def index\n @terms = Term.all\n end",
"def terms\n @title = \"community terms\"\n end",
"def new\n @resource = Resource.new\n @terms = Term.all_iit_subjects\n @iit_terms = Term.all_iit_subjects\n @non_iit_terms = Term.all_iit_non_subjects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def set_people_term\n @people_term = PeopleTerm.find(params[:id])\n end",
"def search_param_terms\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tp['terms']\n\t\tend",
"def profile_specialist_search\n\t\t# search the the speciality name according to the terms\n\t\tspecialities = Speciality.any_of({ :name => /^#{params[:term]}/i }).all.collect{|speciality| {label: speciality.name ,value: speciality.id.to_s}}.to_json \n\t\t# render to the surgery name page\n\t\trespond_to do |format|\n\t\t format.json { render :json => specialities }\n\t\tend\n\tend",
"def term_list(terms)\n ignored = params.keys - ['q', 'solr_document_id', 'action', 'controller']\n list_id = request.original_url\n term_list = IIIF::Presentation::Resource.new('@id' => list_id)\n term_list['@context'] = 'http://iiif.io/api/search/1/context.json'\n term_list['@type'] = 'search:TermList'\n term_list['terms'] = terms\n term_list['ignored'] = ignored\n term_list.to_ordered_hash(force: true, include_context: false)\n end",
"def terms(attributes = nil)\r\n field = attributes.keys.first\r\n query = { field => attributes.values.flatten }\r\n\r\n body = { query: { terms: query } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end",
"def new\n @terms_of_use = TermsOfUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n \n @locations = apply_scopes(@taxonomy_term.locations).uniq().page(params[:page]).per(params[:per_page])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def index\n render json: Term.roots\n .includes(:user)\n .map(&:serialize_list),\n status: :ok\n end",
"def index\n @publications = Publication.order(:year)\n \n respond_to do |format|\n format.html\n format.json { render json: @publications.tokens(params[:q]) }\n end\n \n end",
"def show_selected_glossary_terms(query, args = {})\n includes = @user ? { thumb_image: :image_votes } : :thumb_image\n args = {\n action: :index,\n letters: \"glossary_terms.name\",\n num_per_page: 50,\n include: includes\n }.merge(args)\n\n show_index_of_objects(query, args)\n end",
"def values\n render :json => gen_slugs(params[:term].upcase)\n end",
"def index\n authors = Author.where('name LIKE ?', \"%#{params['term']}%\").order(:name)\n authors = authors.map { |e| { id: e.id, value: e.name } }\n authors << { id: -1, value: TOO_MANY_MESSAGE } if authors.size >= TOO_MANY\n render json: authors\n end",
"def search_terms(resource)\n return nil unless resources.include? resource\n @data[resource][0].keys\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def secondary_terms\n [:creator,\n :contributor,\n :keyword,\n :license,\n :publisher,\n :date_created,\n :subject,\n :language,\n :identifier,\n :based_near,\n :campus,\n :related_url,\n :resource_type]\n end",
"def index\n @terms = Term.where(:user_id => session[:user_id])\n end",
"def terms\n raise NotImplementedError\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end",
"def terms\n redirect_to '/404' unless Rails.configuration.terms\n\n if params[:accept] == \"true\"\n current_user.update_attributes(accepted_terms: true)\n login(current_user)\n end\n end",
"def index\n log_header\n\n @terms_and_conditions = case params[:query].blank?\n when false\n TermsAndCondition\n .where(\"terms_and_conditions ILIKE ? \", \"%#{params[:query]}%\")\n .order(:created_at)\n .page params[:page]\n when true\n TermsAndCondition\n .order(created_at: :desc)\n .page params[:page]\n end\n\n respond_to do |format|\n format.html {}\n format.js { render json: @terms_and_conditions.to_json }\n format.json { render json: @terms_and_conditions.to_json }\n end\n\n end",
"def secondary_terms\n []\n end",
"def index\n @term_relationships = TermRelationship.all\n end",
"def new\n @privacy_term = PrivacyTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @privacy_term }\n end\n end",
"def characterization_terms(doc)\n h = {}\n\n doc.class.terminology.terms.each_pair do |key, _target|\n h[key] = doc.public_send(key)\n rescue NoMethodError\n next\n end\n\n h.compact\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def characterization_terms(omdoc)\n h = {}\n omdoc.class.terminology.terms.each_pair do |key, target|\n # a key is a proxy if its target responds to proxied_term\n next unless target.respond_to? :proxied_term\n begin\n h[key] = omdoc.send(key)\n rescue NoMethodError\n next\n end\n end\n h.delete_if { |_k, v| v.empty? }\n end",
"def show\n term = @authority.find(params[:id])\n render json: term\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend",
"def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def get_taxonomies(options = {})\n get \"/api/taxonomies\", options\n end",
"def destroy\n @people_term.destroy\n respond_to do |format|\n format.html { redirect_to people_terms_url, notice: 'People term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n authorize! :read, Person\n\n if params[:q]\n @items = Person.like(params[:q]).alpha.with_orgs\n respond_to do |format|\n format.json {\n @data = { captions: @items.map { |p| p.complete_name_with_org } }\n render json: @data\n }\n end\n else\n respond_to do |format|\n format.html\n format.js\n format.json { render json: PeopleDatatable.new(view_context, @organisation) }\n end\n end\n\n end",
"def terms_id\n parse_terms_id_response(SolrQuery.new.solr_query(q='rdftype_tesim:\"http://www.w3.org/2004/02/skos/core#ConceptScheme\" AND preflabel_tesim:\"places\"'))\n end",
"def search_people(term, start_index=0, max_results=25)\n get_object_list \"People\", get(\"catalog/people\", {term: term, start_index: start_index, max_results: max_results})\n end",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def index\n authorize!(:index,@user) unless @user.has_access?('Terms of Engagement')\n @termcondition = @matter.matter_termcondition || @matter.build_matter_termcondition\n @pagenumber=139\n add_breadcrumb t(:text_terms_of_engagement), matter_matter_termconditions_path(@matter)\n end",
"def addresss\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['schoolType']) if @data['schoolType']\n end",
"def index\n #@registrations = Registration.where(batches_id: @batch.id, terms_id:@term.id)\n @terms = Term.all\n end",
"def index\n @common_terms = CommonTerm.all\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def doctors_and_cities\n cities_dict, doctor_dict = current_user.dictionaries.where(resource_type: [\"Doctors\", \"Cities\"])\n render json: {doctors: doctor_dict.words.select(:id, :body),\n cities: cities_dict.words.select(:id, :body)}\n end",
"def terms_for_editing\n terms_for_display\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def create\n @errors = []\n term_prms = term_params\n validate_new_term_params(term_prms)\n\n unless @errors.present?\n\n type = term_prms.delete('type')\n term_opts = flat_term_data_to_term_opts(term_prms)\n\n begin\n @term = UriService.client.create_term(type, term_opts)\n rescue UriService::NonExistentVocabularyError, UriService::InvalidUriError, UriService::ExistingUriError, UriService::InvalidAdditionalFieldKeyError, UriService::InvalidOptsError => e\n @errors << e.message\n end\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully created.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def show\n @go_term_enrichment = GoTermEnrichment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term_enrichment }\n end\n end",
"def terms\n @data.flatten.uniq\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def index\n if params[:terms]\n # Search mode\n @organizations = []\n JSON.parse(params[:terms]).map { |t| @organizations = @organizations | MnoEnterprise::Organization.where(Hash[*t]).fetch }\n response.headers['X-Total-Count'] = @organizations.count\n else\n # Index mode\n query = MnoEnterprise::Organization\n query = query.limit(params[:limit]) if params[:limit]\n query = query.skip(params[:offset]) if params[:offset]\n query = query.order_by(params[:order_by]) if params[:order_by]\n query = query.where(params[:where]) if params[:where]\n all = query.all\n\n all.params[:sub_tenant_id] = params[:sub_tenant_id]\n all.params[:account_manager_id] = params[:account_manager_id]\n\n @organizations = all.fetch\n\n response.headers['X-Total-Count'] = @organizations.metadata[:pagination][:count]\n end\n end",
"def search_people(query)\n get(\"/v1/search/people\", query: query)\n end",
"def terms_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_post ...'\n end\n # resource path\n local_var_path = '/terms'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['version'] = opts[:'version'] if !opts[:'version'].nil?\n form_params['file_content'] = opts[:'file_content'] if !opts[:'file_content'].nil?\n form_params['language'] = opts[:'language'] if !opts[:'language'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'TermsOfService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def terms_post(opts = {})\n data, _status_code, _headers = terms_post_with_http_info(opts)\n data\n end",
"def secondary_terms\n [:gw_affiliation, :date_created,\n :description, :keyword,\n :identifier, :contributor, :publisher, :language,\n :based_near, :related_url, :bibliographic_citation]\n end",
"def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def index\n @term_item_terms = TermItemTerm.all\n end",
"def get(lang, term)\n query = \"#{lang}/#{term}\"\n @response = @conn.get query\n @response.body\n end",
"def authorize_term(field, term)\n authorized_terms = []\n if field.include?(\"_facet\") or field.include?(\"_display\")\n authorized_terms << check_term(field.split(\"_\")[0], term) # the .split is b/c \"originator_display\" would be under the \"originator\" values in the yaml file\n else\n authorized_terms << term\n authorized_terms << check_term(field.split(\"_\")[0], term)\n end\n \n return authorized_terms.uniq\n \n end",
"def lookup(terms = {})\n # Format the CWID if that's what we're getting.\n if terms[:cwid]\n terms = format(terms.values.first)\n else\n terms = terms.values.first\n end\n\n # Make the request to the LDAP server\n req = self.connection.get do |r|\n r.url self.configuration.search_path + terms\n end\n\n # Return nil if there's a nil directory return\n if req.body['directory'].nil?\n return []\n end\n\n # Return nil if there aren't any results\n if req.body['directory'] && (req.body['directory'].empty? || req.body['directory'].nil?)\n return []\n\n # Otherwise, create a new Person out of it\n else\n results = []\n\n if req.body['directory']['person'].is_a?(Hash)\n results << Person.new(req.body['directory']['person'])\n else\n req.body['directory']['person'].each do |r|\n results << Person.new(r)\n end\n end\n\n return results\n end\n end",
"def get_citations(word, *args)\n http_method = :get\n path = '/word/{word}/citations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n if params[:term]\n @partners = Partner.scoped.order(:name).where(\"name ILIKE ?\", \"%#{params[:term]}%\")\n else\n @partners = Partner.scoped\n end\n @partner = Partner.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners.map(&:name) }\n end\n end"
] |
[
"0.74198216",
"0.7407318",
"0.72203463",
"0.6823552",
"0.6808383",
"0.67874205",
"0.66972584",
"0.66972584",
"0.6629937",
"0.6517631",
"0.63403815",
"0.6292339",
"0.6215613",
"0.6193557",
"0.6173762",
"0.6170125",
"0.6159998",
"0.61411494",
"0.61262155",
"0.6075106",
"0.6066209",
"0.6065729",
"0.6033929",
"0.60190886",
"0.6000668",
"0.5975668",
"0.59726554",
"0.5943249",
"0.5929665",
"0.5908822",
"0.59021467",
"0.58919495",
"0.5876527",
"0.5866003",
"0.5848841",
"0.584397",
"0.5842434",
"0.584199",
"0.5806458",
"0.5793709",
"0.5792574",
"0.57864",
"0.57687014",
"0.57192266",
"0.5716658",
"0.5706155",
"0.5700482",
"0.56987876",
"0.56936336",
"0.5692387",
"0.56892395",
"0.5684793",
"0.5671564",
"0.56613904",
"0.5655385",
"0.56519365",
"0.5646042",
"0.5641145",
"0.5617192",
"0.56015044",
"0.56015044",
"0.56015044",
"0.5574024",
"0.557394",
"0.55734146",
"0.5571492",
"0.5554861",
"0.554079",
"0.55403876",
"0.5524091",
"0.5517639",
"0.5514915",
"0.5513629",
"0.55090374",
"0.5506718",
"0.5501488",
"0.5489646",
"0.54790545",
"0.5473272",
"0.54660815",
"0.5462538",
"0.5455131",
"0.54387456",
"0.54360145",
"0.54025936",
"0.53928757",
"0.5384058",
"0.53816384",
"0.5379276",
"0.53760237",
"0.5375436",
"0.5375103",
"0.5374581",
"0.5364521",
"0.5357679",
"0.5349702",
"0.53445214",
"0.5343006",
"0.5327516",
"0.5310483"
] |
0.6617918
|
9
|
GET /people_terms/1 GET /people_terms/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end",
"def get_terms(params)\n send_get \"get_terms\", params\n end",
"def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end",
"def index\n @people_terms = PeopleTerm.where([\"person_id = ?\", params[:person_id]]).includes(:term).order(\"terms.start_date\")\n end",
"def show\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def show\n @privacy_term = PrivacyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @privacy_term }\n end\n end",
"def show\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term }\n end\n end",
"def terms_get(opts = {})\n data, _status_code, _headers = terms_get_with_http_info(opts)\n data\n end",
"def terms\n\n end",
"def terms\n\n end",
"def create\n @people_term = PeopleTerm.new(people_term_params)\n\n respond_to do |format|\n if @people_term.save\n format.html { redirect_to @people_term, notice: 'People term was successfully created.' }\n format.json { render :show, status: :created, location: @people_term }\n else\n format.html { render :new }\n format.json { render json: @people_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms\n end",
"def terms_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_get ...'\n end\n # resource path\n local_var_path = '/terms'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20021')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def people_term_params\n params.require(:people_term).permit(:person_id, :term_id)\n end",
"def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"def new\n @terms_of_use = TermsOfUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def new\n @resource = Resource.new\n @terms = Term.all_iit_subjects\n @iit_terms = Term.all_iit_subjects\n @non_iit_terms = Term.all_iit_non_subjects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @privacy_term = PrivacyTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @privacy_term }\n end\n end",
"def glossary_terms_list_with_http_info(account_id, glossary_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_terms_list ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<GlossaryTerm>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_terms_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def set_people_term\n @people_term = PeopleTerm.find(params[:id])\n end",
"def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end",
"def terms\n\tend",
"def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def index\n @terms_of_services = TermsOfService.all\n end",
"def show\n term = @authority.find(params[:id])\n render json: term\n end",
"def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n \n @locations = apply_scopes(@taxonomy_term.locations).uniq().page(params[:page]).per(params[:per_page])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def get_terms(retina_name=nil, term=nil, get_fingerprint=nil, start_index=0, max_results=10)\n resource_path = '/terms'\n verb = 'GET'\n query_params = { 'retina_name' => retina_name, 'term' => term, 'start_index' => start_index,\n 'max_results' => max_results, 'get_fingerprint' => get_fingerprint }\n post_data = nil\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n JSON.parse(response.body, symbolize_names: true).map { |r| RetinaSDK::Model::Term.new(r) }\n end",
"def search\n\n # extract the terms from params\n terms = params[:search_terms]\n\n # redirect to root in case of missing terms\n redirect_to root_path && return if terms.blank?\n\n # extract the terms to an array\n # delete('-') because phones are saved without '-' (numbers only)\n terms_array = params[:search_terms].delete('-').split(' ')\n\n # extract the params using private methods\n age = age_param(terms_array)\n phone = phone_param(terms_array)\n names_array = name_param_array(terms)\n\n # find the people available for the search terms\n @peoples = People.search_by_terms(names_array, phone, age)\n\n # renders 'search.js'\n end",
"def profile_specialist_search\n\t\t# search the the speciality name according to the terms\n\t\tspecialities = Speciality.any_of({ :name => /^#{params[:term]}/i }).all.collect{|speciality| {label: speciality.name ,value: speciality.id.to_s}}.to_json \n\t\t# render to the surgery name page\n\t\trespond_to do |format|\n\t\t format.json { render :json => specialities }\n\t\tend\n\tend",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def add_terms(params)\n send_get \"add_terms\", params\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def show\n @go_term_enrichment = GoTermEnrichment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term_enrichment }\n end\n end",
"def index\n render json: Term.roots\n .includes(:user)\n .map(&:serialize_list),\n status: :ok\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"def index\n @publications = Publication.order(:year)\n \n respond_to do |format|\n format.html\n format.json { render json: @publications.tokens(params[:q]) }\n end\n \n end",
"def terms_agreement\n # @user instantiated by authentication before filter and matched to current user\n if request.post? && params[:commit_agreed]\n alter_current_user do |user|\n user.agreed_with_terms = true\n end\n redirect_back_or_default(user_path(current_user))\n else\n # FIXME: is this the right content for terms agreement and the right call for it?\n # FIXME: this seems flakey, do we have unique machine names for content rather than page name?\n page = ContentPage.find_by_page_name('Terms Of Use')\n @terms = TranslatedContentPage.find_by_content_page_id_and_language_id(page, @user.language_id) unless page.nil?\n end\n end",
"def index\n @terms = Term.all\n end",
"def terms\n @title = \"community terms\"\n end",
"def terms\n @terms ||= Net::HTTP.get(\"rafb.net\", \"/paste/terms.html\")\n # return text inside the div with class \"content_body\", without HTML tags.\n @terms[%r{<div class=\"content_body\">.*?</div>}m].gsub(%r{<.*?>}m, \"\").strip\n end",
"def destroy\n @people_term.destroy\n respond_to do |format|\n format.html { redirect_to people_terms_url, notice: 'People term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @go_term_enrichment = GoTermEnrichment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term_enrichment }\n end\n end",
"def new\n @jc_term = JcTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @jc_term }\n end\n end",
"def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def index\n authors = Author.where('name LIKE ?', \"%#{params['term']}%\").order(:name)\n authors = authors.map { |e| { id: e.id, value: e.name } }\n authors << { id: -1, value: TOO_MANY_MESSAGE } if authors.size >= TOO_MANY\n render json: authors\n end",
"def terms\n [self]\n end",
"def terms_id\n parse_terms_id_response(SolrQuery.new.solr_query(q='rdftype_tesim:\"http://www.w3.org/2004/02/skos/core#ConceptScheme\" AND preflabel_tesim:\"places\"'))\n end",
"def create\n @errors = []\n term_prms = term_params\n validate_new_term_params(term_prms)\n\n unless @errors.present?\n\n type = term_prms.delete('type')\n term_opts = flat_term_data_to_term_opts(term_prms)\n\n begin\n @term = UriService.client.create_term(type, term_opts)\n rescue UriService::NonExistentVocabularyError, UriService::InvalidUriError, UriService::ExistingUriError, UriService::InvalidAdditionalFieldKeyError, UriService::InvalidOptsError => e\n @errors << e.message\n end\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully created.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def index\n log_header\n\n @terms_and_conditions = case params[:query].blank?\n when false\n TermsAndCondition\n .where(\"terms_and_conditions ILIKE ? \", \"%#{params[:query]}%\")\n .order(:created_at)\n .page params[:page]\n when true\n TermsAndCondition\n .order(created_at: :desc)\n .page params[:page]\n end\n\n respond_to do |format|\n format.html {}\n format.js { render json: @terms_and_conditions.to_json }\n format.json { render json: @terms_and_conditions.to_json }\n end\n\n end",
"def index\n @terms = Term.where(:user_id => session[:user_id])\n end",
"def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end",
"def terms(attributes = nil)\r\n field = attributes.keys.first\r\n query = { field => attributes.values.flatten }\r\n\r\n body = { query: { terms: query } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end",
"def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end",
"def index\n @term_relationships = TermRelationship.all\n end",
"def terms\n @term_hash.values\n end",
"def values\n render :json => gen_slugs(params[:term].upcase)\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def index\n #@registrations = Registration.where(batches_id: @batch.id, terms_id:@term.id)\n @terms = Term.all\n end",
"def create\n @term = Term.new(term_params)\n\n if @term.save\n render :show, status: :created, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end",
"def index\n authorize! :read, Person\n\n if params[:q]\n @items = Person.like(params[:q]).alpha.with_orgs\n respond_to do |format|\n format.json {\n @data = { captions: @items.map { |p| p.complete_name_with_org } }\n render json: @data\n }\n end\n else\n respond_to do |format|\n format.html\n format.js\n format.json { render json: PeopleDatatable.new(view_context, @organisation) }\n end\n end\n\n end",
"def create\n @privacy_term = PrivacyTerm.new(params[:privacy_term])\n\n respond_to do |format|\n if @privacy_term.save\n format.html { redirect_to @privacy_term, notice: 'Privacy term was successfully created.' }\n format.json { render json: @privacy_term, status: :created, location: @privacy_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @privacy_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @term_count }\n end\n end",
"def new\n @person = Person.new\n @companies = Company.pluck(:name)\n\n authorize! :create, Person\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def index # rubocop:disable Metrics/MethodLength\n fake_data = {\n data: [\n {\n max_terms: 0,\n min_terms: 0,\n max_amount: '0',\n min_amount: '0',\n interest_rate: '0',\n default_amount: '0',\n default_terms: 0,\n id: 2\n }\n ],\n meta: { current_page: 1, from: 0, last_page: 0, per_page: 0, to: 0, total: 1 }\n }\n\n render json: fake_data\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def addresss\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['schoolType']) if @data['schoolType']\n end",
"def terms\n redirect_to '/404' unless Rails.configuration.terms\n\n if params[:accept] == \"true\"\n current_user.update_attributes(accepted_terms: true)\n login(current_user)\n end\n end",
"def update\n respond_to do |format|\n if @people_term.update(people_term_params)\n format.html { redirect_to @people_term, notice: 'People term was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_term }\n else\n format.html { render :edit }\n format.json { render json: @people_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glossary_term_show_with_http_info(account_id, glossary_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_show ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling GlossaryTermsApi.glossary_term_show\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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] || 'GlossaryTerm' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_term_show\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def term_list(terms)\n ignored = params.keys - ['q', 'solr_document_id', 'action', 'controller']\n list_id = request.original_url\n term_list = IIIF::Presentation::Resource.new('@id' => list_id)\n term_list['@context'] = 'http://iiif.io/api/search/1/context.json'\n term_list['@type'] = 'search:TermList'\n term_list['terms'] = terms\n term_list['ignored'] = ignored\n term_list.to_ordered_hash(force: true, include_context: false)\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def index\n @common_terms = CommonTerm.all\n end",
"def show_selected_glossary_terms(query, args = {})\n includes = @user ? { thumb_image: :image_votes } : :thumb_image\n args = {\n action: :index,\n letters: \"glossary_terms.name\",\n num_per_page: 50,\n include: includes\n }.merge(args)\n\n show_index_of_objects(query, args)\n end",
"def terms_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_post ...'\n end\n # resource path\n local_var_path = '/terms'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['version'] = opts[:'version'] if !opts[:'version'].nil?\n form_params['file_content'] = opts[:'file_content'] if !opts[:'file_content'].nil?\n form_params['language'] = opts[:'language'] if !opts[:'language'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'TermsOfService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @terms_of_use = TermsOfUse.new(params[:terms_of_use])\n\n respond_to do |format|\n if @terms_of_use.save\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully created.' }\n format.json { render json: @terms_of_use, status: :created, location: @terms_of_use }\n else\n format.html { render action: \"new\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_param_terms\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tp['terms']\n\t\tend",
"def create\n @terms_of_service = TermsOfService.new(terms_of_service_params)\n\n respond_to do |format|\n if @terms_of_service.save\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully created.' }\n format.json { render :show, status: :created, location: @terms_of_service }\n else\n format.html { render :new }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @taxonomy = Taxonomy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy }\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def show\n @corpus = Corpus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus }\n end\n end",
"def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def get(lang, term)\n query = \"#{lang}/#{term}\"\n @response = @conn.get query\n @response.body\n end",
"def terms\n raise NotImplementedError\n end",
"def doctors_and_cities\n cities_dict, doctor_dict = current_user.dictionaries.where(resource_type: [\"Doctors\", \"Cities\"])\n render json: {doctors: doctor_dict.words.select(:id, :body),\n cities: cities_dict.words.select(:id, :body)}\n end",
"def create\n @go_term = GoTerm.new(params[:go_term])\n\n respond_to do |format|\n if @go_term.save\n format.html { redirect_to @go_term, notice: 'Go term was successfully created.' }\n format.json { render json: @go_term, status: :created, location: @go_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize!(:index,@user) unless @user.has_access?('Terms of Engagement')\n @termcondition = @matter.matter_termcondition || @matter.build_matter_termcondition\n @pagenumber=139\n add_breadcrumb t(:text_terms_of_engagement), matter_matter_termconditions_path(@matter)\n end",
"def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end",
"def destroy\n @privacy_term = PrivacyTerm.find(params[:id])\n @privacy_term.destroy\n\n respond_to do |format|\n format.html { redirect_to privacy_terms_url }\n format.json { head :no_content }\n end\n end",
"def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end",
"def show\n set_glossary_locale(params[:locale]) if params[:locale]\n\n respond_to do |format|\n format.html {\n redirect_to glossary_terms_path(params[:id])\n }\n format.json {\n @glossary = Glossary.find(params[:id]).prepare_for_display\n render json: @glossary\n }\n end\n end",
"def index\n \tif params[:term]\n \t @v1_forms = V1::Form.search(params[:term]).order(\"visits_count ASC\")\n \telse\n \t @v1_forms = V1::Form.all.order(\"created_at DESC\")\n \tend\n render json: @v1_forms, include: :category\n end",
"def search_people(query)\n get(\"/v1/search/people\", query: query)\n end"
] |
[
"0.75297713",
"0.69020295",
"0.682894",
"0.6803114",
"0.6532857",
"0.6385775",
"0.63797885",
"0.6341279",
"0.6336117",
"0.6296439",
"0.62776375",
"0.626525",
"0.626525",
"0.6250787",
"0.6203944",
"0.6170367",
"0.60844034",
"0.6066779",
"0.6060079",
"0.60503614",
"0.6045771",
"0.60259604",
"0.6003156",
"0.59693897",
"0.59618217",
"0.5945023",
"0.5925923",
"0.59060127",
"0.58875024",
"0.5883429",
"0.584406",
"0.58328253",
"0.580983",
"0.580369",
"0.5773292",
"0.5769959",
"0.5769854",
"0.5714341",
"0.5713246",
"0.56517404",
"0.5642964",
"0.56355923",
"0.5630631",
"0.5624302",
"0.55997616",
"0.5592448",
"0.5580865",
"0.55731046",
"0.5571303",
"0.55687726",
"0.5565618",
"0.5563199",
"0.5539387",
"0.5531321",
"0.5527099",
"0.5519027",
"0.5507622",
"0.5492261",
"0.54911745",
"0.5477668",
"0.5455444",
"0.5452718",
"0.54297376",
"0.5427546",
"0.54266924",
"0.54227626",
"0.54204506",
"0.54056716",
"0.5400778",
"0.53920877",
"0.53914803",
"0.5377168",
"0.53749615",
"0.53675175",
"0.53603745",
"0.53511286",
"0.53486466",
"0.5341867",
"0.53394675",
"0.5329963",
"0.5325559",
"0.53163314",
"0.5306169",
"0.5295685",
"0.5294889",
"0.52881014",
"0.5272929",
"0.52729166",
"0.52679354",
"0.52678305",
"0.52644056",
"0.5262472",
"0.5260645",
"0.5258683",
"0.5257611",
"0.5251876",
"0.52512634",
"0.5250969",
"0.52491397",
"0.52468926",
"0.5245184"
] |
0.0
|
-1
|
POST /people_terms POST /people_terms.json
|
def create
@people_term = PeopleTerm.new(people_term_params)
respond_to do |format|
if @people_term.save
format.html { redirect_to @people_term, notice: 'People term was successfully created.' }
format.json { render :show, status: :created, location: @people_term }
else
format.html { render :new }
format.json { render json: @people_term.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_terms(params)\n send_get \"add_terms\", params\n end",
"def terms_post(opts = {})\n data, _status_code, _headers = terms_post_with_http_info(opts)\n data\n end",
"def people_term_params\n params.require(:people_term).permit(:person_id, :term_id)\n end",
"def create\n @privacy_term = PrivacyTerm.new(params[:privacy_term])\n\n respond_to do |format|\n if @privacy_term.save\n format.html { redirect_to @privacy_term, notice: 'Privacy term was successfully created.' }\n format.json { render json: @privacy_term, status: :created, location: @privacy_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @privacy_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @errors = []\n term_prms = term_params\n validate_new_term_params(term_prms)\n\n unless @errors.present?\n\n type = term_prms.delete('type')\n term_opts = flat_term_data_to_term_opts(term_prms)\n\n begin\n @term = UriService.client.create_term(type, term_opts)\n rescue UriService::NonExistentVocabularyError, UriService::InvalidUriError, UriService::ExistingUriError, UriService::InvalidAdditionalFieldKeyError, UriService::InvalidOptsError => e\n @errors << e.message\n end\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully created.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def create\n @terms_of_use = TermsOfUse.new(params[:terms_of_use])\n\n respond_to do |format|\n if @terms_of_use.save\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully created.' }\n format.json { render json: @terms_of_use, status: :created, location: @terms_of_use }\n else\n format.html { render action: \"new\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @go_term = GoTerm.new(params[:go_term])\n\n respond_to do |format|\n if @go_term.save\n format.html { redirect_to @go_term, notice: 'Go term was successfully created.' }\n format.json { render json: @go_term, status: :created, location: @go_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms\n\n end",
"def terms\n\n end",
"def create\n @term = Term.new(term_params)\n\n if @term.save\n render :show, status: :created, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end",
"def create\n @terms_of_service = TermsOfService.new(terms_of_service_params)\n\n respond_to do |format|\n if @terms_of_service.save\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully created.' }\n format.json { render :show, status: :created, location: @terms_of_service }\n else\n format.html { render :new }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_post ...'\n end\n # resource path\n local_var_path = '/terms'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['version'] = opts[:'version'] if !opts[:'version'].nil?\n form_params['file_content'] = opts[:'file_content'] if !opts[:'file_content'].nil?\n form_params['language'] = opts[:'language'] if !opts[:'language'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'TermsOfService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def terms\n end",
"def get_terms(params)\n send_get \"get_terms\", params\n end",
"def create\n @term = @vocabulary.vocabulary_terms.build(term_params)\n authorize @term, policy_class: VocabularyPolicy\n begin\n @term.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @term.errors.any? ? @term : e },\n status: :bad_request\n else\n toast!(title: \"Term created\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been created.\")\n render \"shared/reload\"\n end\n end",
"def create\n @terms_and_condition = TermsAndCondition.new(terms_and_conditions_params)\n\n respond_to do |format|\n if @terms_and_condition.save\n format.html { redirect_to admin_terms_and_conditions_path, notice: 'terms_and_condition was succesfully created.' }\n format.json { render :show, status: :created, location: @terms_and_condition }\n else\n format.html { render :new }\n format.json { render json: @terms_and_condition.errors, status: :unprocesable_entity }\n end\n end\n end",
"def term_params\n params.require(:term).permit(:name)\n end",
"def terms_agreement\n # @user instantiated by authentication before filter and matched to current user\n if request.post? && params[:commit_agreed]\n alter_current_user do |user|\n user.agreed_with_terms = true\n end\n redirect_back_or_default(user_path(current_user))\n else\n # FIXME: is this the right content for terms agreement and the right call for it?\n # FIXME: this seems flakey, do we have unique machine names for content rather than page name?\n page = ContentPage.find_by_page_name('Terms Of Use')\n @terms = TranslatedContentPage.find_by_content_page_id_and_language_id(page, @user.language_id) unless page.nil?\n end\n end",
"def create\n @vocabulary_term = VocabularyTerm.new(vocabulary_term_params)\n\n respond_to do |format|\n if @vocabulary_term.save\n format.html { redirect_to @vocabulary_term, notice: 'Vocabulary term was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary_term }\n else\n format.html { render :new }\n format.json { render json: @vocabulary_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @term_relationship = TermRelationship.new(term_relationship_params)\n\n respond_to do |format|\n if @term_relationship.save\n format.html { redirect_to @term_relationship, notice: 'Term relationship was successfully created.' }\n format.json { render :show, status: :created, location: @term_relationship }\n else\n format.html { render :new }\n format.json { render json: @term_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms\n redirect_to '/404' unless Rails.configuration.terms\n\n if params[:accept] == \"true\"\n current_user.update_attributes(accepted_terms: true)\n login(current_user)\n end\n end",
"def create\n @admin_term = Admin::Term.new(admin_term_params)\n\n respond_to do |format|\n if @admin_term.save\n format.html { redirect_to @admin_term, notice: 'Term was successfully created.' }\n format.json { render :show, status: :created, location: @admin_term }\n else\n format.html { render :new }\n format.json { render json: @admin_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms\n\tend",
"def terms_of_service_params\n params.require(:terms_of_service).permit(:store_name, :terms)\n end",
"def term_params\n params.require(:term).permit(:name, :starts_on, :ends_on, :school_id)\n end",
"def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n flash[:notice] = 'Term was successfully created.'\n format.html { redirect_to(terms_url) }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @term = Term.new(term_params)\n raise \"nope\" unless term.user_id == session[:user_id]\n\n respond_to do |format|\n if @term.save\n format.html { redirect_to @term, notice: 'Term was successfully created.' }\n format.json { render :show, status: :created, location: @term }\n else\n format.html { render :new }\n format.json { render json: @term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def enter_terms(test_data)\n test_terms = test_data[Org::ORG_TERM_GRP.name]\n prep_fieldsets_for_test_data([fieldset(Org::ORG_TERM_GRP.name)], test_terms)\n scroll_to_top\n test_terms.each_with_index do |test_term, index|\n enter_org_display_name(test_term[Org::TERM_DISPLAY_NAME.name], index)\n wait_for_element_and_type(org_term_name_input(index), test_term[Org::TERM_NAME.name])\n wait_for_element_and_type(org_term_qualifier_input(index), test_term[Org::TERM_QUALIFIER.name])\n wait_for_options_and_select(org_term_status_input(index), org_term_status_options(index), test_term[Org::TERM_STATUS.name])\n wait_for_options_and_select(org_term_type_input(index), org_term_type_options(index), test_term[Org::TERM_TYPE.name])\n wait_for_options_and_select(org_term_flag_input(index), org_term_flag_options(index), test_term[Org::TERM_FLAG.name])\n wait_for_options_and_select(org_term_language_input(index), org_term_language_options(index), test_term[Org::TERM_LANGUAGE.name])\n wait_for_element_and_click org_term_pref_for_lang_input(index) if test_term[Org::TERM_PREF_FOR_LANGUAGE.name]\n wait_for_element_and_type(main_body_name_input(index), test_term[Org::MAIN_BODY_NAME.name])\n wait_for_element_and_type(addition_to_name_input(index), test_term[Org::ADDITIONS_TO_NAME.name])\n enter_auto_complete(org_term_source_name_input(index), org_term_source_name_options(index), test_term[Org::TERM_SOURCE.name], 'Local Citations')\n wait_for_element_and_type(org_term_source_detail_input(index), test_term[Org::TERM_SOURCE_DETAIL.name])\n wait_for_element_and_type(org_term_source_id_input(index), test_term[Org::TERM_SOURCE_ID.name])\n wait_for_element_and_type(org_term_source_note_input(index), test_term[Org::TERM_SOURCE_NOTE.name])\n end\n end",
"def create\n @jc_term = JcTerm.new(params[:jc_term])\n\n respond_to do |format|\n if @jc_term.save\n format.html { redirect_to @jc_term, :notice => 'JC term was successfully created.' }\n format.json { render :json => @jc_term, :status => :created, :location => @jc_term }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @jc_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def terms_id_term_post_with_http_info(id_term, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_id_term_post ...'\n end\n # verify the required parameter 'id_term' is set\n if @api_client.config.client_side_validation && id_term.nil?\n fail ArgumentError, \"Missing the required parameter 'id_term' when calling TermsApi.terms_id_term_post\"\n end\n # resource path\n local_var_path = '/terms/{id_term}'.sub('{' + 'id_term' + '}', id_term.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['language'] = opts[:'language'] if !opts[:'language'].nil?\n form_params['file_content'] = opts[:'file_content'] if !opts[:'file_content'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'TermsOfService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_id_term_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n format.html { redirect_to(@term, :notice => 'Term was successfully created.') }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @common_term = CommonTerm.new(common_term_params)\n\n respond_to do |format|\n if @common_term.save\n format.html { redirect_to @common_term, notice: 'Common term was successfully created.' }\n format.json { render :show, status: :created, location: @common_term }\n else\n format.html { render :new }\n format.json { render json: @common_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_people_term\n @people_term = PeopleTerm.find(params[:id])\n end",
"def create\n @go_term_enrichment = GoTermEnrichment.new(params[:go_term_enrichment])\n\n respond_to do |format|\n if @go_term_enrichment.save\n format.html { redirect_to @go_term_enrichment, notice: 'Go term enrichment was successfully created.' }\n format.json { render json: @go_term_enrichment, status: :created, location: @go_term_enrichment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_term_enrichment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Resource.new(params[:resource])\n @terms = Term.all_iit_subjects\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_param_terms\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tp['terms']\n\t\tend",
"def create\n @neglected_term = NeglectedTerm.new(neglected_term_params)\n\n respond_to do |format|\n if @neglected_term.save\n format.html { redirect_to @neglected_term, notice: 'Neglected term was successfully created.' }\n format.json { render :show, status: :created, location: @neglected_term }\n else\n format.html { render :new }\n format.json { render json: @neglected_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxonomy_term = TaxonomyTerm.new(params[:taxonomy_term])\n\n respond_to do |format|\n if @taxonomy_term.save\n format.html { redirect_to admin_taxonomy_term_path(@taxonomy_term), notice: 'Taxonomy term was successfully created.' }\n format.json { render json: @taxonomy_term, status: :created, location: @taxonomy_term }\n else\n \tset_site_entities @taxonomy_term\n \t\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def glossary_term_create_with_http_info(account_id, glossary_id, glossary_term_create_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_term_create ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_term_create\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_term_create\"\n end\n # verify the required parameter 'glossary_term_create_parameters' is set\n if @api_client.config.client_side_validation && glossary_term_create_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_term_create_parameters' when calling GlossaryTermsApi.glossary_term_create\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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(glossary_term_create_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'GlossaryTerm' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_term_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def destroy\n @people_term.destroy\n respond_to do |format|\n format.html { redirect_to people_terms_url, notice: 'People term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @privacy_term = PrivacyTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @privacy_term }\n end\n end",
"def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def new\n @terms_of_use = TermsOfUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def terms\n @title = \"community terms\"\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 @term_item_term = TermItemTerm.new(term_item_term_params)\n\n respond_to do |format|\n if @term_item_term.save\n format.html { redirect_to @term_item_term, notice: 'Term item term was successfully created.' }\n format.json { render :show, status: :created, location: @term_item_term }\n else\n format.html { render :new }\n format.json { render json: @term_item_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def term_relationship_params\n params.require(:term_relationship).permit(:term_taxonomy_id, :term_order)\n end",
"def term_params\n if TERM_ADDITIONAL_FIELDS[params[:term]['controlled_vocabulary_string_key']].blank?\n addl_term_params = []\n else\n addl_term_params = TERM_ADDITIONAL_FIELDS[params[:term]['controlled_vocabulary_string_key']].map { |key, _value| key.to_sym }\n end\n params.require(:term).permit([:controlled_vocabulary_string_key, :value, :uri, :type, :authority] + addl_term_params)\n end",
"def create\n @term = Term.where(:name=>params[:term])\n if not @term\n @term = Term.new(params[:term])\n if @term.save\n redirect_to(@term, :notice => 'Term was successfully created.')\n else\n render :action => \"new\"\n end\n\n else\n logger.debug \"term name #{@term.name}\"\n redirect_to(@term, :notice=>'Term already exists')\n end\n \n end",
"def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end",
"def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end",
"def sanskrit_term_params\n params.require(:sanskrit_term).permit(:term, :definition)\n end",
"def test_create\n user = login\n params = create_term_params\n\n assert_no_difference(\"Image.count\") do\n post(:create, params: params)\n end\n\n term = GlossaryTerm.last\n assert_equal(params[:glossary_term][:name], term.name)\n assert_equal(params[:glossary_term][:description], term.description)\n assert_not_nil(term.rss_log)\n assert_equal(user.id, term.user_id)\n assert_response(:redirect)\n end",
"def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end",
"def characterization_terms(doc)\n h = {}\n\n doc.class.terminology.terms.each_pair do |key, _target|\n h[key] = doc.public_send(key)\n rescue NoMethodError\n next\n end\n\n h.compact\n end",
"def add_document_terms(terms)\n\t\t\tterms.each_key do |term|\n\t\t\t\t@term_hash[term] = @term_hash[term] + 1\n\t\t\tend\n\t\tend",
"def terms\n [self]\n end",
"def patent_search_params\n params.require(:patent_search).permit(:terms, :fields)\n end",
"def term_params\n params.require(:term).permit(:user_id, :name, :value_float)\n end",
"def create\n @high_level_group_term = HighLevelGroupTerm.new(high_level_group_term_params)\n\n respond_to do |format|\n if @high_level_group_term.save\n format.html { redirect_to @high_level_group_term, notice: 'High level group term was successfully created.' }\n format.json { render :show, status: :created, location: @high_level_group_term }\n else\n format.html { render :new }\n format.json { render json: @high_level_group_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n searchterm = current_user.searches.new(:search_term=>params[:searchterm],:type=>\"case\")\n # check condition for searchterm is saved or not.\n if searchterm.save\n # response to the JSON\n render json: { success: true,message: \"Search Term Successfully Created.\", response: searchterm.as_json('search') },:status=>200\n else\n render :json=> { success: false, message: searchterm.errors },:status=> 203\n end\n end",
"def new\n @resource = Resource.new\n @terms = Term.all_iit_subjects\n @iit_terms = Term.all_iit_subjects\n @non_iit_terms = Term.all_iit_non_subjects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def create\n @person = Person.new(person_params)\n @agreement = Agreement.last\n @person.skip_validation = false\n respond_to do |format|\n if @person.save\n @person.agreements << Agreement.last\n if current_user\n if current_user.user?\n current_user.person_id = @person.id\n current_user.save\n end\n end\n format.html { redirect_to @person, notice: 'Uppgifterna lades till. Tack.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_params\n params.permit(:search_terms)\n end",
"def terms(attributes = nil)\r\n field = attributes.keys.first\r\n query = { field => attributes.values.flatten }\r\n\r\n body = { query: { terms: query } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end",
"def create\n @sales_term = SalesTerm.new(params[:sales_term])\n\n respond_to do |format|\n if @sales_term.save\n format.html { redirect_to @sales_term, notice: 'Sales Term was successfully created.' }\n format.json { render json: @sales_term, status: :created, location: @sales_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def characterization_terms(omdoc)\n h = {}\n omdoc.class.terminology.terms.each_pair do |key, target|\n # a key is a proxy if its target responds to proxied_term\n next unless target.respond_to? :proxied_term\n begin\n h[key] = omdoc.send(key)\n rescue NoMethodError\n next\n end\n end\n h.delete_if { |_k, v| v.empty? }\n end",
"def update\n respond_to do |format|\n if @people_term.update(people_term_params)\n format.html { redirect_to @people_term, notice: 'People term was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_term }\n else\n format.html { render :edit }\n format.json { render json: @people_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @go_term_enrichment = GoTermEnrichment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term_enrichment }\n end\n end",
"def set_token_data(current_types, personality, term)\n current_types.inject({}) do |token_data, content_type|\n humanized_content_type = humanize_content_type(content_type)\n token_data[humanized_content_type] = set_single_type_data(content_type, personality, term)\n token_data\n end.to_json\n end",
"def index\n @people_terms = PeopleTerm.where([\"person_id = ?\", params[:person_id]]).includes(:term).order(\"terms.start_date\")\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 terms_and_conditions_params\n params.fetch(:terms_and_condition, {}).permit(:terms_and_condition, :status, :summary, :full, :version)\n end",
"def conferences_groups terms={}\n call_path = \"conferences/groups\"\n data = build_post_data(terms.to_json)\n perform_post(build_url(call_path), data)\n end",
"def glossary_terms_list_with_http_info(account_id, glossary_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GlossaryTermsApi.glossary_terms_list ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # verify the required parameter 'glossary_id' is set\n if @api_client.config.client_side_validation && glossary_id.nil?\n fail ArgumentError, \"Missing the required parameter 'glossary_id' when calling GlossaryTermsApi.glossary_terms_list\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/glossaries/{glossary_id}/terms'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'glossary_id' + '}', CGI.escape(glossary_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<GlossaryTerm>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GlossaryTermsApi#glossary_terms_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def create\n\n #@term.start = Date.strptime(params[:term][:start], \"%d/%m/%Y %H:%M\")\n\n\n @term = Term.new(parse_term_params)\n \n\n @term.event_id = params[:event_id]\n\n #create associations between terms and categories via categories_terms table\n @event = Event.find(params[:event_id])\n\n @event.terms << @term\n \n respond_to do |format|\n if @term.save\n flash[:notice] = I18n.t('terms.controller.Successfully_created')\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @glossary_term = GlossaryTerm.new(\n user: @user,\n name: params[:glossary_term][:name],\n description: params[:glossary_term][:description]\n )\n return reload_form(\"new\") unless image_and_term_saves_smooth?\n\n redirect_to(glossary_term_path(@glossary_term.id))\n end",
"def create\n @choice = Choice.new(choice_params)\n\n if @choice.save\n render json: @choice, status: :created, location: @choice\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end",
"def add_term\n if(params[:term][:id] && !params[:term][:id].empty?) #existing term\n @term = Term.find(params[:term][:id])\n else #new item\n case params[:term][:type]\n when \"Award\", \"Interest\", \"Skill\" then\n @term = Term.new(:name => params[:term][:name], :type => params[:term][:type])\n @term.save\n when \"Career\" then\n #DON'T make new career...\n flash[:notice] = \"You are not authorized to add new careers.\"\n redirect_to :back and return\n when \"Course\" then\n # make new course\n @term = Course.new(:name => params[:term][:name])\n @term.save\n when \"Club\" then\n # make new club\n @term = Club.new(:name => params[:term][:name])\n @term.save\n else\n end\n end\n \n # now attach the term\n term_attachment = TermAttachment.find_or_initialize_by_term_id_and_attachable_id_and_attachable_type(@term.id, params[:attachable][:id], params[:attachable][:type])\n \n # @student_term = StudentTerm.new(:student_id => @student.id, :term_id => @term.id, :details => params[:comments], :term_type => \"Skill\")\n \n if term_attachment.save\n current_user.add_tag(@term)\n flash[:notice] = \"Successfully added tag.\"\n else\n flash[:notice] = \"Failed to add tag.\"\n end\n redirect_to :back\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def subject_term_association_params\n params.require(:subject_term_association).permit(:feature_id, :subject_id, :branch_id)\n end",
"def search_terms=(value)\n @search_terms = value\n end",
"def usage_terms\n if request.post?\n # OPTIMIZE check if really submitted the form (hidden variable?)\n current_user.usage_terms_accepted!\n redirect_to root_path\n else\n @usage_term = UsageTerm.current\n \n @title = \"Medienarchiv der Künste: #{@usage_term.title}\"\n @disable_user_bar = true\n @disable_search = true\n end\n end",
"def search\n\n # extract the terms from params\n terms = params[:search_terms]\n\n # redirect to root in case of missing terms\n redirect_to root_path && return if terms.blank?\n\n # extract the terms to an array\n # delete('-') because phones are saved without '-' (numbers only)\n terms_array = params[:search_terms].delete('-').split(' ')\n\n # extract the params using private methods\n age = age_param(terms_array)\n phone = phone_param(terms_array)\n names_array = name_param_array(terms)\n\n # find the people available for the search terms\n @peoples = People.search_by_terms(names_array, phone, age)\n\n # renders 'search.js'\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n\n respond_to do |format|\n if @vocabulary.save\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary }\n else\n format.html { render :new }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end",
"def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def values\n render :json => gen_slugs(params[:term].upcase)\n end",
"def create\n @taxinomy = Taxinomy.new(params[:taxinomy])\n\n respond_to do |format|\n if @taxinomy.save\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully created.' }\n format.json { render json: @taxinomy, status: :created, location: @taxinomy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:search_term][:name] = params[:search_term][:new_name].strip\n params[:search_term].delete :new_name\n @search_term = SearchTerm.new(params[:search_term])\n\n respond_to do |format|\n if @search_term.save\n format.html { redirect_to(search_terms_path, :notice => 'SearchTerm was successfully created.') }\n format.xml { render :xml => @search_term, :status => :created, :location => @search_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vocabulary_term_params\n params.require(:vocabulary_term).permit(:label, :uri, :code, :tgm_label, :lcsh_label, :vocabulary_id)\n end",
"def create\n \t\t@searchterm = current_user.searches.create(:search_term=>params[:searchterm],:type=>\"question\")\n \tend",
"def terms_accepted?\n true\n end",
"def create\n @curriculum = Curriculum.new(params[:curriculum])\n authorize! :create, @curriculum\n\n @curriculum.admins << @current_user\n @terms = Term.order(:start_year).all\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to(edit_curriculum_url(:id => @curriculum), :notice => 'Curriculum was successfully created.') }\n format.xml { render :xml => @curriculum, :status => :created, :location => @curriculum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @curriculum.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.69485384",
"0.6921347",
"0.6721231",
"0.64618576",
"0.6352312",
"0.63122314",
"0.6297207",
"0.6260427",
"0.6260427",
"0.6209562",
"0.6202969",
"0.62014294",
"0.61632085",
"0.6136712",
"0.6092729",
"0.60720646",
"0.595872",
"0.5899768",
"0.5899185",
"0.5884864",
"0.58641624",
"0.58573437",
"0.5857051",
"0.5852162",
"0.5830842",
"0.58208",
"0.57912344",
"0.5746858",
"0.57433224",
"0.57155687",
"0.56867236",
"0.5679256",
"0.56510943",
"0.5649919",
"0.56491363",
"0.5645493",
"0.5642787",
"0.56160134",
"0.56136245",
"0.56029147",
"0.5582321",
"0.5575863",
"0.5537755",
"0.5537726",
"0.5522691",
"0.551782",
"0.5506211",
"0.5497924",
"0.5497607",
"0.5481352",
"0.5478606",
"0.54622865",
"0.5456263",
"0.5453476",
"0.5452641",
"0.5445926",
"0.54431754",
"0.5439724",
"0.54288644",
"0.54127413",
"0.53945446",
"0.5379455",
"0.5354161",
"0.5347083",
"0.5339155",
"0.5336651",
"0.5319714",
"0.5319654",
"0.53168195",
"0.5316191",
"0.5314803",
"0.5274707",
"0.52722776",
"0.52646506",
"0.5263905",
"0.5263159",
"0.5248319",
"0.5239686",
"0.52369314",
"0.5233417",
"0.52311313",
"0.5226292",
"0.5211646",
"0.52101994",
"0.52010566",
"0.51877016",
"0.5186711",
"0.51832086",
"0.5180332",
"0.5178037",
"0.5174183",
"0.5171872",
"0.5170157",
"0.5167801",
"0.5167417",
"0.51651955",
"0.5164994",
"0.5164624",
"0.5161917",
"0.5156074"
] |
0.72865486
|
0
|
PATCH/PUT /people_terms/1 PATCH/PUT /people_terms/1.json
|
def update
respond_to do |format|
if @people_term.update(people_term_params)
format.html { redirect_to @people_term, notice: 'People term was successfully updated.' }
format.json { render :show, status: :ok, location: @people_term }
else
format.html { render :edit }
format.json { render json: @people_term.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n if @terms_of_use.update_attributes(params[:terms_of_use])\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @terms_of_service.update(terms_of_service_params)\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully updated.' }\n format.json { render :show, status: :ok, location: @terms_of_service }\n else\n format.html { render :edit }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @errors = []\n term_opts = flat_term_data_to_term_opts(term_params)\n\n begin\n @term = UriService.client.update_term(@term['uri'], term_opts)\n rescue UriService::NonExistentUriError, UriService::InvalidAdditionalFieldKeyError, UriService::CannotChangeTemporaryTerm => e\n @errors << e.message\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully updated.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\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 params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @privacy_term = PrivacyTerm.find(params[:id])\n\n respond_to do |format|\n if @privacy_term.update_attributes(params[:privacy_term])\n format.html { redirect_to @privacy_term, notice: 'Privacy term was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @privacy_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n if @go_term.update_attributes(params[:go_term])\n format.html { redirect_to @go_term, notice: 'Go term was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_term.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 @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 if @term.update(term_params)\n render :show, status: :ok, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @term.update(term_params)\n format.html { redirect_to @term, notice: 'Term was successfully updated.' }\n format.json { render :show, status: :ok, location: @term }\n else\n format.html { render :edit }\n format.json { render json: @term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @term_relationship.update(term_relationship_params)\n format.html { redirect_to @term_relationship, notice: 'Term relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @term_relationship }\n else\n format.html { render :edit }\n format.json { render json: @term_relationship.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 respond_to do |format|\n if @terms_and_condition.update(terms_and_conditions_params)\n format.html { redirect_to admin_terms_and_conditions_path, notice: 'terms_and_condition was succesfully updated.' }\n format.json { render :show, status: :ok, location: @terms_and_condition }\n else\n format.html { render :edit }\n format.json { render json: @terms_and_condition.errors, status: :unprocesable_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 @term.update_attributes(term_params)\n\n render_item @term, :ok\n end",
"def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @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 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 @go_term_enrichment = GoTermEnrichment.find(params[:id])\n\n respond_to do |format|\n if @go_term_enrichment.update_attributes(params[:go_term_enrichment])\n format.html { redirect_to @go_term_enrichment, notice: 'Go term enrichment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_term_enrichment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n if @tenancy_agreement.update_attributes(params[:tenancy_agreement])\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def people_term_params\n params.require(:people_term).permit(:person_id, :term_id)\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n flash[:notice] = 'Term was successfully updated.'\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n format.html { redirect_to(@term, :notice => 'Term was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n format.html { redirect_to(@term, :notice => 'Term was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 if @user.update_attribute(:terms_and_conditions, @t_and_c)\n render :json => {:tc_accepted => true}.to_json\n else\n render :edit\n end\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 authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n @person.skills.delete_all\n if params[:skillid]!= nil\n params[:skillid].each do |i| \n\t\t @person.skills << Skill.find_by_id(i)\n\t\tend\n\t\tend\n format.html { redirect_to @person }\n format.json { render :show, status: :ok, location: @person }\n else\n @groups=@person.group.organization.groups.all\n @skills=@person.group.skills.all\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n if @person.update_attributes(person_params)\n render :json => @person\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n if params[:person][:company_name]\n params[:person][:company] = Company.find_or_create_by_name(params[:person][:company_name])\n params[:person].delete(:company_name)\n end\n @person = Person.find(params[:id])\n\n authorize! :edit, @person\n \n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to people_path, 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 respond_to do |format|\n if @admin_term.update(admin_term_params)\n format.html { redirect_to @admin_term, notice: 'Term was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_term }\n else\n format.html { render :edit }\n format.json { render json: @admin_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @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 @taxinomy = Taxinomy.find(params[:id])\n\n respond_to do |format|\n if @taxinomy.update_attributes(params[:taxinomy])\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cycle = Cycle.find(params[:id])\n\n add_terms(params[\"terms-id\"],@cycle)\n respond_to do |format|\n if @cycle.update_attributes(params[:cycle])\n format.html { redirect_to @cycle, notice: 'Cycle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cycle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @common_term.update(common_term_params)\n format.html { redirect_to @common_term, notice: 'Common term was successfully updated.' }\n format.json { render :show, status: :ok, location: @common_term }\n else\n format.html { render :edit }\n format.json { render json: @common_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\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 @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\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 respond_to do |format|\n if @documents_person.update(documents_person_params)\n format.html { redirect_to @documents_person, notice: 'Documents person was successfully updated.' }\n format.json { render :show, status: :ok, location: @documents_person }\n else\n format.html { render :edit }\n format.json { render json: @documents_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @choice = Choice.find(params[:id])\n\n if @choice.update(choice_params)\n head :no_content\n else\n render json: @choice.errors, status: :unprocessable_entity\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 #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 respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: t('.update_ok') }\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 set_people_term\n @people_term = PeopleTerm.find(params[:id])\n end",
"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 @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 @person = Person.find((params[:person_id]))\n params[:person_identification_doc][:rg_uf].blank? ? (params[:person_identification_doc].delete(:rg_uf)) : (params[:person_identification_doc][:rg_uf] = State.find(params[:person_identification_doc][:rg_uf]))\n params[:person_identification_doc][:vr_uf].blank? ? (params[:person_identification_doc].delete(:vr_uf)) : (params[:person_identification_doc][:vr_uf] = State.find(params[:person_identification_doc][:vr_uf]))\n params[:person_identification_doc][:rg_issuing_institution].blank? ? (params[:person_identification_doc].delete(:rg_issuing_institution)) : (params[:person_identification_doc][:rg_issuing_institution] = IssuingInstitution.find(params[:person_identification_doc][:rg_issuing_institution]))\n \n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n\n respond_to do |format|\n if @person_identification_doc.update_attributes(params[:person_identification_doc])\n format.html { redirect_to [@person,@person_identification_doc], :notice => 'Documentação atualizada.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person_identification_doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n if @key_person.update_attributes(params[:key_person])\n format.html { redirect_to @key_person, notice: 'Key person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @people = args[:people] if args.key?(:people)\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 respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n set_associations\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 @person.update(person_params)\n format.html { redirect_to @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 respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @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 respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @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 # { 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 options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @education_service_provided_typology.update(education_service_provided_typology_params)\n format.html { redirect_to @education_service_provided_typology, notice: 'Education service provided typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_service_provided_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tax = Tax.find(params[:id])\n\n if @tax.update(tax_params)\n head :no_content\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @doc_data = args[:doc_data] if args.key?(:doc_data)\n @salient_term = args[:salient_term] if args.key?(:salient_term)\n @version = args[:version] if args.key?(:version)\n end",
"def on_agree\n @doc.update(agreed: false)\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc }\n else\n format.html { render :edit }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @theoretical_part = TheoreticalPart.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @theoretical_part.update_attributes(params[:theoretical_part])\r\n format.html { redirect_to @theoretical_part, notice: 'Theoretical part was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @theoretical_part.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end",
"def update\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n\n if @service_level_agreement.update_attributes(params[:service_level_agreement])\n render :json => {:success => true}\n else\n render :json => {:success => false, :message => @service_level_agreement.errors.full_messages.join(\". \") }\n end\n end",
"def update\n respond_to do |format|\n if @related_person.update(related_person_params)\n format.html { redirect_to @related_person, notice: 'Related person was successfully updated.' }\n format.json { render :show, status: :ok, location: @related_person }\n else\n format.html { render :edit }\n format.json { render json: @related_person.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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @organization_person = OrganizationPerson.find(params[:id])\n\n if @organization_person.update(organization_person_params)\n render json: @organization_person\n else\n render json: @organization_person.errors, status: :unprocessable_entity\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 @request_person.update(request_person_params)\n format.html { redirect_to @request_person, notice: 'Request person was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_person }\n else\n format.html { render :edit }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end",
"def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n record = TaxRule.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 respond_to do |format|\n if @customized_concept.update(customized_concept_params)\n format.html { redirect_to @customized_concept, notice: 'Customized concept was successfully updated.' }\n format.json { render :show, status: :ok, location: @customized_concept }\n else\n format.html { render :edit }\n format.json { render json: @customized_concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to root_path(@people), notice: 'VIP ' + @people.name.to_s + ' foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taxon = Taxon.find(params[:id])\n\n respond_to do |format|\n if @taxon.update_attributes(params[:taxon])\n format.html { redirect_to @taxon, notice: 'Taxon was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html do\n redirect_to @person, notice: 'Person was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @agreement.update(agreement_params)\n format.html { redirect_to @agreement, notice: 'Agreement was successfully updated.' }\n format.json { render :show, status: :ok, location: @agreement }\n else\n format.html { render :edit }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6565607",
"0.64583135",
"0.6288723",
"0.6251702",
"0.62307066",
"0.6209012",
"0.6176027",
"0.6058723",
"0.6005997",
"0.5985005",
"0.59744",
"0.5972014",
"0.59538966",
"0.59447366",
"0.59418875",
"0.59028655",
"0.5897313",
"0.5893967",
"0.58514655",
"0.58477306",
"0.58403146",
"0.5834608",
"0.58061546",
"0.5773187",
"0.5758207",
"0.57568365",
"0.5756442",
"0.5753928",
"0.5753561",
"0.57174474",
"0.57096183",
"0.5708528",
"0.57077724",
"0.57015514",
"0.5701037",
"0.56930256",
"0.5689947",
"0.5687772",
"0.5677923",
"0.5677923",
"0.5677923",
"0.5677923",
"0.5677923",
"0.56688774",
"0.56678015",
"0.566628",
"0.5666116",
"0.5666116",
"0.56484663",
"0.56454825",
"0.56358194",
"0.5633155",
"0.5629917",
"0.56217504",
"0.5621276",
"0.5617725",
"0.5614428",
"0.5613908",
"0.5608559",
"0.5608559",
"0.5605468",
"0.56046003",
"0.56030864",
"0.56007797",
"0.55971193",
"0.5592233",
"0.55885655",
"0.55885655",
"0.55885655",
"0.55841273",
"0.5576886",
"0.55756354",
"0.5572721",
"0.5572721",
"0.5571092",
"0.5569458",
"0.5565129",
"0.5565129",
"0.5562171",
"0.55588645",
"0.55578846",
"0.55563706",
"0.5555824",
"0.555341",
"0.555143",
"0.55402035",
"0.5521706",
"0.5521117",
"0.5520283",
"0.55193937",
"0.55185837",
"0.5514606",
"0.5507872",
"0.55041283",
"0.5495707",
"0.5487515",
"0.5486833",
"0.54864705",
"0.5478789",
"0.5476569"
] |
0.6949061
|
0
|
DELETE /people_terms/1 DELETE /people_terms/1.json
|
def destroy
@people_term.destroy
respond_to do |format|
format.html { redirect_to people_terms_url, notice: 'People term was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @go_term = GoTerm.find(params[:id])\n @go_term.destroy\n\n respond_to do |format|\n format.html { redirect_to go_terms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @privacy_term = PrivacyTerm.find(params[:id])\n @privacy_term.destroy\n\n respond_to do |format|\n format.html { redirect_to privacy_terms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terms_of_use = TermsOfUse.find(params[:id])\n @terms_of_use.destroy\n\n respond_to do |format|\n format.html { redirect_to terms_of_uses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terms_of_service.destroy\n respond_to do |format|\n format.html { redirect_to terms_of_services_url, notice: 'Terms of service was successfully destroyed.' }\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 UriService.client.delete_term(@term['uri'])\n respond_to do |format|\n format.html { redirect_to terms_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Term has been deleted.' }\n format.json { head :no_content }\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 @jc_term = JcTerm.find(params[:id])\n @jc_term.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 @go_term_enrichment = GoTermEnrichment.find(params[:id])\n @go_term_enrichment.destroy\n\n respond_to do |format|\n format.html { redirect_to go_term_enrichments_url }\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 # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n @taxonomy_term.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomy_terms_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terms_and_condition.destroy\n respond_to do |format|\n format.html { redirect_to admin_terms_and_conditions_url, notice: 'terms_and_conditions was succesfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = people_type.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"index\" }\n format.json { head :ok }\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 @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\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 people_url }\n format.json { head :ok }\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 people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @common_term.destroy\n respond_to do |format|\n format.html { redirect_to common_terms_url, notice: 'Common term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @term.destroy\n respond_to do |format|\n format.html { redirect_to terms_url, notice: 'Term 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 people_url }\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 people_url }\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 people_url }\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 people_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 @person.destroy\n head :no_content\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @term_relationship.destroy\n respond_to do |format|\n format.html { redirect_to term_relationships_url, notice: 'Term relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @term.destroy\n head :no_content\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_service_provided_typology.destroy\n respond_to do |format|\n format.html { redirect_to education_service_provided_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n success = true\n tries ||= 3\n request = Net::HTTP::Delete.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}\")\n WebTranslateIt::Util.add_fields(request)\n begin\n Util.handle_response(Connection.http_connection.request(request), true, true)\n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end",
"def delete_term(params)\n send_get \"delete_term\", params\n end",
"def destroy\n @key_person = KeyPerson.find(params[:id])\n @key_person.destroy\n\n respond_to do |format|\n format.html { redirect_to key_people_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @admin_term.destroy\n respond_to do |format|\n format.html { redirect_to admin_terms_url, notice: 'Term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.user.destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end",
"def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end",
"def destroy\n @person_interest = PersonInterest.find(params[:id])\n @person_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to person_interests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @sanskrit_term.destroy\n respond_to do |format|\n format.html { redirect_to sanskrit_terms_url, notice: 'Sanskrit term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @neglected_term.destroy\n respond_to do |format|\n format.html { redirect_to neglected_terms_url, notice: 'Neglected term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomies_url }\n format.js\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @term.destroy!\n\n head :ok\n end",
"def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[: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 @tenancy_agreement = TenancyAgreement.find(params[:id])\n @tenancy_agreement.destroy\n\n respond_to do |format|\n format.html { redirect_to tenancy_agreements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n the_org = @person.org_id\n the_name = @person.name\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to org_path(the_org), status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Клиент удален из базы.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documents_person.destroy\n respond_to do |format|\n format.html { redirect_to documents_people_url, notice: 'Documents person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabulary_term.destroy\n respond_to do |format|\n format.html { redirect_to vocabulary_terms_url, notice: 'Vocabulary term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @related_person.destroy\n respond_to do |format|\n format.html { redirect_to related_people_url, notice: 'Related person 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 @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Uppgifterna om personen raderades.' }\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.html { redirect_to personas_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.html { redirect_to personas_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.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @personnage = Personnage.find(params[:id])\n @personnage.destroy\n\n respond_to do |format|\n format.html { redirect_to personnages_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_person = UserPerson.find(params[:id])\n @user_person.destroy\n\n respond_to do |format|\n format.html { redirect_to user_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @searchterm.destroy\n respond_to do |format|\n format.html { redirect_to searchterms_url, notice: 'Searchterm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def delete\n Person.find(params[:id]).destroy\n redirect_to action: 'list'\n end",
"def delete(*rest) end",
"def destroy\n @type_person = TypePerson.find(params[:id])\n @type_person.destroy\n\n respond_to do |format|\n format.html { redirect_to type_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.72060794",
"0.7056147",
"0.69761854",
"0.6898458",
"0.68279845",
"0.6753201",
"0.67426723",
"0.66773164",
"0.6667031",
"0.6649049",
"0.66417456",
"0.6623029",
"0.6619173",
"0.6609529",
"0.6605995",
"0.65991205",
"0.6588154",
"0.6583966",
"0.6578589",
"0.6578589",
"0.6578589",
"0.6578129",
"0.6575088",
"0.6571165",
"0.6564627",
"0.6562724",
"0.6562724",
"0.6562724",
"0.6562724",
"0.6555992",
"0.6554199",
"0.6554199",
"0.65436816",
"0.6531277",
"0.6531277",
"0.6531277",
"0.6531277",
"0.6531277",
"0.652108",
"0.6502995",
"0.65019375",
"0.6501432",
"0.6501432",
"0.6496969",
"0.6489799",
"0.64888096",
"0.64880896",
"0.6485364",
"0.64681864",
"0.6461443",
"0.6461224",
"0.64521444",
"0.6449107",
"0.6439295",
"0.6438539",
"0.64377886",
"0.643358",
"0.6433523",
"0.64286685",
"0.64281493",
"0.6419023",
"0.6418668",
"0.64156383",
"0.6412364",
"0.6407893",
"0.6405262",
"0.64023757",
"0.63951886",
"0.6391288",
"0.638935",
"0.63815355",
"0.63720936",
"0.63697535",
"0.63670784",
"0.6364234",
"0.63595897",
"0.63452697",
"0.63409674",
"0.63409674",
"0.63409674",
"0.6339013",
"0.6335983",
"0.6330281",
"0.6328332",
"0.6328332",
"0.6328332",
"0.6328332",
"0.6326814",
"0.63264936",
"0.632353",
"0.63153875",
"0.63132703",
"0.6312252",
"0.6311453",
"0.6310185",
"0.6310185",
"0.6310185",
"0.6310185",
"0.6310185",
"0.6310185"
] |
0.7482181
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_people_term
@people_term = PeopleTerm.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 people_term_params
params.require(:people_term).permit(:person_id, :term_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def 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 listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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 active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] |
0.0
|
-1
|
GET /card_pages GET /card_pages.json
|
def index
@card_pages = CardPage.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @cards = Card.page(params[:page]).per(7)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end",
"def index\n @card = Card.paginate(:page => params[:page], :per_page => 15)\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end",
"def index\n @cards = Card.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @cards }\n end\n end",
"def pages\n get(\"v1/account/#{@email}/pages\")\n end",
"def index\n cards_per_page = 12\n\n @boards = Board.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n format.js\n end\n end",
"def index\n params[:page] = 1 if params[:page].blank?\n @card_sets = CardSet.order(\"name\").page params[:page]\n end",
"def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n render json: @page\n end",
"def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def index\n @cards = Card.order(:full_name).page params[:page]\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n @board = Board.find(params[:id])\n @content_years = @board.content_years.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def index\n @pages = @comic.pages\n \n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def index\n @declaration_containers = @declaration.declaration_containers.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @declaration_containers }\n end\n end",
"def index\n @instances = Instance.page params[:page]\n authorize! :read, @instances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instances }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def pages()\n get('subAccountPages')\n end",
"def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @courts = Court.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def pages\n end",
"def show\n @card = PkCard.find(params[:id])\n render json: @card\n end",
"def show\n render json: @card\n end",
"def show\n render json: @card\n end",
"def index\n @pages = Page.all\n\n respond_with @pages\n end",
"def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end",
"def index\n #Page.all is fine for small sets of data, for larger sets pagination would be best\n @pages = data_cache('pages', 10.minutes) do\n Page.all\n end\n respond_to do |format|\n format.json { render action: 'index', status: :ok, location: api_pages_url(@pages) }\n format.xml { render xml: @pages, location: api_pages_url(@pages) }\n end\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n pagination = pagination_params\n filter = filter_params\n\n @cards = Card.filter_query(filter).page(pagination[:page]).per(pagination[:quantity]).ordered\n end",
"def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end",
"def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\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 show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def set_card_page\n @card_page = CardPage.find(params[:id])\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json do\n\n hash_card = {\n name: @card.name,\n desc: @card.oracle_text,\n url: card_path(@card)\n }\n\n render json: hash_card\n end\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def children\n @pages = @page.children\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def show\n # @card = Card.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @card }\n # end\n end",
"def index\n @containers_pages = @page.containers_pages\n end",
"def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end",
"def pages\n project_size = Project.all.length\n\n puts project_size\n\n respond_to do |format|\n format.json {\n @pages = (project_size/10.0).ceil\n render :json => @pages \n }\n end\n end",
"def pages; 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 index\n @general_frames = @university.general_frames.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @general_frames }\n end\n end",
"def index\n @name_cards = @user.name_cards.page(params[:page])\n end",
"def show\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n page_id = params[:page] || 1\n @articles = Article.order('comments_count desc').page(page_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n #Page data isn't updated very frequently so a longer cache time is acceptable\n @page = data_cache(\"page-#{@page.id}\", 1.hour) do\n Page.find(params[:id])\n end\n respond_to do |format|\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n format.xml { render xml: @page, location: api_page_url(@page) }\n end\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format| \n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n\n end",
"def index\n @manifestation_checkout_stats = ManifestationCheckoutStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manifestation_checkout_stats }\n end\n end",
"def credit_card\n @entries = CreditCard.where(location_id: params[:location]).paginate(:page => params[:page]) if request.xhr? \n end",
"def show\n @pages = Page.all\n end",
"def index\n @m_cards = MCard.all\n end",
"def pages\n @pages\n end",
"def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\n end",
"def index\n #@cards = Card.all\n end",
"def pages\n @pages \n end",
"def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end",
"def index\n @pages = @offering.pages.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def index\n @assessment_olympiads = AssessmentOlympiad.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_olympiads }\n end\n end",
"def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end"
] |
[
"0.7591505",
"0.71511203",
"0.7073391",
"0.69458234",
"0.69192123",
"0.6781108",
"0.6764483",
"0.673955",
"0.67163885",
"0.6691314",
"0.66805345",
"0.6664093",
"0.66534734",
"0.66534734",
"0.66534734",
"0.66534734",
"0.66534734",
"0.66534734",
"0.66534734",
"0.66423315",
"0.66393626",
"0.6610498",
"0.65960693",
"0.6582252",
"0.6566071",
"0.65455955",
"0.65117955",
"0.6501398",
"0.6490649",
"0.6481828",
"0.6452264",
"0.6442444",
"0.64376694",
"0.641192",
"0.6409788",
"0.6401739",
"0.63894546",
"0.6378617",
"0.6378617",
"0.6378617",
"0.6378617",
"0.6378617",
"0.6378617",
"0.6378617",
"0.63739306",
"0.6369555",
"0.6356575",
"0.6321503",
"0.6321503",
"0.6302757",
"0.6301263",
"0.62872005",
"0.62830174",
"0.6266625",
"0.62660223",
"0.62634856",
"0.62579906",
"0.6254396",
"0.6240935",
"0.623541",
"0.6229851",
"0.6229851",
"0.622442",
"0.6206841",
"0.6206841",
"0.6206841",
"0.6206841",
"0.6206841",
"0.61836773",
"0.61777425",
"0.6173362",
"0.61635077",
"0.6157784",
"0.6148575",
"0.6147909",
"0.61472905",
"0.6145054",
"0.6127389",
"0.61266136",
"0.6123033",
"0.61180574",
"0.61179143",
"0.61177933",
"0.60963",
"0.60889477",
"0.6081762",
"0.6080869",
"0.6078164",
"0.60769993",
"0.60683316",
"0.6067689",
"0.6061888",
"0.60591173",
"0.60582906",
"0.6055866",
"0.6050708",
"0.60488987",
"0.6048187",
"0.6048187",
"0.6048187"
] |
0.77419126
|
0
|
GET /card_pages/1 GET /card_pages/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @card_pages = CardPage.all\n end",
"def index\n @cards = Card.page(params[:page]).per(7)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end",
"def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @card = Card.paginate(:page => params[:page], :per_page => 15)\n end",
"def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n render json: @page\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end",
"def index\n @cards = Card.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @cards }\n end\n end",
"def set_card_page\n @card_page = CardPage.find(params[:id])\n end",
"def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @card = PkCard.find(params[:id])\n render json: @card\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n @board = Board.find(params[:id])\n @content_years = @board.content_years.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end",
"def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end",
"def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end",
"def show\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @declaration_containers = @declaration.declaration_containers.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @declaration_containers }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n params[:page] = 1 if params[:page].blank?\n @card_sets = CardSet.order(\"name\").page params[:page]\n end",
"def index\n cards_per_page = 12\n\n @boards = Board.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n format.js\n end\n end",
"def show\n # @card = Card.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @card }\n # end\n end",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"def show\n #Page data isn't updated very frequently so a longer cache time is acceptable\n @page = data_cache(\"page-#{@page.id}\", 1.hour) do\n Page.find(params[:id])\n end\n respond_to do |format|\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n format.xml { render xml: @page, location: api_page_url(@page) }\n end\n end",
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def index\n @cards = Card.order(:full_name).page params[:page]\n end",
"def show\n render json: @card\n end",
"def show\n render json: @card\n end",
"def index\n @pages = @comic.pages\n \n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json do\n\n hash_card = {\n name: @card.name,\n desc: @card.oracle_text,\n url: card_path(@card)\n }\n\n render json: hash_card\n end\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def show\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_page }\n end\n end",
"def index\n @instances = Instance.page params[:page]\n authorize! :read, @instances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instances }\n end\n end",
"def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end",
"def show\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_number }\n end\n end",
"def index\n @courts = Court.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def show\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nested_page }\n end\n end",
"def show\n @mypage = Mypage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypage }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end",
"def index\n @general_frames = @university.general_frames.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @general_frames }\n end\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oasis_page }\n end\n end",
"def show\n render json: @card, status: :ok\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end",
"def new\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @containers_pages = @page.containers_pages\n end",
"def create\n @card_page = CardPage.new(card_page_params)\n\n respond_to do |format|\n if @card_page.save\n format.html { redirect_to @card_page, notice: 'Card page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @card_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @card_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @about_page = AboutPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @about_page }\n end\n end",
"def show\n @enq_page = EnqPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enq_page }\n end\n end",
"def show\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_type }\n end\n end",
"def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend",
"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 new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def pages\n get(\"v1/account/#{@email}/pages\")\n end",
"def show\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json { render json: {id: @card.id, name: @card.name} }\n end\n end",
"def page\n get(\"v1/fundraising/pages/#{@short_name}\")\n end",
"def index\n @name_cards = @user.name_cards.page(params[:page])\n end",
"def show\n @card = Card.find_by_access_token!(params[:id])\n @destination = @card.destination\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @card }\n end\n end",
"def page\n get_page\n nil\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def show\n @page = Page.find(params[:id])\n #this is how we find every page by its id\n end",
"def first\n @cards = Card.where(:first => params[:first])\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @cards }\n end\n end",
"def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end",
"def fetch_page\n url = URI([API, @url].join) # *hiss* \"URI\" has been wrong for years!\n\n unless @args.empty?\n url.query = URI.encode_www_form(@args.merge({ page: @page }))\n end\n\n res = Net::HTTP.get_response(url)\n raise SRL::NetworkError, res unless res.is_a?(Net::HTTPSuccess)\n\n data = JSON.parse(res.body)\n @page += 1\n\n ResultSet.new(\n SRL::Utils.collection(data.fetch(@args[:pkey]), @klass),\n count: data.fetch('count', data.fetch(@args[:pkey]).size),\n page: (@page - 1),\n page_size: @args.fetch(:pageSize, 25)\n )\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def show\n @make_card = MakeCard.find(params[:id])\n @rechargeable_cards_ids = @make_card.rechargeable_cards.ids\n @rechargeable_cards = RechargeableCard.find(@rechargeable_cards_ids)\n @rechargeable_cards = RechargeableCard.paginate(page: params[:page])\n\n end",
"def show\n if params[:id] =~ /^\\d+$/\n @page = Page.find_by_id(params[:id]) \n else\n @page = Page.find_by_path_name(params[:id])\n end\n @page ||= Page.first \n\n case @page.path_name\n when 'metro_icons'\n return redirect_to \"/metro_icons\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\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 @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @page} \n format.xml {render xml: @page}\n end\n end"
] |
[
"0.7601533",
"0.7405421",
"0.7089196",
"0.6946843",
"0.69207877",
"0.6890273",
"0.68581855",
"0.6810554",
"0.6810554",
"0.6810554",
"0.6810554",
"0.6810554",
"0.6810554",
"0.6810554",
"0.6762328",
"0.67246467",
"0.6713379",
"0.66996336",
"0.6680105",
"0.66674906",
"0.66328645",
"0.6583275",
"0.65689754",
"0.65689754",
"0.65689754",
"0.65689754",
"0.65689754",
"0.6551227",
"0.65511286",
"0.6549196",
"0.65404415",
"0.65296966",
"0.65296966",
"0.65296966",
"0.65296966",
"0.65296966",
"0.65296966",
"0.65296966",
"0.652449",
"0.652253",
"0.6510772",
"0.65082437",
"0.6491931",
"0.6486749",
"0.646843",
"0.6444061",
"0.6444061",
"0.64362043",
"0.64360785",
"0.6414227",
"0.64133865",
"0.6391089",
"0.6391085",
"0.63563764",
"0.6346945",
"0.63329446",
"0.63179195",
"0.6309821",
"0.62838167",
"0.6280498",
"0.62700754",
"0.62671775",
"0.6265158",
"0.62585217",
"0.62580997",
"0.62574834",
"0.62571144",
"0.62459946",
"0.62143993",
"0.62005085",
"0.6197216",
"0.619351",
"0.6189776",
"0.6184647",
"0.61776906",
"0.6174186",
"0.61717016",
"0.6167676",
"0.616538",
"0.61592746",
"0.61592746",
"0.61592746",
"0.61592746",
"0.61592746",
"0.6150693",
"0.61497265",
"0.6134048",
"0.6133052",
"0.6132028",
"0.61276567",
"0.6122393",
"0.6122011",
"0.6119499",
"0.6112298",
"0.61108446",
"0.6109338",
"0.61039114",
"0.6102967",
"0.61021394",
"0.60966814",
"0.6095854"
] |
0.0
|
-1
|
POST /card_pages POST /card_pages.json
|
def create
@card_page = CardPage.new(card_page_params)
respond_to do |format|
if @card_page.save
format.html { redirect_to @card_page, notice: 'Card page was successfully created.' }
format.json { render action: 'show', status: :created, location: @card_page }
else
format.html { render action: 'new' }
format.json { render json: @card_page.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @card_pages = CardPage.all\n end",
"def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end",
"def create\n #Each Page could be tied to an ApiKey or set of ApiKeys for security\n @page = Page.new(page_params)\n #Render the object created or errors\n respond_to do |format|\n if @page.save\n #Cache bust pages\n Rails.cache.delete(\"pages\")\n format.json { render action: 'show', status: :created, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card_page_params\n params.require(:card_page).permit(:name, :link)\n end",
"def create\n @page = Page.new(params[:page])\n \n if @page.save\n respond_to do |format|\n format.json { render :json => @page, :status => :created }\n format.xml { render :xml => @page, :status => :created }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidRecordJSONException }\n format.xml { raise Palani::Api::InvalidRecordXMLException }\n end\n end\n end",
"def create\n respond_to do |format|\n begin\n @page = Page.create_page!\n format.html { redirect_to \"/#{@page.request_id}/inspect\", notice: t('pages.create.success') }\n format.json { render action: 'show', status: :created, location: @page }\n rescue => e\n format.html { render action: 'index' }\n format.json { render json: {:message => \"create page error\"}, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nested_page = Nested::Page.new(params[:nested_page])\n\n respond_to do |format|\n if @nested_page.save\n format.html { redirect_to @nested_page, notice: 'Page was successfully created.' }\n format.json { render json: @nested_page, status: :created, location: @nested_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @cards = Card.page(params[:page]).per(7)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_card_page\n @card_page = CardPage.find(params[:id])\n end",
"def create\n @page = Page.new(params[:page])\n\n if @page.save\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.json { render json: @page, status: :created, location: [:api, @page] }\n format.xml { render xml: @page, status: :created, location: [:api, @page] }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n self.build_pages_tree\n format.html { redirect_to @pages_tree[@page.id], notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def create\n @page = Page.new(params[:page])\n if @page.save\n respond_with(@page, location: api_pages_url)\n else\n respond_with(@page)\n end\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @page = Page.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @page }\r\n end\r\n end",
"def create\n url = params['url']\n doc = Crawl::PageHandler.fetch_page(url)\n page_data = Crawl::PageHandler.parse_page(url, doc)\n page = Page.create(url: url,\n chksum: Zlib.crc32(url),\n parsed: page_data.to_json)\n render json: { url: page[:url],\n chksum: page[:chksum],\n parsed: page[:parsed] }\n end",
"def index\n @card = Card.paginate(:page => params[:page], :per_page => 15)\n end",
"def new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n response = @page.parse_url\n render json: response\n end",
"def create\n @page_page = PagePage.new(page_page_params)\n\n respond_to do |format|\n if @page_page.save\n format.html { redirect_to @page_page, notice: 'Page page was successfully created.' }\n format.json { render :show, status: :created, location: @page_page }\n else\n format.html { render :new }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_path(@page), notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n flash[:notice] = @page.errors.full_messages.to_sentence\n format.html { render action: 'new' }\n format.json { render json: [@page.errors.full_messages.to_sentence], status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pages\n end",
"def page\n\n end",
"def new\n @Page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @Page }\n end\n end",
"def create\n params[:page].except!(:map_info) unless params[:page][:map_info].present?\n @page = current_user.pages.new(params[:page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n @business = Business.select('id, title')\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page = Page.new\n @parent = params[:parent]\n @digitaledition = DigitalEdition.find(@parent)\n @de_title = @digitaledition.digital_edition_local_title\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page DESC\").first\n @diged = @digitaledition.id\n\n if (@pages)\n @int_page_value = @pages.page_page + 1\n if (@int_page_value == 0)\n @int_page_value = 1\n end\n else\n @int_page_value = 1\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def page_params\n params.require(:page).permit(:content_header, :content_one, :content_two, :page_type, :active, :lodging_id)\n params.require(:page).permit(:content_header, :content_one, :content_two, :page_type, :active, :lodging_id, epostcards_attributes: [:id, :name, :main_image, :_destroy])\n end",
"def new\n @page = @chapter.pages.build\n\n gon.manga_id = @manga.slug\n gon.chapter_id = @chapter.number\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n @card = Card.new(card_params)\n\n if @card.save\n render json: @card, status: :created, location: @card\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def new\n @nested_page = Nested::Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nested_page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def create\n begin\n fbpage = @graph.get_object(params['page']['page_id'].to_i)\n picture = @graph.get_picture(params['page']['page_id'].to_i)\n rescue Koala::Facebook::ClientError => exc\n error = true\n redirect_to root_url\n end\n\n unless error\n params[\"page\"][\"name\"] = fbpage['name']\n params[\"page\"][\"picture\"] = picture\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.js { }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n respond_with(@page = Page.create(params[:page]), :status => :created)\n end",
"def create\n @customer = Customer.find(session[:current_customer])\n @page = @customer.pages.create(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to(@page, :notice => 'Die Seite wurde erstellt.') }\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # sleep 2 # Wait for Windows to catch up!\n @page = Page.new(params[:page])\n \n @comic.last_updated = Time.now\n @comic.pages << @page \n \n respond_to do |format|\n if @page.save\n @comic.save\n flash[:notice] = 'Page was successfully created.'\n format.html { redirect_to edit_page_path(:comic_id => @comic.alias, :id => @page) }\n format.xml { head :created, :location => page_url(:comic_id => @comic.alias, :id => @page) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors.to_xml }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @containers_page = ContainersPage.new(containers_page_params)\n respond_to do |format|\n if @containers_page.save\n @containers_pages = @page.containers_pages\n format.js\n format.html do \n flash[:success] = 'Container was successfully added to page.'\n redirect_to @containers_page\n end\n format.json { render :show, status: :created, location: @containers_page }\n else\n format.js { head :ok }\n format.html { render :new }\n format.json { render json: @containers_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n# format.html { redirect_to @page, notice: 'Page was successfully created.' }\n# format.json { render :show, status: :created, location: @page }\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: edit_page_path(@page) }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n @page = Page.new\n @page.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n end",
"def create\n @page = Page.new(page_params)\n authorize @page\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n @pages = current_user.pages\n format.html { redirect_to page_url(@page), notice: \"Page was successfully created.\" }\n format.json { render :show, status: :created, location: @page }\n flash.now[:notice] = \"Page was successfully created.\"\n format.turbo_stream { render \"shared/index\", locals: { object: Page.new, objects: @pages } }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @card_page.destroy\n respond_to do |format|\n format.html { redirect_to card_pages_url }\n format.json { head :no_content }\n end\n end",
"def creates\n @page = Page.new(pages_params)\n\n if @page.sav\n redirect_to pages_path\n else\n render :new\n end\n end",
"def create\n\t\t@page = Page.new(params[:page])\n\n\t\trespond_to do |format|\n\t\t\tif @page.save\n\t\t\t\tformat.html { redirect_to @page, notice: 'Boom, page created.' }\n\t\t\t\tformat.json { render json: @page, status: :created, location: @page }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"Create new page\"}\n\t\t\t\tformat.json { render json: @page.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @page = Page.new(page_params)\n @page.profile_pic = params[:page][:profile_pic]\n @page.timeline_pic = params[:page][:timeline_pic]\n @page.like = 0\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n # format.html { redirect_to @page, notice: 'Page was successfully created.' }\n # format.json { render json: @page, status: :created, location: @page }\n\n format.html { redirect_to action: \"edit\", id: @page.id, notice: 'Page was successfully created.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_page\n puts 'params = ' + params.inspect\n puts params[:content_page].inspect\n puts params[:content_page['name']].inspect\n @page = ContentPage.new(params[:content_page])\n puts '@page = ' + @page.inspect\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to show_content_pages_path(@page.id), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created }\n else\n format.html { render :controller => 'content_pages', action: \"new\", alert: 'There were Errors. Could not Create a New Page.' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to cards_url, :notice => 'Card was successfully created.' }\n format.json { render :json => @card, :status => :created, :location => @card }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @structure_page = Structure::Page.new(params[:structure_page])\n\n respond_to do |format|\n if @structure_page.save\n format.html { redirect_to @structure_page, notice: 'Page was successfully created.' }\n format.json { render json: @structure_page, status: :created, location: @structure_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @structure_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to pages_path\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def create\n @enq_page = EnqPage.new(params[:enq_page])\n\n respond_to do |format|\n if @enq_page.save\n format.html { redirect_to @enq_page, notice: 'Enq page was successfully created.' }\n format.json { render json: @enq_page, status: :created, location: @enq_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enq_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n params = page_params\n possible_page = Page.where('user_id IS NOT NULL').where(uid: params[:uid]).order('updated_at DESC').first() # last page associated to some user that has the \"uid\" param\n \n if(!possible_page.nil?)\n params[:user_id] = possible_page.user_id\n end\n\n @page = Page.new(params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to cards_path, notice: t(\".successfully_created\") }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n authorize @page\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = ContentPage.new :title => t(\"new_page\")\n @page.update_sorting params[:drop_id], params[:position]\n \n render :json => { :text => @page.title, :id => @page.id, :icon => @page.icon, \n :cls => @page.type, :leaf => false, :expanded => true, :allowDrag => true, \n :allowDrop => true, :draggable => true }\n end",
"def create\n @comic = Comic.find(params[:comic_id])\n @comic_page = @comic.comic_pages.create(params[:comic_page])\n\n\n respond_to do |format|\n if @comic_page.save\n format.html { redirect_to @comic, notice: 'Comic page was successfully created.' }\n format.json { render json: @comic, status: :created, location: @comic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comic_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n cards_per_page = 12\n\n @boards = Board.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n format.js\n end\n end",
"def new\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page = ComatosePage.new params[:page]\n @page.author = fetch_author_name\n if @page.save\n flash[:notice] = \"Created page '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n else\n @page = ComatosePage.new :title=>'New Page', :parent_id=>(params[:parent] || nil)\n end\n end",
"def create\n @card = Card.create(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end",
"def create\n @page = Page.new(params[:page])\n flash[:notice] = \"Page successfully created\" if @page.save\n respond_with(@page)\n end",
"def create\n @page = Page.new(params[:page])\n flash[:notice] = \"Page successfully created\" if @page.save\n respond_with(@page)\n end",
"def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def create\n @card = Card.new(card_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to action: :index, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = current_site.pages.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to quick_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\r\n html=params[:page][:html]\r\n @page = Page.new(params[:page])\r\n respond_to do |format|\r\n if @page.save\r\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\r\n format.json { render json: @page, status: :created, location: @page }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n if !File.directory?(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}/images\")\r\n end\r\n File.open(target, \"w+\") do |f|\r\n f.write(html)\r\n end\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6703475",
"0.66446877",
"0.6527261",
"0.6402437",
"0.63296163",
"0.63077635",
"0.6211319",
"0.6204911",
"0.61955255",
"0.61908674",
"0.61885166",
"0.6173455",
"0.6173455",
"0.6173455",
"0.6173455",
"0.6173455",
"0.6173455",
"0.6169322",
"0.6157733",
"0.6146727",
"0.6108626",
"0.61053544",
"0.610345",
"0.610345",
"0.610345",
"0.610345",
"0.610345",
"0.6101816",
"0.6101816",
"0.6101816",
"0.60948575",
"0.60948575",
"0.6094421",
"0.6078848",
"0.60700727",
"0.6051594",
"0.6048167",
"0.6040651",
"0.6026954",
"0.60109055",
"0.6007225",
"0.5977973",
"0.59542286",
"0.5947416",
"0.59461683",
"0.5942589",
"0.5930221",
"0.59283817",
"0.592478",
"0.59015375",
"0.5888455",
"0.5877592",
"0.58739424",
"0.5871931",
"0.587138",
"0.58704245",
"0.58646137",
"0.58594143",
"0.5854741",
"0.5852485",
"0.5841901",
"0.58394665",
"0.58367085",
"0.5832426",
"0.5829387",
"0.5822413",
"0.5815045",
"0.58144414",
"0.5812635",
"0.58057016",
"0.5804645",
"0.580292",
"0.58010584",
"0.5798529",
"0.5791532",
"0.5782805",
"0.5780622",
"0.5780622",
"0.5780622",
"0.5780622",
"0.5780622",
"0.5780622",
"0.5780622",
"0.577492",
"0.57744974",
"0.5770332",
"0.57632464",
"0.57564807",
"0.5751753",
"0.57487756",
"0.5736686",
"0.5733613",
"0.5733191",
"0.5714439",
"0.5714439",
"0.57135963",
"0.57103527",
"0.5709676",
"0.5705601",
"0.570454"
] |
0.736481
|
0
|
PATCH/PUT /card_pages/1 PATCH/PUT /card_pages/1.json
|
def update
respond_to do |format|
if @card_page.update(card_page_params)
format.html { redirect_to @card_page, notice: 'Card page was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @card_page.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @card = Card.find(params[:id])\n # @card.update(card_params)\n # render json: @card\n end",
"def update\n @card = Card.find(params[:id])\n\n if @card.update(card_params)\n head :no_content\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, sucess: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Render the object created or errors\n respond_to do |format|\n if @page.update(page_params)\n #Cache bust pages and updated page. With pagination we would only bust the cache of the page that was updated.\n Rails.cache.delete(\"pages\")\n Rails.cache.delete(\"page-#{@page.id}\")\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:page][:id])\n if current_user.id != @page.owner_id\n not_found\n end\n @page.partial_update(params)\n respond_to do |format|\n format.json {\n render partial: 'pages/page.json'\n }\n end\n end",
"def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to cards_url, :notice => 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @page_content.page, :update?\n\n respond_to do |format|\n if @page_content.update(page_content_params)\n format.json { render :show, status: :ok, location: @page_content }\n else\n format.json { render json: @page_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: \"Page was successfully updated. #{undo_link}\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page)\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n flash[:notice] = 'Card was successfully updated.'\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n # format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.html { redirect_to action: \"edit\", id: params[:id], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card.update(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end",
"def update\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n if @nested_page.update_attributes(params[:nested_page])\n format.html { redirect_to @nested_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page, :status => :updated)\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n expire_page :action => :show\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @page.update_attributes(params[:page])\n respond_with(@page)\n else\n respond_with(@page)\n end\n end",
"def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def update\n # @page = Page.new(page_params)\n\n # @page.components.build\n # @page.update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = ContentPage.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:content_page])\n @editingPage = false\n format.html { redirect_to show_content_pages_path(@page.id), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_content_pages_path(@page.id), alert: 'Unable to update Page successfully.'}\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: t(\".successfully_updated\") }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @testimonials = Testimonial.all\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n if @book_page.update_attributes(params[:book_page])\n format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", slug: @page[:page_slug], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n if @comic_page.update_attributes(params[:comic_page])\n format.html { redirect_to @comic_page, notice: 'Comic page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comic_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n if @structure_page.update_attributes(params[:structure_page])\n format.html { redirect_to @structure_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(update_page_params)\n format.html {}\n format.json {}\n\n render \"show\"\n else\n format.html { render \"show\", status: :not_acceptable }\n format.json { render json: @page.errors, status: :not_acceptable }\n end\n end\n end",
"def edit\n # Clear the page cache for this page... ?\n @page = ComatosePage.find params[:id]\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page.update_attributes(params[:page])\n @page.updated_on = Time.now\n @page.author = fetch_author_name\n if @page.save\n expire_cms_page @page\n expire_cms_fragment @page\n flash[:notice] = \"Saved changes to '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n end\n end",
"def update\n @page = current_site.pages.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to quick_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = current_cms.pages.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:big_cms_page])\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:notice] = @page.errors.full_messages.to_sentence\n format.html { render action: 'edit' }\n format.json { render json: [@page.errors.full_messages.to_sentence], status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @pages_tree[(@page.id).to_s], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to plan_path(@plan), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n if @document_page.update_attributes(params[:document_page])\n format.html { redirect_to @document_page, notice: 'Document page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to [:admin, @page], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page_page.update(page_page_params)\n format.html { redirect_to @page_page, notice: 'Page page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page_page }\n else\n format.html { render :edit }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n notify_admin(\"Card Updated (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidUpdateOfRecordJSONException }\n format.xml { raise Palani::Api::InvalidUpdateOfRecordXMLException }\n end\n end\n end",
"def update\r\n @page = Page.find(params[:id])\r\n respond_to do |format|\r\n if @page.update_attributes(params[:page])\r\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\r\n format.json { head :no_content }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n File.open(target, \"w\") do |f|\r\n f.write(@page.html)\r\n end\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @sync_page = SyncPage.find(params[:id])\n\n respond_to do |format|\n if @sync_page.update_attributes(params[:sync_page])\n format.html { redirect_to @sync_page, notice: 'Sync page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sync_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to all_pages_path(:magazine_id=>@page.magazine_id), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts \"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\"\n puts card_params\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, flash: { success: \"Updated the card!\" } }\n format.json { render json: @card, status: :ok }\n else\n format.html {\n flash[:danger] = \"Error : Failed to update card.\"\n render :edit\n }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @page\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to admin_subject_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @m_card.update(m_card_params)\n format.html { redirect_to @m_card, notice: 'M card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n end",
"def update\n @page = current_site.pages.find(params[:id])\n @site = @page.site\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.json { respond_with_bip(@page) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@page) }\n end\n end\n end",
"def update\n @card = @deck.cards.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: deck_card_path(@deck, @card) }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry_card.update(entry_card_params)\n format.html { redirect_to @entry_card, notice: 'Entry card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @page\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @page_object.update_attributes(params[:page_object])\n flash[:notice] = 'PageObject was successfully updated.'\n format.html { redirect_to(@page_object) }\n format.xml { head :ok }\n format.tson { head :ok }\n else\n render_to_page_object\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_object, :status => :unprocessable_entity }\n format.tson { render :json => @page_object, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Tarjeta Actualizada Satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(@card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xmll => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.section_id = params[:section_id] unless params[:section_id].nil? \n @page.title = params[:title] unless params[:title].nil? \n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n #ormat.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n \n Rails.logger.info \"ID: #{params[:id]}\"\n Rails.logger.info \"BODY: #{params[:page][:body].inspect}\"\n\n # Convert <div> line breaks to <p>\n params[:page][:body] = params[:page][:body].gsub(/\\<div\\>/, '<p>')\n params[:page][:body] = params[:page][:body].gsub(/\\<\\/div\\>/, '</p>')\n params[:page][:body] = params[:page][:body].gsub(/\\<p\\>\\<br\\>\\<\\/p\\>/, '')\n params[:page][:body] = params[:page][:body].gsub(/\\<br\\>/, '')\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n Rails.logger.info \"UPDATED PAGE!\"\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :json => @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n if @oasis_page.update_attributes(params[:oasis_page])\n format.html { redirect_to @oasis_page, notice: 'Oasis page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oasis_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@page = Page.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @page.update_attributes(params[:page])\n\t\t\t\tformat.html { redirect_to @page, notice: 'Boom, page 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: @post.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_detail.update(card_detail_params)\n format.html { redirect_to @card_detail, notice: 'Card detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_detail }\n else\n format.html { render :edit }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(pages_path, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n format.html { redirect_to @cms_page, notice: 'Cms page was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = current_user.pages.find(params[:id])\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to page_path(@page) }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @extra_page.update(extra_pages_params)\n format.html { redirect_to @extra_page, notice: 'Your Extra Pages were successfully updated.' }\n format.json { render :show, status: :ok, location: @extra_page }\n else\n format.html { render :edit }\n format.json { render json: @extra_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Cartão atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n format.html { redirect_to @cms_page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @side_card.update(side_card_params)\n format.html { redirect_to @side_card, notice: 'Side card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @side_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_card_page\n @card_page = CardPage.find(params[:id])\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find_by_slug(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n flash[:notice] = 'Page was successfully updated.'\n format.html { redirect_to @page.get_page_path }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @enq_page = EnqPage.find(params[:id])\n\n respond_to do |format|\n if @enq_page.update_attributes(params[:enq_page])\n format.html { redirect_to @enq_page, notice: 'Enq page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enq_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mypage = Mypage.find(params[:id])\n\n respond_to do |format|\n if @mypage.update_attributes(params[:mypage])\n format.html { redirect_to @mypage, notice: 'Mypage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mypage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n if @pages_article.update_attributes(params[:pages_article])\n format.html { redirect_to @pages_article, notice: 'Pages article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pages_article.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.664527",
"0.65790606",
"0.65553373",
"0.65426314",
"0.6520077",
"0.650799",
"0.65025777",
"0.6496636",
"0.64962256",
"0.64962256",
"0.6493549",
"0.6491924",
"0.6478084",
"0.6478084",
"0.6450186",
"0.63840544",
"0.6378237",
"0.637506",
"0.637506",
"0.637506",
"0.6363867",
"0.63535833",
"0.63460016",
"0.63345796",
"0.6334166",
"0.63188696",
"0.63125247",
"0.6310241",
"0.63085526",
"0.63085526",
"0.6301059",
"0.62901497",
"0.6283246",
"0.6277782",
"0.6268583",
"0.6264648",
"0.62448084",
"0.6238822",
"0.6232632",
"0.6223732",
"0.62054455",
"0.6202407",
"0.6194733",
"0.6191747",
"0.61863667",
"0.61863667",
"0.61863667",
"0.61863667",
"0.61863667",
"0.61863667",
"0.61746657",
"0.6174245",
"0.6171369",
"0.6166083",
"0.615318",
"0.6152898",
"0.6144378",
"0.6132608",
"0.6132214",
"0.612085",
"0.61167717",
"0.6107841",
"0.6104535",
"0.6102802",
"0.61018485",
"0.61018485",
"0.61018485",
"0.61018485",
"0.60968095",
"0.609413",
"0.6086394",
"0.6084189",
"0.6083319",
"0.6068833",
"0.6065759",
"0.6063071",
"0.6056772",
"0.605533",
"0.6053468",
"0.60452193",
"0.60329056",
"0.6030575",
"0.6027745",
"0.6009524",
"0.6007333",
"0.6001314",
"0.6001153",
"0.599203",
"0.5990417",
"0.59890956",
"0.5976629",
"0.59737045",
"0.5970304",
"0.5964613",
"0.59566146",
"0.59566146",
"0.59489024",
"0.5947275",
"0.59313047",
"0.59277517"
] |
0.7415093
|
0
|
DELETE /card_pages/1 DELETE /card_pages/1.json
|
def destroy
@card_page.destroy
respond_to do |format|
format.html { redirect_to card_pages_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @card.destroy\n\n head :no_content\n end",
"def destroy\n # @card = Card.destroy(params[:id])\n # render json: 200\n end",
"def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comic_page = ComicPage.find(params[:id])\n @comic_page.destroy\n\n respond_to do |format|\n format.html { redirect_to comic_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.update!(deleted_at: Time.now)\n head :no_content\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @page = @chapter.pages.find_by_number(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to manga_chapter_url(@manga, @chapter) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry_card.destroy\n respond_to do |format|\n format.html { redirect_to entry_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.delete\n render json: {messsage: \"Movie/Series Card was successfully deleted.\"}, status: 204\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n head :no_content\n end",
"def destroy\r\n @page = Page.find(params[:id])\r\n @page.destroy\r\n File.delete(\"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\")\r\n respond_to do |format|\r\n format.html { redirect_to pages_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n #@card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url, :notice => 'Card successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mypage = Mypage.find(params[:id])\n @mypage.destroy\n\n respond_to do |format|\n format.html { redirect_to mypages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oasis_page = OasisPage.find(params[:id])\n @oasis_page.destroy\n\n respond_to do |format|\n format.html { redirect_to oasis_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, :notice => \"Successfully deleted page. #{undo_link}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find_by_slug(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n set_m_card\n @m_card.destroy\n respond_to do |format|\n format.html { redirect_to m_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to tarot_cards_path(@tarot) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @structure_page = Structure::Page.find(params[:id])\n @structure_page.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inden_card.destroy\n respond_to do |format|\n format.html { redirect_to inden_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nested_page = Nested::Page.find(params[:id])\n @nested_page.destroy\n\n respond_to do |format|\n format.html { redirect_to nested_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n \n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: t(\".successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to plan_path(@plan) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.friendly.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_page.destroy\n respond_to do |format|\n format.html { redirect_to page_pages_url, notice: 'Page page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_fetch = PageFetch.find(params[:id])\n @page_fetch.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_fetches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n notify_admin(\"Card Removed (#{@card.last_three_digits})\", @card.as_json)\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @five_card = FiveCard.find(params[:id])\n @five_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(five_card_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to all_pages_path(:magazine_id=>@page.magazine_id), notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_page.destroy\n respond_to do |format|\n format.html { redirect_to story_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Tarjeta Creada Satisfactoriamente' }\n format.json { render :show, status: :ok, location: @card }\n end\n end",
"def destroy\n @pk_card.destroy\n respond_to do |format|\n format.html { redirect_to pk_cards_url, notice: 'Pk card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_cardapio = ItemCardapio.find(params[:id])\n @item_cardapio.destroy\n\n respond_to do |format|\n format.html { redirect_to item_cardapios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enq_page = EnqPage.find(params[:id])\n @enq_page.destroy\n\n respond_to do |format|\n format.html { redirect_to enq_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n respond_with(@page)\n end",
"def destroy\n @bizcard = Bizcard.find(params[:id])\n @bizcard.destroy\n\n respond_to do |format|\n format.html { redirect_to bizcards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_page = TestPage.find(params[:id])\n @test_page.destroy\n\n respond_to do |format|\n format.html { redirect_to test_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n respond_with(@page, :status => :deleted, :location => pages_path)\n end",
"def destroy\n card = Card.find( params[:id] )\n card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @side_card.destroy\n respond_to do |format|\n format.html { redirect_to side_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sync_page = SyncPage.find(params[:id])\n @sync_page.destroy\n\n respond_to do |format|\n format.html { redirect_to sync_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cd_page = CdPage.find(params[:id])\n @cd_page.destroy\n\n respond_to do |format|\n format.html { redirect_to(cd_pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_path(page: params[:page], type: params[:type]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end",
"def destroy\n @card_detail.destroy\n respond_to do |format|\n format.html { redirect_to card_details_url, notice: 'Card detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: 'Cms page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.card_parameters.destroy_all\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :destroy, @page\n @page.destroy\n respond_to do |format|\n format.html { redirect_to request.referer || pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} destroyed \\\"#{@card.story}\\\" Card\"\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @profilepage = Profilepage.find(params[:id])\n @profilepage.destroy\n\n respond_to do |format|\n format.html { redirect_to profilepages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if Card.find(params[:id]).destroy\n format.html { redirect_to cards_path, notice: \"Card deleted!\" }\n format.json { head :no_content }\n else\n format.html {\n flash[:danger] = \"Error : Failed to delete card.\"\n render :index\n }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @page = current_cms.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_cms_pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7245162",
"0.72355306",
"0.723355",
"0.7231964",
"0.7225608",
"0.7199854",
"0.7173993",
"0.7173993",
"0.7173993",
"0.71704423",
"0.71704423",
"0.71704423",
"0.71704423",
"0.7169213",
"0.7169213",
"0.7169213",
"0.7169213",
"0.7169213",
"0.7169213",
"0.7169213",
"0.7169213",
"0.7154861",
"0.7154392",
"0.7150364",
"0.7150364",
"0.7150364",
"0.71182525",
"0.71035653",
"0.7079484",
"0.7066952",
"0.70613533",
"0.7055043",
"0.7048634",
"0.7036159",
"0.7032097",
"0.7018634",
"0.70033437",
"0.6986892",
"0.69861007",
"0.69826764",
"0.6980679",
"0.69748217",
"0.6947853",
"0.6930135",
"0.69264275",
"0.69264275",
"0.69264275",
"0.69264275",
"0.69264275",
"0.69264275",
"0.69264275",
"0.69264275",
"0.6909068",
"0.6897916",
"0.6897113",
"0.68751216",
"0.6874839",
"0.6871707",
"0.6871707",
"0.6871707",
"0.6871707",
"0.6871707",
"0.6871707",
"0.6871707",
"0.6871485",
"0.68693906",
"0.68623",
"0.6855116",
"0.68463504",
"0.6841934",
"0.68402773",
"0.6836484",
"0.6826904",
"0.68245554",
"0.68177944",
"0.68051267",
"0.6804455",
"0.68012816",
"0.67999697",
"0.6798139",
"0.67947495",
"0.67934614",
"0.67928994",
"0.6792323",
"0.6792069",
"0.67847145",
"0.6779682",
"0.67702883",
"0.67685336",
"0.6767929",
"0.6766494",
"0.6764499",
"0.675612",
"0.67555505",
"0.6749842",
"0.6749842",
"0.6749842",
"0.6749842",
"0.6749842",
"0.6749842"
] |
0.8014684
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_card_page
@card_page = CardPage.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 card_page_params
params.require(:card_page).permit(:name, :link)
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
|
As a traveler, I'd like to visit a number towns while only driving a set number of miles, so that I don't fall asleep at the wheel. Scope number of towns will vary (k) number of miles will very (t) list of towns and miles between will be provided (ls) Acceptance Criteria return the number of miles to visit three towns number of miles must be less then set number first part has a prefix to get the rotate return nil if conditions cannot be met
|
def choose_best_sum(miles, towns, list)
list.combination(towns)
.map { |path| path.inject(:+) }
.select { |sum| sum <= miles }
.max
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def game_trains\n trains = build_train_list({\n '2' => 0,\n '3' => 0,\n '4' => 0,\n '5' => 0,\n '6' => 0,\n '7' => 0,\n '3T' => 0,\n 'U3' => 0,\n '2+2' => 0,\n '4T' => 0,\n '4+4E' => 0,\n })\n\n case @units.keys.sort.map(&:to_s).join\n when '1'\n add_train_list(trains, { '2' => 6, '3' => 4, '4' => 3, '5' => 4 })\n when '2'\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 2, '5' => 3, '6' => 2 })\n when '3'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 1, '5' => 3, '7' => 2, '3T' => 1, 'U3' => 1 })\n when '12'\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 4, '5' => 5, '6' => 2, '7' => 0 })\n when '23'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 5, '4' => 4, '5' => 6, '7' => 2, '3T' => 1, 'U3' => 1 })\n else # all units\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 5, '5' => 6, '6' => 2, '7' => 2, '3T' => 1, 'U3' => 1 })\n end\n\n add_train_list(trains, { '3T' => 2, 'U3' => 2 }) if @optional_rules.include?(:u3p)\n add_train_list(trains, { 'U3' => 1, '4T' => 1 }) if @regionals[1]\n add_train_list(trains, { '5' => 1 }) if @regionals[2]\n add_train_list(trains, { '4T' => 1 }) if @regionals[3]\n add_train_list(trains, { '5' => -1, '6' => 3, '7' => 2 }) if @kits[3]\n add_train_list(trains, { '5' => 1, '3T' => 1 }) if @kits[5]\n add_train_list(trains, { '2+2' => 1 }) if @kits[7]\n\n # handle K2\n if @kits[2]\n case @units.keys.sort.map(&:to_s).join\n when '1', '2'\n add_train_list(trains, { '3T' => 3, 'U3' => 1, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1 }) if @kits[3]\n when '12'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n when '23'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '5' => -1 }) if @kits[3]\n when '123'\n add_train_list(trains, { '3T' => 5, 'U3' => 3, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n end\n end\n\n fix_train_availables(trains)\n\n trains\n end",
"def eval_res_distances\n self.greater_than_twenty_away = (self.position_one - self.position_two).abs > 20\n self.greater_than_50_away = (self.position_one - self.position_two).abs > 50\n self.greater_than_100_away = (self.position_one - self.position_two).abs > 100\n self.greater_than_200_away = (self.position_one - self.position_two).abs > 200\n self.greater_than_300_away = (self.position_one - self.position_two).abs > 300\n self.greater_than_400_away = (self.position_one - self.position_two).abs > 400\n self.greater_than_500_away = (self.position_one - self.position_two).abs > 500\n self.greater_than_600_away = (self.position_one - self.position_two).abs > 600\n self.greater_than_700_away = (self.position_one - self.position_two).abs > 700\n self.greater_than_800_away = (self.position_one - self.position_two).abs > 800\n self.greater_than_900_away = (self.position_one - self.position_two).abs > 900\n self.greater_than_1000_away = (self.position_one - self.position_two).abs > 1000\n self.greater_than_1100_away = (self.position_one - self.position_two).abs > 1100\n self.greater_than_1200_away = (self.position_one - self.position_two).abs > 1200\n self.greater_than_1300_away = (self.position_one - self.position_two).abs > 1300\n self.greater_than_1400_away = (self.position_one - self.position_two).abs > 1400\n self.greater_than_1500_away = (self.position_one - self.position_two).abs > 1500\n self.greater_than_1600_away = (self.position_one - self.position_two).abs > 1600\n self.greater_than_1700_away = (self.position_one - self.position_two).abs > 1700\n self.greater_than_1800_away = (self.position_one - self.position_two).abs > 1800\n self.greater_than_1900_away = (self.position_one - self.position_two).abs > 1900\n self.greater_than_2000_away = (self.position_one - self.position_two).abs > 2000\n self.greater_than_2100_away = (self.position_one - self.position_two).abs > 2100\n self.greater_than_2200_away = (self.position_one - self.position_two).abs > 2200\n self.greater_than_2300_away = (self.position_one - self.position_two).abs > 2300\n self.greater_than_2400_away = (self.position_one - self.position_two).abs > 2400\n self.greater_than_2500_away = (self.position_one - self.position_two).abs > 2500\n self.save\n end",
"def check_train_wagons\n passenger_trains_amount = 0\n cargo_amount = 0\n @trains.each_value do |train|\n train.type == 'cargo' ? cargo_amount += 1 : passenger_trains_amount += 1\n end\n passenger_matches(passenger_trains_amount) || cargo_matches(cargo_amount)\n end",
"def min_refuel array_of_gas_station, total_distance, l_km\r\n\tt1 = Time.now\r\n\ttotal_refuel = 0\r\n\trefueld_at = []\r\n\tcan_travel = l_km\r\n\tflag = \"yes\"\r\n\tarray_of_gas_station.each_with_index do |arr,index|\r\n\t\tif arr > can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << (index-1)\r\n\t\telsif arr == can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << index\r\n\t\tend\r\n\tend\r\n\trefueld_at.each_with_index do |arr, i|\r\n\t\tif refueld_at[i] == refueld_at[i+1] || refueld_at[i] < 0\r\n\t\t\tflag = \"no\"\r\n\t\tend\r\n\tend\r\n\tif flag.eql? \"yes\"\r\n\t\tt2 = Time.now\r\n\t\tp \"total refuel : #{total_refuel}\"\r\n\t\tp \"refueled at : #{refueld_at}\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\telse\r\n\t\tt2 = Time.now\r\n\t\tp \"can't travel\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\tend\r\nend",
"def waypoints_must_be_at_most_n_km_apart\n self.waypoints_minus_removed.each do |waypoint|\n next if waypoint.parent_index.nil? || waypoint.parent_index < 0 || waypoint.parent_index == waypoint.local_index\n parent = waypoints_minus_removed[waypoint.parent_index]\n if !parent.nil? && type == 'Road' && waypoint.dist(parent.latitude, parent.longitude) > 50\n\tputs \"cannot be more than 50km apart.\"\n errors.add(:waypoints, \"cannot be more than 50km apart.\")\n elsif !parent.nil? && type != 'Road' && waypoint.dist(parent.latitude, parent.longitude) > 20\n\tputs \"cannot be more than 20km apart.\"\n errors.add(:waypoints, \"cannot be more than 20km apart.\")\n end\n end\n end",
"def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend",
"def optimize_for_location(params)\n flight_floor = params[:flight_floor] || 5000 #meters\n flight_ceiling = params[:flight_ceiling] || 60000 #meters\n\n #verify parameters\n params = params.with_indifferent_access\n\n raise 'No start altitude (params[:start][:altitude])' unless params[:start][:altitude].present?\n raise 'No start latitude (params[:start][:lat])' unless params[:start][:lat].present?\n raise 'No start longitude (params[:start][:lon])' unless params[:start][:lon].present?\n raise 'No start time (params[:start][:time])' unless params[:start][:time].present?\n\n raise 'No finish latitude (params[:finish][:lat])' unless params[:finish][:lat].present?\n raise 'No finish longitude (params[:finish][:lon])' unless params[:finish][:lon].present?\n\n # creates a filter lambda to check that any path passes certain conditions\n filter = lambda {|node, previous|\n node.altitude < flight_ceiling &&\n node.altitude > flight_floor &&\n # (!x || y) checks y only if x is true\n (!params[:use_faa] || node.faa_zones_approx(previous)) && #no restricted zones\n (!params[:check_countries] || node.countries(previous))\n }\n\n #run the search with the provided start, duration, and performance factor\n greedy_search({\n start: Node.from_pos(\n params[:start][:lat].to_f, params[:start][:lon].to_f,\n params[:start][:altitude].to_f, params[:start][:time]\n ),\n finish: Node.from_pos(\n params[:finish][:lat].to_f, params[:finish][:lon].to_f,\n params[:start][:altitude].to_f, params[:start][:time]\n ),\n movement_cost: lambda {|current|\n #vent / ballast costs are proportional to the square of the altitude change\n (current.parent.altitude - current.altitude).abs/1200000.0\n },\n heuristic: lambda {|current|\n ((current.parent.lon - current.lon) / Prediction::time_variance)\n },\n neighbors: lambda {|current|\n current.neighbors(filter)\n },\n build_from_finish: lambda{|finish|\n finish.build_chain\n },\n timeout: params[:timeout],\n performance: params[:performance]\n })\n\n end",
"def truckin(trucks, mileage)\n distance = 0\n while trucks >= 1\n distance += (mileage.to_f / trucks)\n trucks -= 1\n end\n distance\nend",
"def provide_mortgage_3?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05\n max_multiplier = 5 # how many annual income can be borrowed\n deposit >= property_value * min_deposit && (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def uberXL_fare_calculator(distance, minutes)\n base_fareXL = 3.85\n xlTotal = base_fareXL + (0.50 * minutes.to_i) + (2.85 * distance.to_i)\n if xlTotal < 10.50\n puts 10.50\n else\n puts \"The total for an UberXL is #{xlTotal}\"\n end\nend",
"def provide_mortgage_3?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def traveling_time(distance)\n \n hour = Time.new.hour\n bus_speed = 0\n taxi_speed = 0\n \n # vehicle speeds depend on time of day\n case hour\n when 5..8\n bus_speed = 0.6 # km/minute 30km/hour\n \n when 9..13\n bus_speed = 0.5\n \n when 14..16\n bus_speed = 0.6\n \n when 17..20\n bus_speed = 0.4\n \n when 21..23\n bus_speed = 0.8\n \n when 0..4\n bus_speed = 0.000001\n end\n\n case hour\n when 5..8\n taxi_speed = 0.9 # km/minute 30km/hour\n \n when 9..13\n taxi_speed = 0.8\n \n when 14..16\n taxi_speed = 0.9\n \n when 17..20\n taxi_speed = 0.6\n \n when 21..23\n taxi_speed = 0.9\n \n when 0..4\n taxi_speed = 1.0\n end\n \n time_taken_in_bus = distance.to_f / bus_speed.to_f\n time_taken_in_taxi = distance.to_f / taxi_speed.to_f\n return time_taken_in_bus #, time_taken_in_taxi\nend",
"def nearby_metros(miles=400)\n return nil unless self.lat and self.lng\n puts \"within 30 miles of #{self.lat}/#{self.lng}\"\n Metro.find(:all, :origin => [self.lat,self.lng],:within=>miles,:order=>'distance')\n end",
"def guide(from, to, unit_type=nil, max_depth=400)\n return nil if @map.blocked?(from, unit_type) || @map.blocked?(to, unit_type)\n from_element = PathElement.new(from)\n from_element.dist_from = @map.distance(from,to)\n open = PrioritySet.new\n open.push from_element, from_element.rating\n closed = SplayTreeMap.new\n step = 0\n\n until open.empty? || step > max_depth\n step += 1\n\n current_element = open.pop\n @nodes_considered += 1\n\n loc = current_element.location\n if @map.cost(loc,to) == 0\n path = []\n until current_element.parent.nil?\n path.unshift current_element\n current_element = current_element.parent\n end\n\n return path\n else\n closed.push loc, current_element\n @map.neighbors(loc).each do |next_door|\n if closed.has_key? next_door\n next\n end\n \n el = PathElement.new(next_door,current_element)\n\n if @map.blocked? next_door, unit_type\n closed.push el.location, el\n else\n current_rating = current_element.cost_to + @map.cost(loc, next_door)\n\n # add to open\n el.cost_to = current_rating\n el.dist_from = @map.distance(next_door,to)\n el.reset_rating\n\n open.push el, el.rating\n end\n end\n end\n end\n nil\n end",
"def taxi_fare_rate_calculation(distance_travelled, booking_fee)\n \n #basic flag down fee is $2.8\n flag_down_fee = 2.8\n hour = Time.new.hour\n \n # if booking fee exists, how much is it depends on what time of day it is.\n if booking_fee\n case hour\n when 7..9\n flag_down_fee = 3.5 + 2.8\n \n when 17..23\n flag_down_fee = 3.5 + 2.8\n end\n end\n \n case hour\n when 7..9\n taxi_fare_per_km = (1.35 * flag_down_fee.to_f) / distance_travelled.to_f + (1.35 * 0.519480519)\n \n when 10..16\n taxi_fare_per_km = (flag_down_fee.to_f / (distance_travelled.to_f - 1)) + 0.519480519\n \n when 17..19\n taxi_fare_per_km = (1.35 * flag_down_fee.to_f) / distance_travelled.to_f + (1.35 * 0.519480519)\n \n when 20..23\n taxi_fare_per_km = (flag_down_fee.to_f / (distance_travelled.to_f - 1)) + 0.519480519\n \n when 0..5\n taxi_fare_per_km = (1.5 * flag_down_fee.to_f) / distance_travelled.to_f + (1.5 * 0.519480519)\n \n when 6\n taxi_fare_per_km = (flag_down_fee.to_f / (distance_travelled.to_f - 1)) + 0.519480519\n end\n \n return taxi_fare_per_km\nend",
"def getF326FlowRates( elements )\n locationText = \"HouseFile/House/Ventilation/Rooms\"\n roomLabels = [ \"living\", \"bedrooms\", \"bathrooms\", \"utility\", \"otherHabitable\" ]\n ventRequired = 0\n roomLabels.each do |roommName|\n if(roommName == \"living\" || roommName == \"bathrooms\" || roommName == \"utility\" || roommName == \"otherHabitable\")\n numRooms = elements[locationText].attributes[roommName].to_i\n ventRequired += (numRooms*5)\n #print \"Room is \",roommName, \" and number is \",numRooms, \". Total vent required is \", ventRequired, \"\\n\"\n elsif(roommName == \"bedrooms\")\n numRooms = elements[locationText].attributes[roommName].to_i\n if(numRooms >= 1)\n ventRequired += 10\n if(numRooms > 1)\n ventRequired += ((numRooms-1)*5)\n end\n end\n #print \"Room is \",roommName, \" and number is \",numRooms, \". Total vent required is \", ventRequired, \"\\n\"\n end\n end\n\n # If there is a basement, add another 10 L/s\n if(elements[\"HouseFile/House/Components/Basement\"] != nil)\n ventRequired += 10\n #print \"Room is basement. Total vent required is \", ventRequired, \"\\n\"\n end\n #print \"Final total vent required is \", ventRequired, \"\\n\"\n return ventRequired\nend",
"def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n !bankrupt && deposit >= property_value * min_deposit && \n (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def plan_trip(stop1, line1, stop2, line2)\n\n trains = {\n \"N\" => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"],\n \"L\" => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n \"6\" => [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\n\n transfer = \"Union Square\" #DEFAULT TRANSFER STATION\n if line1 != line2 && stop1 == \"Union Square\" #PREVENTS BOARDING THE WRONG TRAIN AT UNION SQUARE\n puts \"Just board the correct train.\"\n line1 = line2\n end\n if line1 == line2 #there may be a clearer way to do this, but this allows a single train line output\n transfer = stop2\n end\n\n route1 = trains[line1] #this is just for readability\n route2 = trains[line2]\n\n if route1.index(stop1) < route1.index(transfer) #this always fires, and is either the only or first segment\n first_path = route1[(route1.index(stop1) + 1)..(route1.index(transfer))]\n puts \"You must travel through the following stops on the #{line1} line: #{first_path.join(\", \")}.\"\n else\n uptown = route1.reverse()\n first_path = uptown[(uptown.index(stop1) + 1)..(uptown.index(transfer))]\n puts \"You must travel through the following stops on the #{line1} line: #{first_path.join(\", \")}.\"\n end\n if line2 == line1\n puts \"A total of #{first_path.length} stops.\"\n end\n\n if line1 != line2 #this only fires if there's a second line\n puts \"Transfer at Union Square.\"\n if route2.index(\"Union Square\") < route2.index(stop2)\n second_path = route2[(route2.index(\"Union Square\") + 1)..(route2.index(stop2))]\n puts \"You must continue through the following stops on the #{line2} line: #{second_path.join(\", \")}.\"\n else\n uptown = route2.reverse()\n second_path = uptown[(uptown.index(\"Union Square\") + 1)..(uptown.index(stop2))]\n puts \"You must continue through the following stops on the #{line2} line: #{second_path.join(\", \")}.\"\n end\n puts \"A total of #{first_path.length + second_path.length} stops.\"\n end\n\nend",
"def miles\n# 1 meter = 0.000621371 miles\n if self.u == 'meters'\n self.distance * 0.000621371\n elsif self.u == 'miles' # mile in mile\n self.distance\n# 1 kilometer = 0.621371 miles\n elsif self.u == 'kilometers'\n self.distance * 0.621371\n# 1 yard = 0.000568182 miles\n elsif self.u == 'yards'\n self.distance * 0.000568182\n end\n end",
"def min_refills(x,n,L)\n\t# total number of refills done so far\n\tnum_refills = 0\n\t# the stop from where we are evaluating whether or not to refill \n\tcurrent_stop = 0\n\n\t# while there are still stops on the road\n\twhile current_stop <= n\n\t\t# last stop where added gas\n\t\tlast_stop_refill = current_stop\n\n\t\t# we check is there are still stops to make\n\t\t# we check if the difference between the next stop and the last stop where \n\t\twhile (current_stop <= n && x[current_stop + 1] - x[last_stop_refill] < L)\n\t\t\tcurrent_stop += 1\n\t\tend\n\n\t\t# if the curren stop did not change meaning that we never entered the previous loop\n\t\t# means that the next stop was too far away and we could no reach it so the trip is imposible\n\t\tif current_stop == last_stop_refill\n\t\t\treturn \"impossible trip\"\n\t\tend\n\n\t\t# if we get here means that there is a new stop where we refilled and we can up the \n\t\t# count if there are still stops to go\n\t\tif current_stop <= n\n\t\t\t# We could also keep track of the path in here\n\t\t\tnum_refills += 1\n\t\tend\n\tend\n\n\tnum_refills\nend",
"def getShortFlight(csa)\n number2 = 10000000\n @parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element|\n number1 = element[\"distance\"]\n if(number1<number2)\n number2 = number1\n end\n end\n airport[\"destinations\"].map{ |dest| \n if(number2==dest[\"distance\"])\n puts \"The min distance is \" + number2.to_s + \" in the fligth between \"+ dest[\"ports\"].to_s\n end\n }\n end\n }\n end",
"def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend",
"def guide(from, to, unit_type=nil, max_depth=400)\n return nil if @map.blocked?(from, unit_type) || @map.blocked?(to, unit_type)\n from_element = PathElement.new(from)\n from_element.dist_from = @map.distance(from,to)\n open = PriorityQueue.new { |x, y| (x <=> y) == -1 }\n open.push from_element, from_element.rating\n closed = SplayTreeMap.new\n step = 0\n \n until open.empty? || step > max_depth\n step += 1\n \n current_element = open.pop\n @nodes_considered += 1\n \n loc = current_element.location\n if @map.cost(loc,to) == 0\n path = []\n until current_element.parent.nil?\n path.unshift current_element\n current_element = current_element.parent\n end\n\n return path\n else\n closed.push loc, current_element\n @map.neighbors(loc).each do |next_door|\n next if closed.has_key? next_door\n\n el = PathElement.new(next_door,current_element)\n\n if @map.blocked? next_door, unit_type\n closed.push el.location, el\n else\n current_rating = current_element.cost_to + @map.cost(loc, next_door)\n\n # add to open\n el.cost_to = current_rating\n el.dist_from = @map.distance(next_door,to)\n \n open.push el, el.rating\n end\n end\n end\n end\n nil\n end",
"def provide_mortgage_2?(salary, deposit, property_value)\n loan_amount = property_value - deposit\n property_value >= 650000 ? min_deposit = 0.2 : min_deposit = 0.05 # 20%\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && \n salary * max_multiplier >= loan_amount\nend",
"def getLongFlight(csa)\n number2 = 0\n @parse.map{ |airport| \n if( airport[\"name\"] == csa) \n airport[\"destinations\"].map do |element|\n number1 = element[\"distance\"]\n if(number1>number2)\n number2 = number1\n end\n end\n airport[\"destinations\"].map{ |dest| \n if(number2 == dest[\"distance\"])\n puts \"The max distance is \" + number2.to_s + \" in the fligth between \"+ dest[\"ports\"].to_s\n end\n }\n end\n }\n end",
"def match_journey_start(category, ivds, quantity)\n case category.meta.wikiname\n when \"Great_Circle_flight_methodology\", \"Specific_jet_aircraft\", \"Specific_turboprop_aircraft\"\n {ivds.find{|x| x.path == 'IATACode1'} => quantity.split(':')[1]}\n when \"Train_Route\"\n {ivds.find{|x| x.path == 'station1'} => quantity.split(':')[1]}\n else\n {}\n end\n end",
"def take_passengers(n) \n return false if (n > 3 || n < 0)\n return true\n end",
"def check5(pmt)\n pmt > 5\nend",
"def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend",
"def provide_mortgage_2?(salary, deposit, property_value) \n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05 # ternary operator: expr ? value_if_true : value_if_false\n max_multiplier = 5 # how many annual incomes can be borrowed\n deposit >= property_value * min_deposit && salary * max_multiplier >= loan_amount\nend",
"def if_goal_reachable(num_gas_stand, course_distance, init_gas_amount, gas_stand_spot, gas_amounts)\n track = Track.new(init_gas_amount)\n gas_stand_spot.each_with_index do |dist, index|\n print \"index: #{index}, dist: #{dist}\\n\"\n track.run(dist - track.location)\n while track.check_gasoline_necessary\n if_successful = track.consume_gasoline\n print \"gasoline_necessary. consume gasoline_successful? #{if_successful}\\n\"\n return -1 unless if_successful\n end\n track.gasoline_right_provided(gas_amounts[index])\n end\n\n # From last gas stop to the goal\n track.run(course_distance - track.location)\n if track.check_gasoline_necessary\n if_successful = track.consume_gasoline\n return -1 unless if_successful\n end\n print \"gas_station_used: #{track.show_gas_station_used}\\n\"\n return track.count_gas_stand_used\nend",
"def trucking(trucks, distance)\n running_sum = 0\n\n current_sum = 0\n\n while (trucks > 0)\n #strictly greater than is 432. Greater than or equal to is 482.\n #actual answer is around 450. Could add with smaller increments and not\n #use integers\n until (current_sum > distance/trucks)\n current_sum += 1\n running_sum += 1\n end\n\n current_sum = 0\n trucks -= 1\n end\n\n return running_sum\nend",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n\n#Method should be able to have add greater speed to to pop density numbers that are lower then each other at increments of 50.\n#steps \n# if @population_density >= 200\n# speed += 0.5\n# elsif @population_density >= 150\n# speed += 1\n# elsif @population_density >= 100\n# speed += 1.5\n# elsif @population_density >= 50\n# speed += 2\n# else\n# speed += 2.5\n# end\n\n\n# puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n# end\n\n# end\n speedhash1 = {0..49 => 2.5, 50..99 => 2.0, 100..149 => 1.5, 150..199 => 1.0, 200..103589999 => 0.5}\n speedhash1.each do |range, speed|\n if (range).include?(@population_density.floor)\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end\n end\n\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def list_of_trains_based_on_direction\n #put puts a list of train stations based on the rail line chosen\n list_stations_from_direction(@get_line)\n\n #receives the input from user to select from an available list of stations based on a rail line\n get_station = gets.strip.to_i\n\n if !get_station.between?(1, @station.length)\n puts \"Lets try this again:\"\n list_of_trains_based_on_direction\n else\n list_trains_from_station_and_dir(get_station)\n end\n end",
"def take_passengers(n) \n return false if (n > 7 || n < 0)\n return true\n end",
"def ftks\n limit = 50\n result = 0\n # these are the correct right angles\n result += limit * limit * 3\n # these are the ones on their side\n (1..limit).each do |i|\n result += i / 2 * 2\n end\n # there are some on their little angles\n (2..limit).each do |long|\n (1..(long - 1)).each do |tall|\n gcd = intGCDInts long, tall\n longd, talld = long / gcd, tall / gcd\n maxn = ((limit - long) / talld > tall / longd ? tall / longd : (limit - long) / talld)\n minn = (long / talld > (limit - tall) / longd ? (limit - tall) / longd : long / talld)\n # p \"(#{long}, #{tall}) => (#{longd}, #{talld}) : #{maxn} + #{minn}\"\n result += (maxn + minn) * 2\n end\n end\n result\nend",
"def optimized_ranking sample, n, theta_target=1\n k = 3\n q = 5\n max_q = n / 4\n step_q = 10\n last_theta = n\n theta, s = calculate_theta(sample, k, n, q)\n\n while (theta > theta_target or theta < last_theta or q < max_q) do\n return s if (theta <= theta_target)\n\n if (theta >= last_theta)\n # effectiveness declining so try next k\n k += 1\n q -= step_q\n last_theta = n\n else\n # try next q\n q += step_q\n last_theta = theta\n end\n\n theta, s = calculate_theta(sample, k, n, q)\n end\n\n s\n end",
"def get_from_direction(fromsc,tosc)\n ((fromsc.number < tosc.number) ? ARTERY[:sc1] : ARTERY[:sc2])[:from_direction] \nend",
"def route_length_in_miles_not_rounded\n departure_airport.distance_from(arrival_airport)\n end",
"def trip_with_maximum_stops(from_city,to_city,max_stops,has_exact=false,max_distance=0)\n max_stops = max_stops.to_i + 1\n max_distance = max_distance.to_i\n # store the intermediate cities in Queue\n intermedite_cities = Queue.new\n\n # Store the start city\n intermedite_cities.push [from_city,from_city]\n\n all_possible_routes = []\n\n #Find routes\n until intermedite_cities.empty?\n #pop up the first element in queue\n city = intermedite_cities.pop\n if max_distance> 0\n has_maximum_or_equal_stops = parse_and_find_distance(city.last).to_i < max_distance\n else\n has_maximum_or_equal_stops = has_exact ? (city.last.split('-').size ==max_stops) : (city.last.split('-').size <=max_stops)\n end\n\n # Add the reached route in array\n if city.first == to_city && has_maximum_or_equal_stops && city.last.split('-').size > 1\n all_possible_routes << city.last\n next\n end\n\n #store adjucent cities in queue\n old_distance = city.last\n\n if max_distance > 0\n condition = \"parse_and_find_distance(old_distance+'-'+adjust_city.first).to_i < max_distance\"\n else\n condition = \"(max_stops >= (old_distance+'-'+adjust_city.first).split('-').size)\"\n end\n\n for adjust_city in adjucent_cities(city.first)\n if eval(condition)\n intermedite_cities.push [adjust_city.first,old_distance+'-'+adjust_city.first]\n end\n end\n \n end\n all_possible_routes\n\n end",
"def guilt_trip\n \"how much of the 10000 hours have you put\"\n end",
"def scan_fort_body\n # use a hardcoded fort layout\n cx, cy, cz = @fort_entrance.x, @fort_entrance.y, @fort_entrance.z\n sz_x, sz_y, sz_z = 35, 22, 5\n @fort_entrance.z1 = (0..cz).to_a.reverse.find { |cz1|\n (-sz_z..1).all? { |dz|\n # scan perimeter first to quickly eliminate caverns / bad rock layers\n (-sz_x..sz_x).all? { |dx|\n [-sz_y, sz_y].all? { |dy|\n t = df.map_tile_at(cx+dx, cy+dy, cz1+dz) and t.shape == :WALL and\n not t.designation.water_table and tm = t.tilemat and (tm == :STONE or tm == :MINERAL or (dz > -1 and tm == :SOIL))\n }\n } and\n [-sz_x, sz_x].all? { |dx|\n (-sz_y..sz_y).all? { |dy|\n t = df.map_tile_at(cx+dx, cy+dy, cz1+dz) and t.shape == :WALL and\n not t.designation.water_table and tm = t.tilemat and (tm == :STONE or tm == :MINERAL or (dz > -1 and tm == :SOIL))\n }\n }\n } and\n # perimeter ok, full scan\n (-sz_z..1).all? { |dz|\n (-(sz_x-1)..(sz_x-1)).all? { |dx|\n (-(sz_y-1)..(sz_y-1)).all? { |dy|\n t = df.map_tile_at(cx+dx, cy+dy, cz1+dz) and t.shape == :WALL and\n not t.designation.water_table and tm = t.tilemat and (tm == :STONE or tm == :MINERAL or (dz > -1 and tm == :SOIL))\n }\n }\n }\n }\n\n raise 'Too many caverns, cant find room for fort. We need more minerals !' if not @fort_entrance.z1\n end",
"def startstop minsize=30\n stopstop(minsize).find_all { | orf | \n codon1= orf.nt.seq[0..2].upcase\n ['ATG','TTG','CTG','AUG','UUG','CUG'].index(codon1) != nil\n }\n end",
"def can_see(mtn)\n (horizon_distance + mtn.horizon_distance) > distance_to(mtn)\n end",
"def driving (hour, total_time_of_journey)\nif hour >= total_time_of_journey\nreturn 'no one'\nend\n\nif hour % 2 == 0\nreturn @friends[1]\nelse\nreturn @friends[0]\nend\nend",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n @speed = 0.0\r\n\r\n# if @population_density >= 200\r\n# @speed += 0.5\r\n# elsif @population_density >= 150\r\n# @speed += 1\r\n# elsif @population_density >= 100\r\n# @speed += 1.5\r\n# elsif @population_density >= 50\r\n# @speed += 2\r\n# else\r\n# @speed += 2.5\r\n# end\r\n \r\n case @population_density\r\n when 0...49 then @speed += 2.5\r\n when 50...99 then @speed += 2\r\n when 100...149 then @speed += 1.5\r\n when 150...200 then @speed += 1\r\n else @speed += 0.5\r\n end\r\n puts \" and will spread across the state in #{@speed} months.\\n\\n\"\r\n end",
"def calculate_time_from_to_cost\n\n time_cost = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_price', '0')\n if time_cost != '0'\n\n # Check if the reservation correspond to the main season or not\n main_season_month_from = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.month_from', 1).to_i\n main_season_day_from = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.day_from', 1).to_i\n main_season_month_to = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.month_to', 12).to_i\n main_season_day_to = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.day_to', 31).to_i\n\n if main_season_month_from == 1 and main_season_day_from == 1 and main_season_month_to == 12 and main_season_day_to == 31\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else\n # JAN DIC\n # -------------------------------------\n # ^=======================^\n # from to\n if main_season_month_from <= main_season_month_to or \n (main_season_month_from == main_season_month_to and main_season_day_from <= main_season_day_to) \n if (@date_from.month >= main_season_month_from or \n (@date_from.month == main_season_month_from and @date_from.day >= main_season_day_from)) and\n (@date_to.month <= main_season_month_to or \n (@date_to.month == main_season_month_to and @date_to.day <= main_season_day_to)) # In main season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else # Out of season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_of_season','0').to_i\n end\n else\n # JAN DIC\n # -------------------------------------\n # ======^ ^======\n # to from\n if ((@date_from.month >= main_season_month_from or\n (@date_from.month == main_season_month_from and @date_from.day >= main_season_day_from)) or\n (@date_from.month <= main_season_month_to or \n (@date_from.month == main_season_month_to and @date_from.day <= main_season_day_to))\n ) and\n ((@date_to.month >= main_season_month_from or\n (@date_to.month == main_season_month_from and @date_to.day >= main_season_day_from)) or\n (@date_to.month <= main_season_month_to or\n (@date_to.month == main_season_month_to and @date_to.day <= main_season_day_to))) # In main season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else # Out of season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_of_season','0').to_i\n end\n end\n end\n\n #p \"timetable_id: #{timetable_id} -- main season: #{main_season_day_from}-#{main_season_month_from} #{main_season_day_to}-#{main_season_month_to}\"\n\n time_cost = BigDecimal.new(time_cost)\n if timetable_id > 0\n if timetable = ::Yito::Model::Calendar::Timetable.get(timetable_id)\n @time_from_cost = calculate_time_cost(@date_from, @time_from, time_cost, timetable)\n @time_to_cost = calculate_time_cost(@date_to, @time_to, time_cost, timetable)\n end\n end\n\n end\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n# if @population_density >= 200\n# speed += 0.5\n# elsif @population_density >= 150\n# speed += 1\n# elsif @population_density >= 100\n# speed += 1.5\n# elsif @population_density >= 50\n# speed += 2\n# else\n# speed += 2.5\n# end\n \n case @population_density \n when 51..100\n speed += 2\n when 101..150 \n speed += 1.5\n when 151..200\n speed += 1\n when 201..50000\n speed += 0.5\n else\n speed += 2.5\n end\n \n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def uberX_fare_calculator(distance, minutes)\n base_fareX = 2.55\n xTotal = base_fareX + (0.35 * minutes.to_i) + (1.75 * distance.to_i)\n if xTotal < 8\n puts 8\n else\n puts \"The total for an UberX is #{xTotal}\"\n end\nend",
"def reachable_by_step(pc)\n (-2..2).map {|x| (x + pc) %12}\nend",
"def provide_mortgage_4?(salary, deposit, property_value, bankrupt)\n return false if bankrupt\n loan_amount = property_value - deposit\n min_deposit = property_value >= 650_000 ? 0.2 : 0.05\n max_multiplier = 5 # how many annual income can be borrowed\n deposit >= property_value * min_deposit && (salary * max_multiplier >= loan_amount || deposit >= property_value * 0.75)\nend",
"def buy_power_3 d0, d1, s0, s1\n next_condition = @battery - (d0 - s0) - (d1 - s1) # 未来の条件式\n crnt_condition = @battery - (d0 - s0) # 現在の条件式\n result = 0.0 # 結果値\n\n if crnt_condition < @target # 現時点で目標値よりバッテリー残量が少ないとき\n if next_condition < @target # 次の時刻でも目標値が達成できないとき\n # 達成できなくなる分の電力を買っておく\n if @target - next_condition > 500.0 # 15分に受け取れる電力量は500wと想定する\n result = 500.0\n else\n result = @target - next_condition\n end\n # 買った分で最大容量を超えてしまったときは超えないようにする\n next_battery = crnt_condition + result # 次の時刻でのバッテリー残量予測\n result = next_battery > @max_strage ? result - (next_battery - @max_strage) : result\n else # 次の時刻では目標値が達成できるとき\n # 買わない 売るかどうかは保留したほうがいい?ただし0にはしないようにする\n result = 1.0 if crnt_condition == 0.0\n sell_power_2\n end\n else # 現時点では目標値は達成しているとき\n if next_condition < @target # 次の時刻で目標値が達成できない\n # 達成できなくなる分の電力を買っておく\n if @target - next_condition > 500.0 # 15分に受け取れる電力量は500wと想定する\n result = 500.0\n else\n result = @target - next_condition\n end\n next_battery = crnt_condition + result # 次の時刻でのバッテリー残量予測\n result = next_battery > @max_strage ? result - (next_battery - @max_strage) : result\n else # 次の時刻でも目標値が達成できるとき\n # Don't buy power.\n # むしろ売る\n sell_power_2\n end\n end\n @battery = crnt_condition + result # バッテリー残量の状態遷移\n @battery = @max_strage if @battery > @max_strage\n return result\n end",
"def filter_locations_tu(points)\n filter_locations(points, 15.9.within(0.07), 50.57.within(0.1))\nend",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n if @population_density >= 200\r\n travel_time = 0.5\r\n elsif @population_density >= 150\r\n travel_time = 1\r\n elsif @population_density >= 100\r\n travel_time = 1.5\r\n elsif @population_density >= 50\r\n travel_time = 2\r\n else\r\n travel_time = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{travel_time} months.\\n\\n\"\r\n\r\n end",
"def scan_addicts(array)\n array.map do |minutes|\n if minutes < 90\n 'mal'\n elsif minutes >= 90 and minutes < 180\n 'mejorable'\n else\n 'malo' \n end \n end\nend",
"def boiling_elevation?(elevation, low_elevation = 1000)\n \televation > low_elevation\nend",
"def can_go_on_ride(height, weight)\n if height > 120 && weight <= 200\n return true\n else\n return false\n end\nend",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n # speed = 0.0\r\n # if @population_density >= 200\r\n # speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n case @population_density\r\n when 0 .. 49 then speed = 2.5\r\n when 50 .. 99 then speed = 2\r\n when 100 .. 149 then speed = 1.5 \r\n when 150 .. 200 then speed = 1\r\n else speed = 0.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end",
"def check_angle(hours, minutes)\n (minutes * 6 - (hours * 30 + minutes * 0.5)).abs\nend",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 2.5\n\n thresholds = [50,100,150,200]\n\n thresholds.each do |threshold|\n\n if @population_density >= threshold\n speed -= 0.5\n end\n\n end\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n case @population_density\n when 200...1000000 then speed += 0.5\n when 150...200 then speed += 1\n when 100...150 then speed +=1.5\n when 50...100 then speed += 2\n when 0...50 then speed += 2.5\n end\n \n #if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n speed += case @population_density\n when 0...50\n 2.5\n when 50...100\n 2\n when 100...150\n 1.5\n when 150...200\n 1\n else\n 0.5\n end\n \n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n if @population_density >= 200\n @speed = 0.5\n elsif @population_density >= 150\n @speed = 1\n elsif @population_density >= 100\n @speed = 1.5\n elsif @population_density >= 50\n @speed = 2\n else\n @speed = 2.5\n end\n\n \n\n end",
"def order_goride(opts = {})\n clear_screen(opts)\n form = View.order_goride(opts)\n form[:location_data]=Location.location_data\n form[:location_gojek]=Location.location_gojek\n \n location_data = form[:location_data]\n\n point_1 = Hash.new(0)\n point_2 = Hash.new(0)\n\n location_length = nil\n gojek_length = nil\n\n location_data.each do |x|\n if x.rassoc(form[:start])\n point_1 = x\n end\n if x.rassoc(form[:finish])\n point_2 = x\n end\n end\n\n point_1_num = point_1.values[1]\n point_2_num = point_2.values[1]\n\n gojek_lg_data = 0\n gojek_point = nil\n\n dd = form[:location_gojek]\n dd.each do |x|\n p = x.values.last\n gojek_length = Math.sqrt(((point_1_num[0] - p[0])**2) + ((point_1_num[1] - p[1])**2)).to_f\n if gojek_length <= 1.0\n gojek_lg_data = gojek_length\n gojek_point = p\n end\n end\n\n if (point_1.values == []) || (point_2.values == []) \n form[:flash_msg] = 'Sorry, the route is unavailable'\n order_goride(form)\n else\n if gojek_lg_data == 0\n form[:flash_msg] = 'Sorry, the driver is not around'\n order_goride(form)\n else\n gojek_point = point_1_num\n location_length = Math.sqrt(((point_2_num[0] - gojek_point[0])**2) + ((point_2_num[1] - gojek_point[1])**2)).to_f\n form[:est_price] = (location_length * 1500).to_i\n form[:timestamp] = DateTime.now\n order_goride_confirm(form)\n end\n end\n form\n end",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n # spread_rates = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2, 0 => 2.5}\r\n spread_rates = {0 => 2.5, 50 => 2, 100 => 1.5, 150 => 1, 200 => 0.5}\r\n\r\n spread_rates.each do |density, rate|\r\n if @population_density >= density\r\n speed = rate\r\n end\r\n end\r\n\r\n=begin - refactored\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n=end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def test_lhurgoyfs\n assert_search_results \"t:lhurgoyf\", \"Tarmogoyf\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow=0\"\n assert_search_results \"t:lhurgoyf tou=0\"\n assert_search_results \"t:lhurgoyf tou=1\"\n assert_search_results \"t:lhurgoyf pow>=0\"\n assert_search_results \"t:lhurgoyf tou>=0\"\n assert_search_results \"t:lhurgoyf pow<tou\", \"Tarmogoyf\"\n assert_search_results \"t:lhurgoyf pow<=tou\", \"Tarmogoyf\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow>=tou\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow=tou\", \"Detritivore\"\n assert_search_results \"t:lhurgoyf pow>tou\"\n end",
"def match_weather(want_to)\n if want_to == \"dance\"\n audio_features.valence > 0.5 && audio_features.danceability > 0.5\n elsif want_to == \"chill\"\n audio_features.valence > 0.5 && audio_features.danceability < 0.5\n elsif want_to == \"sulk\"\n audio_features.valence < 0.5 && audio_features.energy < 0.6\n elsif want_to == \"rage\"\n audio_features.valence < 0.5 && audio_features.energy > 0.5\n end\n end",
"def get_target(map, loc)\n owned = nil\n owned_min = 1000\n GameMap::CARDINALS.each do |l|\n new_loc = map.find_location(loc, l)\n site = map.site(new_loc)\n if site.owner != $tag && site.strength < owned_min\n owned_min = site.strength\n owned = l\n end\n end\n owned\nend",
"def uberSUV_fare_calculator(distance, minutes)\n base_fareSUV = 14.00\n suvTotal = base_fareSUV + (0.80 * minutes.to_i) + (4.50 * distance.to_i)\n if suvTotal < 25.00\n puts 25.00\n else\n puts \"The total for an UberSUV is #{suvTotal}\"\n end\nend",
"def restricted_number_of_awards\n n = nil\n other_awards.each do |other_award|\n restricted_number = other_award.restrict_number_of_awards_to\n unless restricted_number.blank?\n n = restricted_number if n.nil? || restricted_number < n\n end\n end\n n\n end",
"def try_to_loan(loan)\n atms = Array.new(100) { |i| i.even? ? 2**i : -2**i }\n signs = atms.dup\n moves = []\n while loan != 0\n # binding.pry\n first_bigger, method = next_value(loan, atms)\n break if first_bigger == false\n if method == :cut\n moves << signs.index(atms[first_bigger])\n loan -= atms.delete_at(first_bigger)\n moves << signs.index(atms[first_bigger - 1]) if loan != 1\n loan -= atms.delete_at(first_bigger - 1) if loan != 1\n else\n moves << signs.index(atms[first_bigger - 2])\n loan -= atms.delete_at(first_bigger - 2)\n end\n p moves\n p loan\n end\nend",
"def can_train_siege_engine?\n gold >= 200 && food >= 3 && lumber >= 60\n end",
"def max_flight_distance; end",
"def need_gas(miles)\n if miles < 50\n puts \"No worries! You don't need to stop and get guess yet!\"\n else miles > 50\n puts \"Now's the time to stop and get gas!\"\n end \nend",
"def do_mill()\r\n # - - - - - - - - - - - - - - - - - - - -\r\n #print \"(mill arc segment pocket pBeg_angle=\", pBeg_angle, \" pEnd_angle=\", pEnd_angle, \" pDepth = \", pDepth, \" @pDepth=\", @pDepth, \")\\n\"\r\n check_parms()\r\n bit_radius_half = bit_radius / 2\r\n beg_mid_radius = (beg_min_radius + beg_max_radius) / 2.0\r\n end_mid_radius = (end_min_radius + end_max_radius) / 2.0\r\n cut_inc = mill.cut_inc\r\n\r\n curr_depth = beg_depth\r\n if (curr_depth < 0)\r\n curr_depth = 0\r\n end #if\r\n \r\n lbeg_min_radius = beg_min_radius + mill.bit_radius\r\n lbeg_max_radius = beg_max_radius + mill.bit_radius\r\n \r\n if (mill.cz < beg_depth)\r\n mill.retract(beg_depth)\r\n end #if\r\n \r\n #mill.retract()\r\n while (true) # depth \r\n # print \"(mill arc pocket curr_depth=\", curr_depth, \" depth=\", depth, \")\\n\" \r\n cibr = beg_mid_radius - mill.cut_inc\r\n cier = end_mid_radius - mill.cut_inc\r\n cmbr = beg_mid_radius + mill.cut_inc\r\n cmer = end_mid_radius + mill.cut_inc \r\n while(true) # radius\r\n next_depth = curr_depth - (mill.cut_depth_inc)\r\n if (next_depth < depth)\r\n next_depth = depth\r\n degree_per_step = 7.0 \r\n else\r\n degree_per_step = 1.0\r\n end\r\n \r\n \r\n if (cibr < beg_min_radius)\r\n cibr = beg_min_radius\r\n end #if\r\n \r\n if (cier < end_min_radius)\r\n cier = end_min_radius\r\n end # if\r\n \r\n if (cmbr > beg_max_radius)\r\n cmbr = beg_max_radius\r\n end\r\n \r\n if (cmer > end_max_radius)\r\n cmer = end_max_radius\r\n end #if\r\n \r\n #cp = calc_point_from_angle(pcx,pcy, pBeg_angle, cibr) \r\n #mill.move(cp.x, cp.y)\r\n #mill.plung(pDepth)\r\n \r\n \r\n \r\n changing_radius_curve(mill, \r\n pcx = x,\r\n pcy = y,\r\n pBeg_radius = cibr,\r\n pBeg_angle = beg_angle, \r\n pBeg_z = curr_depth, \r\n pEnd_radius = cier, \r\n pEnd_angle = end_angle,\r\n pEnd_z = next_depth, \r\n pDegrees_per_step=degree_per_step, \r\n pSkip_z_LT=nil, \r\n pSkip_z_GT=nil,\r\n pAuto_speed_adjust= false)\r\n \r\n #changing_radius_curve(mill, \r\n # pcx = x,\r\n # pcy = y,\r\n # pBeg_radius = cier,\r\n # pBeg_angle = end_angle , \r\n # pBeg_z = next_depth, \r\n # pEnd_radius = cibr, \r\n # pEnd_angle = beg_angle,\r\n # pEnd_z = next_depth, \r\n # pDegrees_per_step=degree_per_step, \r\n # pSkip_z_LT=nil, \r\n # pSkip_z_GT=nil,\r\n # pAuto_speed_adjust= false) \r\n \r\n \r\n #changing_radius_curve(mill, \r\n # pcx = x,\r\n # pcy = y,\r\n # pBeg_radius = cmbr,\r\n # pBeg_angle = beg_angle, \r\n # pBeg_z = curr_depth, \r\n # pEnd_radius = cmer, \r\n # pEnd_angle = end_angle,\r\n # pEnd_z = next_depth, \r\n # pDegrees_per_step=degree_per_step, \r\n # pSkip_z_LT=nil, \r\n # pSkip_z_GT=nil,\r\n # pAuto_speed_adjust= false)\r\n #mill.retract(curr_depth)\r\n changing_radius_curve(mill, \r\n pcx = x,\r\n pcy = y,\r\n pBeg_radius = cmer,\r\n pBeg_angle = end_angle , \r\n pBeg_z = next_depth, \r\n pEnd_radius = cmbr, \r\n pEnd_angle = beg_angle,\r\n pEnd_z = next_depth, \r\n pDegrees_per_step=degree_per_step, \r\n pSkip_z_LT=nil, \r\n pSkip_z_GT=nil,\r\n pAuto_speed_adjust= false) \r\n \r\n #changing_arc(mill, x,y,cibr, beg_angle, cier, end_angle, curr_depth, degree_inc) # mill increasing\r\n #mill.retract()\r\n #changing_arc(mill, x,y,cmer, end_angle, cmbr, beg_angle, curr_depth, degree_inc)\r\n #mill.retract() # mill decreasing\r\n \r\n if ((cibr <= beg_min_radius) &&\r\n (cier <= end_min_radius) &&\r\n (cmbr >= beg_max_radius) &&\r\n (cmer >= end_max_radius))\r\n break\r\n end \r\n \r\n cibr -= cut_inc\r\n cier -= cut_inc\r\n cmbr += cut_inc\r\n cmer += cut_inc\r\n end #while radius\r\n \r\n if (next_depth == depth)\r\n break\r\n else\r\n curr_depth -= mill.cut_depth_inc\r\n if (curr_depth < depth)\r\n curr_depth = depth\r\n end\r\n end #else\r\n \r\n end #while depth\r\n \r\n\r\n end",
"def parking_lot lot_size\n lot_size -= 14 if lot_size >= 14\n while lot_size >1\n return true if (lot_size%2 == 0 || lot_size%5 == 0)\n lot_size-= 7\n end\n return false\nend",
"def criteria(start, length)\n crit = [\n (values.max - values.min == 4),\n (values.uniq.length == 5),\n (card_suits.uniq.length == 1),\n (values[0] == 14)\n ]\n crit[start, length] == Array.new(length, true)\n end",
"def test_cantidad_cuotas\n print validate(36, cantidad_cuotas(16,1900.0))\n print validate(24, cantidad_cuotas(29,2100.0)) \n print validate(12, cantidad_cuotas(19,700.0)) \n print validate(6, cantidad_cuotas(20,1000.0))\n print validate(3, cantidad_cuotas(15,3200.0)) \nend",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n# when @population_density += 50 then\n# speed -= 0.5\n#this is what I feel would work in some way, I just can't figure out the syntax\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def isValidWalk(walk)\n #your code here\n directions = {'n'=>0, 's'=>0, 'e'=>0, 'w'=>0}\n\n walk.each do |step|\n directions[step] += 1\n end\n\n if directions['n'] == directions['s'] && directions['e'] == directions['w']\n walk\n else\n false\n end\nend",
"def which_watch(flight_length, movie_times)\n # we don't want brute force\n # assume there is a way to do this with O(n) given the last comment\n # we are not going to put this into anything and it doesn't really seem like a sorting problem\n # brute force is O(n) +\n\n times = {}\n movie_times.each_with_index do |movie, index|\n times[movie] = [flight_length - movie, index]\n end\n\n movie_times.each_with_index do |movie, index|\n movie, i = times[times[movie].first]\n return true if movie && i != index\n end\n\n return false\nend",
"def matches(trip)\n if trip.to_work\n origin_dist = 8000\n destination_dist = 1000\n else\n origin_dist = 1000\n destination_dist = 8000\n end\n @matches = Trip.joins(:users).\n where(pools: { is_active: true}).\n where.not(users: { id: id}).\n where(\"users.driving_pref = 0 OR driving_pref != ?\", driving_pref).\n where(trips: {to_work: trip.to_work}).\n where(\"ST_NumGeometries(trips.waypoints) = 2\").\n where(\"ST_DWithin( ST_geometryN(trips.waypoints, 1)::geography , ?::geography, ? )\", trip.waypoints[0], origin_dist).\n where(\"ST_DWithin( ST_geometryN(trips.waypoints, 2)::geography , ?::geography, ? )\", trip.waypoints[1], destination_dist).\n limit(20)\n\n # This gets up to 20 trips where (in order):\n # - the match user is actively taking this trip\n # - the match user isn't the current user\n # - the match user is neutral driving_pref or opposite of current user\n # - the match trip has same \"to_work\" value as current trip\n # - the match trip is currently an individual trip (technically not checking this, just checking that trip only has 2 waypoints)\n # - the match trip's origin is within [origin_dist] of the current trip's origin (note the difference in indexing!)\n # - the match trip's destination is [destination_dist] 1km of the current trip's destination\n \n # ATM TIMES NEVER CONSIDERED ANYWHERE\n # SHOULD FILTER IN DB BASED ON TIME/LOCATIONS (POSSIBLY ORDER AND LIMIT), THEN ALSO COMPUTE COMPAT AND ORDER RESULTS SOMEHOW\n # SHOULD HAVE SOME WAY OF RELAXING IF NOT ENOUGH RESULTS / BEING MORE PICKY IF TOO MANY.\n # ALSO SHOULD PRIORITIZE EXISTING MATCHES SOMEWHERE SOMEHOW\n \n @matches = @matches.sort_by{|t| -compatibility(t.users.first)} #right now sorting by compatability with first user\n return @matches\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n \n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n case \n when @population_density >= 200; speed += 0.5\n when @population_density >= 150; speed += 1 \n when @population_density >= 100; speed += 1.5\n when @population_density >= 50; speed += 2 \n else speed += 2.5 end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n \n\n end",
"def stanley_and_kerber md_width_li_on_one_side\n\tunless (23..30) === md_width_li_on_one_side\n\t\traise ArgumentError,\n\t\t \"The total sum of the mesio-distal width of the erupted Permanent Central and Lateral Incisors, and the unerupted Canine and Premolar, on one side of the mandible must be between 23-30mm \"\n\tend\n\n PREDICTION_TABLE.fetch(md_width_li_on_one_side) #returns the space needed when supplied with the measured mesio-distal width of the incissors on one side of the mandible\n\nend",
"def evaluate(time_in_bus, time_in_taxi, salary_per_minute, distance_travelled, taxi_fare_per_km, bus_fare_per_km, misery_tax)\n\n# comparison formula\n# obtains Left-Hand Side and Right-Hand Side of inequality and compares them\n\n # LHS of inequality\n # the value of your time is how much your work pays you if you were working\n value_of_time_lost = (time_in_bus.to_f - time_in_taxi.to_f) * salary_per_minute\n\n # RHS of inequality\n extra_cost_of_taxi_ride = distance_travelled.to_f * (taxi_fare_per_km - bus_fare_per_km) - misery_tax.to_f\n \n # time taken for both rides as well as the distance travelled\n puts \"A taxi ride would take #{time_in_taxi.to_i} minutes while a bus ride would take #{time_in_bus.to_i} minutes.\"\n puts \"The entire journey for both would be #{distance_travelled} km.\"\n \n # Too late at night. Forget about any comparison. Cab it.\n if (0..4) === Time.new.hour\n puts \"It's too late for a bus. This argument is moot. Take a taxi. Good night.\"\n Process.exit(0)\n end\n\n if value_of_time_lost < extra_cost_of_taxi_ride\n puts \"The taxi ride costs \\$#{extra_cost_of_taxi_ride - value_of_time_lost} more than your time is worth.\"\n puts \"Taking a taxi isn't worth it. Suck it up and take public transport like a man.\"\n end\n \n if value_of_time_lost > extra_cost_of_taxi_ride\n puts \"The value of your time is worth \\$#{value_of_time_lost - extra_cost_of_taxi_ride} more than a taxi ride.\"\n puts \"Take a taxi. You deserve it.\"\n end\n Process.exit[0]\nend",
"def miles_to_kilometers(miles)\n miles * 1.60934\nend",
"def test_distance_in_km\r\n third_party_distance_in_km = 313.92 # http://boulter.com/gps/distance/?from=53.3381985%2C+-6.2592576&to=51.92893%2C+-10.27699&units=k\r\n margin_of_error_in_km = 2\r\n\r\n args = 51.92893, -10.27699, 53.3381985, -6.2592576\r\n assert_in_delta(third_party_distance_in_km, CustomerFinder.send(:distance_in_km, *args), margin_of_error_in_km)\r\n end",
"def speed_of_spread #in months\n# We are still perfecting our formula here. The speed is also affected\n# by additional factors we haven't added into this functionality.\nif @population_density >= 200\n speed = 0.5\nelsif @population_density >= 150\n speed = 1\nelsif @population_density >= 100\n speed = 1.5\nelsif @population_density >= 50\n speed = 2\nelse\n speed = 2.5\nend\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\nend",
"def kilohertz? = unit == 'kilohertz'",
"def move_by_route(forward = true)\n return unless exist_train_route?\n depart_from_station\n\n train_start_speed_kmh = 5\n train_regular_speed_kmh = 60\n\n move train_start_speed_kmh\n move train_regular_speed_kmh\n move train_start_speed_kmh\n\n arrive_to_station forward\n brake\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n case @population_density\n when 200..Float::INFINITY then speed += 0.5\n when 150..199 then speed += 1\n when 100..149 then speed += 1.5\n when 50..99 then speed += 2\n else speed += 2.5\n end\n=begin \n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n=end \n speed\n end",
"def uberB_fare_calculator(distance, minutes)\n base_fareB = 7\n bTotal = base_fareB + (0.65 * minutes.to_i) + (3.75 * distance.to_i)\n if bTotal < 15\n puts 15\n else\n puts \"The total for an UberBlack is #{bTotal}\"\n end\nend",
"def first_trip(l1, s1)\n ## find index of stop s1 on line l1\n index_s1 = $lines[l1].index(s1)\n ## find index of Union Square Staion on line l1\n index_of_USquare = $lines[l1].index('Union Square')\n\n trip1 = []\n\n if index_s1 <= index_of_USquare\n trip1 = $lines[l1][index_s1..index_of_USquare]\n else\n trip1 = $lines[l1][index_of_USquare..index_s1].reverse\n end\n\n puts \">>> You must travel through the following stops on the #{l1} line: #{trip1.join(', ')}.\"\n puts \">>> Change at Union Square.\"\n\n trip1\nend",
"def plan\n calculate_scores_and_attendabilities\n \n highest_attendability_value = @attendabilities.sort {|a,b| a[1] <=> b[1]}.reverse[0][1]\n best_attendabilities = @attendabilities.to_a.select {|a| (a[1] == highest_attendability_value)}\n pairs_with_best_attendabilities = best_attendabilities.collect {|b| b[0]}\n best_scores = @scores.to_a.select {|s| pairs_with_best_attendabilities.include?(s[0])}.sort {|a,b| a[1] <=> b[1]}.reverse\n \n produce_roster(:monday, best_scores[0][0][0])\n produce_roster(:wednesday, best_scores[0][0][1])\n end",
"def avarage_workout_with_km_calories\n # Sum totals\n total_distance = set_sport_by_user.sum(:distance)\n # Return if there are workouts\n return total_distance / total_workouts if total_workouts > 0\n 0\n end"
] |
[
"0.5820945",
"0.56517243",
"0.5486238",
"0.53279316",
"0.53126425",
"0.5310793",
"0.5306572",
"0.5300798",
"0.52415425",
"0.52345425",
"0.52216804",
"0.5157555",
"0.5129693",
"0.5128798",
"0.51196384",
"0.51063293",
"0.50889313",
"0.5081421",
"0.50611514",
"0.5043999",
"0.5025839",
"0.50172293",
"0.49974644",
"0.49959752",
"0.49879956",
"0.4983306",
"0.4982067",
"0.49678576",
"0.49505955",
"0.49439386",
"0.4943146",
"0.4942488",
"0.49394858",
"0.49387154",
"0.49385455",
"0.49326304",
"0.49268436",
"0.49233043",
"0.49205148",
"0.49150285",
"0.4913582",
"0.48951647",
"0.4884619",
"0.48713523",
"0.48670915",
"0.4865532",
"0.48644432",
"0.48602742",
"0.48587522",
"0.48584062",
"0.48571357",
"0.4854787",
"0.4844851",
"0.48406374",
"0.48368913",
"0.48354357",
"0.48316202",
"0.48285395",
"0.48211053",
"0.48202932",
"0.48143032",
"0.48115736",
"0.48115736",
"0.48076242",
"0.48069292",
"0.4806902",
"0.4806578",
"0.48063532",
"0.47987685",
"0.47959214",
"0.47897923",
"0.4789264",
"0.47883564",
"0.47828594",
"0.47812065",
"0.47757486",
"0.4773685",
"0.47717586",
"0.47713247",
"0.47692034",
"0.47669202",
"0.47623217",
"0.47556907",
"0.475552",
"0.47484758",
"0.47448978",
"0.47448608",
"0.47425002",
"0.4742047",
"0.47409308",
"0.47370452",
"0.47365806",
"0.4731305",
"0.47282767",
"0.4724666",
"0.47184232",
"0.4718317",
"0.4711306",
"0.4710663",
"0.47076607"
] |
0.50534743
|
19
|
Define input_to_index to convert the user input to a valid array position (subtract 1 from their input)
|
def input_to_index(user_input)
index=(user_input .to_i) -1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def input_to_index(input)\n #converts the user's input (a string) into an integer\n #converts the user's input from the user-friendly format (on a 1-9 scale) to the array-friendly format (where the first index starts at 0)\n input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input = user_input.to_i # converts string into integer\n index = user_input - 1 # Change user input to array index.\nend",
"def input_to_index(user_input) \n #converts the user's input (a string) into an integer / would use .to_i\n #converts the user's input from the user-friendly format (on a 1-9 scale) to the array-friendly format (where the first index starts at 0) \n user_input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\n end",
"def input_to_index(user_input)\n arr_index = user_input.to_i - 1\n return arr_index\nend",
"def input_to_index(user_input) #this method takes one argument (the users input)\n new_user_input = user_input.to_i #this specific .to converts the string into an intergeer\n new_user_input -= 1 #this subtracts it by 1 since arrays start with 0\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n end",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n end",
"def input_to_index(user_input)\n index = (user_input.to_i - 1)\n end",
"def input_to_index(input)\n input_int = input.to_i\n index = input_int - 1\nend",
"def input_to_index(input)\n return input.to_i - 1\n #idx = [inpu - 1]\n # return idx\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\nend",
"def input_to_index(input)\r\n index = input.to_i - 1\r\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\nend",
"def input_to_index(input)\n @input = input.to_i - 1\n end",
"def input_to_index (input)\n index = input.to_i\n index - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\nend",
"def input_to_index(input)\n index = input.to_i - 1\nend",
"def input_to_index(input)\n self.convert_to_i(input) - 1\n end",
"def input_to_index(input)\n index = (input.to_i) - 1\nend",
"def input_to_index(user_input)\nindex = user_input.to_i - 1 #convert to integer and covert to index\nreturn index #return index for use in other methods\nend",
"def input_to_index(user_input)\n user_input.to_i - 1 # user_input converted to an integer\n end",
"def input_to_index(user_input)\n index = (user_input.to_i - 1)\nend",
"def input_to_index(input)\n input = input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i-1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1 # user_input converted to an integer\nend",
"def input_to_index( user_input )\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n\tactual_input = user_input.to_i - 1\n\nend",
"def input_to_index(user_input)\n #take the user's input (\"1\"-\"9\") and convert it to the index of the board array (0-8)\n user_input.to_i - 1\nend",
"def input_to_index(input)\n\t\tinput.to_i - 1\n\tend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n return index\n end",
"def input_to_index(input)\n input = input.to_i\n input = input - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(input)\n newInput = input.to_i\n return newInput - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\n return index\nend",
"def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\nend",
"def input_to_index(user_input)\n if (user_input === \"invalide\")\n return -1\n else\n input = user_input.to_i\n input = input - 1\n end\nend",
"def input_to_index(input)\n input.to_i - 1\n end",
"def input_to_index(input)\n return index = input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input = user_input.to_i\n index = user_input - 1\n return index\nend",
"def input_to_index(input)\n index = input.to_i\n index -= 1\nend",
"def input_to_index(user_input)\nconverted_input = user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_1 - 1 #they are entering a number we have to translate that to the board speak\nend",
"def input_to_index(user_input = 0)\n index = (user_input.to_i - 1)\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index( position )\n position = position.to_i\n position = position - 1\nend",
"def input_to_index(user_input) #this method converts the user_input into the 0-8 index, AKA the position on the board\n user_input = user_input.to_i # assign user_input to (user_input.to_i), which converts the user_input to an integer\n user_input = user_input-1 # assign user_input to (user_input-1), which substracts 1 from the user_input\n #the above line with the (user_input-1) also returns -1 for strings without integers\n end",
"def input_to_index(user_input)\n\n user_input.to_i - 1\n\n\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n return index\nend",
"def input_to_index(input)\r\n return input.to_i - 1\r\n end",
"def input_to_index(input)\n offset = input.to_i - 1\n return offset\nend",
"def input_to_index(user_input)\n user_input = user_input.to_i\n user_input = user_input - 1\nend",
"def input_to_index(user_input)\r\n user_input.to_i - 1\r\nend",
"def input_to_index(input)\n user_input=input.to_i\n user_input - 1\nend",
"def input_to_index(position)\n index = position.to_i - 1\nend",
"def input_to_index(input)\n return input.to_i - 1\n end"
] |
[
"0.88397723",
"0.875728",
"0.87117165",
"0.84226054",
"0.84226054",
"0.84226054",
"0.84080553",
"0.83906186",
"0.83724815",
"0.83724815",
"0.8269485",
"0.82275397",
"0.82080424",
"0.820289",
"0.820289",
"0.820289",
"0.820289",
"0.8201862",
"0.8190206",
"0.8181772",
"0.8166701",
"0.8150667",
"0.8150667",
"0.8144177",
"0.81188333",
"0.8118294",
"0.8116074",
"0.8101652",
"0.8101352",
"0.8085913",
"0.80702144",
"0.80686605",
"0.8063089",
"0.80570567",
"0.80540067",
"0.804207",
"0.80350006",
"0.80345225",
"0.80345225",
"0.80345225",
"0.80316764",
"0.80316764",
"0.80316764",
"0.80316764",
"0.80316764",
"0.80316764",
"0.80316764",
"0.8029192",
"0.8025765",
"0.802294",
"0.8021959",
"0.80144465",
"0.80072916",
"0.80056876",
"0.8004121",
"0.8000965",
"0.79933214",
"0.7993206",
"0.7987321",
"0.7987321",
"0.79859227",
"0.79766303",
"0.7956342",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.79322445",
"0.7930416",
"0.7927788",
"0.792615",
"0.7925676",
"0.79100233",
"0.79076755",
"0.7899339",
"0.789689"
] |
0.829487
|
10
|
Define valid_move? Returns true if the index is within the correct range of 08 and is currently unoccupied by an X or O token. Encapsulate the logic to check if a position is occupied in its own method, with position_taken?
|
def valid_move?(board,index)
# The user_input was accepted, converted to an integer and reduced by 1 in #input_to_index. Now you are testing to make sure
# that the value of the index is within the confines of the board array whose elements are 0-8. It also requires NOT #position_taken
# which means that the test that was done in position_taken which resulted in TRUE is turned into a NOT by using !position_taken
if index .between?(0,8) && !position_taken?(board,index)
true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_move?(index)\n if position_taken?(index)\n false\n elsif position_taken?(index) == false && index.between?(0,8)\n true\n end\n end",
"def valid_move?(index)\n !position_taken?(index) && index.between?(0, 8)\n end",
"def valid_move?(index)\n if position_taken?(index)\n false\n elsif index < 0 || index > 8\n false\n else\n true \n end\n end",
"def valid_move?(index)\n if index.between?(0,8)\n if !position_taken?(index)\n true\n else\n false\n end\n end\nend",
"def valid_move?(index)\n index.between?(0, 8) && !position_taken?(index)\n end",
"def valid_move?(index)\n index.between?(0,8) && ! position_taken?(index)\n end",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(index)\n return !position_taken?(index) && index.between?(0,8)\n end",
"def valid_move?(index)\n if position_taken?(index) == false && index.between?(0,8)\n true\n else\n false\n end\nend",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n true #is valid move\n else\n false\n end\nend",
"def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def valid_move? index_position \n index_position < 9 && !position_taken?(index_position)\n end",
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index.between?(0, 8)\n true\n end\nend",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n true\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index) == FALSE && index.between?(0, 8) == TRUE\n TRUE\n else\n FALSE\n end\nend",
"def valid_move?(board, index)\n !position_taken?(board, index) && index.between?(0, 8)\nend",
"def valid_move?(board, index)\n position_taken?(board, index) == false && index.between?(0, 8) ? true : false\nend",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end",
"def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n false\n end\nend",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend",
"def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend",
"def valid_move?(board, index)\n !position_taken?(board, index) && index.between?(0, 8)\nend",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def valid_move?(board, index)\n if !position_taken?(board, index) && (index).between?(0, 8)\n return true\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == false && index.between?(0, 8) == true\n true\n else\n false\nend\nend",
"def valid_move? (board, index)\n if index.between?(0,8) && position_taken?(board, index) == true\n #position is between 0-8 (1-9) AND the position is available (#position_taken)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, idx)\n if position_taken?(board, idx) == false && idx.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"def valid_move? (board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n if !(position_taken?(board, index)) && index.between?(0,8)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) then return false\n elsif index.between?(0, 8) then return true\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def valid_move?(board, index)\n if index.between?(0, 8)\n !position_taken?(board, index)\n else\n false\n end\nend",
"def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend",
"def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == false && index.between?(0,8) == true\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n position = index.to_i - 1\n if !position_taken? && position.between?(0-8)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0,8)\n return true\n else\n return false\n end\nend",
"def valid_move?(index)\n if (index.between?(0,8) == true) && (position_taken?(index) == false)\n return true \n else\n return false\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index) == false && index.between?(0,8)\n true\n end \n end",
"def valid_move?(board, index)\n !(position_taken?(board,index)) && index.between?(0, 8)\nend",
"def valid_move? (board, index)\n if position_taken?(board, index) == false && (index).between?(0,8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\r\n if index.between?(0, 8) && ! position_taken?(board, index)\r\n return TRUE\r\n else \r\n return FALSE\r\n end\r\nend",
"def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend",
"def valid_move?(board, index)\r\n if !position_taken?(board, index) && index.between?(0,8)\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end\r\n valid\r\n end",
"def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend",
"def valid_move?(board, index)\n if !(index.between?(0,8))\n return false\n end\n if (position_taken?(board,index))\n return false\n end\n true\nend",
"def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend",
"def valid_move?(board, position)\n index = position.to_i\n if position_taken?(board, index) == false && index.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8)\n !position_taken?(board, index)\n else\n false\n end\nend",
"def valid_move?(board, index)\nif position_taken?(board, index)\nreturn false\nelsif !index.between?(0, 8)\n return false\n else\n return true\n end\nend",
"def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n return index.between?(0, 8) && !position_taken?(board, index) ? true : false;\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8)\n if !position_taken?(board, index)\n true\n end\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def valid_move?(board, index)\n \nif position_taken?(board, index) === false && index.between?(0, 8)\n return true\nelse \n return false\nend\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n return true\n else\n false\nend\nend",
"def valid_move?(board, index)\n return index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) and not position_taken?(board, index)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move?(board, index)\n if (index.between?(0, 8) && !position_taken?(board, index))\n return true\n else\n return false\n end\nend",
"def valid_move?(position) ### changed from index to position - ER 2017\n\n if (position > 9) || (position < 0) #if index (position on board entered by user) is greater than 9 or less than 0, return false\n false\n elsif position_taken?(position) ###otherwise, if position on board is taken, return false\n false\n else position.between?(0, 8) ###finally, if the position isn't taken, and the index (position on board entered by user) is between 0 and 8, return true\n true\n end # end if...elsif statements\n end",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) #if the position isn't taken and is on the board, the move must be valid\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n puts \"this is a valid move\"\n return true\n else\n return false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) == true && position_taken?(board, index) == false\n return true\n else return false\n end\nend",
"def valid_move?( index )\n if position_taken?( index ) == true || !index.between?(0,9)\n return false\n else\n return true\n end\n end",
"def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(index)\r\n if (index>=0 && index<9) && !position_taken?(index)\r\n return true\r\n end\r\n end"
] |
[
"0.8558111",
"0.85237193",
"0.84963006",
"0.84871745",
"0.8486549",
"0.8484653",
"0.84749264",
"0.84749264",
"0.84749264",
"0.84749264",
"0.8474716",
"0.84658647",
"0.84604704",
"0.8458227",
"0.8458227",
"0.8454504",
"0.8436539",
"0.8432324",
"0.8431812",
"0.8429814",
"0.8422164",
"0.8421283",
"0.8419297",
"0.84176886",
"0.84167534",
"0.84120125",
"0.8410342",
"0.8410318",
"0.8410318",
"0.8410318",
"0.8410318",
"0.8408637",
"0.8405553",
"0.83981586",
"0.83975434",
"0.8393171",
"0.83930314",
"0.8386853",
"0.83831966",
"0.83794224",
"0.83756196",
"0.83747905",
"0.83733726",
"0.83730006",
"0.83663243",
"0.8366274",
"0.8364321",
"0.8364144",
"0.8364144",
"0.8364144",
"0.8362708",
"0.8362509",
"0.83599466",
"0.83589256",
"0.835862",
"0.83579946",
"0.835679",
"0.8355993",
"0.8343875",
"0.8343667",
"0.8342117",
"0.83416253",
"0.8340729",
"0.83399343",
"0.833852",
"0.83382666",
"0.8336667",
"0.8335707",
"0.83335674",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83319175",
"0.83312565",
"0.83270514",
"0.83270043",
"0.83264786",
"0.8326458",
"0.8325811",
"0.83257973",
"0.83257455",
"0.8322865",
"0.8319557",
"0.8317879",
"0.8312023",
"0.8311556",
"0.83078307",
"0.83023447",
"0.829979",
"0.82986647",
"0.8298074",
"0.82955337"
] |
0.0
|
-1
|
Define turn to get user input
|
def turn (board)
#Ask the user to tell you where they want to move on the board
puts "Please enter 1-9:"
#Get the user input
user_input=gets.strip
index=input_to_index(user_input)
# If the move is a valid move, then make the move and display the board
if valid_move?(board,index)
move(board,index,"X")
display_board(board)
#If the user puts in an invalid answer or the space in the array is not free, go back to turn and start over
else turn(board)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def input\n puts \"It's #{@player_turn.capitalize}'s turn. Please enter your move/ command.\"\n @input = gets.chomp.upcase\n end",
"def request_input(turn)\r\n if turn === true\r\n puts \"Player 1\"\r\n puts \"=\" * 8\r\n puts \"Put in your first coordinate:\"\r\n first_coor = gets.chomp.to_i\r\n puts \"Put in your second coordinate:\"\r\n second_coor = gets.chomp.to_i\r\n end\r\n return [first_coor, second_coor]\r\nend",
"def take_turn\n puts \"#{player.name}'s turn. Enter 0-9:\"\n input = gets.strip\n if board.valid_move?(input)\n board.move(input, player)\n else\n puts \"Please enter valid move:\"\n take_turn(board, player)\n end\n board.display\n end",
"def take_turn\n puts \"Pick a space, #{@name}\"\n space = gets\n parse_input(space)\n end",
"def get_turn\n @pos, @action = @player.prompt\n end",
"def turn \n puts \"Make a move compadre\"\n input = gets.strip\n location = input_to_index(input)\n if valid_move?(location)\n tictac = current_player\n move(location, tictac)\n display_board\n else\n turn\n end\n end",
"def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend",
"def turn(player)\n if player == 'X'\n print \"\\nPlayer X turn >> \"\n @x_move = gets.chomp\n elsif player == 'O'\n print \"\\nPlayer O turn >> \"\n @o_move = gets.chomp\n end\n end",
"def get_input\n puts \"Input [L] to turn Left, [R] to turn right and [M] to move your Mars rover forward. Type [Q] to leave. See you, Space Cowboy\"\n @input = gets.chomp.downcase\n # Loops through the array of inputs to specify commands for each specific instruction with a case statement\n @input.each_char do |i|\n case i\n # If l is inputted, make the Rover face left\n when \"l\"\n turn_left\n # If r is inputted, make the Rover face right\n when \"r\"\n turn_right\n # Get the rover to move forward in the direction it's facing.\n when \"m\"\n move\n # Exit the game when q is typed\n when \"q\"\n exit\n end\n # Convert the results to a string\n to_s\n end\n end",
"def turn\n\t\t\t@turns += 1\n\t\t\t@guess_letter = gets[0].downcase\n\t\t\tshow_matches\n\t\t\tcheck_win\n\t\tend",
"def turn\n puts \"Please enter 1-9:\"\n location = gets.strip\n if valid_move?(location)\n token = current_player #This was not clear in the instructions on how to get the correct token\n move(location, token)\n else\n turn\n end\n display_board\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets\n go = input_to_index(input)\n if valid_move?(go)\n move(go, current_player)\n display_board\n else\n turn\n end\nend",
"def get_move\n\t\tputs \"Your current bankroll is $#{bankroll}, and your hand is:\"\n\t\t@hand.render \n\t\tputs \"Do you wish to fold, see the bet, or raise?\"\n\t\tbegin\n\t\t\tinput = gets.chomp.downcase\n\t\t\traise BadInputError unless ['fold', 'see', 'raise'].include?(input)\n\t\t\tinput.to_sym\n\t\trescue\n\t\t\tputs \"You must input 'fold', 'see', or 'raise'.\"\n\t\t\tretry\n\t\tend\n\tend",
"def turn\r\n puts \"Please enter 1-9:\"\r\n user_input = gets.strip\r\n user_move = input_to_index(user_input)\r\n \r\n if valid_move?(user_move)\r\n move(user_move,current_player)\r\n display_board\r\n else\r\n turn\r\n end\r\n end",
"def turn\n # Asks user for input.\n puts \"Please enter 1-9:\"\n # Places the user's answer into the variable 'input'.\n input = gets.strip\n # Uses the conversion method to place it into variable 'index'.\n index = input_to_index(input)\n # Goes through an if/else loop to check if move is valid.\n if valid_move?(index)\n # Adds the player's input if valid.\n move(index, current_player)\n # Displays the board back to the player in the CLI afterwards.\n display_board()\n else\n # Recursively calls the turn method if an incorrect move is played.\n turn()\n end\n end",
"def turn\n puts \"\"\n puts \" \" * 35 + \"c'est au tour à #{@current_player.name} de joué (1-9): \"\n puts \"\"\n print \" \" * 40 + \"> \"\n choice = gets.chomp.to_i\n if choice > 9 || choice < 1\n puts \"Tu te trompe de touche jeune apprentie\"\n elsif @current_player.move(choice) != false\n @winner = @current_player if @current_player.winner?\n @turn += 1\n switch_player\n end\n end",
"def input_move(db, cur_position)\r\n\tprint \"Enter a move for #{cur_player(db, cur_position)} in standard chess notation, or HELP for help: \"\r\n\tmove = gets.chomp.downcase\r\n\treturn move\r\nend",
"def turn\n puts \"#{@current_player.name}\\'s turn. Choose your cell (1-9)\" \n choice = gets.chomp.to_i\n if choice > 9 || choice < 1\n puts \"Warning : number must be between 1 and 9\"\n elsif @current_player.move(choice) != false\n @winner = @current_player if @current_player.winner?\n @turn += 1\n switch_player\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n is_valid = valid_move?(index)\n if is_valid === true\n current_turn = current_player\n move(index,current_turn)\n display_board\n else\n puts 'Please enter correct input'\n puts \"Please enter 1-9:\"\n input = gets.strip\n end\n end",
"def turn\n #asks for user input, converts input to integer\n puts \"Enter the position you like to play (1-9): \"\n user_input = gets.strip\n\n #if move is valid, accepts move as index and displays new board\n if valid_move?(user_input)\n token=current_player\n move(user_input, token)\n display_board\n else\n turn\n end\n end",
"def view_fight_input\n puts \"Would you like to view a specific fight? (y/n)\"\n input = gets.strip.downcase\n end",
"def take_turn player\n puts \"#{player}, It is your turn. What position on the board would you like to mark?\"\n int_input = false\n @position = gets.to_i\n while int_input == false do\n if check_integer == false\n puts \"Input was invalid. Please try again\"\n @position = gets.to_i\n elsif check_input_range == false \n puts \"Position doesn't exist on the board. Please try again\"\n @position = gets.to_i\n else int_input = true\n end\n end\n return @position\n end",
"def prompt\n if @first_guess\n first_turn\n else\n second_turn\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n user_input = gets.strip\n user_input = input_to_index(user_input)\n if valid_move?(user_input)\n move(user_input, current_player)\n else \n turn\n end\n display_board\nend",
"def ask_input\n\t\tputs \"Take a look at the board, please.\"\n\t\t@b.draw_board\n\t\tputs \"#{@player1.name}, make your move please (pick a number from 1 to 9).\"\n\t\tmove = gets.chomp\n\n\t\tif move == \"a1\"\n\t\t \t@b.board[move] = @player1.mark\n\t\t \t@b.draw_board\n\t\t \ttaking_turns\n\t\t \t\n\t\t# elsif move == \"a2\"\n\t\t# \t@b.board[move] = @player1.mark\n\t\t# \t@b.draw_board\n\t\t# \task_input\n\t\t# elsif move == \"a3\"\n\t\t# \t@b.board[move] = @player1.mark\n\t\t# \t@b.draw_board\n\t\t# \task_input\n\t\t end\n\tend",
"def user_turn\n input = ''\n x = 1\n while input.downcase != 'r' && input.downcase != 'p' && input.downcase != 's'\n if x != 1\n say(\"Invalid choice. Rock, Paper, or Scissors? [R/P/S]\")\n end\n input = gets.chomp\n x += 1\n end\n case input.downcase\n when 'r'\n return 'Rock'\n when 'p'\n return 'Paper'\n when 's'\n return 'Scissors'\n end\nend",
"def input\n\t\tprint_word\n\t\tprint \"\\n>> \"\n\t\tinput = gets.chomp\n\t\tif @player.word_to_guess.include? input\n\t\t\t@player.correct_letters << input\n\t\telsif input == \"save game\"\n\t\t\toutput = File.new('save.yml', 'w')\n\t\t\toutput.puts YAML.dump(@player)\n\t\t\toutput.close\n\t\t\tputs \">game saved<\"\n\t\t\tgame_loop\n\t\telsif input == \"exit\"\n\t\t\texit\n\t\telse\n\t\t\t@player.turn += 1\n\t\tend\n\tend",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n value = current_player\n move(index, value)\n display_board\n else\n turn\n end\n end",
"def pt;z.gets 'Your choice:'; end",
"def turn()\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index, current_player())\n display_board()\n else\n turn()\n end\n end",
"def takeTurn(string)\n#your logic goes here.\nend",
"def turn \n player = current_player\n puts \"Player '#{player}' enter a move [1-9]\"\n input = gets.chomp \n index = input_to_index(input)\n if valid_move?(index)\n move(index,player)\n display_board\n else \n turn\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index, current_player)\n display_board\n else\n turn\n end\nend",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index, current_player)\n display_board\n else\n turn\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index, current_player)\n display_board\n else\n turn\n end\n end",
"def run\n choose_game(prompt)\nend",
"def take_turn(player)\n if player == @player1\n color = :red\n else\n color = :blue\n end\n puts \"#{player.name} ('#{player.mark}'), it's your turn.\".colorize(color)\n puts\n puts \"What cell do you want to place your '#{player.mark}'? \"\\\n \"(Choose a cell number from 1-9)\"\n print \">> \"\n cell = get_input\n return if quit_or_restart?(cell)\n cell\n end",
"def try_turn\n print \"\\nPlayer #{@player.to_s.capitalize}'s command: \"\n input = gets.chomp\n outcome = if is_raw_command?(input) then try_command(input) # Returns :(no_)load, :(no_)save, :(no_)draw, :quit\n elsif is_raw_move?(input) then try_move(input) # Returns :(no_)move, :check(mate), :stalemate, :draw\n else :unknown_input end\n end",
"def turn(board)\n # ask the user for input:\n puts \"Please enter 1-9:\"\n # gets the user input\n input = gets.strip\n # calls the input_to_index method\n index = input_to_index(input)\n #validates the input correctly\n if valid_move?(board, index)\n # makes valid move\n move(board, index, \"X\")\n else\n # asks for input again after a failed validation\n turn(board)\n end\n # displays a correct board after a valid turn\n display_board(board)\nend",
"def select_game\n intro\n input = gets.chomp\n\n case input.to_i\n when 1\n start_new_game\n when 3\n load_last_save\n else\n puts 'i do not know that input'\n end\nend",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n position = input_to_index(input)\n\n if valid_move?(position)\n player = current_player\n move(position, player)\n display_board\n else\n turn\n end\n end",
"def get_user_input\n loop do\n puts @current_player ? \"Player 1's turn\" : \"Player 2's turn\"\n\n input = CLI.ask \"Please enter a valid column from 1 to 7:\"\n case input\n when /^[1-7]$/\n return input.to_i\n else\n puts \"INVALID INPUT!\"\n puts\n next\n end\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n char = current_player\n if valid_move?(index)\n move(index, char)\n display_board\n else\n turn\n end\nend",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n char = current_player\n if valid_move?(index)\n move(index, char)\n display_board\n else\n turn\n end\nend",
"def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n position = input_to_index(input)\n token = current_player(board)\n if valid_move?(board, position)\n move(board, position, token)\n display_board(board)\n else\n turn(board)\n end\nend",
"def take_turn\n puts \"Please choose what piece you'd like to move?\"\n start_pos = gets.chomp\n puts \"And where would you like to move it to?\"\n end_pos = gets.chomp\n\n move_piece(start_pos,end_pos)\n\n\n end",
"def turn\n display_board\n puts \"Please enter 1-9:\"\n input = gets.strip\n if !valid_move?(input)\n turn\n end\n move(input, current_player)\n display_board\nend",
"def determine_turn\n @player = if @player1_turn\n puts \"It is #{@player1}'s turn\"\n \"X\"\n\n else\n puts \"It is #{@player2}'s turn\"\n \"O\"\n\n end\n\n end",
"def chooseMove\r\n\t\tprint \"\\nEnter your move human: \"\r\n\t\tmove = gets.chomp.to_i\r\n\t\treturn move\r\n\tend",
"def start_turn \n if @game_over == false\n @game.print_grid\n puts \"Pick an empty box, \" + print_name(@game.current_player) + \". Resitance is \" + pink(\"futile.\")\n player_choice = STDIN.gets.chomp \n valid = \"123456789\".split(\"\") \n unless valid.include? player_choice\n puts \"Enter a number from \" + pink(\"1 to 9\") + \", resistance discouraged... with \" + pink(\"deadly neurotoxin\")\n start_turn\n end\n if @game.blank_box?(player_choice) \n control(player_choice) \n else \n puts blue(\"That square is taken\") + \". Since you cannot see that obvious fact we have taken points off your \" + blue(\"final grade\") + \". If you were not an \" + pink(\"orphan\") + \" your family would be ashamed\"\n start_turn\n end\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index, current_player)\n display_board\n else\n turn\n end\n end",
"def turn\n puts \"Choose a spot between 1-9\"\n spot = gets.strip\n #calls #input_to_index, #valid_move?, and #current_player\n #makes valid moves and displays the board\n #loop back spot/input if/else statement to ask for input again after a failed validation\n spot = input_to_index(spot)\n if valid_move?(spot)\n move(spot, current_player)\n else\n turn\n end\n display_board\n end",
"def your_turn\n type(\"#{\"It's\".green} #{@current_team.name.white}#{'\\'s turn:'.green}\\n\\n\\n\")\n end",
"def turn(board)\n#This is the initial prompt telling our user to input\n puts \"Please enter 1-9:\"\n#this gets our user input\n user_input= gets.strip\n#I set the index variable for later methods to = the outcome of the input to index method\n index = input_to_index(user_input)\n#If the outcome of the valid move method is true then run the board method and display the board\n if valid_move?(board, index) == true\n move(board, index, char = \"X\")\n display_board(board)\n#if not run the turn method again\n else\n turn(board)\n end\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n if valid_move?(board,input)\n move(board,input,current_player(board))\n else\n turn(board)\n end\n display_board(board)\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n user_input = gets.strip\n arr_index = input_to_index(user_input)\n position = current_player(board)\n\n if !valid_move?(board, arr_index)\n puts \"Please enter a different option\"\n user_input = gets.strip\n else\n move(board, arr_index, position)\n display_board(board)\n end\n\nend",
"def tictactoe\n g = Game.new\n puts `clear`\n puts \"Please enter the name of player1\"\n g.player1 = gets.chomp\n puts \"Please enter the name of player2\"\n g.player2 = gets.chomp\n\n until g.finished?\n puts `clear`\n puts\n print_board(g)\n puts\n puts \"#{g.whose_turn}'s turn\"\n input = gets.chomp.downcase\n if input.to_i.to_s == input\n g.make_move(g.whose_turn, input.to_i)\n else \n until input.is_a?(Fixnum) do\n print \"Please enter a number: \"\n input = Integer(gets) rescue nil\n end\n end\n end\n\n puts `clear`\n puts g.result\n puts \"\\n Would you like a (r)ematch?\"\n case gets.chomp.downcase\n when 'r'\n tictactoe\n end\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n if valid_move?(board, input)\n player = current_player(board)\n move(board, input, player)\n else\n turn(board)\n end\n\n display_board(board)\nend",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index,current_player)\n display_board\n else\n turn\n end\n end",
"def turn(board)\r\n # if draw?(board)\r\n # puts \"Cat's Game!\"\r\n # elsif over?(board) \r\n # puts \"Congratulations #{winner(board)}!\"\r\n # else\r\n puts \"Please enter 1-9:\"\r\n input = gets.strip\r\n index = input_to_index(input)\r\n if valid_move?(board, index)\r\n token = current_player(board)\r\n player_move(board, index, token)\r\n display_board(board)\r\n else\r\n turn(board)\r\n end\r\n # end\r\nend",
"def turn_player\n input = get_user_input_and_check([\"h\",\"s\"])\n if input === \"h\"\n\n get_card_and_put_in_hand(\"player\")\n display_board_screen(\"hidden\")\n hand_total = calculate_hand_total_value(@hand_player)\n if check_if_over_21(hand_total)\n return \"over\"\n else\n turn_player\n end\n\n elsif input === \"s\"\n return \"stay\"\n end\nend",
"def take_a_turn\n puts \"Select a position on the board from 1 to 9: \"\n user_input = gets.chomp\n user_input = input_to_index(user_input)\n was_valid_move = valid_move? user_input\n\n if was_valid_move\n @board[user_input] = @current_player\n @turns_taken += 1\n @current_player = @current_player == \"X\" ? \"O\" : \"X\" \n else\n if position_taken? user_input \n puts \"That position is taken!\" \n else \n \"Invalid move!\"\n end\n end\n end",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(index)\n move(index, current_player)\n display_board\n else\n turn\n end\n end",
"def ask_play \n\tputs \" - Bon, tu joues quoi #{@name} ? je n'est pas que ca a faire !!! (Donne les coordonnees, ex : a1, b3, c2, etc.) \"\n\t@answer_play = gets.chomp \t\n end",
"def turn\n puts \"Please enter 1-9:\"\n user_input = gets.strip\n index = input_to_index(user_input)\n if valid_move?(index) == true\n move(index, current_player)\n else\n turn\n end\n display_board\n end",
"def turn(board)\n\n#ask for input\n puts \"Please enter 1-9:\"\n\n#get input\ninput = gets.strip\n\n#if input is valid\nif (valid_move?(board, input))\n\n # make the move for input\n move(board, input)\n\n#else\nelse\n\n # ask for input again until you get a valid input\n puts \"Please enter a valid move.\"\n turn(board)\n\n#end\nend\n\n#show the board\ndisplay_board(board)\nend",
"def turn(board)\n puts \"Make your move, enter a grid value from 1 - 9: \"\n input = gets.strip\n index = input_to_index(input)\n value = current_player(board)\n if valid_move?(board, index)\n move(board, index, value)\n else\n turn(board)\n end\n display_board(board)\nend",
"def take_turn\n valid_input = false\n puts \"\"\n puts \"Current text is: #{@fragment}\"\n\n until valid_input\n player_char = @current_player.guess\n valid_input = valid_play?(player_char)\n unless valid_input\n @current_player.alert_invalid_guess\n end\n end\n\n @fragment += player_char\n end",
"def take_a_turn(input = nil)\n print \"Guess a letter: \"\n loop do\n input ||= gets.chomp.upcase\n if input == \"SAVE\"\n save_game\n puts \"GAME SAVED!\"\n break\n elsif input.length != 1 || !board.letters.include?(input)\n puts \"invalid entry. Try again: \"\n input = nil\n else\n @turns += 1\n self.letter = input\n break\n end\n end\n end",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n if !valid_move?(board, input)\n turn(board)\n end\n move(board, input, current_player(board))\n display_board(board)\nend",
"def turn(board)\r\n puts \"Please enter 1-9:\"\r\n user_input = gets.strip\r\n index = input_to_index(user_input)\r\n if valid_move?(board, index)\r\n move(board, index, current_player(board))\r\n display_board(board)\r\n else\r\n turn(board)\r\n end\r\nend",
"def turn \n\t\tputs \"\"\n\t\tputs current_player + \", Enter a square to take:\"\n\t\tindex = gets.strip\n\t\tindex = input_to_index(index)\n\t\tif valid_move?(index)\n\t\t\tmove(index, current_player)\n\t\telse \n\t\t\tputs \"Invald space, try again\" \n\t\tend\n\tend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n if !valid_move?(board, input) \n turn(board)\n end\n move(board, input, current_player(board))\n display_board(board)\nend",
"def player_turn\r\n answer = nil\r\n puts \"#{player.name} has #{player.total_for_hand}\"\r\n loop do\r\n puts \"Do you want to hit or stay? (enter 'h' or 's') \"\r\n loop do\r\n answer = gets.chomp.downcase\r\n break if ['h', 's'].include? answer\r\n puts \"Please enter h or s\"\r\n end\r\n if answer == 's'\r\n player.show_hand\r\n break\r\n elsif answer == 'h'\r\n player.add_to_hand(deck)\r\n puts \"#{player.name} has #{player.total_for_hand}\"\r\n end\r\n break if player.busted?\r\n end\r\n end",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n input = input_to_index(input)\n if !valid_move?(board, input)\n\t turn(board)\n end\n move(board,input,current_player(board))\n display_board(board)\nend",
"def start\n @choice = list[ get_user_input ]\n puts \"You chose #{@choice}.\\n\\n\"\n end",
"def turn(board)\n player = current_player(board)\n puts \"It's #{player}'s turn!\"\n puts \"Please enter 1-9:\"\n input = gets.strip\n i = input_to_index(input)\n if valid_move?(board, i)\n move(board, i, current_player(board))\n elsif valid_move?(board, i) == false\n puts \"Sorry, that move isn't valid. Try again.\"\n puts \"\\n\"\n puts turn(board)\n end\nend",
"def start_turn\n write('START_TURN')\n end",
"def turn\n puts \"Pick a spot by number starting from 1 in top left corner\"\n position = gets.chomp!.to_i\n @position = Integer(position) > 0 && Integer(position) < 10 ? position - 1 : not_valid\n end",
"def turn()\n puts \"Please enter 1-9:\"\n input = gets.strip\n intger=input.to_i\n #position = intger.to_i -1\n if valid_move?(input)\n move( intger,current_player())\n display_board()\n else\n turn()\n end\nend",
"def turn\n puts \"Please enter 1-9:\"\n user_input = gets.strip\n index = input_to_index(user_input)\n\n until valid_move?(index)\n puts \"Invalid Move! Try again.\"\n user_input = gets.strip\n index = input_to_index(user_input)\n\n end\n\n move(index, current_player)\n display_board\n end",
"def menu(game)\n puts \"Do you want to play tic-tac-toe? 1 for yes 2 for no\"\n option = gets.chomp.to_i\n case option \n when 1\n gam.turn\n when 2\n exit\n end\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(board,index)\n move(board,index,current_player(board))\n else\n puts \"Hey, pay attention!\"\n turn(board)\n end\n display_board(board)\nend",
"def action_choice(a_player)\n print (\"#{a_player}\").yellow\n puts \", it is your turn to play.\"\n puts \"This is the board situation :\"\n puts @board.the_board\n puts\n puts \"Which box do you want to tick?\"\n print \">\"\n choice = gets.chomp\n while board.boxes.include?(choice) == false\n puts \"Invalid box reference. Please, pick up another box reference.\"\n choice = gets.chomp\n end\n return choice\n end",
"def turn(board)\n puts \"Please enter 1-9:\"\n user_input = gets.strip # Gets user input\n index = input_to_index(user_input) # Passes user input to input_to_index method as argument\n if valid_move?(board, index) == true # Test Code not valid then turn(board) to run again\n move(board, index, value = \"X\")\n display_board(board)\n else\n turn(board)\n end\n end",
"def get_move\n puts \"Please enter 1-9\"\n type = gets.strip\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(board,index)\n # puts \"Please enter X or O\"\n # xo = gets.strip\n puts \"The move is valid\"\n move(board,index,current_player(board))\n display_board(board)\n else\n puts \"Input invalid and provide valid location\"\n turn(board)\n end\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(board, index) == true\n move(board, index, token = \"X\")\n display_board(board)\n else\n turn(board)\n end\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n user_number = gets.strip\n index = input_to_index(user_number)\n if !(valid_move?(board,index)) \n puts \"Not a valid move. Try again.\"\n turn(board)\n else\n move(board, index, sign)\n end\nend",
"def ask_player_for_move(current_player)\n puts\n puts \"#{@current_player.name}, it's your move:\"\n @move = gets.chomp.capitalize.to_s\n # puts @move\n self.validate_move(@move)\n next_turn\n end",
"def take_turn\n @board.show_board\n puts \"#{@current_player}'s turn.\"\n square = 0\n until ((1..9) === square) && @board.take_a_square(square, @current_player)\n puts \"Which square do you want to take?\"\n square = gets.to_i\n end\n @current_player.occupy_a_square(square)\n @current_player, @other_player = @other_player, @current_player\n @turns += 1\n end",
"def turn(board)\n puts 'Please enter 1-9:'\n user_input = gets.strip\n index = input_to_index(user_input)\n\n if valid_move?(board, index)\n move(board, index, current_player(board))\n display_board(board)\n else\n turn(board)\n end\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n user_input = gets.strip\n index = input_to_index(user_input)\nif valid_move?(board,index)\n move(board, index, current_player(board))\n display_board(board)\nelse\n turn(board)\nend\nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n if valid_move?(board, input)\n player_character = current_player(board)\n move(board, input, player_character)\n else\n turn(board)\n end\n display_board(board)\nend",
"def turn(board)\n display_board(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n \n ##if valid_move?(board, input) == true\n ##display_board(board)\n if valid_move?(board, input) == false\n turn(board)\n else\n move(board, input)\n display_board(board)\n end\n \nend",
"def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(board, index)\n value = current_player(board)\n move(board, index, value)\n display_board(board)\n else\n turn(board)\n end\nend",
"def turn(board)\r\n puts \"Please enter 1-9:\"\r\n input = gets.strip\r\n index = input_to_index(input)\r\n if valid_move?(board, index)\r\n move(board, index)\r\n display_board(board)\r\n else\r\n turn(board)\r\n end\r\nend",
"def start \n puts \"Welcome to \" + blue(\"Apeture Science TicTacToe\") + \", were we screen the test \" + blue(\"test subjects\") + \" from the \" + pink(\"cake ingredients\") \n # Get input from player on game mode\n valid = false\n until valid == true\n puts \"To play against another pathetic test \\\"participant\\\", \" + blue(\"press P\") + \". If you dare challenge a cyber god, \" + blue(\"press A\") + \". On a relevant note, \" + pink(\"please don't spill tears into any Apeture Science equipement.\")\n @input = STDIN.gets.chomp.downcase\n\n valid = \"pa\".split(\"\")\n if valid.include?(@input)\n valid = true\n else\n puts \"Seems you could not manage that simple task. Well at least you can rest assured that \" + pink(\"you will burn well.\")\n end\n end\n # Set game mode\n if @input == \"p\"\n @game_mark = \"player\"\n elsif @input == \"a\"\n @AI = AI.new(@game, self) \n @game_mark = \"AI\" \n if @game.current_player == \"X\" \n @AI.make_move\n end\n end\n start_turn \n end",
"def get_input\n story = gets.chomp\nend",
"def turn\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n character = current_player\n if valid_move?(index)\n move(index, character)\n display_board\n else\n # puts \"Invalid move\"\n turn\n end\n end"
] |
[
"0.75016606",
"0.7140702",
"0.7129659",
"0.70943475",
"0.70621485",
"0.702581",
"0.695332",
"0.69462794",
"0.6903805",
"0.68961173",
"0.68489593",
"0.6846276",
"0.6832692",
"0.68207484",
"0.6798719",
"0.6793288",
"0.6775677",
"0.67718244",
"0.6734213",
"0.6731906",
"0.6722639",
"0.67118496",
"0.6681577",
"0.66769326",
"0.66731083",
"0.6657481",
"0.6645085",
"0.66371024",
"0.6635241",
"0.6624543",
"0.66185915",
"0.6610096",
"0.6600994",
"0.66007084",
"0.66007084",
"0.6595052",
"0.6585038",
"0.6576408",
"0.65747684",
"0.65644085",
"0.6548124",
"0.65479153",
"0.65461195",
"0.65461195",
"0.6542097",
"0.6541551",
"0.6533342",
"0.65292186",
"0.6526322",
"0.6517396",
"0.65129596",
"0.6508438",
"0.6506085",
"0.6506052",
"0.6497156",
"0.64935017",
"0.6483461",
"0.6478022",
"0.64773804",
"0.64693296",
"0.6467102",
"0.6466609",
"0.64637023",
"0.64557457",
"0.6454446",
"0.64493513",
"0.644656",
"0.6439455",
"0.6439237",
"0.64386237",
"0.64349294",
"0.6431877",
"0.6424731",
"0.64188766",
"0.6415501",
"0.6415229",
"0.6412793",
"0.640698",
"0.64013225",
"0.63991076",
"0.6392796",
"0.63909125",
"0.63879853",
"0.638324",
"0.638128",
"0.63769305",
"0.6373752",
"0.63725036",
"0.6371109",
"0.63708985",
"0.63635296",
"0.6358888",
"0.63510865",
"0.6348892",
"0.6346381",
"0.63448834",
"0.63446677",
"0.634411",
"0.6342329",
"0.6340985",
"0.6340556"
] |
0.0
|
-1
|
Define position_taken to see if the position the user requests is available or already filled with an X or an O. This code will be used with valid_move?
|
def position_taken?(board, index)
if (board[index]==" " || board[index]=="" || board[index] ==nil)
false
elsif (board[index]=="X"|| board[index]=="O")
true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def position_taken?(board, pos)\n if board[pos]==\"X\" || board[pos]==\"O\"\n taken = true\n else\n taken = false\n end\n taken\nend",
"def position_taken?(input)\n @board[input] == \"X\" || @board[input] == \"O\"\n end",
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def position_taken?(board, position)\n\tif board[position] == \"X\" || board[position] == \"0\"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def position_taken?(board, position)\n board[position] == 'X' || board[position] == 'O'\nend",
"def position_taken?(board, position)\n board[position] == \"X\" || board[position] == \"O\"\nend",
"def position_taken?(board, position)\n board[position] == \"X\" || board[position] == \"O\"\nend",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, index_to_validate)\n if (board[index_to_validate] == \"X\" || board[index_to_validate] == \"O\")\n return true\n end\n return false # NOTE: if we arrive here, the position is definitely not taken\nend",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\n false\nend",
"def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n end\nend",
"def position_taken?(board,position)\n return false if [\" \", \"\", nil].include?(board[position])\n return true if [\"X\", \"O\"].include?(board[position])\n raise \"#{board[position]} is not a valid move\"\nend",
"def position_taken?(position)\n if @board[position] == \" \" || @board[position] == \"\" || @board[position] == nil\n false\n elsif @board[position] == \"X\" || @board[position] == \"O\"\n true\n end\n end",
"def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n else\n false\n end\n\nend",
"def position_taken?\nend",
"def position_taken?(position)\r\n if @board[position] == \"\" || @board[position] == \" \" || @board[position] == nil\r\n return false\r\n elsif @board[position] == \"X\" || @board[position] == \"O\"\r\n return true\r\n end\r\n end",
"def position_taken?(index)\n @board[index] == \"X\" || @board[index] == \"O\"\n end",
"def position_taken?(board,pos)\n if board[pos.to_i]==\"X\" || board[pos.to_i] ==\"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(index)\n ((@board[index] == \"X\") || (@board[index] == \"O\"))\n end",
"def position_taken?(board,position)\n return true if board[position]==\"X\" || board[position]==\"O\"\n return false\nend",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\nend",
"def position_taken?(board, position)\n if !board.empty? && board[position] && (board[position].include?(\"X\") || board[position].include?(\"O\"))\n true\n else\n false\n end\nend",
"def position_taken?(board, position)\n if !(board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n else \n return false\n end\nend",
"def position_taken?(board, position)\n return true if board[position - 1] == \"X\" || board[position - 1] == \"O\"\n false\nend",
"def position_taken?(board, index)\n board[index] == \"X\" || board[index] == \"O\"\n end",
"def position_taken?(board, position)\n if board[position]==\"\" || board[position]==\" \"\n return false\n elsif board[position] == \"X\" || board[position]==\"O\"\n return true\n else\n return false\n end\nend",
"def taken?(input)\n\t\tif position(input) == \"X\" || position(input) == \"O\"\n\t\t\ttrue # Position is taken\n\t\telse\n\t\t\tfalse # Position is free\n\t\tend\n\tend",
"def position_taken?(board, input)\n if board[input] == \"X\" || board[input] == \"O\"\n TRUE\n else FALSE\n end\nend",
"def position_taken?(board, position)\n if ((board[position] == \"X\") || (board[position] == \"O\" ))\n return true\n elsif board[position] == nil\n false\n else\n false\n end\nend",
"def position_taken?(board, position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n true\n end\nend",
"def taken?(input_position)\n self.position(input_position) == \"X\" || self.position(input_position) == \"O\"\n end",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def valid_move?\n\t\tvalid_1 = (0..2).include? (@take_from)\n\t\tvalid_2 = (0..2).include? (@move_to)\n\t\tif valid_1 == false || valid_2 == false\n\t\t\tputs \"I'm sorry, please input your move in a 'x,y' format, ensuring that you are selecting numbers between 1 and 3!\"\n\t\t\tmove_input\n\t\telsif @pegs[@take_from][0] == nil\n\t\t\tputs \"I'm sorry, I'm not in the mood for a philosophical debate so let's just agree that you cannot move nothing and you can try again.\"\n\t\t\tmove_input\n\t\tend\n\tend",
"def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end",
"def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end",
"def position_taken?(board,position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board,position)\n pos = position.to_i\n val = board[pos-1]\n if val == \"X\" || val ==\"O\"\n true\n else\n false\n end\nend",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(board,index)\n if board[index] == \"X\" || board[index] == \"O\"\n TRUE\n else\n FALSE\n end\nend",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def position_taken?(board, i)\n board[i] == \"X\" || board[i] == \"O\"\nend",
"def position_taken?(board, index)\n board[index]== \"X\" || board[index] == \"O\"\nend",
"def taken?(position)\n #board position -1 because of test using range 1-9 (user input numbers)\n self.cells[position.to_i-1] == \"X\" || \n self.cells[position.to_i-1] == \"O\"\n end",
"def position_taken?(board, index)\n board[index] == \"X\" || board[index] == \"O\"\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, index)\n board[index] === \"X\" || board[index] ===\"O\" ? true : false\nend",
"def position_taken?(board, index)\n board[index] === \"X\" || board[index] ===\"O\" ? true : false\nend",
"def position_taken?(board, position)\n value = position.to_i - 1\n if board[value] == \"X\" || board[value] == \"0\"\n true\n end\nend",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(board, position_index)\n board[position_index] == \"X\" or board[position_index] == \"O\"\nend",
"def position_taken?(index)\n @board[index]==\"X\" || @board[index] == \"O\"\nend",
"def position_taken?(board, position)\n if board[position] == nil || board[position] == \" \" || board[position] == \"\"\n return false\n elsif board[position] == \"X\" || board[position] == \"O\"\n return true \n end \nend",
"def position_taken?(board, desired_position)\n if [\" \", \"\", nil].include?board[desired_position]\n return false\n end\n if [\"X\", \"O\"].include?board[desired_position]\n return true\n end\nend",
"def position_taken?(board, position)\n\tif board[position] == \" \" || board[position] == \"\" || board[position] == nil \n\t\treturn true\n\telse board[position] == \"O\" || \"X\"\n\t\treturn false\n\tend\nend",
"def position_taken?(board, position)\n\tif board[position] == \" \" || board[position] == \"\" || board[position] == nil \n\t\treturn true\n\telse board[position] == \"O\" || \"X\"\n\t\treturn false\n\tend\nend",
"def position_taken?(board,position)\n if board[position]== \"\" || board[position]== \" \" || board[position]== nil\n return false\n\n elsif board[position]==\"X\" || board[position]==\"O\"\n return true\n end\nend",
"def position_taken?(board, position)\n if board[(position.to_i) - 1] == \" \" || board[(position.to_i) - 1] == \"\" || board[(position.to_i) - 1] == nil\n false\n elsif board[(position.to_i) - 1] == \"X\" || board[(position.to_i) - 1] == \"O\"\n \tfalse\n end\nend",
"def position_taken?(board, index)\n space = board[index]\n if space == 'X' || space == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(index)\n if @board[index] == \"X\"\n true\n elsif @board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n elsif board[position] != \" \" || board[position] != \"\"\n return false\n end\nend",
"def position_taken?(board, idx)\n [\"X\", \"O\"].include?(board[idx])\nend",
"def position_taken?(board, position)\n spot = board[position]\n if((spot == \" \") || (spot == \"\") || (spot == nil))\n return false\n elsif ((spot == \"X\") || (spot == \"O\"))\n return true\n end\nend",
"def position_taken?(board, new_index)\n if board[new_index] == \"X\" || board[new_index] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n if (board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n elsif !(board[position.to_i - 1] == \" \" || board[position.to_i - 1] == nil )\n return true\n else\n return false\n end\nend",
"def position_taken? (board,index)\n if ( board[index] == \"X\" || board[index] == \"O\" )\n return true\n else\n return false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\"\n true\n elsif board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board,position)\n\n if board[position]== \"\" || board[position]== \" \" || board[position]== nil\n return false\n elsif board[position]==\"X\" || board[position]==\"O\"\n return true\n end\nend",
"def position_taken?(board, position)\n if board[position] == \" \"\n return false\n elsif board[position] == \"\"\n return false\nelsif board[position] == nil\n return false\nelsif board[position] == \"X\" || \"O\"\n return true\nend\nend",
"def position_taken?(board, position)\n \n if board[position.to_i-1] == \" \"\n then false\n elsif board[position.to_i-1] == \"\" \n then false\n elsif board[position.to_i-1] == nil\n then false\n elsif board[position.to_i-1] == \"X\"\n then true\n elsif board[position.to_i-1] == \"O\"\n then true\n end\nend",
"def position_taken?(index)\n if @board[index] == nil or @board[index] == \"\" or @board[index] == \" \"\n return false\n elsif @board[index] == \"X\" or @board[index] == \"O\"\n return true\n end\n end",
"def position_taken?(board,index)\n board[index] == \"X\" || board[index] == \"O\"\nend",
"def position_taken?(board, idx)\n\tif board[idx] == nil || board[idx] == \"\" || board[idx] == \" \" \n\t\tfalse\n\telsif board[idx] == \"X\" || board[idx] == \"O\"\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def position_taken?(position)\n @board[position] != nil && @board[position] != \" \"\n end",
"def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end",
"def position_taken?(location)\n !(board[location] == \" \" || board[location].nil?)\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def position_taken?(board, position)\n if (board[position]==\" \") || (board[position]==\"\")\n return false\n elsif (board[position]==\"X\") || (board[position]==\"O\")\n return true\n elsif (board[position]==nil)\n return false\n end\nend",
"def position_taken?(board, position)\n\n position = board[position.to_i]\n if board[position.to_i] == \" \" || board[position.to_i] == \"\" || board[position.to_i] == nil\n false\n else board[position.to_i] == \"X\" || board[position.to_i] == \"O\"\n true\n end\nend",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def position_taken?(position)\n !(@board[position].nil? || @board[position] == \" \")\n end",
"def position_taken?(board, spot)\n if board[spot] == \"\"\n false\n elsif board[spot] == \" \"\n false\n elsif board[spot] == nil\n false\n elsif board[spot] == \"X\"\n true\n elsif board[spot] == \"O\"\n true\n end\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def position_taken?(board,n)\n return board[n]=='X'||board[n]=='O'\nend",
"def position_taken? (board, position)\nif board[position] == \" \" || board[position] == \"\" || board[position] == nil\n return false\nelsif board[position] == \"X\" || board[position] == \"O\"\n return true\nend\nend",
"def position_taken?(board, position)\n if board[position] == \" \" || board[position] == \"\" || board[position] == nil\n false\n elsif board[position] == \"X\" || board[position] == \"O\"\n true\n end\nend",
"def valid_move?(input)\n (0..8).include?(input) && !position_taken?(input)\n end",
"def position_taken?(board, position)\n return true if (board[position-1] == \" \" || board[position-1] == \"\" || board[position-1] == nil)\n return false if (board[position-1] == \"X\" || board[position-1] == \"O\")\nend",
"def valid_move?(position)\n if is_number?(position)\n if position.to_i.between?(0, 10)\n if position_taken?(position.to_i-1)\n false\n else\n true\n end\n else \n false\n end\n else\n false\n end\n end",
"def position_taken?(board, position)\nif board[position] == \" \" || board[position] == \"\" || board[position] == nil\n false\n elsif board[position] == \"X\" || board[position] == \"O\" \n true\nelse\n true\nend \nend",
"def valid_move?(new_x, new_y)\n true\n end",
"def position_taken?(board, position)\n p_taken = false\n if (board[position] == \"\" || board[position] == \" \" || board[position] == nil)\n p_taken = false\n else\n p_taken = true\n end\n p_taken\nend",
"def position_taken?(board,position)\n if board[position] == \" \" or board[position] == \"\"\n return false\n elsif board[position] == nil\n return false\n elsif board[position] == \"X\" or board[position] == \"O\"\n return true\n end\nend",
"def position_taken?(board, position)\n\n if (board[position] == \"X\") || (board[position] == \"O\")\n return true\n end\n\n if (board[position] == \" \") || (board[position] == \"\") || (board[position] == nil)\n return false\n end\n\nend",
"def position_taken? (board, index)\n if (board[index] == \" \")\n false\n\n elsif (board[index] == \"X\") || (board[index] == \"O\")\n true\n\n else\n false\n\n end\n end"
] |
[
"0.7893439",
"0.78867096",
"0.77809876",
"0.77543986",
"0.7724337",
"0.77015907",
"0.77015907",
"0.76881784",
"0.7685502",
"0.7664862",
"0.76627904",
"0.7656584",
"0.76449805",
"0.76388377",
"0.761582",
"0.7611678",
"0.7606079",
"0.76016253",
"0.7597656",
"0.7589818",
"0.7574585",
"0.7570194",
"0.7564504",
"0.7562213",
"0.75598425",
"0.7554797",
"0.7543259",
"0.7542399",
"0.7504674",
"0.750452",
"0.74949646",
"0.748743",
"0.7462593",
"0.7461601",
"0.7460756",
"0.7453373",
"0.7432136",
"0.7419781",
"0.7419781",
"0.7413973",
"0.7413073",
"0.74095464",
"0.7393419",
"0.7390948",
"0.7389431",
"0.7381211",
"0.7381211",
"0.7381211",
"0.73765194",
"0.73765194",
"0.7355806",
"0.73547786",
"0.73427194",
"0.7339118",
"0.7338636",
"0.7337329",
"0.73345935",
"0.73345935",
"0.73297274",
"0.7324076",
"0.7323164",
"0.73224866",
"0.73209566",
"0.7319735",
"0.7316287",
"0.7309261",
"0.7308263",
"0.7308263",
"0.73058546",
"0.7289845",
"0.72892946",
"0.72720736",
"0.72703224",
"0.72652566",
"0.72609544",
"0.72552043",
"0.72520006",
"0.7249359",
"0.72464913",
"0.7243306",
"0.72421294",
"0.7235392",
"0.7232138",
"0.7229965",
"0.7225388",
"0.72244024",
"0.72207224",
"0.7219675",
"0.7215024",
"0.72120893",
"0.71982855",
"0.71938694",
"0.7187323",
"0.71847457",
"0.71838814",
"0.71815693",
"0.71809506",
"0.7173856",
"0.7162031",
"0.7157373",
"0.7142239"
] |
0.0
|
-1
|
Define move. Once it is is verified that the position is valid this method inserts an X by default into the position chosen by the user
|
def move (board,index,character="X")
board[index]=character
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move(position, token='X')\n @board[position] = token\n end",
"def move_x(val)\n update(y, val)\n apply_pos\n end",
"def move(board, position, xo = \"X\")\n board[position] = xo\nend",
"def move(board, position, token=\"X\")\n board[position.to_i - 1] = token \nend",
"def move(position,token=\"X\")\n position=position.to_i - 1\n @board[position]=token\n end",
"def move(location, token = \"X\")\n #this sets the correct index value of the chosen position on the board equal to the token \n #(i.e., puts an X or O where you chose, if valid)\n @board[location.to_i-1]= token\n end",
"def move(location, token=\"X\") # move( 0 , O ) \n @board[location] = token\n #binding.pry\n end",
"def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.update_board(from, to, @color)\n\t\t\tputs \"#{input} is either not a valid input or unavailable. Please try again.\"\n\t\t\tprintf \"Make your move: \"\n\t\t\tinput = gets.chomp\n\t\t\tfrom = input[0..1]\n\t\t\tto = input[2..3]\n\t\tend\n end",
"def move(user_input, character = \"X\")\n @board[user_input] = character\n end",
"def move(board,position,choice=\"X\")\n iPosition = position.to_i\n board[iPosition-1] = choice\nend",
"def move(move_position, player=\"X\")\n @board[move_position] = player\n end",
"def move(location, token =\"X\")\r\n @board[(location.to_i) -1 ]=token\r\n end",
"def make_move(pos, value)\n\t\tif @gameplay_positions[pos] == 0\n\t\t\t@gameplay_positions[pos] = value\n\t\t\tdraw()\n\t\telse\n\t\t\tdraw()\n\t\t\tnot_available()\n\t\tend\n\tend",
"def set_move(x)\n PlayerModelContracts.invariant(self)\n @move = x\n end",
"def move(input, value = \"X\")\n @board[input.to_i - 1] = value\n end",
"def move(board, converted_input, user_marker = \"X\")\n board[converted_input] = user_marker\nend",
"def move(board, position, character = \"X\")\n board[position] = character\nend",
"def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end",
"def move(position,player_letter = \"X\")\r\n #input logic here\r\n @board[position] = player_letter\r\n end",
"def place_x(space)\n \tchoice = to_space_sym(space)\n \t@spaces[choice] = \"X\"\n end",
"def move(board, position, char=\"X\")\n board[position] = char\nend",
"def move(board, position, value = \"X\")\n\n board[position.to_i - 1] = value\n\n return board\nend",
"def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def move(board, pos, mark=\"X\")\n board[pos.to_i-1] = mark\nend",
"def move pos\n new_board = nil\n next_player = @current_player == :x ? :o : :x\n new_board = @board.make_move @current_player, pos\n State.new new_board, next_player, @computer_player\n end",
"def move(y, x)\n update(y, x)\n apply_pos\n end",
"def move(board, position, current_player = \"X\")\n board[position.to_i-1] = current_player\nend",
"def move (board, position, character = \"X\")\n board[(position.to_i - 1)] = character\n return board\nend",
"def make_move\n show_board(\"Let's put your #{@marker} on the board by\\ntyping the letter-number coordinate.\\n\\n\")\n the_move = gets.chomp\n if valid_move(the_move,@marker) then\n show_board(\"You picked #{the_move}. Great spot!\")\n cpu_move \n return\n else\n puts \"That's not a valid move. Please specify your desired position\"\n puts \"using the letter-number coordinate system, e.g. A1 or C2.\"\n make_move\n end\n \n end",
"def set_entered_pos(pos)\n #returning -1 when losing\n unless self[pos] == \"-\"\n return false if self[pos].value == \"X\"\n end\n\n self.handle_pos(pos)\n\n end",
"def make_move\n move = nil\n loop do\n move = input_move\n break if @board.legal?(move, @current_player)\n\n puts 'Please enter a legal move'\n end\n update_fifty_move_counter(move)\n @board.move_piece(move)\n @previous_positions.push(Position.new(@board.clone, @opposing_player.clone, @current_player.clone))\n end",
"def move(board, position, current_player= \"X\")\n board[position.to_i - 1] = current_player\nend",
"def place(x, y, heading_symbol)\n heading = Heading.create(heading_symbol)\n valid_location = @board.safe_location(x, y)\n if valid_location && heading\n @state.unshift(Robot.new(x,y,heading))\n else\n puts \"Invalid heading: #{heading}\" if heading.nil?\n puts \"Invalid location: (#{x}, #{y}). Must be between (0, 0) and (#{@width}, #{@height})\" unless valid_location\n end\n self\n end",
"def move(board, input_to_index, x = \"X\")\n board[input_to_index] = x\n return board\nend",
"def place!(x, y, f)\n raise ArgumentError, 'invalid coordinate' unless @playground.valid_coordinate?(x, y)\n raise ArgumentError, 'invalid position' unless @robot.set_position(x, y, f)\n end",
"def move(board, position , player= \"X\" )\n\tposition = position.to_i\n\tboard[position -1] = player\n\tdisplay_board(board)\nend",
"def move(board, input ,char=\"X\")\n board[input.to_i-1] = char\n display_board(board)\nend",
"def make_a_move(x=nil,y=nil)\n\n\t\tputs '================================'\n\t\tputs '======= Choose your move! ======'\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$ Row 1,2 or 3 $$$$$$$$$'\n\n\t\tx = gets.chomp.to_i if !x\n\n\t\tputs '$$$$$$$ Column 1,2 or 3 $$$$$$$$'\n\n\t\ty = gets.chomp.to_i if !y\n\n\t\tputs '--------------------------------'\n\n\t\tmove = [x-1,y-1]\n\n\t\treturn move\n\n\tend",
"def place(x, y)\n self.robot_position = {\n x: x,\n y: y\n } if valid_coordinates?(x, y)\n end",
"def place(x, y, f)\n return unless valid_position?(x, y)\n set_position(x, y)\n set_direction(f.downcase.to_sym)\n end",
"def make_move(board)\n puts \"Opponent is thinking...\\n\"\n minimax(board, @char, 0)\n if board.update('O', @choice[0], @choice[1])\n board.draw\n puts \"Opponent chose coordinates (#{@choice[0]+1}, #{@choice[1]+1})\\n\"\n else\n puts \"Something went wrong. The opponent made an illegal move.\\n\"\n end\n end",
"def move(index, token = 'X')\n @board[index] = token\nend",
"def move(board, input, character = \"X\")\n board[input] = character\n display_board(board)\nend",
"def move (board, index, token = \"X\")\n board[index] = token\nend",
"def move(board, place, char=\"X\")\n board[place] = char\nend",
"def move(board, input_to_index, character = \"X\")\n board[input_to_index] = character\nend",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end",
"def move(board, index, token = \"X\")\n board[index] = token\nend",
"def move(board, index, token = \"X\")\n board[index] = token\nend",
"def move(board, location, character = \"X\")\n int_location = location.to_i - 1\n board[int_location] = character\nend",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def apply move, symbol=:x\r\n @table[move[0]][move[1]] = symbol if @table[move[0]][move[1]] == :blank\r\n end",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def move(board, location, char=\"X\")\n location = location.to_i\n board[location - 1] = char\nend",
"def move(board, user_input, charac = \"X\")\n board[user_input] = charac \nend",
"def move(board, index, token = \"X\")\n board[index] = token\nend",
"def make_player_move!(player_move_position)\n self.game_data[player_move_position] = \"O\"\n self.player_move_count += 1\n self.save!\n end",
"def move(board, index, token = \"X\")\r\n board[index] = token\r\nend",
"def move_to(pos)\n if (@current_pos != nil && @current_pos == pos)\n return\n end\n if pos == 5\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end\n if [1, 2, 3].include?(pos)#bottom\n self.y = Graphics.height - self.height\n if @win_help != nil\n self.y -= @win_help.height\n end\n end\n if [1, 4, 7].include?(pos)#left\n self.x = 0\n end\n if [7, 8, 9].include?(pos)#top\n self.y = 0\n end\n if [3, 6, 9].include?(pos)#right\n self.x = Graphics.width - self.width\n end\n @current_pos = pos\n end",
"def move(move_index, player_token = \"X\")\r\n @board[move_index] = player_token\r\n end",
"def move(board, location, current_player = \"X\")\n board[location.to_i-1] = current_player\nend",
"def move(board, location, current_player = \"X\")\n board[location.to_i-1] = current_player\nend",
"def move(board, new_index, position = \"X\")\n\nboard[new_index] = position\n\nend",
"def x_player_turn\n print \"Player X:\"\n @x_player_choice = gets.chomp\n #Make sure that the player inputs a correct input\n if check_coord_marked?(@x_player_choice)\n print \"Already marked please try again\\n\"\n self.x_player_turn\n elsif @coordinates.any?{|i| i==@x_player_choice}\n self.place_mark(@x_player_choice, \"x\")\n else\n print \"Not a valid Coordinate try again \\n\"\n self.x_player_turn\n end\n end",
"def place x, y, f\n if @board.can_place?(x, y) and valid_direction?(f)\n @x = x\n @y = y\n @f = DIRECTIONS.index(f.to_s.downcase)\n end\n report\n end",
"def move(board, index, token = \"X\")\n board[index] = token\n display_board(board)\nend",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def make_move(symbol, row, column)\n if(symbol != @@X_SYMBOL && symbol != @@O_SYMBOL)\n raise ArgumentError, \"symbol must either be an X or an O\"\n end\n\n if(@board[row][column] != @@X_SYMBOL && @board[row][column] != @@O_SYMBOL)\n @board[row][column] = symbol\n return true\n end\n return false\n end",
"def move x, y\n put x, y # FIXME\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def setup_move\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n mx = @map_char.real_x + @acts[1]\n my = @map_char.real_y + @acts[2]\n goto(mx, my, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def move(board, position, token)\n board[position] = token\nend",
"def move(index, character = \"X\")\n if character == \"X\"\n @board[index] = \"X\"\n else character == \"O\"\n @board[index] = \"O\"\nend\nend",
"def make_move(position, player)\n row, col = get_index(position: position)\n if @squares[row][col].nil?\n @squares[row][col] = player\n else\n raise ArgumentError.new('Position already taken!')\n end\n end",
"def move(board, input_to_index, player_character = \"X\")\n board[input_to_index] = player_character\nend",
"def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end",
"def move(index, token = \"X\")\n @board[index] = token\n end",
"def make_move(board, display)\n new_pos = nil\n until new_pos\n display.render\n new_pos = display.cursor.get_input\n end\n new_pos\n end",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def make_move(move)\n\t\t@board[move]= $current_player\n\tend",
"def move\n return unless placed?\n # We know place() will already ignore invalid placements, so just advance\n # the robot and let it fail silently if those positions are not on the board\n place(*next_position, direction)\n end",
"def resolve_move(player_move, token)\n\t\t@board.insert(player_move, token)\n\t\tcheck_victory_condition\n\tend",
"def place(x, y, direction)\n raise TypeError, 'Invalid coordinates' unless x.is_a? Integer and y.is_a? Integer\n raise TypeError, 'Invalid direction' unless DIRECTIONS.include?(direction)\n\n if valid_position?(x, y)\n @position = { x: x, y: y }\n @direction = direction\n true\n else\n false\n end\n\n end",
"def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end",
"def place(x, y, direction)\n raise TypeError, 'Invalid coordinates' unless x.is_a?(Integer) && y.is_a?(Integer)\n raise TypeError, 'Invalid direction' unless Constant::DIRECTIONS.include?(direction)\n\n if valid_position?(x, y)\n @position = { x: x, y: y }\n @direction = direction\n true\n else\n false\n end\n end",
"def move!(move = {})\n raise GameNotStarted, 'this game is not running' unless started?\n\n raise InvalidPlayerMove, 'this player is not authorized for this move' unless move_valid_for?(current_mover.id)\n\n if board.move!(move.fetch(:y_axis).to_i, move.fetch(:x_axis).to_i, current_mover.id)\n move.merge!(player_id: current_mover.id)\n self.board.moves.create!(move)\n\n update_columns({last_player_id: current_mover.id})\n else\n return false\n end\n\n # checking out for possible result!\n game_over?\n\n true\n end",
"def get_move\n print \"enter a position in format 'x y' : \"\n input = gets.chomp.split.map(&:to_i)\n move_position(input)\n end",
"def move(board, pos, character= \"X\")\n update_array_at_with(board, pos, character)\nend",
"def valid_move?(new_x, new_y)\n true\n end",
"def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif direction == \"S\"\n\t\t\t@y -= 1\n\t\telsif direction == \"E\"\n\t\t\t@x += 1\n\t\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend",
"def move(x_pos, y_pos, type)\n # convert y_pos and x_pos to proper array index integer!\n y_pos = y_pos.ord - 65\n x_pos = x_pos.to_i - 1\n\n # inputs move of type Z at X,Y (if not illegal!)\n return false unless @board[x_pos][y_pos].type == TYPE_EMPTY\n\n @board[x_pos][y_pos].type = type\n true\n end",
"def move(board, index, value = 'X')\n board[index] = value\nend",
"def turn \n\n puts \"Please enter a position between 1-9. \\n\"\n\n position = gets\n\n if !position_taken?(position) && valid_move?(position)\n move(position,current_player)\n display_board\n elsif position_taken?(position) || !valid_move?(position)\n puts \"Invalid move. Please re-enter a position between 1-9. \\n\"\n position = gets\n end\n end",
"def interpret_move(command)\n ensure_placed\n @robot.move_forward\n end",
"def move(position, player_token)\n @board[position] = player_token\n end",
"def turn(board)\n puts \"Please enter 1-9:\"\n position = gets.strip\n\n if valid_move?(board, position) #&& position_taken?(board, position)\n move(board, position, current_player = \"X\")\n puts \"Please enter 1-9 again:\"\n else\n puts \"Please enter a valid number\"\n turn(board)\n end\n\n display_board(board)\n\nend",
"def place_mark(*pos, mark)\n if !valid_move?(*pos)\n pos = off_board_error\n self[*pos] = mark\n elsif !empty?(*pos)\n pos = pos_error\n self[*pos] = mark\n else\n self[*pos] = mark\n end\n end",
"def make_move(row: , column: )\n symbol = current_symbol\n raise 'Round finished' if finished?\n raise 'Move already taken' if board(row: row, column: column) != '_'\n board_state[index_from_row_column(row, column)] = symbol\n self.update(board_state: board_state, current_player: next_player)\n end",
"def move_straight(step, x)\n comp(:position).add!(x * step)\n on_move\n end"
] |
[
"0.71694547",
"0.70786256",
"0.7068784",
"0.700451",
"0.69008243",
"0.6840095",
"0.68384933",
"0.6796639",
"0.6777916",
"0.6719428",
"0.66996807",
"0.6694327",
"0.6694293",
"0.66904205",
"0.6656348",
"0.6647354",
"0.6640236",
"0.6633135",
"0.6602142",
"0.65712494",
"0.6567188",
"0.6562884",
"0.6560412",
"0.6547233",
"0.65452933",
"0.651877",
"0.65067077",
"0.6504143",
"0.65008134",
"0.64900076",
"0.6487336",
"0.64832914",
"0.6482803",
"0.647736",
"0.64630896",
"0.6447274",
"0.64464974",
"0.64297837",
"0.64027",
"0.64026064",
"0.6392169",
"0.63910204",
"0.6388749",
"0.63831794",
"0.6383103",
"0.63648176",
"0.63570595",
"0.6353244",
"0.6340028",
"0.6337448",
"0.6337448",
"0.63362044",
"0.6320315",
"0.6318786",
"0.63169026",
"0.63024247",
"0.63010985",
"0.6298657",
"0.62972677",
"0.62949574",
"0.6265002",
"0.62624204",
"0.6226506",
"0.6226506",
"0.6223015",
"0.6222876",
"0.62224644",
"0.62192655",
"0.6217183",
"0.6210532",
"0.62101525",
"0.62090886",
"0.62015235",
"0.62010294",
"0.6184485",
"0.61797386",
"0.6172054",
"0.616945",
"0.6164863",
"0.61608213",
"0.61602265",
"0.61581784",
"0.6157395",
"0.6136629",
"0.6135981",
"0.6134739",
"0.6131299",
"0.6127851",
"0.61247134",
"0.611236",
"0.61033785",
"0.6102177",
"0.61012256",
"0.6093854",
"0.6090717",
"0.6089535",
"0.6081246",
"0.60786",
"0.6078346",
"0.60775316",
"0.6075046"
] |
0.0
|
-1
|
define una variable matrix, fil, col y realiza por defecto un set y un get de dicha variable == Inicializacion Densa
|
def initialize(filas, columnas, *args)
@fil = filas
@col = columnas
@numCeldas = @fil * @col
@matrix = Array.new(@fil) {Array.new(@col)} # variable de instancia al accessor matrix que se hizo previamente
if args.length != 0
to_s(*args)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(nfil,ncol,mat) \n @nfil = nfil # inicializo numero de filas\n @ncol = ncol # inicializo numero de columnas \n @mat = Array.new(mat) #inicializo la matriz pasando como parametro un objeto de tipo matriz \n end",
"def set_valores_num\n valor = 1\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n @matrix[i][j] = valor\n valor += 1\n j += 1\n end\n i += 1\n end\n end",
"def set_valores_fracc\n a = 1\n b = 2\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n @matrix[i][j] = Fraccion.new(a,b)\n a += 1\n b += 1\n j += 1\n end\n i += 1\n end\n end",
"def initialize(filas, columnas)\n #Variable que guarda el numero de filas de la matriz.\n @filas=filas\n #Variable que guarda el numero de columnas de la matriz. \n @columnas=columnas \n end",
"def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \t@filas.times{ |i|\n \t\t@columnas.times{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend",
"def setVariable(name, var)\n\n # Since this code was already written for three separate values,\n # I'm just splitting it back up for now.\n\n arg_names = var.old_args\n cells = Array.new\n var.cells.each do |cell|\n c = Array.new\n c << cell.onset\n c << cell.offset\n c << Array.new\n var.arglist.each do |arg|\n t = eval \"cell.#{arg}\"\n c[2] << t.to_s()\n end\n cells << c\n end\n print \"creating column\"\n # If the column already exists, delete it and build a new one.\n # If it doesn't, just add a new one.\n if not $db.col_name_in_use(name)\n col = DataColumn.new($db, name, MatrixVocabElement::MatrixType::MATRIX)\n $db.add_column(col)\n else\n oldcol = $db.get_column(name)\n numcells = oldcol.get_num_cells\n numcells.downto(1) do |i|\n $db.remove_cell($db.get_cell(oldcol.get_id, i).get_id)\n end\n #$db.remove_column(oldcol.get_id)\n\n #col = DataColumn.new($db, name, MatrixVocabElement::MatrixType::MATRIX)\n #$db.add_column(col)\n end\n # Check if matrix already defined\n col = $db.get_column(name)\n mve0 = $db.get_matrix_ve(col.its_mve_id)\n if mve0.get_num_formal_args() == 1\n # Setup structure of matrix column\n mve0 = MatrixVocabElement.new(mve0)\n\n mve0.delete_formal_arg(0)\n arg_names.each do |arg|\n farg = NominalFormalArg.new($db, arg)\n mve0.append_formal_arg(farg)\n end\n\n $db.replace_matrix_ve(mve0)\n end\n col = $db.get_column(name)\n mve0 = $db.get_matrix_ve(col.its_mve_id)\n matID0 = mve0.get_id()\n cells.each do |cell|\n #print \"writing cell\"\n c = DataCell.new($db, col.get_id, matID0)\n mat = Matrix.new($db, matID0)\n\n if cell[0].to_i > 0\n c.onset = TimeStamp.new(1000, cell[0].to_i)\n end\n if cell[1].to_i > 0\n c.offset = TimeStamp.new(1000, cell[1].to_i)\n end\n\n narg = 0\n cell[2].each do |dv|\n argid = mve0.get_formal_arg(narg).get_id()\n if dv == \"\" or dv == nil\n a = arg_names[narg]\n fdv = NominalDataValue.new($db, argid)\n fdv.clearValue()\n else\n fdv = NominalDataValue.new($db, argid, dv)\n end\n\n mat.replaceArg(narg,fdv)\n narg += 1\n end\n c.set_val(mat)\n $db.append_cell(c)\n end\nend",
"def createMatrix()\n #matriks = Matrix.new\n @matriks_data = Matrix.zero(@jumlah_node)\n for i in 0..@jumlah_node-1\n for j in 0..@jumlah_node-1\n @matriks_data[i,j] = @file_data[i*@jumlah_node+ j]\n end\n end\n end",
"def trasponer\n\t\telemento = Array.new(0)\n\t\tfor i in 0...colum do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...filas do\n\t\t\t\tfila << pos[j][i]\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@ncol, @nfil, elemento)\n\tend",
"def trasponer\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...colum\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...filas\n\t\t\t\t\tfila << pos[j][i]\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@ncol, @nfil, elemento)\n\t\tend",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def matrix\n end",
"def set_matriz\n @matriz = Matriz.find(params[:id])\n end",
"def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end",
"def set!(row, col, val)\n validate_pos(row, col)\n @fm[row*@cols+col] = val\n end",
"def set_matriz\n @matriz = Matriz.find(params[:matriz_id])\n end",
"def x(escalar)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end",
"def x(escalar)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end",
"def initialize (n,m,mat)\n @f = n\n @c = m\n @matriz = mat\n end",
"def columns=(integer); end",
"def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end",
"def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end",
"def initialize(color, columna, fila, tablero)\n @se_movio = false\n @color = color\n @columna = columna\n @fila = fila\n @tablero = tablero\n @tablero[@columna][@fila] = self\n end",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n for i in 0...@nFil do\n result[i] = Array.new\n for j in 0...mat.mCol do\n if (mat.matriz[0][0].class == Fraccion)\n result[i][j] = Fraccion.new(0, 1)\n else\n result[i][j] = 0\n end\n end\n end\n\n aux = MatrizDensa.new(result)\n\n for i in 0...@nFil do\n for j in 0...mat.mCol do\n for z in 0...@mCol do\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def principal\n op=0\n while (op!=5)\n op= menu1\n case op\n when 1\n\tputs \"CREAR MATRICES\"\n\tputs \"Introduce la dimension de las matriz 1: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1\n\t a= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2\n\t a= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t a.introducir_datos(1)\n\t when 2\n\t a.introducir_datos(2)\n\tend\n\n\tputs \"Introduce la dimension de las matriz 2: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1\n\t b= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2\n\t b= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t b.introducir_datos(1)\n\t when 2\n\t b.introducir_datos(2)\n\tend\n\tputs a.to_s\n\tputs b.to_s\n\t\n when 2\n\tputs \"GENERAR MATRICES CON VALORES ALEATORIOS\"\n\tputs \"Introduce la dimension de la matriz 1: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\t\n\top4=menu4\n\tcase op4\n\t when 1\n\t a= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2\n\t a= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t a.generar(1)\n\t when 2\n\t a.generar(2)\n\tend\n\t\n\tputs \"Introduce la dimension de la matriz 2: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1 #matriz densa\n\t b= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2 #matriz dispersa\n\t b= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t b.generar(1)\n\t when 2\n\t b.generar(2)\n\tend\n\tputs a.to_s\n \tputs b.to_s\n\n when 3\n\t op2=0\n\t while (op2!=5)\n\t op2= menu2\n\t case op2\n\t when 1\n\t\tputs \"Suma\"\n\t\tputs \"M1 + M2 = M3\"\n\t\tputs a.to_s\n\t\tputs \"+\" \n\t\tputs b.to_s\n\t\tputs \"=\"\n\t\tc = a+b\n\t\tputs c.to_s\n\t\n\t\tputs \"Resta\"\n\t\tputs \"M1 - M2 = M3\"\n\t\tputs a.to_s\n\t\tputs \"-\" \n\t\tputs b.to_s\n\t\tputs \"=\"\n\t\tc = a-b\n\t\tputs c.to_s\n\t\tpausa\n\t\t\n\t when 2\n\t\tputs \"Mutiplicacion por un escalar\"\n\t\tprint \"Numero a multiplicar?: \"\n\t\tSTDOUT.flush\n\t\tnum=gets.chomp\n\t\tnum = num.to_i\n\t\tputs \"#{num.to_i} * M1 = M3\"\n\t\tputs a.to_s\n\t\tc= a*num\n\t\tputs c.to_s\n\t\tputs \"Producto de matrices\"\n\t\tputs \"M1 * M2 = M3\"\n\t\tputs a.to_s\n\t\tputs \"*\"\n\t\tputs b.to_s\n\t\tputs \"=\"\n\t\td=a*b\n\t\tputs d.to_s\n\t\tpausa\n\n\t when 3\n\t\tputs \"Traspuesta de matrices\"\n\t\tputs \"M1\"\n\t\tputs a.to_s\n\t\tputs \"traspuesta M1\"\n\t\tputs \"#{a.t.to_s}\"\n\t\tputs \"M2\"\n\t\tputs b.to_s\n\t\tputs \"traspuesta M2\"\n\t\tputs \"#{b.t.to_s}\"\n\t\tpausa\n\n\t when 4\n\t\tputs \"Elementos maximos y minimos\"\n\t\tputs \"Maximo y minimo de M1\"\n\t\tputs a.to_s\n\t\tputs \"Max= #{a.max}\"\n\t\tputs \"Min= #{a.min}\"\n\t\tputs \"Maximo y minimo de M2\"\n\t\tputs b.to_s\n\t\tputs \"Max= #{b.max}\"\n\t\tputs \"Min= #{b.min}\"\n\t\tpausa\n\t end\n\t end\n when 4\n\t\n nueva = MatrizDSL.new(\"suma\") do\n\toption(\"densa\",\"densa\")\n\tresul(operand([[1,2,3],[4,5,6],[7,8,9]]),operand([[1,1,1],[1,1,1],[1,1,1]]))\n end\n# puts \"#{nueva.class}\"\n puts nueva\n# \tm=MatrizDSL.new(\"suma\")\n# \tputs m.to_s\n\tputs \"MOSTRAR\"\n\tputs \"M1 = \"\n\tputs a.to_s\n\tputs \"M2 = \"\n\tputs b.to_s\n\tif a==b\n\t puts \"Las matrices son iguales\"\n\telse\n\t puts \"Las matrices son diferentes\"\n\tend\n end\n pausa\n end\nend",
"def settings(row,column); det.table(:index, 11)[row][column]; end",
"def data\n @data ||= load_matrix\n end",
"def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end",
"def load(arg)\n index = 0\n @mat.each do | _ ,row|\n (0..row.length-1).each do |i|\n row[i] = arg[index]\n index += 1\n end\n end\n end",
"def setmatrixcolumnvalue(c,i,val)\r\n\t\t\tif @matrix[c][i]==\"_\"\r\n\t\t\t\t@matrix[c][i] = val\r\n\t\t\tend\r\n\t\tend",
"def set(row, column, value)\n @matrix[row][column] = value\n end",
"def initialize(f, c)\n\t \t@fil=f.to_i; \t \t\n\t \t@col=c.to_i; \n\tend",
"def setup_with_dims(rows, cols)\n raise \"Invalid dims provided for setting up matrix: #{rows} x #{cols}\" unless rows > 0 && cols > 0\n \n @rows = rows\n @cols = cols\n @fm = Array.new(rows*cols) {|i| 0 }\n end",
"def filas(tablero)\r\n\t#Fila0\r\n\t\te = 0\r\n\t\t@fila0 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila0 << tablero[0,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila1\r\n\t\te = 0\r\n\t\t@fila1 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila1 << tablero[1,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila2\r\n\t\te = 0\r\n\t\t@fila2 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila2 << tablero[2,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila3\r\n\t\te = 0\r\n\t\t@fila3 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila3 << tablero[3,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila4\r\n\t\te = 0\r\n\t\t@fila4 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila4 << tablero[4,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\r\n\t#Fila5\r\n\t\te = 0\r\n\t\t@fila5 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila5 << tablero[5,e]\r\n\t\t\te += 1\r\n\t\tend\r\nend",
"def column=(_); end",
"def getVariable(name)\n index = -1\n\n # Find the internal database index of the column we are looking for.\n $db.get_col_order_vector.each do |col_index|\n if name == $db.get_data_column(col_index).get_name\n index = col_index\n end\n end\n\n #puts \"Got column index.\"\n #puts index\n\n\n dc = $db.get_data_column(index)\n mve = $db.get_matrix_ve(dc.get_its_mve_id)\n\n # Convert each cell into an array and store in an array of arrays\n cells = Array.new\n arg_names = Array.new\n\n if dc.get_its_mve_type == MatrixVocabElement::MatrixType::MATRIX\n for i in (0 .. (mve.get_num_formal_args - 1))\n fa = mve.get_formal_arg_copy(i)\n arg_names << fa.get_farg_name\n end\n end\n\n for i in (1 .. dc.get_num_cells)\n cell = dc.get_db.get_cell(dc.get_id, i)\n c = Array.new\n c << cell.get_onset.get_time\n c << cell.get_offset.get_time\n c << cell.get_val.to_escaped_string.tr_s(\"(\", \"\").tr_s(\")\", \"\").split(\",\")\n c << i\n cells << c\n end\n\n\n v = Variable.new\n v.name = name\n v.old_args = arg_names\n #v.type = dc.get_its_mve_type\n v.set_cells(cells, arg_names)\n\n\n return v\nend",
"def initalize_3d(desviacion, cantidad, xpos, ypos, zpos, yd)\n @matrix = Array.new\n cantidad.times do\n @matrix.push([xpos + 2 * desviacion * rand - desviacion, ypos + 2 * desviacion * rand - desviacion, zpos + 2 * desviacion * rand - desviacion, yd])\n end\n end",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def matriz_clave\n @m_clave=Array.new(4){Array.new()}\n i,j,contador=0,0,0\n @k.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_clave[i][j] = x\n i+=1\n contador+=1\n end\n @m_clave\n end",
"def set(m)\n 0.upto(m.row_size - 1) do |i|\n 0.upto(m.column_size - 1) do |j|\n self[i, j] = m[i, j]\n end\n end\n self.wrap = m.wrap\n end",
"def +(mat)\n if (mat.f == @f && mat.c == @c)\n resultado = Array.new\n for i in 0...@f do\n resultado[i] = Array.new\n for j in 0...@c do\n# \t if((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((@matriz[i][j].class = Fraccion) || (mat.matriz[i][j] == Fraccion)))\n# \t resultado[i][j] = Fraccion.new(0,1)\n# \t else\n\t resultado[i][j] = 0 \n# \t end\n end\n end\n aux = Densa.new(resultado)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n\t if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n nElementos += 1\n\t elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n\t aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n\t elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n\t aux.matriz[i][j] = mat.matriz[i][j]\n nElementos += 1\n\t end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end",
"def initialize_2d(desviacion, cantidad, xpos, ypos, yd)\n @matrix = []\n cantidad.times do\n @matrix << ([xpos + 2 * desviacion * rand - desviacion, ypos + 2 * desviacion * rand - desviacion, yd])\n end\n end",
"def initialize(nfil, ncol)\n\t\t\t@nfil = nfil\n\t\t\t@ncol = ncol\n\t\tend",
"def state=matrix\n @current_state=matrix\n end",
"def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def columnas(tablero)\r\n\t#Columnas0\r\n\t\te = 0\r\n\t\t@columna0 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna0 << tablero[e,0]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas1\r\n\t\te = 0\r\n\t\t@columna1 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna1 << tablero[e,1]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas2\r\n\t\te = 0\r\n\t\t@columna2 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna2 << tablero[e,2]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas3\r\n\t\te = 0\r\n\t\t@columna3 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna3 << tablero[e,3]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas4\r\n\t\te = 0\r\n\t\t@columna4 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna4 << tablero[e,4]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\r\n\t#Columnas5\r\n\t\te = 0\r\n\t\t@columna5 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna5 << tablero[e,5]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas6\r\n\t\te = 0\r\n\t\t@columna6 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna6 << tablero[e,6]\r\n\t\t\te += 1\r\n\t\tend\r\nend",
"def to_dispersa(mat)\n resultado = {}\n for i in 0...mat.f do\n for j in 0...mat.c do\n if (mat.matriz[i][j] != 0)\n if (resultado[i].nil?)\n resultado[i] = {}\n end\n resultado[i][j] = mat.matriz[i][j]\n end\n end \n end\n aux = Dispersa.new(mat.f, mat.c, resultado)\n end",
"def set_columna\n @objeto = Columna.find(params[:id])\n end",
"def initialize(fil, col)\n @f, @c = fil, col\n end",
"def Vecinos(matriz,y,x)\r\n\t\t@matriz=matriz #recibo todo el tablero\r\n\t\t#recibo las coordenas donde estoy \r\n\t\t@x=x \r\n\t\t@y=y \r\n\t\t@cuantos=0 #variable para guardar cuantos vecinos tengo en estado true\r\n\r\n\t\t#variables que se posicionan alrededor de la celda en true, Valido no estar en los extremos\r\n\r\n\t\tif @y == 0\r\n\t\t\ttmpY = @y\r\n\t\t\tfinalY=1\r\n\t\telsif @y == @y1-1\r\n\t\t\ttmpY = @y-1\r\n\t\t\tfinalY=1\r\n\t\telse\r\n\t\t\ttmpY = @y-1\r\n\t\t\tfinalY=2\r\n\t\tend\r\n\r\n\t\tif @x == 0\r\n\t\t\ttmpX=@x\r\n\t\t\tfinalX=1\r\n\t\telsif @x == @x1-1\r\n\t\t\ttmpX=@x-1\r\n\t\t\tfinalX=1\r\n\t\telse\r\n\t\t\ttmpX=@x-1\r\n\t\t\tfinalX=2\r\n\t\tend\r\n\t\t\t\r\n\r\n\t\t#hago un ciclo iniciando por la celda que se encuentra a la derecha y arriba de la celda en la que estoy \r\n\t\tfor filas in tmpY..tmpY+finalY\r\n\t\t\tfor columna in tmpX..tmpX+finalX\r\n\t\t\t\tif @matriz[filas][columna] == true \r\n\r\n\t\t\t\t\tif columna == @x && filas == @y #si la celda que estoy validando esta en true la cuento, al menos que sea donde ya estaba\t\t\r\n\t\t\t\t\t\t@cuantos=@cuantos\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\t@cuantos=@cuantos+1\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\tend\t\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def initialize\n\t\t@vida = 1\n\t\t@forca = 1\n\t\t@carisma = 1\n\t\t@arma = 1\n\tend",
"def initTableaux\n @meilleursJoueursScore = [[],[],[]]\n for i in 1..4\n @meilleursJoueursScore.push([])\n for j in 0..4\n @meilleursJoueursScore[i][j]=0\n end\n end\n @meilleursJoueursPseudo = [[],[],[]]\n for i in 1..4\n @meilleursJoueursPseudo.push([])\n for j in 0..4\n @meilleursJoueursPseudo[i][j]=\"---\"\n end\n end\n end",
"def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def initialize\n\n\t\t@width = 8\n\t\t@height = 8\n\t\t@board = Array.new(@height){Array.new(@width)}\n\n\t\t# inicializamos en board con guiones (vacio\n\t\tfor file in (0..@width-1)\n\t\t\tfor column in (0..@height-1)\n\t\t\t\t@board[file][column] = \"--\"\n\t\t\tend\n\t\tend\n\tend",
"def []=(row, column, value)\n end",
"def marcar x, y\n tabuleiro[x][y] = @jogador\n end",
"def det\n if (@nFil == @mCol)\n det = @matriz[0][0]\n aux = MatrizDensa.new(@matriz)\n for k in 0...@nFil do\n l = k+1\n for i in l...@mCol do\n for j in l...@mCol do\n aux.matriz[i][j] = (aux.matriz[k][k] * aux.matriz[i][j] - aux.matriz[k][j] * aux.matriz[i][k])/ aux.matriz[k][k]\n end\n end\n det = det * aux.matriz[k][k]\n end\n else\n det = \"ERROR, la matriz no es cuadrada\"\n end\n det\n end",
"def exercise_1113 (matrix)\n end",
"def initMatrix(a)\n\t\tfor i in 0..5\n\t\tcolumn = []\n\t\ta[i] = column\n\t\t\tfor j in 0..5\n\t\t\tcolumn[j] = \" \"\n\t\t\tend\n\t\tend\n\treturn a\t\n\tend",
"def set_data_matrix(matrix, data_matrix = DATAMATRIX_KEY)\n @map[data_matrix] = matrix.to_a\n end",
"def calcularFilCol(numElem)\r\n\t\t\r\n\t\ti = 0\r\n\t\tnum = 0\r\n\t\t\r\n\t\twhile i < @fil\r\n\t\t\t\r\n\t\t\tj = 0\r\n\t\t\t\r\n\t\t\twhile j < @col\r\n\t\t\t\t\r\n\t\t\t\tif (num == numElem)\r\n\t\t\t\t\t\r\n\t\t\t\t\t@filM.push(i)\r\n\t\t\t\t\t@colM.push(j)\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tnum += 1\r\n\t\t\t\tj += 1\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\t\t\r\n\t\tend\r\n\t\t\r\n\tend",
"def get(i,j)\n if( !(i.is_a? Fixnum) or i < 0 or i >=@fil or !(j.is_a? Fixnum) or j < 0 or j >= @col)\n return nil\n end\n \n return @matrix[i][j]\n end",
"def createMatrix\n jsonArray = Array.new(@matrixRow)\n #Tenim un array vertical de n files, en cada casella es crea un altre\n #vector horitzontal amb tantes posicions com \"tags\" té aquest tipus de taula\n\t\tfor i in 0..@matrixRow-1\n\t\t\tjsonArrayColumns = Array.new(@matrixColumn)\n\t\t\tfor j in 0..@matrixColumn-1\n if i==0 #Quan es la primera fila s'afegeixen els tags a la matriu\n jsonArrayColumns[j] = @firstRow[j]\n else\n\t\t\t\t jsonArrayColumns[j] = @jsonObject[i-1][@firstRow[j]]\n end\n\t\t\tend\n\t\t\tjsonArray[i] = jsonArrayColumns\n\t\tend\n return jsonArray\n end",
"def initialize(codigo,nome,duracao)\n @duracao = duracao\n @disciplinas = Array.new\n\n for semestre in (0 .. @duracao - 1 ) do\n disciplinas[semestre] = Array.new\n end\n # @disciplinas = Matrix.empty(duracao,0)\n super(codigo, nome)\n end",
"def det\n if (@nFil == @mCol)\n det = @matriz[0][0]\n aux = Matriz.new(@matriz)\n for k in 0...@nFil do\n l = k+1\n for i in l...@mCol do\n for j in l...@mCol do\n aux.matriz[i][j] = (aux.matriz[k][k] * aux.matriz[i][j] - aux.matriz[k][j] * aux.matriz[i][k])/ aux.matriz[k][k]\n end\n end\n det = det * aux.matriz[k][k]\n end\n else\n det = \"ERROR, la matriz no es cuadrada\"\n end\n det\n end",
"def por(other)\n\t\t\tif ((@nfil != other.ncol) || (@ncol != other.nfil))\n\t\t\t\tputs \"No se pueden multiplicarr las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...nfil\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...other.ncol\n\t\t\t\t\t\taux = 0\n\t\t\t\t\t\tfor k in 0...ncol\n\t\t\t\t\t\t\taux += pos[i][k] * other.pos[k][j]\n\t\t\t\t\t\tend\n\t\t\t\t\t\tfila << aux\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, other.ncol, elemento)\n\t\tend",
"def initialize key , valor, linea, columna\n @key = key \n @valor = valor\n @linea = linea\n @columna = columna\n end",
"def PrimeraRonda(matriz,numAleatorios)\t\r\n\t\tfor x1 in 0..numAleatorios\r\n\t\t\t\t@tablero[Random.rand(fila-1)][Random.rand(col-1)]= true\r\n\t\tend\r\n\tend",
"def initialize()\n @memory = 0\n @variables = Array.new\n @nombres = Array.new\n @salidaF = \"\"\n end",
"def set_matricula\n\t\t\t@matricula = Matricula.find(params[:id])\n\t\tend",
"def initialize(filas, columnas)\n super(filas, columnas)\n @container = Hash.new(zero)\n end",
"def apply(matrix, line, column, value)\n matrix[line, column] = value\n end",
"def +(other)\t \n\t\tif(self.fil == other.fil and self.col == other.col)\n\t\t\t# SELF Matrices densas\n\t\t\tif self.instance_of?MatrizDensa\n\t\t\t\ttemp = MatrizDensa.new(self.fil, self.col, nil)\n\t\t\t\tif other.instance_of?MatrizDensa\n\t\t\t\t\t\n\t\t\t\t\t#for i in (0...@fil.to_i)\n\t\t\t\t\t@fil.to_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in (0...@col.to_i)\n\t\t\t\t\t\t@col.to_i.times do |j|\n\t\t\t\t\t\t\ttemp.mat[i][j] = (@mat[i][j]) + (other.mat[i][j])\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif other.instance_of?MatrizDispersa\n\t\t\t\t\t#for i in (0...@fil.to_i)\n\t\t\t\t\t@fil.to_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in (0...@col.to_i)\n\t\t\t\t\t\t@col.to_i.times do |j| \n\t\t\t\t\t\n\t\t\t\t\t\t\tencontrado = 0\n\t\t\t\t\t\t\t#for k in (0...other.posx.size)\n\t\t\t\t\t\t\tother.posx.size.times do |k| \n\t\t\t\t\t\t\t\tif (i==other.posx[k] and j==other.posy[k] and encontrado==0)\n\t\t\t\t\t\t\t\t\ttemp.mat[i][j] = (self.mat[i][j]) + (other.valor[k])\n\t\t\t\t\t\t\t\t\tencontrado = 1\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif (encontrado == 0)\n\t\t\t\t\t\t\t\ttemp.mat[i][j] = self.mat[i][j]\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\n\t\t\tend\n\n\t\t\t# SELF Matriz Dispersa\n\t\t\tif self.instance_of?MatrizDispersa\n\t\t\t\tif other.instance_of?MatrizDensa\n\t\t\t\t\ttemp = MatrizDensa.new(self.fil, self.col, nil)\n\t\t\t\t\t#for i in (0...@fil.to_i)\n\t\t\t\t\t\t@fil.to_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\tfor j in (0...@col.to_i)\n\t\t\t\t\t\t\tencontrado = 0\n\t\t\t\t\t\t\t#for k in (0...self.posx.size.to_i)\n\t\t\t\t\t\t\tself.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (i==self.posx[k] and j==self.posy[k] and encontrado==0)\n\t\t\t\t\t\t\t\t\ttemp.mat[i][j] = (other.mat[i][j]) + (self.valor[k])\n\t\t\t\t\t\t\t\t\tencontrado = 1\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif (encontrado == 0)\n\t\t\t\t\t\t\t\ttemp.mat[i][j] = other.mat[i][j]\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\n\t\t\n\n\t\t\t\tif other.instance_of?MatrizDispersa\n\t\t\t\t\ttemp = MatrizDispersa.new(self.fil,self.col,[],[],[])\n\t\t\t\t\ttemp.valor = self.valor\n\t\t\t\t\ttemp.posx = self.posx\n\t\t\t\t\ttemp.posy = self.posy\n\n\t\t\t\t\t#for j in (0...other.posx.size.to_i)\n\t\t\t\t\tother.posx.size.to_i.times do |j| \n\t\t\t\t\t\n\t\t\t\t\t\tencontrado = false\n\t\t\t\t\t\t#for k in (0...self.posx.size.to_i)\n\t\t\t\t\t\tself.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(other.posx[j] == temp.posx[k] and other.posy[j] == temp.posy[k])\n\t\t\t\t\t\t\t\ttemp.valor[k] = temp.valor[k] + other.valor[j]\n\t\t\t\t\t\t\t\tencontrado = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif (encontrado == false)\n\t\t\t\t\t\t\ttemp.posx << other.posx[j]\n\t\t\t\t\t\t\ttemp.posy << other.posy[j]\n\t\t\t\t\t\t\ttemp.valor << other.valor[j]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\t\treturn temp\n\t\telse \n\t\t\treturn nil\n\t\tend\n\tend",
"def initialize\n\t\t# Pour désigner une case : @board[i][j] avec i = ligne, j = colonne\n\t\t@board = Array.new(4, nil)\n\t\t@board.map! {|line| Array.new(4, nil)}\n\t\t\n\t\t# Utilisation des lignes et colonnes 0 pour l'affichage : \n\t\t(1..3).each { |col| @board[0][col] = \"#{col}\" }\n\t\t(1..3).each {|line| @board[line][0] = ([\"A\",\"B\",\"C\"][line-1])}\n\t\t@board[0][0] = \" \"\n\n\t\t# Initialisation des 9 BoardCase\n\t\t(1..3).each {|col|\n\t\t\t\t(1..3).each { |line|\n\t\t\t\t\t@board[line][col] = BoardCase.new\n\t\t\t\t}\n\t\t}\n\tend",
"def initialize() # Metodo construtor\r\n \t@caixas = [0,0,0,0,0]\r\n\tend",
"def matrix(arg); return Matrix::new(arg); end",
"def []=(x, y, mark)\n @matrix[y][x] = mark\n end",
"def initialize(cantidad,dimension,epocas,funcion,entradas,capas)\n\t\t@cantidad = cantidad\n\t\t@epocas = epocas\n\t\t@bestPosGlobal = Array.new(dimension,0.0)\n\t\t@entradas = entradas\n\t\t@capas = capas\n\t\t@particulas = initializeProblem\n\tend",
"def populate(lines)\n\t\ti = 1\n\t\t@matrix.each_index do |x|\n\t\t\t# split each line into an array of integers and map to a 2 dimensional array\n\t\t\t@matrix[x] = lines[i].split(' ').map(&:to_i)\n\t\t\ti+=1\t\n\t\tend\t\n\tend",
"def max\n \n # Establecemos valor del primer elemento\n max = @matrix[0][0]\n i = 0\n \n #Fila a fila actualizando el valor maximo\n while (i < @fil)\n j = 0\n while (j < @col)\n if (@matrix[i][j] > max)\n max = @matrix[i][j]\n end\n j += 1\n end\n i += 1\n end\n max\n end",
"def -(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n \n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def set(cols, rows, lays, cell_w, cell_h, cell_d)\n @columns = cols.to_i\n @rows = rows.to_i\n @layers = lays.to_i\n @cell_width = cell_w.to_i\n @cell_height = cell_h.to_i\n @cell_depth = cell_d.to_i\n self\n end",
"def initialize_part_data(data_matrix = DATAMATRIX_KEY)\n raise \"Invalid Method Call: cannot associate part data to an object that isn't a collection\" unless @object.is_a?(Collection)\n # TODO: fix the following so that can use the Base method\n # coll = collection_from(@object.id)\n coll = Collection.find(@object.id)\n @map[data_matrix] = Array.new(coll.dimensions[0]) { Array.new(coll.dimensions[1]) { {} } } if @map[data_matrix].nil?\n end",
"def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend",
"def clearcolumns\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\tend",
"def test_cont\n @m4[0,0]=1\n @m1[0,0]=1\n #insercion\n assert_equal(@m4.to_s,'[[1,0],[0,5]]')\n assert_equal(@m1.to_s,'[[1,1],[1,0]]')\n #obtencion\n assert_equal(@m4[1,1],5)\n assert_equal(@m1[0,0],1)\n end",
"def initialize()\n @rows = 7\n @cols = 7\n @connect = 4\n @ai = false\n @load = \"\"\n end",
"def mapping=(map, dim_set = false)\n p \"reader.rb mapping =. FIX!\"\n @column_mapping.map = map\n end",
"def initialize(rows)\n @rows = rows \n @cols = []\n @blks = []\n adjust_values\n @solution = \"\"\n @valid = validate_all\n @solved = false\n @value_changed = true\n end",
"def set_column\n @column = Column.find_by(id: params[:id], board: @board)\n end",
"def turno!\r\n\t\t#CICLO PARA PASAR POR EL ARREGLO HASTA ENCONTRAR LAS CELDAS VIVAS O LAS CELULAS MUERTAS QUE CUMPLEN CON LA REGLA 4\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\r\n\t\t\t\tif @matriz[f][c] == true\r\n\t\t\t\t\tVecinos(@matriz,f,c) #checo cuantos vecinos tengo alrededor\r\n\t\t\t\t\tReglas(@matriz,@matrizTMP,@cuantos,f,c)#verifico si cumple alguna regla de conway\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\telse # de lo contrario la celda esta en false y debo comprobar la regla 4\r\n\t\t\t\t\t\r\n\t\t\t\t\tVecinos(@matriz,f,c) #regreso cuantos vecinos tiene vivos\r\n\t\t\t\t\t#REGLA 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\r\n\t\t\t\t\tif @cuantos == 3\r\n\t\t\t\t\t\t@matrizTMP[f][c] = true\r\n\t\t\t\t\tend\r\n\t\t\t\tend #cierra if\r\n\t\t\tend #cierra ciclo for\r\n\t\tend #cierra ciclo for \r\n\r\n\t\t#ACTUALIZO LA MATRIZ CON LA TEMPORAL QUE ES COMO DEBE QUEDAR AHORA EL JUEGO\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\t\t \t\t@matriz[f][c]=@matrizTMP[f][c]\r\n\t\t\tend\r\n\t\tend\r\n\r\n\tend",
"def initialize(users, matrix)\n @matrix = matrix\n\n @users = users\n\n # room_id => room\n @rooms = {}\n end",
"def test_creac\n #Matriz densa\n assert_equal(@m1.rows, 2)\n assert_equal(@m1.cols, 2)\n \n #Matriz dispersa\n assert_equal(@m4.rows, 2)\n assert_equal(@m4.cols, 2)\n \n #Creacion\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,@m2.to_s)\n assert_equal(Matriz.nula.to_s,@m3.to_s)\n end",
"def []=(pos, num)\n row, col = pos\n @partial[row][col] = num\n end",
"def sen_settg(row,column); det.table(:index, 12)[row][column]; end",
"def porf(other)\n\t\t\tif ((@nfil != other.ncol) || (@ncol != other.nfil))\n\t\t\t\tputs \"No se pueden multiplicarr las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...nfil\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...other.ncol\n\t\t\t\t\t\taux = Fraccion.new(1,1)\n\t\t\t\t\t\taux = aux - aux\n\t\t\t\t\t\tfor k in 0...ncol\n\t\t\t\t\t\t\taux += pos[i][k] * other.pos[k][j]\n\t\t\t\t\t\tend\n\t\t\t\t\t\tfila << aux\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, other.ncol, elemento)\n\t\tend",
"def setup\n @matrix = Array.new(bordered_image.height) { Array.new(bordered_image.width, 0) }\n\n max_row_index = (bordered_image.height - invader.height)\n max_column_index = (bordered_image.width - invader.width)\n\n return max_row_index, max_column_index\n end",
"def setrowcol r, c\n @row = r unless r.nil?\n @col = c unless c.nil?\n end",
"def initialize (marca,modelo)\n @marca = marca\n @modelo = modelo\n end",
"def set_variables\n prefix = survey.prefix\n\n q = self.number.to_roman.downcase\n self.question_cells.map do |cell|\n if cell.class.to_s =~ /Rating|Checkbox|ListItemComment|SelectOption|TextBox/\n var = Variable.get_by_question(id, cell.row, cell.col)\n if var\n # puts \"Setting cell (#{cell.row},#{cell.col}) i: #{cell.answer_item}: #{var.var}\"\n cell.var = var.var\n else\n item = cell.answer_item\n item << \"hv\" if !(item =~ /hv$/) && cell.type =~ /Comment|Text/\n cell.var = \"#{prefix}#{q}#{item}\"\n end\n else\n cell.var = \"\" unless cell.var.nil?\n end\n cell.save\n\t\t\tcell\n end\n end"
] |
[
"0.7009535",
"0.6854426",
"0.6816914",
"0.66970515",
"0.6523886",
"0.64816755",
"0.61885285",
"0.60683024",
"0.60620594",
"0.59683216",
"0.59330755",
"0.59307754",
"0.5920561",
"0.5917447",
"0.58944577",
"0.5858102",
"0.5846265",
"0.5837566",
"0.579734",
"0.5723614",
"0.5722694",
"0.5722679",
"0.569089",
"0.56563556",
"0.56463313",
"0.5640883",
"0.5633621",
"0.55690175",
"0.553043",
"0.55023396",
"0.5431383",
"0.54307747",
"0.5421075",
"0.5382274",
"0.5379329",
"0.5377776",
"0.5365647",
"0.53575534",
"0.534116",
"0.53336924",
"0.5317282",
"0.53166527",
"0.5316257",
"0.5311847",
"0.53064215",
"0.5303339",
"0.5286155",
"0.52739125",
"0.52586454",
"0.5252398",
"0.5251089",
"0.52499706",
"0.52424955",
"0.52258956",
"0.5225067",
"0.52114385",
"0.52053577",
"0.5180568",
"0.5174662",
"0.517383",
"0.5168518",
"0.5163367",
"0.5155327",
"0.51416886",
"0.5141166",
"0.51276684",
"0.5118682",
"0.50831246",
"0.50825894",
"0.5081652",
"0.50607055",
"0.50581807",
"0.5050289",
"0.50489956",
"0.5046458",
"0.50440896",
"0.50379974",
"0.502697",
"0.5022773",
"0.5019621",
"0.5014149",
"0.49948236",
"0.49938107",
"0.4986487",
"0.49858716",
"0.4980355",
"0.49725023",
"0.49640745",
"0.4960181",
"0.49595773",
"0.49566028",
"0.49507347",
"0.49487388",
"0.4947854",
"0.49461076",
"0.49435526",
"0.49322972",
"0.4928933",
"0.49263832",
"0.49138868"
] |
0.64318675
|
6
|
== Paso a string Densa
|
def to_s(*args)
if args.length != @numCeldas
raise ArgumentError, "Numero incorrecto de elementos"
else
numEle = 0
i = 0
while i < @fil
j = 0
while j < @col
@matrix[i][j] = args[numEle]
numEle += 1
j += 1
end
i += 1
end
return @matrix
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string(str); end",
"def str(str); end",
"def str(str); end",
"def damballa(text)\n StringFactory::damballa(text)\n end",
"def damballa(text)\n StringFactory::damballa(text)\n end",
"def String(p0) end",
"def text(string); end",
"def text(string); end",
"def text(str); end",
"def gritar(texto = \"Ahhhh\")\n\t\ttexto\n\tend",
"def input_string; end",
"def string() end",
"def string(*) end",
"def str2; end",
"def str2; end",
"def saludo(sld)\n if sld == 'Hola'\n puts 'Hola Mundo'\n else\n puts 'Buenos días'\n end\nend",
"def string!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n\n\n\n type = STRING\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 36:9: 'nombre'\n match( \"nombre\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 15 )\n\n\n end",
"def text\n \"STRAT\"\n end",
"def read_string; end",
"def è_una_stringa?\n @contenuto.start_with? \"\\\"\" or\n @contenuto.start_with? \"'\" or\n @contenuto.start_with? \"%{\"\n end",
"def str1; end",
"def str1; end",
"def string=(p0) end",
"def string?; end",
"def hello_world (str)\n if str==\"es\"\n puts \"Hola Mundo\"\n elsif str==\"de\"\n puts \"Hallo Welt\"\n elsif str== \"ru\"\n puts \"Привет\"\n end\nend",
"def initialize string\n\t\t@string = string.strip\n\tend",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def str1\n 'from string'\nend",
"def str3; end",
"def str3; end",
"def double_metaphone(str); end",
"def content=(string); end",
"def content=(string); end",
"def str(str)\n Atoms::Str.new(str)\n end",
"def string=(_arg0); end",
"def string_processing(string)\n insert_pair = string.split(' - ')\n\n if insert_pair.size == 2\n @dataset.insert(en: insert_pair.first, ru: insert_pair.last)\n end\n end",
"def str; end",
"def str; end",
"def phrase(str)\n puts \"#{str}..Only in America!\"\nend",
"def initialize string\n @string = string.strip\n end",
"def american_string(string)\n\tputs string + \" only in america\"\nend",
"def set(str)\n\t\timport_fen(str)\n\tend",
"def convert_string string\n string\n end",
"def riempi_stringa(str, lunghezza)\n raise ArgumentError, \"Il primo argomento deve essere una stringa\" unless str.is_a? String\n raise ArgumentError, \"Il secondo argomento deve essere un intero\" unless lunghezza.is_a? Integer\n\n l = str.size\n nsb = lunghezza-l # numero di spazi bianchi da aggiungere\n \n \n return str if nsb == 0\n \n par = str.chomp.split \" \"\n \n i = 1\n while nsb > 0\n # post poni uno spazio bianco alla fine di ogni parola\n par[i].insert(0, \" \")\n i += 1\n nsb -= 1\n end\n \n nuova_linea = par.join \" \"\n l = nuova_linea.size\n \n # se le parole nella linea sono meno degli spazi bianchi, \n # aggiungo spazi bianchi dopo l'ultima parola \n nsb = lunghezza-l # numero di spazi bianchi da aggiungere\n nuova_linea << \" \"*nsb\n \n l = nuova_linea.size\n begin\n msg = \"La lunghezza della linea #{nuova_linea.inspect} di #{l} non e` compatibile con #{lunghezza}\"\n raise RuntimeError, msg unless l == lunghezza\n rescue\n binding.pry\n end\n nuova_linea << \"\\n\" # la linea deve andare accapo\n return nuova_linea\nend",
"def pali(string)\n str = string\n string = string.gsub(/[[:space:]]/, '')\n string = string.downcase\n # p string\n if string.reverse == string\n puts \"#{str} pali\"\n else \n puts \"#{str} not a pali\"\n end\n end",
"def disemvowel(string)\n\nend",
"def encode_string_ex; end",
"def string()\n #This is a stub, used for indexing\n end",
"def string\n end",
"def string\n end",
"def string\n end",
"def step1(str)\n r1,r2 = r12(str)\n r1_text = str[r1..-1]\n r2_text = str[r2..-1]\n\n case r2_text\n when /(anzas?|ic[oa]s?|ismos?|[ai]bles?|istas?|os[oa]s?|[ai]mientos?)$/i\n str[%r{#$&$}]=''\n return true\n when /(ic)?(ador([ae]s?)?|aci[óÓ]n|aciones|antes?|ancias?)$/ui\n str[%r{#$&$}]=''\n return true\n when /log[íÍ]as?/ui\n str[%r{#$&$}]='log'\n return true\n when /(uci([óÓ]n|ones))$/ui\n str[%r{#$&$}]='u'\n return true\n when /(encias?)$/i\n str[%r{#$&$}]='ente'\n return true\n end\n\n if r2_text =~ /(ativ|iv|os|ic|ad)amente$/i or r1_text =~ /amente$/i\n str[%r{#$&$}]=''\n return true\n end\n\n case r2_text\n when /((ante|[ai]ble)?mente)$/i, /((abil|i[cv])?idad(es)?)$/i, /((at)?iv[ao]s?)$/i\n str[%r{#$&$}]=''\n return true\n end\n false\n end",
"def string(str)\n TYPE_STRING +\n word(str.length) +\n str.encode!(\"ASCII\")\n end",
"def fragment(string); end",
"def sn(s)\r\n (s == '(none)' || s == '') ? '-' : s\r\n end",
"def add(string)\n \tstring + \"only in America!\"\n end",
"def formalize(string)\n string.downcase.gsub(/'\"/, '').gsub(/[^a-z0-9_]/, '-').squeeze('-')[0..250].sub(/-$/, '')\n end",
"def init(string)\n return string[0]\nend",
"def diga_ola (nome)\n\nputs 'ola ,' + nome\n\nend",
"def string\n @string\n end",
"def string\n @string\n end",
"def on_tstring_content(string)\n string\n end",
"def write_string(*text); end",
"def string(string_id, skip_ampersand = true)\n string = driver.getString(string_id, skip_ampersand)\n end",
"def anstatauKodo(teksto)\n\n trovoj = teksto.scan(/&(.*?);/)\n if trovoj == nil or trovoj.size <= 0 then return teksto end\n\n for i in 0..trovoj.size do\n \n\ttrov = trovoj[i].to_s[2..-3]\n if @literoj[trov] != nil\n\t teksto.sub!(\"&#{trov};\", @literoj[trov])\n\telse\n\t #puts \"Eraro! Ne trovis [#{trov}]\"\n\tend\n end\n\n teksto = CGI::unescapeHTML(teksto)\n return teksto\nend",
"def sb(s)\r\n (s == '(none)' || s == '') ? '' : s\r\n end",
"def string= string\n #This is a stub, used for indexing\n end",
"def pirates_say_arrrrrrrrr(string)\n\nend",
"def string(string)\n Types::String.cast(string)\n end",
"def pessoavaidois(lugar)\n \"indo para \" + lugar\nend",
"def string(text)\n common_string(text, text.event.unicode)\n end",
"def string(text)\n common_string(text, text.event.unicode)\n end",
"def strings; end",
"def saludanombre(nombre)\n\tputs \"Estimado Señor #{nombre}\"\nend",
"def name_2_id( a_string ) \n return a_string.gsub(\"[\",\"_\").gsub(\"]\",\"\");\n end",
"def string(l, str)\n local(l)\n if str # nil here is bizarre and probably a bug - it means get_arg() was called with nil\n # FIXME: Should rewrite a lot more thoroughly here...\n buf = \"\"\n str.each_byte do |b|\n if b < 32 || b == 92\n buf << @csi\n buf << b.to_s(8)\n elsif b == 34\n buf << '\\\"'\n else\n buf << b.chr\n end\n end\n\n emit(\".asciz\", \"\\\"#{buf}\\\"\")\n end\n end",
"def gritar(texto = \"Grrrrrhhh!\")\r\n\t\t\"Gritando....... #{texto}\"\r\n\tend",
"def valid_string?(field, param)\n true\n end",
"def stringNextChar\r\n\t\t@Line.slice!(0, 1)\r\n\t\tcheckLine\r\n\tend",
"def use string\n @use = string.gsub(/^\\s*\\n/, '').gsub(/\\n\\s*$/, '')\nend",
"def hipsterfy(string)\r\n\r\nend",
"def soundex_str(str); end",
"def soundex_str(str); end",
"def string(*format)\n str=\"\"\n tsformat=\"\"\n kcode=\"\"\n \n if(format.empty?)\n str=\"%o\"\n else\n str=String(format[0])\n tsformat=String(format[1])\n kcode=String(format[2]).downcase\n end\n \n if(tsformat.empty?)\n tsformat=\"%H:%M\"\n end\n \n str.gsub!(\"%T\",@timestamp.strftime(tsformat))\n str.gsub!(\"%n\",String(@selfNick))\n str.gsub!(\"%s\",String(@server))\n str.gsub!(\"%f\",String(@fromNick))\n str.gsub!(\"%F\",String(@from))\n str.gsub!(\"%c\",String(@command))\n str.gsub!(\"%C\",String(@cmndstr))\n str.gsub!(\"%t\",String(@to))\n if(@args.empty?)\n str.gsub!(\"%a\",\"\")\n else\n str.gsub!(\"%a\",@args.join(\" \"))\n end\n str.gsub!(\"%o\",@origin.to_s)\n \n case kcode\n when \"jis\"\n return Kconv::tojis(str)\n when \"sjis\"\n return Kconv::tosjis(str)\n else\n return str\n end\n end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def convert_string string\n return string unless @in_b or @in_em\n chars = if @in_b then\n string.chars.map do |char| \"#{char}\\b#{char}\" end\n elsif @in_em then\n string.chars.map do |char| \"_\\b#{char}\" end\n end\n\n chars.join\n end",
"def to_s \n \"Error: Se encontró un caracter inesperado \\\"#{@valor}\\\" en la línea #{@linea}, Columna #{@columna}\"\n end",
"def lex_en_inside_string=(_arg0); end",
"def saludo(saluda)\n if saluda == 'hola'\n puts 'hola mundo'\n else\n puts \"hola #{saluda}\"\n end\nend",
"def add_rutabaga_to_string(str)\n str << \"rutabaga\"\nend",
"def pasar_cadena(cadena)\n letra = \"\"\n i = 0\n aux =\"\"\n \n cadena.bytes do |c|\n # 32 es el espacio Se pone un 0 para que se de 8 bit\n i = i + 1\n if( i==8) then\n aux << c\n letra << aux.to_i(2).chr\n aux =\"\"\n i=0\n elsif \n \n aux << c\n \n end\n \n # binario << \"0\" + c.to_s(2)\n end\n return letra\n end",
"def decode_string(str)\n\nend",
"def substrings(string)\r\n \r\nend"
] |
[
"0.7018091",
"0.68637675",
"0.68637675",
"0.66699845",
"0.66699845",
"0.6543886",
"0.6535791",
"0.6535791",
"0.6502503",
"0.6474396",
"0.6375788",
"0.62123674",
"0.6179793",
"0.6132193",
"0.6132193",
"0.6086596",
"0.6028436",
"0.5974928",
"0.59657115",
"0.59541386",
"0.5949038",
"0.5949038",
"0.5932278",
"0.5932213",
"0.58856475",
"0.5878908",
"0.58772236",
"0.58772236",
"0.58772236",
"0.58772236",
"0.58772236",
"0.58772236",
"0.58772236",
"0.58772236",
"0.58772236",
"0.5876859",
"0.5816715",
"0.5816715",
"0.5807446",
"0.57327276",
"0.57327276",
"0.57278883",
"0.57106674",
"0.570805",
"0.5705369",
"0.5705369",
"0.56650716",
"0.56553036",
"0.5649047",
"0.5639605",
"0.5628149",
"0.5621307",
"0.56017846",
"0.55887187",
"0.55748636",
"0.55602807",
"0.5552981",
"0.5552981",
"0.5552981",
"0.55526733",
"0.5542876",
"0.5542582",
"0.5540283",
"0.55370855",
"0.552593",
"0.5522188",
"0.550802",
"0.55046535",
"0.55046535",
"0.55042714",
"0.5500983",
"0.54976183",
"0.54886246",
"0.54871815",
"0.5485897",
"0.54827327",
"0.54817694",
"0.5478249",
"0.5475714",
"0.5475714",
"0.54752153",
"0.5472859",
"0.5471541",
"0.54699045",
"0.54673463",
"0.54623777",
"0.5449346",
"0.5444476",
"0.5430829",
"0.5415832",
"0.5415832",
"0.541575",
"0.5409105",
"0.5408458",
"0.5389203",
"0.53760546",
"0.53630686",
"0.5359717",
"0.5343436",
"0.5334954",
"0.5333294"
] |
0.0
|
-1
|
== Metodo suma Densa
|
def +(other)
#if ((other.class.to_s == "Densa") && (other.fil == @fil) && (other.col == @col))
0.upto(@fil - 1) do |i|
j = 0
(@col - 1).times do
@matrix[i][j] = @matrix[i][j] + other.matrix[i][j]
j += 1
end
end
#puts "#{@matrix}"
return @matrix
#else
#raise ArgumentError, "Matrices de distinto tamanio"
#end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum; end",
"def sum (tableau)\n chiffre = 0\n tableau.each do |element|\n chiffre = chiffre + element\n end\n return chiffre\nend",
"def saldo\n\t\t@saldo = 0\n\t\tself.categories.each do |cat|\n\t\t\t@saldo += cat.valor_receita_efetivado\n\t\t\t@saldo -= cat.valor_despesa_efetivado\n\t\tend\n\t\t@saldo\n\tend",
"def opcion4(inventario)\n sum = 0\n inventario.each do |llave,valor|\n sum += valor\n end\n \n puts \"El stock total de la tienda es: #{sum}\"\nend",
"def valor_deducao\n deducoes.reduce(0) do |total,deducao|\n total += deducao.valor\n end\n end",
"def sumar_insumo(nombreInsumo, cantidad)\n\t\tcase nombreInsumo\n\t\t\twhen \"cebada\" then (@cebada += cantidad)\n\t\t\twhen \"arroz_maiz\" then (@arroz_maiz += cantidad)\n\t\t\twhen \"levadura\" then (@levadura += cantidad)\n\t\t\twhen \"lupulo\" then (@lupulo += cantidad)\n\t\t\twhen \"producto_silos_cebada\" then \n\t\t\t\t(@producto_silos_cebada += cantidad)\n\t\t\twhen \"producto_molino\" then \n\t\t\t\t(@producto_molino += cantidad)\n\t\t\twhen \"producto_paila_mezcla\" then \n\t\t\t\t(@producto_paila_mezcla += cantidad)\n\t\t\twhen \"producto_cuba_filtracion\" then \n\t\t\t\t(@producto_cuba_filtracion += cantidad)\n\t\t\twhen \"producto_paila_coccion\" then \n\t\t\t\t(@producto_paila_coccion += cantidad)\n\t\t\twhen \"producto_tanque_preclarificador\" then \n\t\t\t\t(@producto_tanque_preclarificador += cantidad)\n\t\t\twhen \"producto_enfriador\" then \n\t\t\t\t(@producto_enfriador += cantidad)\n\t\t\twhen \"producto_tcc\" then (@producto_tcc += cantidad)\n\t\t\twhen \"producto_filtro_cerveza\" then \n\t\t\t\t(@producto_filtro_cerveza += cantidad)\n\t\t\twhen \"producto_tanque_cerveza\" then \n\t\t\t\t(@producto_tanque_cerveza += cantidad)\n\t\t\twhen \"cerveza\" then (@cerveza += cantidad)\n\t\tend\n\tend",
"def suma(numero_uno:0,numero_dos:0)\n\treturn numero_uno+numero_dos\n\t\nend",
"def sumaint(digitos)\n suma = 0\n if digitos.to_i < 0\n digitos = digitos.to_i\n digitos*= -1\n negativo = true\n end\n arreglo = digitos.to_s.chars\n for digito in arreglo\n dig = digito.to_i\n suma += dig\n end\n if negativo == true\n suma *= -1\n end\n return suma\nend",
"def sum (arr)\n somme = 0 # initialiser la variable la somme à 0 #\n arr.each do |x| # utilisation de l'itérateur each qui va prendre chaque valeur de cette variable #\n somme += x # (somme = somme + x )chaque valeur de l'array est ajouter a la variable somme #\n end\n return somme #\nend",
"def sum_totals\n @total = Lote.where(:programacion_id => @programacion.first).sum(:precio_t)\n @total = Money.new(\"#{@total}00\", \"USD\").format\n @cantidades = Lote.where(:programacion_id => @programacion.first).sum(:cantidad)\n end",
"def valorenergetico\n acumulador1 = 0\n nodo = @head\n while nodo != @tail\n acumulador1 = acumulador1 + nodo.value.valor_energetico\n nodo = nodo.next\n end\n acumulador1\n end",
"def sumar()\n\t\tnumeroUno = 1\n\t\tnumeroDos = 3\n\t\tputs \"-------------------\"\n\t\tputs numeroUno + numeroDos\n\tend",
"def sum(array)\n\t\tsum = 0 #initialise 0 \n\t\tif array.empty? # si tableau vide = rien \n\t\treturn 0 # renvoie 0\n\t\telse # sinon\n\t\tarray.each{|x| sum = sum + x} # tous les elements du tableaux / incremente le code sum\n \t\treturn sum\n\t\tend\n\tend",
"def suma(dato1,dato2)\n return dato1 + dato2\nend",
"def sum arr\n if !arr.empty?\n soma = 0\n arr.each do |elt| ; soma += elt ; end\n return soma\n end\n return 0 \nend",
"def calorie_sum_by_day\n\n end",
"def suma(n, d)\n if(@d == d)\n @n += n\n @n, @d = reducir(@n, @d)\n else\n new_d = lcm(@d, d)\n new_n = ((new_d / @d) *@n ) + ((new_d / d) *n ) \n @n, @d = reducir(new_n,new_d)\n end\n return @n,@d\n end",
"def suma_gramos\n\t\t\t@proteinas + @carbohidratos + @lipidos\n\t\tend",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def calculadora(uno,dos,tres=0, opciones= {})\n if(opciones['suma']==1)\n return uno +dos+tres\n end\n if(opciones['multiplica']==1)\n return uno * dos *tres\n end\nend",
"def dieta_gases_anuales(gramos)\n aux = @head\n suma_gases = 0\n i = 0\n while (!aux.nil?)\n suma_gases += aux[:value].auxiliar(gramos[i])\n aux = aux[:next]\n i = i+1\n end\n return suma_gases.round(2)\n\n end",
"def despesa_mes(data)\n\t\t@valor = 0\n\t\tself.categories.each do |c|\n\t\t\t@valor += c.valor_despesa_mes(data)\n\t\tend\n\t\t@valor\n\tend",
"def dieta_terreno(gramos)\n\n aux = @head\n suma_terreno = 0\n i = 0\n while (!aux.nil?)\n suma_terreno += aux[:value].auxiliar2(gramos[i])\n aux = aux[:next]\n i = i+1\n end\n return suma_terreno.round(2)\n\n end",
"def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end",
"def vct\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el valor\n\t\t#nutricional de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.val_en*cant\n end\n sum\n end",
"def pega_soma(v1,v2)\r\n v1 + v2\r\nend",
"def calculo_valor_calorico_total\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n acumulador = 0\n\n while (recorrido != nil && cantidad != nil)\n acumulador = acumulador + (((recorrido.value.proteinas * cantidad.value)/1000) * 4) + (((recorrido.value.lipidos * cantidad.value)/1000) * 9) + (((recorrido.value.carbohidratos * cantidad.value)/1000) * 4)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n acumulador.round(2)\n end",
"def pega_soma (valor1, valor2)\n valor1 + valor2\nend",
"def sum\n\t\treturn self.reduce(:+)\n\tend",
"def calculate_eficiencia_diaria\n\t\taux = @head\n\t\twhile (aux != nil) do\n\t\t\t$eficiencia_diaria += aux[\"value\"].get_eficiencia_energetica\n\t\t\taux = aux[\"next\"]\n\t\tend\n\t\t$eficiencia_diaria = $eficiencia_diaria.ceil(2)\n\n\tend",
"def suma_visita\n puts \"\\n\\nGuardo conteo de visitas #{id} ...\"\n\n if estadistica = especie_estadisticas.where(estadistica_id: 1).first\n estadistica.conteo+= 1\n estadistica.save\n return\n end\n\n # Quiere decir que no existia la estadistica\n estadistica = especie_estadisticas.new\n estadistica.estadistica_id = 1\n estadistica.conteo = 1\n estadistica.save\n end",
"def sum(a, b)\n\n\tsum = a + b #=> zwroci nam sume zmiennych a i b\n\nend",
"def suma_valores\n resultados = {}\n self.totales = {}\n self.totales_por_comprobante = {}\n\n # revisa todas las monedas\n EmpCuentab.monedas.each do |moneda, id_moneda|\n resultados[moneda] = {\n valor: 0.0,\n descuento: 0.0,\n desc_general: 0.0,\n subtotal: 0.0,\n iva: 0.0,\n ieps: 0.0,\n total: 0.0,\n }\n \n com_det_compra.where(moneda: moneda).each do |cdc|\n valor = cdc.precio * cdc.cantidad\n desc_cdc = valor * (cdc.descuento / 100)\n subtotal_temp = valor - desc_cdc\n desc_gral = subtotal_temp * (descuento / 100)\n subtotal = valor - desc_cdc - desc_gral\n iva = subtotal * (cdc.iva / 100)\n ieps = subtotal * (cdc.ieps / 100)\n total = subtotal + iva + ieps\n\n resultados[moneda][:valor] += valor\n resultados[moneda][:descuento] += desc_cdc\n resultados[moneda][:desc_general] += desc_gral\n resultados[moneda][:subtotal] += subtotal\n resultados[moneda][:iva] += iva\n resultados[moneda][:ieps] += ieps\n resultados[moneda][:total] += total\n\n # actualiza totales\n totales[moneda] = 0.0 unless totales[moneda]\n totales[moneda] += total\n\n # actualiza totales por comprobante\n comprobante = cdc.comprobante ? cdc.comprobante : \"Sin comprobante\"\n tipo_comp = cdc.tipo_comprobante ? cdc.tipo_comprobante : nil\n # total, moneda, nombre del departamento, id del departamento, comprobante, tipo de comprobante\n totales_por_comprobante[comprobante] = [0.0, nil, nil, nil, nil] unless totales_por_comprobante[comprobante]\n totales_por_comprobante[comprobante][0] += total\n totales_por_comprobante[comprobante][1] = cdc.moneda\n totales_por_comprobante[comprobante][2] = cdc.emp_locacion.nombre\n totales_por_comprobante[comprobante][3] = cdc.emp_locacion.id\n totales_por_comprobante[comprobante][4] = comprobante\n totales_por_comprobante[comprobante][5] = tipo_comp\n end\n end\n\n resultados\n end",
"def adeudos\n sumas = suma_valores\n resp = {cuentas_con_deuda: 0} # cuenta si alguna cuenta cuenta con deuda\n EmpCuentab.monedas.each do |moneda, id_moneda|\n total_compra = sumas[moneda][:total]\n total_deuda = total_compra - com_pagos.joins(:emp_cuentab).where('emp_cuentabs.moneda = ?', id_moneda).sum(:monto)\n resp[moneda] = {\n total: total_compra,\n deuda: total_deuda}\n if total_deuda > 0\n resp[:cuentas_con_deuda] += 1\n end\n end\n\n resp\n end",
"def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lipidos*9) + (@proteinas*4)\n\t\tend",
"def sum(data)\n return data.inject{ |sum, n| sum + n }\n end",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def precio_total_compras\n compras.sum(:precio_total)\n #p = 0\n #compras.each do |compra|\n #p += (compra.precio_total || 0)\n #end\n #return p\n end",
"def sum\n turn[0] + turn[1]\n end",
"def sum\n self.inject(:+)\n end",
"def sum(n=16) end",
"def sum\n\t\tprintf(\"%02i.%i\\n\", @options[:monat], @options[:jahr])\n\t\t@db.execute(\"select summe, gemeinsam from sum_#{@options[:name]} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} \") do |row|\n\t\t\tprintf(\"(%s) % .2f EUR \\n\", row[1], row[0])\n\t\tend\n\tend",
"def vrat_celkovy_soucet_vah\n soucet = 0\n @pole_vah.each do |prvek| \n soucet += prvek.to_i\n end\n return soucet\n end",
"def pega_soma(valor1, valor2)\n #resultado =\n valor1 + valor2\n #return resultado\nend",
"def total(a)\n\ta.reduce(:+)\nend",
"def sum(array)\n\t\tarray.empty? ? 'vacio' : sum_of_elements(array)\n\tend",
"def valor_total(estado)\n\t\t@valor = 0\n\t\tself.parts.each do |p|\n\t\t\tif(p.confirmacao == estado)\n\t\t\t\t@valor += p.valor\n\t\t\tend\n\t\tend\n\t\t@valor\n\tend",
"def valor_energetico\n (@proteinas * 4) + (@glucidos * 4) + (@grasas * 9)\n end",
"def sum(addends)\n addends.inject(0, :+)\n end",
"def sum\n reduce(0, &:+)\n end",
"def aumentar(array, aumento, desde, hasta)\n arr_filtro = array[desde..hasta] #rango de los datos filtrados\n arr_filtro.map!{|venta_mensual| venta_mensual * aumento}.sum #valor total por el porcentaje de aumento\nend",
"def ndp_sum; self[:ndp_sum].to_i; end",
"def sum(tab,coef = Array.new(tab.length,1))\n mini = 0\n maxi = 0\n for i in 0..tab.length\n if tab[i].is_a?(IntVar)\n maxi+= tab[i].domain.last*coef[i]\n mini+= tab[i].domain.first*coef[i]\n elsif tab[i].is_a?(Integer)\n maxi+=tab[i]*coef[i]\n mini+=tab[i]*coef[i]\n tab[i]= IntVarStat.new(\"DuMmyINT\"+tab[i].to_s,[tab[i]],self)\n end\n end\n varS = createIntVar(\"PlusDuMmy\"+@dummyNameNb.to_s,mini,maxi)\n varS.depend = true\n @dummyNameNb+=1\n varD = civ(\"PlusDuMmy\"+@dummyNameNb.to_s,mini,maxi)\n @dummyNameNb+=1\n post(eq(varD,varS))\n cst = ContrainteSum.new([varD]+tab,coef)\n post(cst)\n varS.specifique = cst\n return varS\n end",
"def get_valor_energetico\n \n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n \n \n end",
"def vrat_soucet_vah(jedinec)\n soucet = 0\n citac = 0\n jedinec.each do |prvek| \n if(prvek)then\n soucet += @pole_vah[citac].to_i\n end\n citac +=1\n end\n return soucet\n end",
"def set_importe_total\n self.importe_total = 0\n self.detalles.each do |detalle|\n self.importe_total += detalle.precio_unitario * detalle.cantidad unless detalle.marked_for_destruction?\n end\n end",
"def valorcompensacion(idiguana, tipo)\n sumvalor = Iguanaspago.sum('valor', :conditions => [\"iguana_id = ? and tipo = ?\", idiguana, tipo])\n return sumvalor.to_i\n end",
"def sumar (valor1,valor2=0)\n valor1 + valor2\nend",
"def sum\n inject(0) { |acc, i| acc + i }\n end",
"def sumarPrecioBebidas(valor)\n\t lasBebidas = valor\n\t suma = 0\n\t if lasBebidas != nil \n\t lasBebidas.each do |b|\n\t bebAux = Bebida.find(b.to_i)\n\t suma = suma + bebAux.precio\n\t end\n\t return suma\n\t end\n\t return suma\n\t end",
"def sum(n)\n end",
"def calculo_emisiones_diarias\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n\n while (recorrido != nil && cantidad != nil)\n @emisiones_diarias = @emisiones_diarias + ((recorrido.value.gei * cantidad.value)/1000)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n @emisiones_diarias\n end",
"def sum\n transactions.sum(:amount)\n end",
"def sum\n transactions.sum(:amount)\n end",
"def sum\n [@r,@g,@b].inject(:+)\n end",
"def sum_all()\n values = [700, 44, 10, 1, -4, 0, 44, 1001, 88]\n sum = 0\n values.each do |i|\n sum += i\n end\n p sum\nend",
"def total; end",
"def sum n\n\tbegin\n\tn.reduce(:+)\n\trescue \n\t\tn.map!{|x| x.is_a?(Array) ? x.reduce(:+) : x }\n\t\tsum n\n\tend\n\tp n.reduce(:+)\nend",
"def valor_total_gasto\n\t\tself.qualificacoes.sum(:valor_gasto)\n\tend",
"def ValorRetirado(billetes_retiro,valor_solicitado , tipo_cuenta)\n \tsalida = []\n \tsum = 0\n billetes_retiro.each { |a| sum+=a }\n \n\t puts \"total de esta\"\n\t puts sum == valor_solicitado.to_i\n retiro = Atm.new\n retiro.fecha_retiro = Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")\n retiro.valor_retiro = sum\n retiro.save\n if sum == valor_solicitado.to_i\n \tsalida = sum # Si el valor es exacto lo retorna\n else\t\n #Buscamos la diferencia de la cantidad\t\n valor_sobra = sum - valor_solicitado.to_i\n puts valor_sobra\n #Buscamos si un solo billete esta dando la diferencia\n if billetes_retiro.include?(valor_sobra)\n nuevo_array = billetes_retiro.delete(20)\n nuevo_array.each { |a| sum+=a } #relizamos la suma de nuevo\n salida = [nuevo_array, sum] # retornamos array con nuevos valores\n \t else\n \t \tsalida = sum\n end \n end \t\n\n end",
"def sumdet(tipo)\n\t\t\tsuma=0\n\t\t\teach_determinante {|det|\n\t\t\t\t\tif tipo=='M'\n\t\t\t\t\t\tsuma+=1 if det=='Ma' or det=='Mp'\n\t\t\t\t\telsif tipo=='FD'\n\t\t\t\t\t\tsuma+=1 if det=='FD'\n\t\t\t\t\telsif tipo=='C'\n\t\t\t\t\t\tsuma+=1 if det=='C' or det=='FC' or det=='CF'\n\t\t\t\t\telsif tipo=='Cn'\n\t\t\t\t\t\tsuma+=1 if det=='Cn'\n\t\t\t\t\telsif tipo=='F'\n\t\t\t\t\t\tsuma+1 if det=='F'\n\t\t\t\t\telse\n\t\t\t\t\t\tdet=det.gsub(/[ap]/,'')\n\t\t\t\t\t\tsuma+=1 if det=~/#{tipo}/\n\t\t\t\t\tend\n\t\t\t}\n\t\t\tsuma\n\t\tend",
"def ndp_sum=(i); typecast i; end",
"def +(other)\n\t if (other.is_a? Matriz_Dispersa)\n\t\tif(@alt==other.alt && @anc=other.anc)\n\t\t\tsuma=Matriz_Dispersa.new(@alt+1,@anc+1, [],[],[], (@n_elem+other.n_elem))\n\t\t\tm = 0\n\t\t\t0.upto(suma.n_elem-1) do |i|\n\t\t\t if(other.elem[i].is_a? Fixnum)\n\t\t\t suma.elem[i]=0\n\t\t\t end\n\t\t\t if(other.elem[i].is_a? Fraccion)\n\t\t\t suma.elem[i]=Fraccion.new(0,1)\n\t\t\t end\n\t\t\tend\n\t\t\t0.upto(@alt) do |i|\n\t\t\t 0.upto(@anc) do |j|\n\t\t\t 0.upto(@n_elem-1) do |h|\n\t\t\t if(i==@alto[h])\n\t\t\t\t0.upto(@n_elem-1) do |t|\n\t\t\t\t if(j == @alto[t] && h==t)\n\t\t\t\t suma.elem[m]=@elem[t]\n\t\t\t\t suma.alto[m]=@alto[t]\n\t\t\t\t suma.ancho[m]=@ancho[t]\n\t\t\t\t m = m+1\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t end\n\t\t\t 0.upto(other.n_elem-1) do |l|\n\t\t\t\tif(i==other.alto[l])\n\t\t\t\t 0.upto(other.n_elem-1) do |t|\n\t\t\t\t if(j==other.alto[t] && l==t)\n\t\t\t\t suma.elem[m]=(suma.elem[m]+other.elem[t])\n\t\t\t\t suma.alto[m]=other.alto[t]\n\t\t\t\t suma.ancho[m]=other.ancho[t]\n\t\t\t\t m = m+1\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t end\n\t\t\tend\n\t\t\tsuma\n\t\telse\n\t\t puts \"no se puede realizar la suma\"\n\t\tend\n\t else\n\t if(other.is_a? Matriz_Densa)\n\t if(@alt==other.alt && @anc=other.anc)\n\t\tother.+(self.to_densa)\n\t else\n\t\tputs \"no se puede realizar la suma\"\n\t end\n\t end\n\t end\n\tend",
"def sum_produits_assoc\n # TODO URGENT facture 46 la valeur renvoyee est fausse\n sum = 0\n # logger.error \"facture : #{self.id}\"\n self.protofactures.each do |p| \n # logger.error \"produit #{p.produit.name}\"\n # logger.error \"\\tquantite: #{p.quantite}\"\n # logger.error \"\\tused: #{p.get_used}\"\n # logger.error \"\\tstock: #{p.quantite - p.get_used}\"\n sum += p.prix_unit * p.quantite\n end\n # logger.error \"\\tsum_produits_assoc : #{sum}\"\n sum\n end",
"def valor\n\t\t@valor = 0\n\t\tself.parts.each do |p|\n\t\t\t@valor += p.valor\n\t\tend\n\t\t@valor\n\tend",
"def sumarCant(cant,vector)\n\t\tsum = 0.0\n\t\tindex = 0\n\t\twhile(cant > index)\n\t\t\tsum += vector[index]\n\t\t\tindex +=1\n\t\tend\n\t\tsum\n\tend",
"def calculate_sum\n 1000000000000\n end",
"def add_a_d\n end",
"def terreno\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el terreno\n #usado de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.terreno*cant\n end\n @terreno = sum\n\n end",
"def sumarPuntos(resultado)\n @puntos = [@puntos,resultado].transpose.map { |x| x.reduce :+ }\n end",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end",
"def sum_expense(expenses)\n sum = expenses.sum\n return sum\nend",
"def sum(sums)\r\n if sums.empty?\r\n 0\r\n else\r\n sums.reduce(:+)\r\n end\r\nend",
"def sum(arr)\n arr.reduce {|a,b| a+b}\n #correction : arr.reduce(:+,0) marche aussi\nend",
"def sum\n @num1 = params[:bike.days]\n @num2 = params[:bike.price]\n @result = Calculator.total(@num1.to_i, @num2.to_i)\n end",
"def odb_sum\n \"sum(#{to_s})\"\n end",
"def items_cesta()\n @total_cesta_cables = 0\n @items_cesta = 0\n CestaCable.all.each{|c| t=TipoMaterial.find_by_id(c.tipo_material_id);c.cantidad =1 unless !c.cantidad.blank?; suma= t.costo * c.cantidad unless t.nil?; @total_cesta_cables += suma unless t.nil?; @items_cesta += 1 unless t.nil?}\n\n return @items_cesta\nend",
"def sum(num, total) => total += num",
"def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend",
"def add_new_dado\n\t\t@dado += 1\n\tend",
"def suma\n importe = 0\n if params[:depositocaucion_ids].blank? \n else \n params[:depositocaucion_ids].each { |item_id|\n item = Depositocaucion.find(item_id.to_i)\n params[:idcheque] = item.chequetercero_id\n @buscaimportes = Depositocaucion.buscaimporte(params[:idcheque])\n imp = 0\n @buscaimportes.each {|i| imp = imp + i.importe.to_d }\n importe = importe + imp\n }\n end \n params[:importe] = importe \n render :partial => \"suma\"\n end",
"def valor_pendente\n\t\tself.valor_total(0)\n\tend",
"def sum_of_sums(array)\r\nend",
"def salvar_calculados\n self.cif_dolares = fob_dolares.to_f + seguro.to_f + flete_I.to_f + flete_II.to_f + otros_gastos.to_f\n self.cif_bolivianos = 7.07 * cif_dolares.to_f\n self.ga = cif_bolivianos * 0.10\n self.iva = (cif_bolivianos.to_f + ga.to_f) * 0.1494\n self.ice = (cif_bolivianos.to_f + ga.to_f) * 0.18\n self.total_impuestos = ga.to_f + iva.to_f + ice.to_f + diu.to_f\n # otros_1 = ibmetro\n # otros_2 = ibnorca\n self.total_servicios = almacenaje.to_f + senasac.to_f + camara_comercio.to_f + otros_1.to_f + otros_2.to_f + nuestros_servicios.to_f + gastos_tramite.to_f\n \n self.total_despacho = total_impuestos.to_f + total_servicios.to_f\n end",
"def sequence_sum\n reduce(:+)\n end",
"def preco_total\n produto.preco * quantidade\n end",
"def calculo_de_sueldo(attr={})\r\n retencion = @salario * 0.1\r\n salud = @salario * 0.07\r\n pension = @salario * 0.12\r\n sueldo = @salario - retencion - salud - pension\r\n end",
"def increment_dracula\n @count_dracula += 1\n @total_count += 1\n end",
"def hd_sum(config = HD::HDConfig.new)\n total = 0\n all_pairs = []\n self.pairs.each {|x,y| all_pairs << [x,y]}\n all_pairs.each {|x| total += x[0].distance(x[1], config)}\n total\n end",
"def suma_elementos(perrito)\n suma = 0\n perrito.each do |elemento|\n if elemento > 50\n suma += elemento \n end\n end\n puts \"La suma de los elementos del arreglo es: #{suma}\"\nend"
] |
[
"0.72064143",
"0.6970855",
"0.684749",
"0.6810384",
"0.6791239",
"0.67835426",
"0.67128974",
"0.6711477",
"0.6584759",
"0.65599924",
"0.6546582",
"0.6527039",
"0.65146023",
"0.64804494",
"0.6467506",
"0.6406411",
"0.63787323",
"0.6374913",
"0.63739216",
"0.63354427",
"0.63317597",
"0.6316468",
"0.6278337",
"0.6265953",
"0.62436557",
"0.6229925",
"0.6211344",
"0.6205264",
"0.61963654",
"0.6175358",
"0.61593246",
"0.61567134",
"0.6152349",
"0.61492276",
"0.61397177",
"0.6136997",
"0.61302817",
"0.6128648",
"0.6121364",
"0.6113815",
"0.61065555",
"0.6104792",
"0.6102702",
"0.6096264",
"0.6093873",
"0.6087877",
"0.60740167",
"0.6074012",
"0.6063002",
"0.6062407",
"0.60447264",
"0.6040417",
"0.60246545",
"0.60245985",
"0.60050666",
"0.5995525",
"0.59844834",
"0.5983586",
"0.59787554",
"0.5977892",
"0.5973874",
"0.5973423",
"0.59711164",
"0.59711164",
"0.59710425",
"0.5965491",
"0.5959786",
"0.59536254",
"0.5951874",
"0.5948213",
"0.59376925",
"0.59289294",
"0.5915709",
"0.59015834",
"0.5896362",
"0.5886966",
"0.588621",
"0.58834475",
"0.5881731",
"0.58608836",
"0.58597976",
"0.5854332",
"0.58519083",
"0.5846445",
"0.5845735",
"0.58429515",
"0.5839118",
"0.583408",
"0.5833278",
"0.58329797",
"0.5830724",
"0.58281505",
"0.5826789",
"0.58202636",
"0.58163595",
"0.58061785",
"0.57936543",
"0.5793648",
"0.5793129",
"0.5792879",
"0.579217"
] |
0.0
|
-1
|
== Metodo resta Densa
|
def -(other)
#if ((other.class.to_s == "Densa") && (other.fil == @fil) && (other.col == @col))
0.upto(@fil - 1) do |i|
0.upto(@col - 1) do |j|
@matrix[i][j] = @matrix[i][j] - other.matrix[i][j]
end
end
#puts "#{@matrix}"
return @matrix
#else
#raise ArgumentError, "Matrices de distinto tamanio"
#end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def suivre; end",
"def extraer_delante\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cabeza\n @cabeza = @cabeza[:Next_]\n @cabeza[:prev] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end",
"def mi_carrera\n\n\tend",
"def zuruecksetzen()\n end",
"def extraer_detras\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cola\n @cola = @cola[:prev]\n @cola[:Next_] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end",
"def daa\n end",
"def schumann; end",
"def verdi; end",
"def sub_d\n end",
"def schubert; end",
"def terpene; end",
"def sigla; @nome; end",
"def deco_pos; end",
"def devolver_azucar \n\t\treturn @azucares\n\tend",
"def solicitudes_atrasadas\n end",
"def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end",
"def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end",
"def changerEnVide\n\t\t@couleur=-1\n\tend",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def initialize(nombre)\n @nombre = nombre\n @edad = 0\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def revisa_deuda\n if com_compra.adeudos[:cuentas_con_deuda] == 0\n com_compra.pagado!\n else\n com_compra.pendiente!\n end\n end",
"def recuperationNbEtape()\n\t\t@nbEtape=@techniqueObjet.combienEtape()\n\tend",
"def recuperationNbEtape()\n\t\t@nbEtape=@techniqueObjet.combienEtape()\n\tend",
"def descuento_sueldo(sueldo, tipo_obrero)\n\tif tipo_obrero == 'o'\n\t\tsueldo - (sueldo * 0.12) #OCURRE A\n\telse\n\t\tsueldo - (sueldo * 0.15) #OCURRE B\n\tend\nend",
"def traktiNodon(nod, stato)\n\n objekto = {\"tipo\" => nod.name, \"filoj\" => [], \"tradukoj\" => {}, \"filNombro\" => 0}\n stato[\"super\"] << nod.name\n\n miaMarko = false\n\n if nod[\"mrk\"] != nil\n objekto[\"mrk\"] = nod[\"mrk\"]\n stato[\"marko\"] << nod[\"mrk\"]\n miaMarko = true\n end\n\n teksto = \"\"\n \n nod.children().each do |fil|\n\n if fil.name == \"kap\"\n novaKapo = traktiKapon(fil, stato)\n objekto[\"nomo\"] = novaKapo[\"nomo\"]\n objekto[\"tildo\"] = novaKapo[\"tildo\"]\n objekto[\"kapo\"] = novaKapo\n if nod.name == \"drv\"\n # Registri tradukojn en esperanton\n\t for nom in objekto[\"nomo\"].split(\", \")\n\t @esperantaj << fariSerchTradukon(nom, nom, stato[\"nomo\"], stato[\"artikolo\"][\"indekso\"], stato[\"marko\"].last, 0)\n\t end\n end\n elsif fil.name == \"uzo\"\n novaUzo = traktiUzon(fil, stato)\n \t if objekto[\"uzoj\"] == nil\n\t objekto[\"uzoj\"] = []\n\t end\n\t objekto[\"uzoj\"] << novaUzo\n elsif fil.name == \"gra\"\n fil.children().each do |fil2|\n if fil2.name == \"vspec\"\n objekto[\"vspec\"] = fil2.text\n end\n end\n elsif fil.name == \"subart\"\n objekto[\"filNombro\"] += 1\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n elsif fil.name == \"drv\"\n objekto[\"filNombro\"] += 1\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n elsif fil.name == \"subdrv\"\n objekto[\"filNombro\"] += 1\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n elsif fil.name == \"snc\"\n objekto[\"filNombro\"] += 1\n stato[\"senco\"] = objekto[\"filNombro\"]\n novaSenco = traktiNodon(fil, stato)\n objekto[\"filoj\"] << novaSenco\n if novaSenco[\"mrk\"] != nil\n @indikiloDeMarko[novaSenco[\"mrk\"]] = objekto[\"filNombro\"].to_s\n end\n stato[\"senco\"] = 0\n elsif fil.name == \"subsnc\"\n objekto[\"filNombro\"] += 1\n novaSubSenco = traktiNodon(fil, stato)\n objekto[\"filoj\"] << novaSubSenco\n if novaSubSenco[\"mrk\"] != nil\n litero = (\"a\"..\"z\").to_a[objekto[\"filNombro\"]-1]\n numero = stato[\"senco\"].to_s + litero\n @indikiloDeMarko[novaSubSenco[\"mrk\"]] = numero\n end\n elsif fil.name == \"dif\"\n novaDifino = traktiDifinon(fil, stato)\n objekto[\"filoj\"] << novaDifino\n elsif fil.name == \"rim\"\n novaRimarko = traktiRimarkon(fil, stato)\n objekto[\"filoj\"] << novaRimarko\n elsif fil.name == \"ref\"\n stato[\"refspac\"] = objekto[\"filoj\"].count > 0\n novaRefo = traktiRefon(fil, stato)\n objekto[\"filoj\"] << novaRefo\n elsif fil.name == \"refgrp\"\n stato[\"refspac\"] = objekto[\"filoj\"].count > 0\n novaRefgrupo = traktiRefgrupon(fil, stato)\n objekto[\"filoj\"] << novaRefgrupo\n elsif fil.name == \"ekz\"\n novaEkzemplo = traktiEkzemplon(fil, stato)\n #teksto += novaEkzemplo[\"teksto\"]\n\t objekto[\"filoj\"] << novaEkzemplo\n elsif fil.name == \"trd\"\n traktiTradukon(fil, stato)\n elsif fil.name == \"trdgrp\"\n traktiTradukGrupon(fil, stato)\n elsif fil.name == \"text\"\n #puts \"teksto: \" + fil.text + \"|\"\n #objekto[\"filoj\"] << {\"tipo\" => \"teksto\", \"teksto\" => fil.text}\n elsif fil.name == \"frm\"\n novaFormulo = traktiFormulon(fil, stato)\n\t teksto += novaFormulo[\"teksto\"]\n else\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n end\n end\n\n for fil in objekto[\"filoj\"]\n if fil[\"teksto\"] != nil\n if fil[\"tipo\"] == \"refo\" or fil[\"tipo\"] == \"refgrupo\"\n\t teksto += \" \"\n\t end\n teksto += fil[\"teksto\"]\n end\n end\n\n # atendu ghis la fino de drv antau enmeti tradukojn el ekzemploj -\n # tiuj ghenerale rilatas al dirajhoj, ke ne estas baza vortoj por serchi\n if stato[\"super\"].count == 1 and stato[\"ekzTradukoj\"] != []\n for lng, tradoj in stato[\"ekzTradukoj\"]\n for trad in tradoj\n\t stato[\"artikolo\"][\"tradukoj\"][lng] << trad\n\t end\n end\n\n stato[\"ekzTradukoj\"] = {}\n end\t \t \n\n if miaMarko then stato[\"marko\"].pop end\n\n #objekto[\"teksto\"] = teksto\n stato[\"super\"].pop\n return objekto\nend",
"def det\n\t\t\t@frecuencias['determinantes']\n\t\tend",
"def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end",
"def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def ingresar_detalle_en_venta(detalle_venta,venta)\n if venta[:esta_vacio]\n venta[:tope] = detalle_venta\n venta[:final] = detalle_venta\n venta[:esta_vacio] = false\n venta[:size] +=1\n venta[:max]-=1\n else\n final = venta[:final]\n final[:siguiente] = detalle_venta\n venta[:final] = detalle_venta\n venta[:size]+=1\n venta[:max]-=1\n end\nend",
"def trd; end",
"def grilleSuivante()\n @grilleRaz = nil\n return nil\n end",
"def add_a_d\n end",
"def imprime_dados()\n if @esq==-1 && @dir==-1\n puts 'no folha'\n else\n puts 'no interno ou raiz'\n puts @dir.to_s + '->' + @esq.to_s \n end\n end",
"def desliga\n if desligado == false then\n return \"NÃO\"\n else\n return \"SIM\"\n end\n\n end",
"def rescatar\n self.estado_id = 1 #salida si lo creo, entrada/foliado si lo redirijo\n self.estado_id = 3 if self.trazas.count(:conditions => 'movimiento_id in (2,7,8)') > 0\n if self.origen.externo\n RAILS_DEFAULT_LOGGER.info \"devolviendo de origen externo #{self.origen.to_label} a #{self.documento.buzon}\"\n self.buzon_id = self.documento.buzon_id\n else\n self.buzon_id = self.origen_id\n end\n self.add_traza(current_user.id, 14, current_user.puesto.buzon_id)\n self.save!\n end",
"def dv; end",
"def cala\n @prueba = \"esto es una variable\"\n end",
"def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend",
"def ognia(a,b)\n\t\tsystem \"clear\"\n\t\tif @pelna.litera[a][b] == \" X\"\n\t\t\t@pusta.litera[a][b] = \" X\"\n\t\t\tprint \"Trafiony \"\n\t\t\tszukany = (Statek.lista_statkow.select {|x| x if x.sam_statek[0] == [a,b] || x.sam_statek[1] == [a,b] ||\n\t\t\t x.sam_statek[2] == [a,b] || x.sam_statek[3] == [a,b]})[0]\n\t\t\tszukany.sam_statek.delete([a,b])\n\t\t\t\n\t\t\tif szukany.sam_statek.length == 0\n\t\t\t\tputs \"Zatopiony !!!\"\n\t\t\t\tszukany.otoczka.each {|x| pusta.litera[x[0]][x[1]]=\" .\" if x[0] >=0 && x[1] >=0 && x[0] < 10 && x[1] < 10}\n\t\t\t\tStatek.lista_statkow.delete(szukany)\n\t\t\t\tprint \"Zostało Ci jeszcze #{Statek.lista_statkow.count} statków do zatopienia\"\n\t\t\tend\n\t\t\tputs\n\t\t\t\n\t\t\telse \n\t\t\tputs \"Pudło !\"\n\t\t\t@pusta.litera[a][b] = \" .\"\n\t\t\t\n\t\tend\n\t\tif Statek.lista_statkow.count > 0\n\t\t\t@pusta.rysuj \n\t\telse\n\t\t\tsystem \"clear\"\n\t\t\t@pusta.rysuj \n\t\t\tputs \"Koniec GRY !!!\" \n\t\tend\n\tend",
"def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend",
"def retornoBusqueda()\nreturn @busqueda\nend",
"def vrat_modif_instanci\n vystup=\"\"\n @pole_dat.each do |radek| \n if(radek[0]==\"p\")then \n vystup +=radek\n vystup += \"w #{generuj_vahy(radek).join(' ')}\\n\" #pridani radku s vahami\n else\n vystup +=radek\n end \n end\n # puts vystup\n return vystup\n end",
"def ligar #iniciando o método ligar\n puts 'O carro está ligado...' #imprime na tela a ação do método\n end",
"def relatorios\n end",
"def formation; end",
"def changerEnRouge\n\t\t@couleur=1\n\tend",
"def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend",
"def chargementJeu(nomJoueur)\n @sauvegardeYaml = SauvegardeYAML.creer(nomJoueur)\n @sauvegarde = @sauvegardeYaml.chargement()\n @joueur = @sauvegarde.joueur\n nom=@joueur.nom.split(\".\")\n @joueur.nom = nom[0]\n print @joueur.nom\n @carte = @sauvegarde.carte\n @nbTour = @sauvegarde.nbTour\n\tend",
"def secondo\n self[1]\n end",
"def to_densa\n\t @M = Matriz_Densa.new(@alt+1,@anc+1, 0)\n\t for i in (0..@alt)\n\t\t for j in (0..@anc)\n\t\t @M[i][j] = 0\n\t\t end\n\t end\n\t for i in (0..@n_elem-1)\n\t @M[@alto[i]][@ancho[i]]=@elem[i]\n\t end\n\t @M\n\tend",
"def extraer_inicio()\n @cola=@cola.next\n\n end",
"def karte_drucken()\n if !tarif_gewaehlt?()\n puts (\"Es wurde noch kein Tarif gewählt. Bitte wählen Sie zuerst einen Tarif aus.\")\n elsif @tarif - @eingeworfen > 0\n offener_betrag = @tarif - @eingeworfen\n puts (\"Sie müssen noch \" + offener_betrag.to_s() + \" Euro einzahlen.\")\n else\n kartenpreis = @tarif\n\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.to_s + \" Euro\")\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\")\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n wechsel_geld()\n @summe_automat += kartenpreis\n @tarif = nil\n return\n end\n end",
"def importancia(t)\n #fórmula para calculo de importancia\n ### quantidade de vizinhos dominados pelo inimigo + funcao impedeConquista\n ### se essa soma for 0, então usa a fórmula: \n ### (distancia do inimigo mais proximo - 10) / 1000 \n \n ###### TODO: verificar como é \"medida\" essa distancia na classe de grafo do pereira #####\n end",
"def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend",
"def funktionsname\n\tanweisung\nend",
"def rla\n end",
"def set_unidad_medida\n end",
"def set_unidad_medida\n end",
"def initialize(nombre,lista,listagr)\n super(nombre,lista,listagr)\n @gei = 0\n\t\t@terreno = 0\n end",
"def actualiza_atributos_diariodets \n sum_debe = 0\n sum_haber = 0\n sum_debe_sec = 0\n sum_haber_sec = 0\n item_max = 0\n idcuenta_ajuste_dif_cambio = 709 #Catalogo.find_by(id: Catalogo::ID_CTA_AJUSTE_DIF_CAMBIO)\n\n set_datos_segun_conf\n\n if self.origenasiento_id == 1 # si es manual actualiza columnas debe, haber...\n diariodets.each do |child| \n if child.ajuste.blank? or child.ajuste == '0'\n cod_moneda_trasac = Moneda.find_by(id:child.moneda_id).codigo \n child.tcori = self.tc\n child.ajuste = '0' \n if cod_moneda_trasac == Moneda::CODIGO_SYS[:nal]\n child.debe = (child.debeori).round(2) \n child.haber = (child.haberori).round(2) \n child.debesec = (child.debeori/Conta::TCV_CONST).round(2) \n child.habersec = (child.haberori/Conta::TCV_CONST).round(2) \n child.tcsec = child.tcori\n else\n if cod_moneda_trasac == Moneda::CODIGO_SYS[:sec]\n tc_transac = 0\n if Conta::TCV_CONST != child.tcori\n tc_transac = child.tcori\n else\n tc_transac = Conta::TCV_CONST\n end\n child.tcsec = tc_transac\n\n child.debe = (child.debeori*tc_transac).round(2) \n child.haber = (child.haberori*tc_transac).round(2) \n\n child.debesec = (child.debeori).round(2) \n child.habersec = (child.haberori).round(2) \n end #cod_moneda_trasac = Moneda::CODIGO_SYS[:sec]\n end #cod_moneda_trasac = Moneda::CODIGO_SYS[:nal]\n if item_max < child.item\n item_max = child.item\n end \n sum_debe = sum_debe + child.debe\n sum_haber = sum_haber + child.haber\n sum_debe_sec = sum_debe_sec + child.debesec\n sum_haber_sec = sum_haber_sec + child.habersec\n end #if child.ajuste.blank? or child.ajuste == '0'\n end #end diariodets.each do |child|\n\n ###\n ###cuadre global\n if (sum_debe != sum_haber) or (sum_debe_sec != sum_haber_sec)\n ajuste = 0\n ajuste_sec = 0 \n ajuste = sum_debe - sum_haber\n ajuste_sec = sum_debe_sec - sum_haber_sec \n if ajuste != 0 \n if ajuste > 0\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber => ajuste, :debesec => 0, :habersec => 0, :debeori => 0, :haberori => ajuste, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 1)\n else\n ajuste = ajuste * (-1)\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => ajuste, :haber => 0, :debesec => 0, :habersec => 0, :debeori => ajuste, :haberori => 0, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 1)\n end#end ajuste > 0\n end# end ajuste != 0 \n if ajuste_sec != 0\n if ajuste_sec > 0\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber =>0 , :debesec => 0, :habersec => ajuste_sec, :debeori => 0, :haberori => ajuste_sec, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 2)\n else\n ajuste_sec = ajuste_sec * (-1)\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber => 0, :debesec => ajuste_sec, :habersec => 0, :debeori => ajuste_sec, :haberori => 0, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 2) \n end#end ajuste_sec > 0\n end# end ajuste_sec != 0 \n end #(sum_debe != sum_haber) or (sum_debe_sec != sum_haber_sec)\n end#if self.tipocomprobante_id != 5 # si es automatico no aplica lo siguiente \n end",
"def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end",
"def partido\n localidad.partido\n end",
"def devolver_nombre \n return @nombre\n end",
"def malts; end",
"def ligar #Metodo/função da classe Carro\n puts 'O carro está pronto para iniciar o trajeto.'\n end",
"def contrato\n avaluo.try(:contrato)\n end",
"def candidatGrille()\n\n\tend",
"def valorenergetico\n acumulador1 = 0\n nodo = @head\n while nodo != @tail\n acumulador1 = acumulador1 + nodo.value.valor_energetico\n nodo = nodo.next\n end\n acumulador1\n end",
"def traer_insumo(nombreInsumo, cantidad)\n\t case nombreInsumo\n\t\t when \"cebada\" then \n\t\t\t if (@cebada >= cantidad)\n\t\t\t\t @cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cebada\n\t\t\t\t @cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"arroz_maiz\" then\n\t\t\t if (@arroz_maiz >= cantidad)\n\t\t\t\t @arroz_maiz -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @arroz_maiz\n\t\t\t\t @arroz_maiz = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"levadura\" then\n\t\t\t if (@levadura >= cantidad)\n\t\t\t\t @levadura -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @levadura\n\t\t\t\t @levadura = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"lupulo\" then\n\t\t\t if (@lupulo >= cantidad)\n\t\t\t\t @lupulo -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @lupulo\n\t\t\t\t @lupulo = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_silos_cebada\" then\n\t\t\t if (@producto_silos_cebada >= cantidad)\n\t\t\t\t @producto_silos_cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_silos_cebada\n\t\t\t\t @producto_silos_cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_molino\" then\n\t\t\t if (@producto_molino >= cantidad)\n\t\t\t\t @producto_molino -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_molino\n\t\t\t\t @producto_molino = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_mezcla\" then\n\t\t\t if (@producto_paila_mezcla >= cantidad)\n\t\t\t\t @producto_paila_mezcla -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_mezcla\n\t\t\t\t @producto_paila_mezcla = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_cuba_filtracion\" then\n\t\t\t if (@producto_cuba_filtracion >= cantidad)\n\t\t\t\t @producto_cuba_filtracion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_cuba_filtracion\n\t\t\t\t @producto_cuba_filtracion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_coccion\" then\n\t\t\t if (@producto_paila_coccion >= cantidad)\n\t\t\t\t @producto_paila_coccion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_coccion\n\t\t\t\t @producto_paila_coccion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_preclarificador\" then\n\t\t\t if (@producto_tanque_preclarificador >= cantidad)\n\t\t\t\t @producto_tanque_preclarificador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_preclarificador\n\t\t\t\t @producto_tanque_preclarificador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_enfriador\" then\n\t\t\t if (@producto_enfriador >= cantidad)\n\t\t\t\t @producto_enfriador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_enfriador\n\t\t\t\t @producto_enfriador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tcc\" then\n\t\t\t if (@producto_tcc >= cantidad)\n\t\t\t\t @producto_tcc -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tcc\n\t\t\t\t @producto_tcc = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_filtro_cerveza\" then\n\t\t\t if (@producto_filtro_cerveza >= cantidad)\n\t\t\t\t @producto_filtro_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_filtro_cerveza\n\t\t\t\t @producto_filtro_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_cerveza\" then\n\t\t\t if (@producto_tanque_cerveza >= cantidad)\n\t\t\t\t @producto_tanque_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_cerveza\n\t\t\t\t @producto_tanque_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"cerveza\" then\n\t\t\t if (@cerveza >= cantidad)\n\t\t\t\t @cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cerveza\n\t\t\t\t @cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t end\n\tend",
"def preco\n @preco\n end",
"def cp_d\n end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def calculo_de_sueldo(attr={})\r\n retencion = @salario * 0.1\r\n salud = @salario * 0.07\r\n pension = @salario * 0.12\r\n sueldo = @salario - retencion - salud - pension\r\n end",
"def initialize(nombre,alimentos,cantidad)\n super(nombre,alimentos,cantidad) # Llamada al contructor de la clase padre\n @emisiones_diarias = 0 # Variable para almacenar valor de efceto invernadero\n @metros_terreno = 0 # variable para almacenar valor del terreno\n end",
"def extraer_inicio()\n @cola=@cola.next\n end",
"def realizar_cuestionario_demora\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario por Demora\"\n end",
"def sub_e\n end",
"def bilan\n raise \"Il faut lancer l'étude avec Etude::start avant de construire le bilan\" if @data.nil?\n @bilan ||= begin\n c = []\n # Largeur : 26 (sans les \"|\")\n titre = \"Exercices #{from_exercice} à #{to_exercice}\"\n gauche = ((26 - titre.length).to_f / 2).floor - 1\n droite = \" \" * (26 - (gauche + titre.length))\n gauche = \" \" * gauche\n entete = <<-TXT\n----------------------------\n|#{gauche}#{titre}#{droite}|\n----------------------------\n| Doigté | Nombre de fois |\n TXT\n c << entete.strip\n titre_section = <<-TXT\n----------------------------\n| Par quantité |\n----------------------------\n TXT\n c << titre_section.strip\n nombre_max = nil\n nombre_min = nil\n nb_courant = nil\n @data.sort_by{|c, e| e[:nombre]}.reverse.each do |combi, data_combi|\n nb_courant = data_combi[:nombre]\n nombre_max = nb_courant if nombre_max.nil?\n nb = (\" \" * 5) << nb_courant.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n nombre_min = nb_courant\n \n titre_section = <<-TXT\n----------------------------\n| Par premier doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[0..0]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n \n titre_section = <<-TXT\n----------------------------\n| Par second doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[2..2]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n c << \"-\" * 28\n c << \"\\n\"\n c.join(\"\\n\")\n end\n end",
"def reset \n\t\t@resultado[\"rondas\"] = 0\n\t\t@resultado[\"1\"] = 0\n\t\t@resultado[\"2\"] = 0\n\t\t@s1 = \"\"\n\t\t@s2 = \"\"\n\t\t@j1 = \"\"\n\t\t@j2 = \"\"\n\t\t@puntos = \"\"\n\t\t@rondas = \"\"\n\tend",
"def converte\n # estados\n estados = ['q']\n 1.upto(@estados.length) do |i|\n @estados.keys.combination(i).to_a.collect { |c| c.sort.join }.each do |a|\n estados << 'q' + a\n end\n end\n\n # alfabeto\n alfabeto = @alfabeto\n\n # função de transição\n transicao = []\n estados.each do |estado|\n if estado == 'q' # vazio\n alfabeto.each { |el| transicao << [ 'q', el, 'q' ] }\n else\n alfabeto.each do |el|\n # verifica setas\n setas = []\n estado[1,estado.length].each_char do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == el\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # adiciona setas no caso de 'e'\n setas.each do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == nil\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # acrescenta à função de transição\n transicao << [ estado, el, 'q' + setas.join ]\n end\n end\n end\n\n # estado inicial\n i = [@atual.nome]\n @transicao.each do |funcao|\n if funcao[0] == @atual.nome and funcao[1] == nil\n i << funcao[2]\n end\n end\n inicial = 'q' + i.flatten.uniq.sort.join\n\n # estados finais\n finais = []\n estados.each do |estado|\n @finais.each do |final|\n finais << estado if estado.include? final\n end\n end\n finais.uniq!\n\n # simplifica, removendo os estados que não recebem nenhuma seta\n a_remover = []\n (estados - [inicial]).each do |estado|\n encontrado = false\n transicao.each do |funcao|\n encontrado = true if funcao[2] == estado\n end\n a_remover << estado if not encontrado\n end\n a_remover.each do |estado|\n estados.delete estado\n r = []\n transicao.each do |funcao|\n r << funcao if funcao[0] == estado\n end\n r.each { |x| transicao.delete x }\n finais.delete estado\n end\n\n return { K: estados, S: alfabeto, d: transicao, s: inicial, F: finais }\n end",
"def asignar_titulo_propiedad()\n \n end",
"def terreno\n\t\treturn @terreno*@cantidad\n\tend",
"def donizetti; end",
"def delelte\n\n end",
"def initialize\n\t\t@vida = 1\n\t\t@forca = 1\n\t\t@carisma = 1\n\t\t@arma = 1\n\tend",
"def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend",
"def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend",
"def datos_default\n if new_record?\n lastRecord = MovMovimiento.last\n if lastRecord\n self.hoja = lastRecord.hoja\n end\n\n num_abonos = ComPago.where(com_compra: com_compra).count + 1\n self.concepto = \"Abono #{num_abonos} a compra \\\"#{com_compra.title}\\\"\"\n end\n end",
"def letzte_komponente\n \n end",
"def get_nombre; @nombre; end",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def deaf_grandma\nend",
"def residency_diploma\n\tend",
"def berlioz; end",
"def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end",
"def sauvegarderJeu()\n\t\t# création de la sauvegarde\n\t\t@sauvegarde = Sauvegarde.creer( self.joueur,self.carte,self.nbTour )\n\n @sauvegardeYaml = SauvegardeYAML.creer(self.joueur.nom)\n @sauvegardeYaml.enregistrement( self.sauvegarde)\n\n\tend",
"def sonido()\n return super << \" miaaauuu\"\n end",
"def campoord_inicial\n 'fecharec'\n end",
"def despachar\n self.estado_id = 2 # en ruta\n self.buzon_id = self.destinatario_id\n self.add_traza(current_user.id ,1, current_user.puesto.buzon_id)\n self.recepcion = Time.now\n self.save!\n end"
] |
[
"0.70778394",
"0.6828922",
"0.6824248",
"0.68130535",
"0.6604603",
"0.6466142",
"0.64488673",
"0.6356107",
"0.6298351",
"0.62911534",
"0.62844944",
"0.62044334",
"0.60821193",
"0.6071368",
"0.6050576",
"0.60402703",
"0.6023909",
"0.6023124",
"0.60010165",
"0.59943926",
"0.59878254",
"0.59871745",
"0.5936893",
"0.5936893",
"0.5908547",
"0.5902726",
"0.5902296",
"0.5888605",
"0.5873683",
"0.58711994",
"0.58675057",
"0.5863288",
"0.5848303",
"0.5845105",
"0.58290726",
"0.5824549",
"0.58097374",
"0.58077383",
"0.5802369",
"0.57939136",
"0.57846826",
"0.5773635",
"0.5771018",
"0.57698375",
"0.57501847",
"0.5745665",
"0.5745328",
"0.57344514",
"0.56978524",
"0.5697488",
"0.5694849",
"0.56843513",
"0.5675232",
"0.5672469",
"0.5669142",
"0.56637514",
"0.5662992",
"0.5654955",
"0.56537384",
"0.56537384",
"0.56466454",
"0.56460214",
"0.56425524",
"0.5638001",
"0.56367284",
"0.5633792",
"0.56331044",
"0.56312233",
"0.56296194",
"0.56268466",
"0.56247306",
"0.562278",
"0.5622467",
"0.5621504",
"0.56165373",
"0.56122243",
"0.5612219",
"0.56099594",
"0.5606742",
"0.5603969",
"0.560088",
"0.5595326",
"0.5591722",
"0.5586459",
"0.55845976",
"0.5572756",
"0.5571537",
"0.5570639",
"0.5570639",
"0.55630153",
"0.55621016",
"0.5556841",
"0.5551721",
"0.55502754",
"0.55486035",
"0.5547792",
"0.5545605",
"0.5540378",
"0.552745",
"0.5525185",
"0.5525101"
] |
0.0
|
-1
|
== Metodo producto Densa
|
def *(other)
#if ((other.class.to_s == "Densa") && (@fil == @col) && (other.fil == other.col) && (@fil == other.fil))
matrizMult = Array.new(@fil) {Array.new(@col)}
i = 0
(0..(@fil - 1)).collect {
0.upto(@col - 1) do |j|
matrizMult[i][j] = 0
k = 0
(@col - 1).times {
matrizMult[i][j] = matrizMult[i][j] + (@matrix[i][k] * other.matrix[k][j])
k += 1
}
end
i += 1
}
#puts "#{matrizMult}"
return matrizMult
#else
#raise ArgumentError, "Numero distinto de filas y columnas"
#end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prod_nar\n\t\t@edad * 2\n\tend",
"def get_products_dato(id)\n products = Product.find_by(company_id: self.id,id: id) \n \n if products.unidad == nil\n return products.name + \" - \" \n else \n return products.name + \" - \"+products.unidad \n end \n end",
"def ahorrodinero(año)\n\n i = 0\n final = Array.new \n final1 = Array.new \n final2 = Array.new \n \n\n datos = Valore.where(:año => año)\n \n datos.each do |datos|\n \n \n final[i] = datos.read_attribute(\"es\")\n final1[i] = datos.read_attribute(\"tarifa\")\n final2[i] = final1[i]*final[i]\n \n i = i +1\n \n \n end\n \n return final2\n\n\n\n end",
"def get_products_dato(id)\n products = Product.find_by(company_id: self.id,id: id) \n if products.unidad == nil\n return products.name + \" - \" \n else \n return products.name + \" - \"+products.unidad \n end \n end",
"def get_products_dato(id)\n products = Product.find_by(company_id: self.id,id: id) \n if products.unidad == nil\n return products.name + \" - \" \n else \n return products.name + \" - \"+products.unidad \n end \n end",
"def orden_product_params\n params.require(:orden_product).permit(:avisodetail_id, :price, :quantity, :total, :fecha, :tarifa, :i, :dia, :d01, :d02, :d03, :d04, :d05, :d06, :d07, :d08, :d09, :d10, :d11, :d12, :d13, :d14, :d15, :d16, :d17, :d18, :d19, :d20, :d21, :d22, :d23, :d24, :d25, :d26, :d27, :d28, :d29, :d30, :d31 )\n end",
"def llenar_productos\n self.productos = self.clase.descripcion unless self.clase.nil?\n end",
"def to_s\n\t\t\"Por 100g o 100ml de producto\\tIr del producto\\tPor porcion de X gramos\\tIR por porcion\\n\"+\n\t\t\" Valor energetico: #{valorenergeticoKJ}/#{valorenergeticoKcal}\\t#{irenergeticoKJ}/#{irenergeticoKcal}\\t#{valorenergeticoKJp}/#{valorenergeticoKcalp}\\t#{irenergeticoKJp}/#{irenergeticoKcalp}\\n\"+\n\t\t\" Grasas: #{cgrasas}\\t#{irgrasas}\\t#{valorgrasasp}\\t#{irgrasasp}\\n\"+\n\t\t\" Grasas monosaturadas: #{grasasmono}\\t#{irmonograsas}\\t#{valormonograsasp}\\t#{irmonograsaslp}\\n\"+\n\t\t\" Grasas poliinsaturadas: #{grasaspoli}\\t#{irpoliinsaturadas}\\t#{valorgrasasp}\\t#{irpoliinsaturadas}\\n\"+\n\t\t\" Hidratos de carbono: #{hcarbono}\\t#{irhidratos}\\t#{valorhidratosp}\\t#{irhidratosp}\\n\"+\n\t\t\" Azucares: #{azucares}\\t#{irazucares}\\t#{valorazucaresp}\\t#{irazucaresp}\\n\"+\n\t\t\" Polialcoholes: #{polialcoholes}\\t#{irpolialcoholes}\\t#{valorpolialcoholesp}\\t#{irpolialcoholesp}\\n\"+\n\t\t\" Almidon: #{almidon}\\t#{iralmidon}\\t#{valoralmidonp}\\t#{iralmidonp}\\n\"+\n\t\t\" Fibra alimentaria: #{fibra}\\t#{irfibra}\\t#{valorfibrap}\\t#{irfibrap}\\n\"+\n\t\t\" Sal: #{sal}\\t#{irsal}\\t#{valorsalp}\\t#{irsalp}\\n\"+\n\t\t\" Vitamina/mineral: #{vitymin}\\t#{irvitaminas}\\t#{valorvityminp}\\t#{irvitaminasp}\\n\"\n\tend",
"def preco_total\n produto.preco * quantidade\n end",
"def valor_energetico\n (@proteinas * 4) + (@glucidos * 4) + (@grasas * 9)\n end",
"def new\n \n @orden_product = OrdenProduct.new\n @company = Company.find(1)\n @orden_product.d01 = 0\n @orden_product.d02 = 0\n @orden_product.d03 = 0\n @orden_product.d04 = 0\n @orden_product.d05 = 0\n @orden_product.d06 = 0\n @orden_product.d07 = 0\n @orden_product.d08 = 0\n @orden_product.d09 = 0\n @orden_product.d10 = 0\n @orden_product.d11 = 0\n @orden_product.d12 = 0\n @orden_product.d13 = 0\n @orden_product.d14 = 0\n @orden_product.d15 = 0\n @orden_product.d16 = 0\n @orden_product.d17 = 0\n @orden_product.d18 = 0\n @orden_product.d19 = 0\n @orden_product.d20 = 0\n @orden_product.d21 = 0\n @orden_product.d22 = 0\n @orden_product.d23 = 0\n @orden_product.d24 = 0\n @orden_product.d25 = 0\n @orden_product.d26 = 0\n @orden_product.d27 = 0\n @orden_product.d28 = 0\n @orden_product.d29 = 0\n @orden_product.d30 = 0\n @orden_product.d31 = 0\n @orden_product.quantity = 0\n @orden_product.tarifa = 0\n @orden_product.price = 0\n @orden_product.total = 0\n end",
"def create\n \n \n @orden_product = OrdenProduct.new(orden_product_params)\n \n @orden_product.orden_id = @orden.id \n \n @orden_product.avisodetail_id = 131\n @orden_product.price = (@orden_product.tarifa / 30 * @orden.tiempo )\n @company = Company.find(1)\n sum_dias = (@orden_product.d01 + @orden_product.d02 + @orden_product.d03 + @orden_product.d04+ \n @orden_product.d05 + @orden_product.d06 + @orden_product.d07 + @orden_product.d08+\n @orden_product.d09 + @orden_product.d10 + @orden_product.d11 + @orden_product.d12+\n @orden_product.d13 + @orden_product.d14 + @orden_product.d15 + @orden_product.d16+\n @orden_product.d17 + @orden_product.d18 + @orden_product.d19 + @orden_product.d20+\n @orden_product.d21 + @orden_product.d22 + @orden_product.d23 + @orden_product.d24+\n @orden_product.d25 + @orden_product.d26 + @orden_product.d27 + @orden_product.d28+\n @orden_product.d29 + @orden_product.d30 + @orden_product.d31)\n @orden_product.quantity = sum_dias \n @orden_product.total = @orden_product.price * sum_dias\n\n \n \n respond_to do |format|\n if @orden_product.save\n \n @orden[:subtotal] = @orden.get_subtotal(\"subtotal\")\n @orden[:tax] = @orden.get_subtotal(\"tax\")\n @orden[:total] = @orden[:subtotal] + @orden[:tax]\n \n @orden.update_attributes(:subtotal=> @orden[:subtotal])\n \n \n \n \n format.html { redirect_to @orden, notice: 'Orden product was successfully created.' }\n format.json { render :show, status: :created, location: @orden }\n \n else\n format.html { render :new }\n format.json { render json: @orden.errors, status: :unprocessable_entity }\n end\n end\n end",
"def products\n end",
"def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end",
"def orden_product_params\n params.require(:orden_product).permit(:avisodetail_id, :price, :quantity, :total, :fecha, :tarifa, :i, :dia, :d01, :d02, :d03, :d04, :d05, :d06, :d07, :d08, :d09, :d10, :d11, :d12, :d13, :d14, :d15, :d16, :d17, :d18, :d19, :d20, :d21, :d22, :d23, :d24, :d25, :d26, :d27, :d28, :d29, :d30, :d31,:canal,:descrip,:d,:h,:cantidad,:rating,:rating2,:tpp,:impactos,:miles,:impactos2,:cpp,:cpm,:cmp2 )\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def get_valor_energetico\n \n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n \n \n end",
"def set_producto_detalle\n @producto_detalle = ProductoDetalle.find(params[:id])\n end",
"def asignaturas_peda_por(profe)\n # per = Horario.where('professor_id = ?', profe.id).joins(:asignatura).where('lectiva=true')\n per = Horario.where('professor_id = ?', profe.id).joins(:asignatura)\n .where('asignaturas.lectiva=TRUE').order('asignaturas.orden')\n a = per.map do |h|\n [\"#{h.asignatura.name} #{h.curso.name} \", \"#{h.horas}\"]\n end\n\n end",
"def clasificar_por_sal (lista)\n \n sal_recomendada = Lista.new()\n sal_excesiva = Lista.new()\n \n nodo = lista.extract\n \n while !(nodo.nil?)\n \n if nodo.value.sal > 6\n sal_excesiva.insert(nodo.value.sal)\n else\n sal_recomendada.insert(nodo.value.sal)\n end\n nodo = lista.extract\n end\n \n \"Los productos con una cantidad de sal menor o igual a la recomendada son #{sal_recomendada.to_s} y los que tienen una sal excesiva son #{sal_excesiva.to_s}\"\n \nend",
"def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend",
"def traer_insumo(nombreInsumo, cantidad)\n\t case nombreInsumo\n\t\t when \"cebada\" then \n\t\t\t if (@cebada >= cantidad)\n\t\t\t\t @cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cebada\n\t\t\t\t @cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"arroz_maiz\" then\n\t\t\t if (@arroz_maiz >= cantidad)\n\t\t\t\t @arroz_maiz -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @arroz_maiz\n\t\t\t\t @arroz_maiz = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"levadura\" then\n\t\t\t if (@levadura >= cantidad)\n\t\t\t\t @levadura -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @levadura\n\t\t\t\t @levadura = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"lupulo\" then\n\t\t\t if (@lupulo >= cantidad)\n\t\t\t\t @lupulo -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @lupulo\n\t\t\t\t @lupulo = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_silos_cebada\" then\n\t\t\t if (@producto_silos_cebada >= cantidad)\n\t\t\t\t @producto_silos_cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_silos_cebada\n\t\t\t\t @producto_silos_cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_molino\" then\n\t\t\t if (@producto_molino >= cantidad)\n\t\t\t\t @producto_molino -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_molino\n\t\t\t\t @producto_molino = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_mezcla\" then\n\t\t\t if (@producto_paila_mezcla >= cantidad)\n\t\t\t\t @producto_paila_mezcla -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_mezcla\n\t\t\t\t @producto_paila_mezcla = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_cuba_filtracion\" then\n\t\t\t if (@producto_cuba_filtracion >= cantidad)\n\t\t\t\t @producto_cuba_filtracion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_cuba_filtracion\n\t\t\t\t @producto_cuba_filtracion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_coccion\" then\n\t\t\t if (@producto_paila_coccion >= cantidad)\n\t\t\t\t @producto_paila_coccion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_coccion\n\t\t\t\t @producto_paila_coccion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_preclarificador\" then\n\t\t\t if (@producto_tanque_preclarificador >= cantidad)\n\t\t\t\t @producto_tanque_preclarificador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_preclarificador\n\t\t\t\t @producto_tanque_preclarificador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_enfriador\" then\n\t\t\t if (@producto_enfriador >= cantidad)\n\t\t\t\t @producto_enfriador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_enfriador\n\t\t\t\t @producto_enfriador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tcc\" then\n\t\t\t if (@producto_tcc >= cantidad)\n\t\t\t\t @producto_tcc -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tcc\n\t\t\t\t @producto_tcc = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_filtro_cerveza\" then\n\t\t\t if (@producto_filtro_cerveza >= cantidad)\n\t\t\t\t @producto_filtro_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_filtro_cerveza\n\t\t\t\t @producto_filtro_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_cerveza\" then\n\t\t\t if (@producto_tanque_cerveza >= cantidad)\n\t\t\t\t @producto_tanque_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_cerveza\n\t\t\t\t @producto_tanque_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"cerveza\" then\n\t\t\t if (@cerveza >= cantidad)\n\t\t\t\t @cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cerveza\n\t\t\t\t @cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t end\n\tend",
"def producto (other)\n\t\tprod=Fraccion.new(0,0)\n\t\tprod.x= @x * other.x\n\t\tprod.y= @y * other.y\n\treturn prod\t\t\t\n\tend",
"def partido\n localidad.partido\n end",
"def juega_despues mano, carta_inicial, baza\n\t\tcarta_a_jugar = nil\n\t\tUtil.muestra_msg baza.to_s, @verbose\n\t\tcadena = (Util.captura_entrada \"Escoge una carta por su posicion en la mano (0=inicial)=>\").chomp\n\t\tcarta_a_jugar = mano[cadena.to_i]\n\t\treturn carta_a_jugar\t\n\tend",
"def create_product\n\t\tproduct_attributes = @view.creando_producto\n\t\t@store.add_product(product_attributes[0], product_attributes[1])\n\t\toption = @view.second_view(@current_user, @current_user.actions)\n\t\tlist(option)\n\tend",
"def calculadora(uno,dos,tres=0, opciones= {})\n if(opciones['suma']==1)\n return uno +dos+tres\n end\n if(opciones['multiplica']==1)\n return uno * dos *tres\n end\nend",
"def producao (quantidade, tamanho: :M, cor: :azul) #não precisa obdecer a ordem de tamanho e cor, pq tem chave e valor\n puts \"Produzindo #{quantidade} de roupas tamanho #{tamanho} e cor #{cor}\"\nend",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def producto_params\n params.require(:producto).permit(:nombre, :sustancium_id, :presentacion_id, :compra, :oferta, :laboratorio_id, :plan_paciente_id)\n end",
"def importancia(t)\n #fórmula para calculo de importancia\n ### quantidade de vizinhos dominados pelo inimigo + funcao impedeConquista\n ### se essa soma for 0, então usa a fórmula: \n ### (distancia do inimigo mais proximo - 10) / 1000 \n \n ###### TODO: verificar como é \"medida\" essa distancia na classe de grafo do pereira #####\n end",
"def tipoproductopf_de_productopf\n if params[:id] && params[:id].to_i>0 &&\n Productopf.where(id: params[:id].to_i).count == 1\n pr = Productopf.find(params[:id].to_i)\n respond_to do |format|\n format.js { render text: pr.tipoproductopf_id }\n format.json { render json: pr.tipoproductopf_id, status: :created }\n format.html { render inline: 'No implementado', \n status: :unprocessable_entity }\n end\n else\n render inline: 'Falta paŕametro', status: :unprocessable_entity \n end\n end",
"def set_producto_padre\r\n @producto_padre = ProductoPadre.find(params[:id])\r\n end",
"def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"def retorna_nome_produto\n titulo_produto.greenify\n titulo_produto.text\n end",
"def terreno\n\t\treturn @terreno*@cantidad\n\tend",
"def producto_params\n params.require(:producto).permit(:referencia, :color, :talla, :categoria, :ripo, :marca, :descripcion, :tela, :cantidad, :costo, :precio)\n end",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def juega_despues mano, carta_inicial, baza\n\t\tcarta_a_jugar = nil\n\t\tcartas_de_la_mano_del_palo_muestra = obtiene_cartas_mismo_palo mano, carta_inicial\n\t\tif cartas_de_la_mano_del_palo_muestra.size > 0\n\t\t\tthen\n\t\t\t# Tenemos cartas del mismo palo\n\t\t\tcartas_jugadas = baza.obtiene_cartas_jugadas\n\t\t\tcartas_jugadas_palo_muestra = obtiene_cartas_mismo_palo cartas_jugadas, carta_inicial\n\t\t\tmayor_carta_jugada_del_palo_muestra = obtiene_carta_mayor cartas_jugadas_palo_muestra\n\t\t\tcartas_del_mismo_palo_inferiores = obtiene_cartas_inferiores cartas_de_la_mano_del_palo_muestra, mayor_carta_jugada_del_palo_muestra\n\t\t\tif cartas_del_mismo_palo_inferiores.size > 0\n\t\t\t\tthen\n\t\t\t\tcarta_a_jugar = obtiene_carta_mayor cartas_del_mismo_palo_inferiores\n\t\t\telse\n\t\t\t\tcarta_a_jugar = obtiene_carta_mayor cartas_de_la_mano_del_palo_muestra\n\t\t\tend\n\t\telse\n\t\t\t# No tenemos cartas del mismo palo\n\t\t\t# Miramos si tenemos un palo corto\n\t\t\tcartas_palo_menor = obtiene_cartas_palo_menor mano\n\t\t\tif es_palo_corto cartas_palo_menor\n\t\t\t\tthen \n\t\t\t\t# Si tenemos un palo corto escogemos la mayor de ese palo\n\t\t\t\tcarta_a_jugar = obtiene_carta_mayor cartas_palo_menor\n\t\t\t\tUtil.muestra_msg \"Palo Corto=>\" + carta_a_jugar.carta.split(\"+\")[1] + \"\\n\", @verbose\n\t\t\telse\n\t\t\t\t# sino tenemos palo corto escogemos la mayor de toda la mano\n\t\t\t\tcarta_a_jugar = obtiene_carta_mayor mano\n\t\t\tend\n\t\tend\n\t\treturn carta_a_jugar\n\tend",
"def consulta_prod\n @product = Product.select('codigo_ncm,cest').where(name: params[:name]).first\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n #------------DEU CERTO GLORIA Á DEUS!!!-----------------------------------------------\n end",
"def valor\n\t\t@valor = 0\n\t\tself.parts.each do |p|\n\t\t\t@valor += p.valor\n\t\tend\n\t\t@valor\n\tend",
"def imprimir_produtos #metodo de impirmir a tabela produtos\n puts \"-------TABELA DE PRODUTOS----------\"\n PRODUTOS.each do |k,v| #k e v significam keys e values, chaves e valores\n puts \"#{k} - #{SIMBOLO_MOEDA} #{v}\" #aqui é como a tabela deve funcionar, mostrando chaves, valores e o simbolo da moeda\n end\n puts \"-----------------------------------\"\n end",
"def discount\n @shop.dig('discount_de')\n end",
"def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n self.total_prize # Retorno el precio final\n end",
"def set_product\n \n end",
"def producto_params\n params.require(:producto).permit(:precio, :nombre, :codigo, :descripcion, :orden,\n :precio_super, :highlight, :oculto, :supplier_id,\n :pack, :faltante,:cantidad_permitida, :imagen, :stock,\n categoria_ids: [])\n end",
"def descuento_sueldo(sueldo, tipo_obrero)\n\tif tipo_obrero == 'o'\n\t\tsueldo - (sueldo * 0.12) #OCURRE A\n\telse\n\t\tsueldo - (sueldo * 0.15) #OCURRE B\n\tend\nend",
"def carta_mayor\n \"#{@carta_mayor[1][:numero]} #{@carta_mayor[1][:pinta]}\"\n end",
"def tas_poser_1_carte joueur\n # Examine tous les tas déjà posés un par un\n self.ta12s.each do |tas|\n # Abandonne l'examen des différents tas quand plus qu'une carte\n break if joueur.cartes.size == 1\n # Evite de compléter la tierce franche lors de la 1° pose\n unless joueur.a_atteint_51?\n next if tas.nom_joueur == joueur.nom + \"_tf\"\n end\n # Regarde si on peut ajouter une carte au tas\n joueur.cartes.each do |carte|\n # Regarde si la carte peut aller sur le tas\n if tas.complete_le_tas? carte\n type = tas.combinaison.type\n # Pose la carte\n self.traces << \" tas <= #{tas.to_s} + [ #{carte.to_s} ]\"\n poser_sur_tas joueur, tas, carte\n # On ne peut plus compléter le tas si c'est une série de plus de 3 cartes\n break if tas.cartes.size > 3\n # on ne peut plus compléter le tas si ce n'est pas une série\n break if type != :serie\n end\n end\n end\n end",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end",
"def precio_mercado\n @serie.valor_primer_dia('precio')\n end",
"def show\r\n @productos = Producto.where(\"producto_padre_id = ?\",@producto_padre.id);\r\n end",
"def product_params\n params.require(:product).permit(:codigo, :descripcion, :montoU, :detalle)\n end",
"def product_params\n params.require(:product).permit(:description, :precio, :cantidad)\n end",
"def entrada_produto_params\n params.require(:entrada_produto).permit(:data, :utilizador, :itemProduto_id, :fornecedor_id)\n end",
"def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end",
"def create\n entry = params[:pro_entry]\n var = entry[:products_id] \n\n\n @product = Product.find(var)\n cant_product = @product.quantity\n puts \"#{cant_product} estaes la 1111111**************************************************************###}\"\n\n @pro_entry = ProEntry.new(pro_entry_params) \n qu_in = @pro_entry.quantity_input \n puts \"#{qu_in} cantidad subida**************************************************************###}\"\n \n inputs = cant_product + qu_in\n puts \"#{inputs} suma del 33333**************************************************************###}\"\n\n @product.quantity = inputs\n\n @product.save\n\n url= \"/products/\"\n\n respond_to do |format|\n if @pro_entry.save\n format.html { redirect_to url, notice: 'Pro entry was successfully created.' }\n format.json { render :show, status: :created, location: url }\n else\n format.html { render :new }\n format.json { render json: url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sample_products_list(facturama)\n puts \"===== Obtener los productos - Inicio =====\"\n\n lst_products = facturama.products.list # Se obtiene una lista con todos los productos\n lst_products_count = lst_products.count # Cantidad inicial de productos\n\n puts \"Cantidad inicial de productos: \" + lst_products_count.to_s\n\n puts \"===== Obtener los productos - Fin =====\"\n end",
"def to_s\n salida = \"\\n #{@operacion} \\n\"\n \n case @operacion\n when \"suma\" then salida << \"\\n#{(@operador[0]+@operador[1]).to_s}\\n\"\n when \"producto\" then salida << \"\\n#{(@operador[0]*@operador[1]).to_s}\\n\" \n end \n \n salida \n end",
"def precio\n\t\t@precio\n\tend",
"def set_entrada_produto\n @entrada_produto = EntradaProduto.find(params[:id])\n end",
"def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lipidos*9) + (@proteinas*4)\n\t\tend",
"def cant_productos(opcion)\n lines = read()\n\n if opcion == \"a\"\n lines.each do |x|\n arr = x.split(\" \")\n existencia = arr[3].to_i + arr[2].to_i + arr[1].to_i\n puts \"#{arr[0]} hay #{existencia} productos\"\n end\n elsif opcion == \"b\"\n tienda1 = 0\n tienda2 = 0\n tienda3 = 0\n lines.each do |x|\n arr = x.split(\" \")\n tienda1 += arr[1].to_i\n tienda2 += arr[2].to_i\n tienda3 += arr[3].to_i\n end\n puts \"tienda 1 hay un total de #{tienda1} productos\\ntienda 2 hay un total de #{tienda2} productos\\ntienda 3 hay un total de #{tienda3} productos\\n\"\n elsif opcion == \"c\"\n total = 0\n lines.each do |x|\n arr = x.split(\" \")\n total += (arr[1].to_i + arr[2].to_i + arr[3].to_i)\n end\n puts \"en total hay #{total} productos en todas las tiendas\"\n end\nend",
"def porc_grasa\n\t\t(1.2 * self.indice_masa_corporal + 0.23 * edad - 10.8 * sexo - 5.4).round(1)\n\tend",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def base_product\n product_num\n end",
"def product\n self.product_size.product\n end",
"def set_distri_product_info\n @distri_product_info = DistriProductInfo.find(params[:id])\n end",
"def test_producto\n \t\tassert_equal(@pro3, (@pro1*@pro2))\n\t assert_equal((@ma * @a).to_s,('[[4/3,13/8],[8/3,13/4]]')) \n \tend",
"def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end",
"def suivre; end",
"def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend",
"def ponderado(pesos)\n @promedio = @p.zip(pesos).inject(0) do |suma, coordenada, peso| {suma+coordenada*peso }\n end\nend",
"def index\n @pedido_produtos = PedidoProduto.where(pedido_id: @pedido.id)\n end",
"def karte_drucken()\n if !tarif_gewaehlt?()\n puts (\"Es wurde noch kein Tarif gewählt. Bitte wählen Sie zuerst einen Tarif aus.\")\n elsif @tarif - @eingeworfen > 0\n offener_betrag = @tarif - @eingeworfen\n puts (\"Sie müssen noch \" + offener_betrag.to_s() + \" Euro einzahlen.\")\n else\n kartenpreis = @tarif\n\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.to_s + \" Euro\")\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\")\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n wechsel_geld()\n @summe_automat += kartenpreis\n @tarif = nil\n return\n end\n end",
"def producto_params\n params.require(:producto).permit(:precio, :nombre, :codigo, :descripcion, :orden,\n :precio_super, :highlight, :oculto, :marca, :supplier_id,\n :pack, :faltante,:cantidad_permitida, :imagen, :stock,\n :orden_remito, :view_type, :product_type,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :sale_type, :wholesale,\n bundle_products_attributes: [:id, :item_id, :qty, :description],\n categoria_ids: [], warehouse_ids: [],)\n end",
"def set_producto_platillo\n @producto_platillo = ProductoPlatillo.find(params[:id])\n end",
"def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end",
"def valorEnergetico\n\t\treturn @valorEnergetico*@cantidad\n\tend",
"def producto_detalle_params\n params.require(:producto_detalle).permit(:precio_compra, :fecha_compra, :proveedor_id, :producto_id)\n end",
"def carbohidratos\n\t\treturn @carbohidratos*@cantidad\n\tend",
"def proteinas\n\t\treturn @proteinas*@cantidad\n\tend",
"def dieta_terreno(gramos)\n\n aux = @head\n suma_terreno = 0\n i = 0\n while (!aux.nil?)\n suma_terreno += aux[:value].auxiliar2(gramos[i])\n aux = aux[:next]\n i = i+1\n end\n return suma_terreno.round(2)\n\n end",
"def product_params\n params.require(:product).permit(:productarticul, :productname, :distributor, :price, :nalichie)\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def set_produto\n @produto = Produto.find(params[:id])\n end",
"def opcion4(inventario)\n sum = 0\n inventario.each do |llave,valor|\n sum += valor\n end\n \n puts \"El stock total de la tienda es: #{sum}\"\nend",
"def crear_productos_contratados\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.sale_quotation_id)\n @lis_products.each do |product|\n product.quantity.times do\n Payment::ContractedProduct.create(\n plan_id: self.id,\n product_product_id: product.product_product_id,\n price_contracted: product.product_product.price,\n valid_until: Date.today + product.product_product.valid_days,\n user_created_id: self.user_created_id)\n end\n end\n end",
"def limpar!\n @produtos = []\n end",
"def create\n @produto_pedido = ProdutoPedido.new(produto_pedido_params)\n @produto_pedido.valor_unitario = Produto.find_by(nome: params[:produto_pedido][:nome]).preco\n @produto_pedido.valor_total = @produto_pedido.valor_unitario * Integer(params[:produto_pedido][:quantidade])\n\n respond_to do |format|\n if @produto_pedido.save\n @pedido.quantidade_itens += @produto_pedido.quantidade\n @pedido.valor_pedido += @produto_pedido.valor_total\n @pedido.save\n format.html { redirect_to @pedido, notice: 'Produto pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sumar_insumo(nombreInsumo, cantidad)\n\t\tcase nombreInsumo\n\t\t\twhen \"cebada\" then (@cebada += cantidad)\n\t\t\twhen \"arroz_maiz\" then (@arroz_maiz += cantidad)\n\t\t\twhen \"levadura\" then (@levadura += cantidad)\n\t\t\twhen \"lupulo\" then (@lupulo += cantidad)\n\t\t\twhen \"producto_silos_cebada\" then \n\t\t\t\t(@producto_silos_cebada += cantidad)\n\t\t\twhen \"producto_molino\" then \n\t\t\t\t(@producto_molino += cantidad)\n\t\t\twhen \"producto_paila_mezcla\" then \n\t\t\t\t(@producto_paila_mezcla += cantidad)\n\t\t\twhen \"producto_cuba_filtracion\" then \n\t\t\t\t(@producto_cuba_filtracion += cantidad)\n\t\t\twhen \"producto_paila_coccion\" then \n\t\t\t\t(@producto_paila_coccion += cantidad)\n\t\t\twhen \"producto_tanque_preclarificador\" then \n\t\t\t\t(@producto_tanque_preclarificador += cantidad)\n\t\t\twhen \"producto_enfriador\" then \n\t\t\t\t(@producto_enfriador += cantidad)\n\t\t\twhen \"producto_tcc\" then (@producto_tcc += cantidad)\n\t\t\twhen \"producto_filtro_cerveza\" then \n\t\t\t\t(@producto_filtro_cerveza += cantidad)\n\t\t\twhen \"producto_tanque_cerveza\" then \n\t\t\t\t(@producto_tanque_cerveza += cantidad)\n\t\t\twhen \"cerveza\" then (@cerveza += cantidad)\n\t\tend\n\tend",
"def paraLetras(d)\n #excluídos o \"L minúsculo\" e o \"ó maiúsculo\"\n a = Array.new; a.push('x','y','z','a','b','c','u','v','w','d','e','f','r','s','t','g','h','i','o','p','q','j','k','m','n')\n b = Array.new; b.push('Z','A','Y','B','X','C','W','D','V','E','U','F','T','G','S','H','R','I','Q','J','P','K','N','L','M')\n c = a + b\n return c[d]\n end",
"def desplegarProceso\n\t\tputs \"id=#{@id} cantBytes=#{@cantBytes} cantPaginas=#{@cantPaginas}\"\n\t\tputs \"marcosRealAsig=#{@marcosRealAsig} marcosSwapAsig=#{@marcosSwapAsig}\"\n\tend",
"def iva\n restaurant_menu.each { |k, v| resultado = iva = 1.19 * v }\n puts resultado\nend"
] |
[
"0.6853558",
"0.6301637",
"0.6292693",
"0.6231372",
"0.6231372",
"0.62190586",
"0.620419",
"0.6173047",
"0.6115624",
"0.60781974",
"0.6049917",
"0.6043287",
"0.6030931",
"0.5982276",
"0.5975735",
"0.59498346",
"0.58931184",
"0.5869912",
"0.58644134",
"0.5855044",
"0.5835901",
"0.582591",
"0.5814476",
"0.58004767",
"0.57874745",
"0.5777255",
"0.577566",
"0.5772787",
"0.57640725",
"0.5752207",
"0.575132",
"0.574991",
"0.57498026",
"0.57460773",
"0.5742776",
"0.5741069",
"0.5741029",
"0.5738294",
"0.5733992",
"0.57316977",
"0.5726946",
"0.5724953",
"0.5724338",
"0.57217425",
"0.57184875",
"0.5714637",
"0.57100725",
"0.569603",
"0.56960064",
"0.5691732",
"0.5686664",
"0.5685257",
"0.56833017",
"0.5681872",
"0.56771475",
"0.5672938",
"0.5668268",
"0.5667333",
"0.56564",
"0.5647927",
"0.5647169",
"0.5646801",
"0.5642085",
"0.56336546",
"0.5630479",
"0.56245124",
"0.5622556",
"0.5618709",
"0.56174487",
"0.5613258",
"0.56107914",
"0.5605828",
"0.5605442",
"0.5603461",
"0.5599586",
"0.5591723",
"0.55913407",
"0.55861086",
"0.5585664",
"0.5583623",
"0.5581575",
"0.55801105",
"0.55795044",
"0.5574591",
"0.5574086",
"0.5571176",
"0.5571176",
"0.5571176",
"0.5571176",
"0.5571176",
"0.5571176",
"0.5571176",
"0.5571176",
"0.5570873",
"0.5570712",
"0.5567045",
"0.55597657",
"0.5558913",
"0.5558349",
"0.5557075",
"0.55541927"
] |
0.0
|
-1
|
== Metodo minimo Densa
|
def minimo
min = @matrix[0][0]
i = 0
# while i < @fil
(@fil).times do
j = 0
# while j < @col
(@col).times do
if(@matrix[i][j] < min)
min = @matrix[i][j]
end
j += 1
end
i += 1
end
#puts "minimo: #{min}"
return min
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ultimoDia (mes, ano=7)\n fim_do_mes = { \"1\" => \"31\", \"01\" => \"31\", \"2\" => \"28\", \"02\" => \"28\", \"3\" => \"31\",\n \"03\" => \"31\", \"4\" => \"30\", \"04\" => \"30\", \"5\" => \"31\", \"05\" => \"31\",\n \"6\" => \"30\", \"06\" => \"30\", \"7\" => \"31\", \"07\" => \"31\", \"8\" => \"31\",\n \"08\" => \"31\", \"9\" => \"30\", \"09\" => \"30\", \"10\" => \"31\", \"11\" => \"30\",\n \"12\" => \"31\" }\n\n ultimo_dia = fim_do_mes[mes]\n\n # anos bissextos\n if ultimo_dia == \"28\" && ((ano % 4 == 0 && ano % 100 != 0) || ano % 400 == 0)\n ultimo_dia = ultimo_dia + 1\n end\n\n return ano + \"-\" + mes + \"-\" + ultimo_dia\n end",
"def importancia(t)\n #fórmula para calculo de importancia\n ### quantidade de vizinhos dominados pelo inimigo + funcao impedeConquista\n ### se essa soma for 0, então usa a fórmula: \n ### (distancia do inimigo mais proximo - 10) / 1000 \n \n ###### TODO: verificar como é \"medida\" essa distancia na classe de grafo do pereira #####\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def minimo()\n\t\tminimo = 0;\n\t\t@hash_no_nulos.each do |key,valor|\n\t\t\tif (valor < minimo)\n\t\t\t\tminimo = valor\n\t\t\tend\n end\n\t\treturn minimo\n\tend",
"def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend",
"def extraer_delante\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cabeza\n @cabeza = @cabeza[:Next_]\n @cabeza[:prev] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def mi_carrera\n\n\tend",
"def joga nome, dificuldade\n\tnumero_secreto = sortea_numero_secreto dificuldade\n\tpontos_ate_agora = 1000\n\tlimite_tentativas = 5\n\tchutes = []\n\ttentativa = 1\n\n\tfor tentativa in 1..limite_tentativas\n\t\t\n\t\tchute = pede_numero_jogador chutes, tentativa,\n\t\t\tlimite_tentativas\n\n\t\tchutes << chute\t\n\t\n\t\tif nome == \"Vinicius\"\n\t\t\tputs \"Acertou em cheio meu camarada.\"\n\t\t\tbreak\n\t\tend\n\n\t\tpontos_a_perder = (chute - numero_secreto).abs / 2.0\n\t\tpontos_ate_agora -= pontos_a_perder\n\n\t\tvitoria = verifica_se_acertou numero_secreto, chute\n\n\t\tbreak if vitoria\n\n\t\tif tentativa == 5\n\t\t\tif perdeu_por_um numero_secreto, chute\n\t\t\t\ttentativa += 1\n\t\t\t\tlimite_tentativas += 1\n\t\t\t\tchute = pede_numero_jogador chutes, tentativa, limite_tentativas\n\t\t\t\tvitoria = verifica_se_acertou numero_secreto, chute\n\t\t\t\tbreak if vitoria\n\t\t\tend\n\t\tend\n\tend\n\n\tputs \"Você ganhou #{pontos_ate_agora} pontos\"\n\tvitoria\nend",
"def extraer_detras\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cola\n @cola = @cola[:prev]\n @cola[:Next_] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end",
"def precio_mercado\n @serie.valor_primer_dia('precio')\n end",
"def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |valor_pos| valor_pos.nivel }\r\n \r\n if jugador_actual == 'O'\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.min\r\n #nivels.max\r\n else\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.max\r\n end\r\n end",
"def descuento_sueldo(sueldo, tipo_obrero)\n\tif tipo_obrero == 'o'\n\t\tsueldo - (sueldo * 0.12) #OCURRE A\n\telse\n\t\tsueldo - (sueldo * 0.15) #OCURRE B\n\tend\nend",
"def suivre; end",
"def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend",
"def verificaesonitre (primo, secondo, terzo)\n\tesonicomuni=0\n\t#se il secondo e il terzo includono lo stesso esone lo conto come comune\n\tprimo.each do |v|\n\t\tif secondo.include?(v) then\n\t\t\tif terzo.include?(v) then \n\t\t\t\tesonicomuni=esonicomuni+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tprimosecondo=0\n\tprimo.each do |v|\n\t\tif secondo.include?(v) then\n\t\t\tif terzo.include?(v)==false then \n\t\t\t\tprimosecondo=primosecondo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tsecondoterzo=0\n\tsecondo.each do |v|\n\t\tif terzo.include?(v) then\n\t\t\tif primo.include?(v)==false then \n\t\t\t\tsecondoterzo=secondoterzo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tprimoterzo=0\n\tprimo.each do |v|\n\t\tif terzo.include?(v) then\n\t\t\tif secondo.include?(v)==false then \n\t\t\t\tprimoterzo=primoterzo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\t#il numero di esoni totali è così calcolato\n\tesoni=esonicomuni+primosecondo+secondoterzo+primoterzo+(primo.length-esonicomuni-primosecondo-primoterzo)+(secondo.length-esonicomuni-primosecondo-secondoterzo)+(terzo.length-secondoterzo-esonicomuni-primoterzo)\n\treturn esoni\nend",
"def segundoDigitoMenor(clave)\n\tcadena_digito = clave.to_s\n\treturn (cadena_digito[1]).to_i\nend",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def cuadrada\n @n==@m\n end",
"def schumann; end",
"def povuci_mrezu\n return @mreza\n end",
"def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def calculadora(uno,dos,tres=0, opciones= {})\n if(opciones['suma']==1)\n return uno +dos+tres\n end\n if(opciones['multiplica']==1)\n return uno * dos *tres\n end\nend",
"def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end",
"def min\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]< m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend",
"def seuil()\n\t\treturn 0\n\tend",
"def set_unidad_medida\n end",
"def set_unidad_medida\n end",
"def bilan\n raise \"Il faut lancer l'étude avec Etude::start avant de construire le bilan\" if @data.nil?\n @bilan ||= begin\n c = []\n # Largeur : 26 (sans les \"|\")\n titre = \"Exercices #{from_exercice} à #{to_exercice}\"\n gauche = ((26 - titre.length).to_f / 2).floor - 1\n droite = \" \" * (26 - (gauche + titre.length))\n gauche = \" \" * gauche\n entete = <<-TXT\n----------------------------\n|#{gauche}#{titre}#{droite}|\n----------------------------\n| Doigté | Nombre de fois |\n TXT\n c << entete.strip\n titre_section = <<-TXT\n----------------------------\n| Par quantité |\n----------------------------\n TXT\n c << titre_section.strip\n nombre_max = nil\n nombre_min = nil\n nb_courant = nil\n @data.sort_by{|c, e| e[:nombre]}.reverse.each do |combi, data_combi|\n nb_courant = data_combi[:nombre]\n nombre_max = nb_courant if nombre_max.nil?\n nb = (\" \" * 5) << nb_courant.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n nombre_min = nb_courant\n \n titre_section = <<-TXT\n----------------------------\n| Par premier doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[0..0]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n \n titre_section = <<-TXT\n----------------------------\n| Par second doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[2..2]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n c << \"-\" * 28\n c << \"\\n\"\n c.join(\"\\n\")\n end\n end",
"def min\n\n minimo = 0.to_f\n for i in 0...matriz.size \n if matriz[i] != nil \n matriz[i].each do |key, value|\n if matriz[i][key].to_f < minimo\n minimo = matriz[i][key].to_f\n end\n end\n end \n end\n minimo\n\tend",
"def minimo\r\n\t\t\r\n\t\tmin = 0\r\n\t\t\r\n\t\ti = 0\r\n\t\t\r\n\t\twhile i < @numElementos\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\tif(@eleM[i] < min)\r\n\t\t\t\t\r\n\t\t\t\tmin = @eleM[i]\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"minimo: #{min}\"\r\n\t\t\r\n\t\treturn min\r\n\t\t\r\n\tend",
"def deco_pos; end",
"def zuruecksetzen()\n end",
"def idade\n if nascimento != nil\n now = Time.now.utc.to_date\n now.year - nascimento.year - ((now.month > nascimento.month || (now.month == nascimento.month && now.day >= nascimento.day)) ? 0 : 1)\n else\n '--'\n end \n end",
"def jugada_max\r\n movimiento.max_by{|x| x.nivel} #Devuelve el objeto de enumeración que da el valor máximo\r\n end",
"def verdi; end",
"def imprime_dados()\n if @esq==-1 && @dir==-1\n puts 'no folha'\n else\n puts 'no interno ou raiz'\n puts @dir.to_s + '->' + @esq.to_s \n end\n end",
"def minvalue\n MINVALUE\n end",
"def es_menor(dia,mes,anio)\n fecha = false\n \tif (mes >= 1) && (mes <= 12) then\n\t\t\tcase mes\n\t\t\t\twhen 1,3,5,7,8,10,12 then\n\t\t\t\t\tmax = 31\n\t\t\t\twhen 4,6,9,11 then\n\t\t\t\t\tmax = 30\n\t\t\t\twhen 2 then\n\t\t\t\t\tif (es_bisiesto(anio) == true) then\n\t\t\t\t\t\tmax = 29\n\t\t\t\t\telse\n\t\t\t\t\t\tmax = 28\n\t\t\tend\n\t\tend\n\t\t\n\t\tif (dia >= 1) && (dia <= max)\n\t\t\tbirth = Date.civil(anio, mes, dia)\n\t\t\tnow = Date.today\n\t\t\tdifference_in_days = (now - birth).to_i\n\t\t\tdiff = (difference_in_days / 365.25).to_i\n\t\t\t\n\t\t\tif diff < 17\n\t\t\t\tfecha = true\n\t\t\tend\n\t\tend\n else\n\t\t\tfecha = false\n end\n return fecha\n\tend",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend",
"def terpene; end",
"def campoord_inicial\n 'fecharec'\n end",
"def test_min_densa\n\t\tassert_equal(3, @h6.min, \"Resultado Incorrecto\" )\n\tend",
"def terreno\n\t\treturn @terreno*@cantidad\n\tend",
"def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend",
"def tempo_min\n @tempo_min ||= data[:tempo_min].to_i\n end",
"def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end",
"def min() end",
"def valor_energetico\n (@proteinas * 4) + (@glucidos * 4) + (@grasas * 9)\n end",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def sigla; @nome; end",
"def paraLetras(d)\n #excluídos o \"L minúsculo\" e o \"ó maiúsculo\"\n a = Array.new; a.push('x','y','z','a','b','c','u','v','w','d','e','f','r','s','t','g','h','i','o','p','q','j','k','m','n')\n b = Array.new; b.push('Z','A','Y','B','X','C','W','D','V','E','U','F','T','G','S','H','R','I','Q','J','P','K','N','L','M')\n c = a + b\n return c[d]\n end",
"def to_densa\n\t @M = Matriz_Densa.new(@alt+1,@anc+1, 0)\n\t for i in (0..@alt)\n\t\t for j in (0..@anc)\n\t\t @M[i][j] = 0\n\t\t end\n\t end\n\t for i in (0..@n_elem-1)\n\t @M[@alto[i]][@ancho[i]]=@elem[i]\n\t end\n\t @M\n\tend",
"def valores_por_default\n \t\tself.costo ||= 0\n \tend",
"def producao (quantidade, tamanho: :M, cor: :azul) #não precisa obdecer a ordem de tamanho e cor, pq tem chave e valor\n puts \"Produzindo #{quantidade} de roupas tamanho #{tamanho} e cor #{cor}\"\nend",
"def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend",
"def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end",
"def porc_grasa\n\t\t(1.2 * self.indice_masa_corporal + 0.23 * edad - 10.8 * sexo - 5.4).round(1)\n\tend",
"def formata_valor_segundo_desconto(tamanho = 13)\n format_value(:valor_segundo_desconto, tamanho)\n end",
"def calculo_de_sueldo(attr={})\r\n retencion = @salario * 0.1\r\n salud = @salario * 0.07\r\n pension = @salario * 0.12\r\n sueldo = @salario - retencion - salud - pension\r\n end",
"def min\n end",
"def min\n end",
"def defineSueldoVendedor(monto)\n sueldoBase = 1500\n comision = 0.0\n if(monto >= 0 && monto <=1999)\n comision = 0.00*monto\n elsif(monto >= 2000 && monto <=10000)\n comision = (0.03*monto).round(2)\n elsif(monto >= 10001 && monto <=20000)\n comision = (0.06*monto).round(2)\n elsif(monto >= 20001)\n comision = (0.1*monto).round(2)\n end\n return (sueldoBase + comision).round(2)\nend",
"def campoord_inicial\n 'ubicacion'\n end",
"def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend",
"def turno_nivel_dificil\n if tem_naipe_da_rodada_ou_trunfo?\n if pontos_da_mesa > 0\n if tem_carta_maior_do_que_a_maior_carta_da_mesa?\n return joga_maior_carta\n end\n end\n end\n joga_menor_carta\n end",
"def test_min_dispersa\n\t\tassert_equal(Fraccion.new(66,5), @h3.min, \"Resultado Incorrecto\" )\n\tend",
"def soma_total\n\n\t\t\n\t\tif janeiro.present?\n\t\t\tjaneiro\n\t\telse\n\t\t\tjaneiro == 0 or unless janeiro.present?\n\t\t\tself.janeiro = 0\n\t\t\tend\n\t\tend\n\t\tif fevereiro.present?\n\t\t\tfevereiro\n\t\telse\n\t\t\tfevereiro == 0 or unless fevereiro.present?\n\t\t\tself.fevereiro = 0\n\t\t\tend\n\t\tend\n\n\n\tif marco.present?\n\t\tmarco\n\telse \n\t\tmarco == 0 or unless marco.present?\n\t\tself.marco = 0\t\n\tend\nend\t\nif abril.present?\n\tabril\nelse abril == 0 or unless abril.present?\n\tself.abril = 0\nend\nend\t\nif maio.present?\n\tmaio\nelse maio == 0 or unless maio.present?\n\tself.maio = 0\nend\nend\t\nif junho.present?\n\tjunho\nelse junho == 0 or unless junho.present?\n\tself.junho = 0\nend\nend\t\nif julho.present?\n\tjulho\nelse julho == 0 or unless julho.present?\n\tself.julho = 0\nend\nend\t\nif agosto.present?\n\tagosto\nelse agosto == 0 or unless agosto.present?\n\tself.agosto = 0\nend\nend\t\nif setembro.present?\n\tsetembro\nelse setembro == 0 or unless setembro.present?\n\tself.setembro = 0\nend\nend\t\nif outubro.present?\n\toutubro\nelse outubro == 0 or unless outubro.present?\n\tself.outubro = 0\nend\nend\t\nif novembro.present?\n\tnovembro\nelse novembro == 0 or unless novembro.present?\n\tself.novembro = 0\nend\nend\t\nif dezembro.present?\n\tdezembro\nelse dezembro == 0 or unless dezembro.present?\n\tself.dezembro = 0\nend\nend\t\n\nif (self.janeiro == 0 and self.fevereiro == 0 and self.marco == 0 and \n\tself.abril == 0 and self.maio == 0 and self.junho == 0 and\t\n\tself.julho == 0 and self.agosto == 0 and self.setembro == 0 and \n\tself.outubro == 0 and self.novembro == 0 and self.dezembro == 0)\n\tself.total = 0\nelse\n\tself.total = (janeiro + fevereiro + marco + abril + \n\tmaio + junho + julho + agosto + setembro + \n\toutubro + novembro + dezembro)\nend\nend",
"def get_valor_energetico\n \n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n \n \n end",
"def sugestao_de_codigo(empresa_id)\n ultimo_composicao = self.class.da_empresa(empresa_id).asc(:created_at).last\n if ultimo_composicao and ultimo_composicao.codigo and !ultimo_composicao.codigo.blank?\n if ultimo_composicao.codigo.blank?\n codigo = \"00000001\"\n self.codigo = self.sugestao_de_codigo_achar_ultima(empresa_id, codigo)\n else\n codigo = ultimo_composicao.codigo.succ\n self.codigo = self.sugestao_de_codigo_achar_ultima(empresa_id, codigo)\n end\n else\n self.codigo = \"00000001\"\n end\n end",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def det\n\t\t\t@frecuencias['determinantes']\n\t\tend",
"def duns_number; end",
"def valorenergetico\n acumulador1 = 0\n nodo = @head\n while nodo != @tail\n acumulador1 = acumulador1 + nodo.value.valor_energetico\n nodo = nodo.next\n end\n acumulador1\n end",
"def calculoDiametro(raio)\n return raio * 2\nend",
"def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end",
"def menor\n min = 0\n for i in 0...@f do\n for j in 0...@c do\n\tif((!@matriz[i].nil?) && (!@matriz[i][j].nil?))\n\t if (min > @matriz[i][j])\n\t min = @matriz[i][j]\n\t end\n\tend\n end\n end\n end",
"def test_minimizar\n assert_equal 2,Fraccion.new(1,1).minimizar(@c.num,@c.denom).num\n assert_equal 1,Fraccion.new(1,1).minimizar(@c.num,@c.denom).denom\n end",
"def mambo_no_5; end",
"def numero_marca\n fecha_numero_marca[:numero]\n end",
"def actualiza_atributos_diariodets \n sum_debe = 0\n sum_haber = 0\n sum_debe_sec = 0\n sum_haber_sec = 0\n item_max = 0\n idcuenta_ajuste_dif_cambio = 709 #Catalogo.find_by(id: Catalogo::ID_CTA_AJUSTE_DIF_CAMBIO)\n\n set_datos_segun_conf\n\n if self.origenasiento_id == 1 # si es manual actualiza columnas debe, haber...\n diariodets.each do |child| \n if child.ajuste.blank? or child.ajuste == '0'\n cod_moneda_trasac = Moneda.find_by(id:child.moneda_id).codigo \n child.tcori = self.tc\n child.ajuste = '0' \n if cod_moneda_trasac == Moneda::CODIGO_SYS[:nal]\n child.debe = (child.debeori).round(2) \n child.haber = (child.haberori).round(2) \n child.debesec = (child.debeori/Conta::TCV_CONST).round(2) \n child.habersec = (child.haberori/Conta::TCV_CONST).round(2) \n child.tcsec = child.tcori\n else\n if cod_moneda_trasac == Moneda::CODIGO_SYS[:sec]\n tc_transac = 0\n if Conta::TCV_CONST != child.tcori\n tc_transac = child.tcori\n else\n tc_transac = Conta::TCV_CONST\n end\n child.tcsec = tc_transac\n\n child.debe = (child.debeori*tc_transac).round(2) \n child.haber = (child.haberori*tc_transac).round(2) \n\n child.debesec = (child.debeori).round(2) \n child.habersec = (child.haberori).round(2) \n end #cod_moneda_trasac = Moneda::CODIGO_SYS[:sec]\n end #cod_moneda_trasac = Moneda::CODIGO_SYS[:nal]\n if item_max < child.item\n item_max = child.item\n end \n sum_debe = sum_debe + child.debe\n sum_haber = sum_haber + child.haber\n sum_debe_sec = sum_debe_sec + child.debesec\n sum_haber_sec = sum_haber_sec + child.habersec\n end #if child.ajuste.blank? or child.ajuste == '0'\n end #end diariodets.each do |child|\n\n ###\n ###cuadre global\n if (sum_debe != sum_haber) or (sum_debe_sec != sum_haber_sec)\n ajuste = 0\n ajuste_sec = 0 \n ajuste = sum_debe - sum_haber\n ajuste_sec = sum_debe_sec - sum_haber_sec \n if ajuste != 0 \n if ajuste > 0\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber => ajuste, :debesec => 0, :habersec => 0, :debeori => 0, :haberori => ajuste, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 1)\n else\n ajuste = ajuste * (-1)\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => ajuste, :haber => 0, :debesec => 0, :habersec => 0, :debeori => ajuste, :haberori => 0, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 1)\n end#end ajuste > 0\n end# end ajuste != 0 \n if ajuste_sec != 0\n if ajuste_sec > 0\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber =>0 , :debesec => 0, :habersec => ajuste_sec, :debeori => 0, :haberori => ajuste_sec, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 2)\n else\n ajuste_sec = ajuste_sec * (-1)\n item_max = item_max + 1\n diariodets.build(:item => item_max, :catalogo_id => idcuenta_ajuste_dif_cambio, :tlaux1 => \"0\", :tlaux2 => \"0\", :codtlaux1 => \"\", :codtlaux2 => \"\", :debe => 0, :haber => 0, :debesec => ajuste_sec, :habersec => 0, :debeori => ajuste_sec, :haberori => 0, :tcori => self.tc, :glosa => 'AJUSTE AUTOMATICO POR CUADRE', :esdebito => false, :monto => ajuste_sec, :ajuste => \"1\", :oficina_id => Oficina.id_oficina_nacional, :libauxdet_id => 0, :moneda_id => 2) \n end#end ajuste_sec > 0\n end# end ajuste_sec != 0 \n end #(sum_debe != sum_haber) or (sum_debe_sec != sum_haber_sec)\n end#if self.tipocomprobante_id != 5 # si es automatico no aplica lo siguiente \n end",
"def traer_insumo(nombreInsumo, cantidad)\n\t case nombreInsumo\n\t\t when \"cebada\" then \n\t\t\t if (@cebada >= cantidad)\n\t\t\t\t @cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cebada\n\t\t\t\t @cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"arroz_maiz\" then\n\t\t\t if (@arroz_maiz >= cantidad)\n\t\t\t\t @arroz_maiz -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @arroz_maiz\n\t\t\t\t @arroz_maiz = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"levadura\" then\n\t\t\t if (@levadura >= cantidad)\n\t\t\t\t @levadura -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @levadura\n\t\t\t\t @levadura = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"lupulo\" then\n\t\t\t if (@lupulo >= cantidad)\n\t\t\t\t @lupulo -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @lupulo\n\t\t\t\t @lupulo = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_silos_cebada\" then\n\t\t\t if (@producto_silos_cebada >= cantidad)\n\t\t\t\t @producto_silos_cebada -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_silos_cebada\n\t\t\t\t @producto_silos_cebada = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_molino\" then\n\t\t\t if (@producto_molino >= cantidad)\n\t\t\t\t @producto_molino -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_molino\n\t\t\t\t @producto_molino = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_mezcla\" then\n\t\t\t if (@producto_paila_mezcla >= cantidad)\n\t\t\t\t @producto_paila_mezcla -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_mezcla\n\t\t\t\t @producto_paila_mezcla = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_cuba_filtracion\" then\n\t\t\t if (@producto_cuba_filtracion >= cantidad)\n\t\t\t\t @producto_cuba_filtracion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_cuba_filtracion\n\t\t\t\t @producto_cuba_filtracion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_paila_coccion\" then\n\t\t\t if (@producto_paila_coccion >= cantidad)\n\t\t\t\t @producto_paila_coccion -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_paila_coccion\n\t\t\t\t @producto_paila_coccion = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_preclarificador\" then\n\t\t\t if (@producto_tanque_preclarificador >= cantidad)\n\t\t\t\t @producto_tanque_preclarificador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_preclarificador\n\t\t\t\t @producto_tanque_preclarificador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_enfriador\" then\n\t\t\t if (@producto_enfriador >= cantidad)\n\t\t\t\t @producto_enfriador -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_enfriador\n\t\t\t\t @producto_enfriador = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tcc\" then\n\t\t\t if (@producto_tcc >= cantidad)\n\t\t\t\t @producto_tcc -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tcc\n\t\t\t\t @producto_tcc = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_filtro_cerveza\" then\n\t\t\t if (@producto_filtro_cerveza >= cantidad)\n\t\t\t\t @producto_filtro_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_filtro_cerveza\n\t\t\t\t @producto_filtro_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"producto_tanque_cerveza\" then\n\t\t\t if (@producto_tanque_cerveza >= cantidad)\n\t\t\t\t @producto_tanque_cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @producto_tanque_cerveza\n\t\t\t\t @producto_tanque_cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t\t when \"cerveza\" then\n\t\t\t if (@cerveza >= cantidad)\n\t\t\t\t @cerveza -= cantidad\n\t\t\t\t resultado = cantidad\n\t\t\t else\n\t\t\t\t resultado = @cerveza\n\t\t\t\t @cerveza = 0\n\t\t\t end\n\t\t\t return resultado\n\t end\n\tend",
"def prox()\n # Como sigue una distribucion uniforme entonces \n # cada uno de los movimientos tendra la misma\n # probabilidad. Esto se traduce en conseguir un\n # numero random entre 0 y el numero de estrategias\n # menos 1 \n posicion_jugada = $r.rand(0..(@estrategias.length - 1))\n jugada_seleccionada = @estrategias[posicion_jugada]\n jugada_seleccionada = jugada_seleccionada.to_s\n @mano = Jugada.new(jugada_seleccionada)\n return @mano \n end",
"def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end",
"def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + (cgrasassa * 37) + (grasasmono * 37) + (grasaspoli * 37) + (hcarbono * 17) + (polialcoholes * 10) + (almidon * 17) + (fibra * 8) + (proteinas * 17) + (sal * 25)\n\t\tveKJ.round(2)\n\tend",
"def jugar\n ganador = case self.maquina_tirada\n when self.humano_tirada\n\t\"empatan\"\n when Ppt.jugadas_posibles[self.humano_tirada]\n\t\"humano\"\n else \n\t\"maquina\"\n end\n return ganador\n end",
"def valor_administracion\n\t\tarea * 2300\n\tend",
"def french_siret_number; end",
"def smaller(restaurant_menu)\n mas_barato = restaurant_menu.min_by{|k,v| v}\n puts \"El plato mas barato es el #{mas_barato[0]}\"\nend",
"def mapee i=0\n dist[i][0]\n end",
"def mmin(md)\n mod md, 16\n end",
"def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end",
"def obtenerPuntaje_Del_Primer_Tiro()\n return roll1.obtenerPinsDerrumbados()\n end",
"def initialize(nombre)\n @nombre = nombre\n @edad = 0\n end",
"def salta_il_primo\n self.drop 1\n end",
"def somme\n if marquer!\n # Deja marque, donc on ne le visite pas.\n 0\n else\n # Pas marque: on visite les voisins pour calculer leur somme, a\n # laquelle on ajoute la valeur du noeud courant.\n @voisins\n .pmap { |v| @graphe[v] }\n .pmap(&:somme)\n .reduce(@val, :+)\n end\n end",
"def imprimir_machete(rondas_del_juego = 1)\n\t\t1.upto(@cantidad_de_alumnos.*(rondas_del_juego)) do |numero|\n\t\t\tprint juzgar_numero(numero).<<(' ')\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend",
"def dieta_terreno(gramos)\n\n aux = @head\n suma_terreno = 0\n i = 0\n while (!aux.nil?)\n suma_terreno += aux[:value].auxiliar2(gramos[i])\n aux = aux[:next]\n i = i+1\n end\n return suma_terreno.round(2)\n\n end",
"def residency_diploma\n\tend"
] |
[
"0.6585546",
"0.6554372",
"0.6547542",
"0.6391379",
"0.62446874",
"0.62172526",
"0.6100826",
"0.608667",
"0.60679126",
"0.6000963",
"0.5999675",
"0.5987367",
"0.5953063",
"0.59339565",
"0.5909219",
"0.5908701",
"0.58908784",
"0.58877355",
"0.5883555",
"0.58823127",
"0.58252126",
"0.5824991",
"0.58093333",
"0.5798285",
"0.5774175",
"0.5765634",
"0.5765118",
"0.5752615",
"0.57522327",
"0.57522327",
"0.572155",
"0.5720185",
"0.57057565",
"0.5691865",
"0.569097",
"0.56629103",
"0.5659464",
"0.5638097",
"0.56340694",
"0.5626211",
"0.5620457",
"0.56199545",
"0.5618637",
"0.561707",
"0.5616525",
"0.56153095",
"0.5608917",
"0.5600566",
"0.5592086",
"0.5590995",
"0.55747765",
"0.5572476",
"0.55689186",
"0.5555443",
"0.55458677",
"0.55316967",
"0.55290675",
"0.55164623",
"0.55162555",
"0.5512142",
"0.5508886",
"0.55025053",
"0.55010563",
"0.55010563",
"0.55008644",
"0.54915744",
"0.5490145",
"0.54866856",
"0.5477159",
"0.54678357",
"0.54641944",
"0.5454785",
"0.54531777",
"0.54427683",
"0.54399383",
"0.54387516",
"0.5437311",
"0.5435433",
"0.54343486",
"0.5431136",
"0.54297644",
"0.54265004",
"0.5422415",
"0.5416859",
"0.54165447",
"0.5415759",
"0.5414664",
"0.5414286",
"0.5407128",
"0.54063594",
"0.54057187",
"0.539927",
"0.5395763",
"0.53927964",
"0.5392147",
"0.5391599",
"0.5389703",
"0.5389266",
"0.5388502",
"0.5388135",
"0.5383411"
] |
0.0
|
-1
|
== Metodo maximo Densa
|
def maximo
max = @matrix[0][0]
i = 0
# while i < @fil
(@fil).times do
j = 0
# while j < @col
(@col).times do
if(@matrix[i][j] > max)
max = @matrix[i][j]
end
j += 1
end
i += 1
end
#puts "maximo: #{max}"
return max
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def jugada_max\r\n movimiento.max_by{|x| x.nivel} #Devuelve el objeto de enumeración que da el valor máximo\r\n end",
"def maximo()\n\t\tmaximo = 0;\n\t\t@hash_no_nulos.each do |key,valor|\n\t\t\tif (valor > maximo)\n\t\t\t\tmaximo = valor\n\t\t\tend\n end\n\t\treturn maximo\n\tend",
"def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend",
"def maximo\r\n\t\t\r\n\t\tmax = 0\r\n\t\t\r\n\t\ti = 0\r\n\t\t\r\n\t\twhile i < @numElementos\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\tif(@eleM[i] > max)\r\n\t\t\t\t\r\n\t\t\t\tmax = @eleM[i]\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\tend\r\n\t\t\r\n\t\t#puts \"maximo: #{max}\"\r\n\t\t\r\n\t\treturn max\r\n\t\t\r\n\tend",
"def maxvalue\n MAXVALUE\n end",
"def max; end",
"def max; end",
"def max\n end",
"def max\n end",
"def get_max()\n end",
"def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |valor_pos| valor_pos.nivel }\r\n \r\n if jugador_actual == 'O'\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.min\r\n #nivels.max\r\n else\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.max\r\n end\r\n end",
"def tam\n @Max\n end",
"def max\n @n[0]\n end",
"def get_max\n @max\n end",
"def max\n maximo = 0.to_f\n for i in 0...matriz.size\n if matriz[i] != nil\n matriz[i].each do |key, value|\n if matriz[i][key].to_f > maximo\n maximo = matriz[i][key].to_f\n end\n end\n end\n end\n maximo\n end",
"def tempo_max\n @tempo_max ||= data[:tempo_max].to_i\n end",
"def max\n if valid?\n max_value\n end\n end",
"def max\n @max\n end",
"def max\n @max\n end",
"def max\n max = @valor[0][0]\n i=0\n\tself.fil.times do |i|\n\t j=0\n\t self.col.times do |j|\n\t if (@valor[i][j] > max)\n\t\t max= @valor[i][j]\n\t end\n\t j=j+1\n\t end\n\ti=i+1\n end\n max\n end",
"def max\n @maxNumber\n end",
"def max=\n end",
"def item_max() @item_max end",
"def max\n data.max\n end",
"def find_max()\r\n self.max\r\n end",
"def max\r\n temp = @first\r\n maxValue = -999999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n maxValue\r\n end",
"def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n maxValue\n end",
"def wordMax\n @wordMax\n end",
"def max\r\n temp = @first\r\n maxValue = -99999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return maxValue\r\n end",
"def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"def test_max_densa\n\t\tassert_equal(8, @h6.max, \"Resultado Incorrecto\" )\n\tend",
"def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n return maxValue\n end",
"def tor(dd, max)\n dd == max - 1 ? -1 : dd\n end",
"def maximum\n return @maximum\n end",
"def max\n @data[0]\n end",
"def max\n\t\t@max || nil\n\tend",
"def get_max\n\t\t@max.last\n\tend",
"def max\r\n @range.max\r\n end",
"def maximum\n object.maximum.to_f\n end",
"def max_vendedor\n pv = self.punto_venta\n cantVend = pv.concesionaria.cantVend\n cantvendconc = Vendedor.where(:id => pv.id).count\n\n if (cantVend.to_i <= cantvendconc.to_i + 1 )\n errors.add(:base, \"No puede crear mas Vendedores para este punto de venta, solicite permiso\")\n end\n end",
"def max(_); '1000'; end",
"def max\n\t\tmax = @m[0][0]\n\t\tfor i in 0...@fi \n\t\t\tfor k in 0...@co\n\t\t\t\tif (@m[i][k] > max) then\n\t\t\t\t\tmax=@m[i][k] \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tmax\n\tend",
"def max\n max = get(0,0)\n for i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) > max)\n max = get(i,j)\n end\n end\n end\n max\n end",
"def max\n \n # Establecemos valor del primer elemento\n max = @matrix[0][0]\n i = 0\n \n #Fila a fila actualizando el valor maximo\n while (i < @fil)\n j = 0\n while (j < @col)\n if (@matrix[i][j] > max)\n max = @matrix[i][j]\n end\n j += 1\n end\n i += 1\n end\n max\n end",
"def ultimoDia (mes, ano=7)\n fim_do_mes = { \"1\" => \"31\", \"01\" => \"31\", \"2\" => \"28\", \"02\" => \"28\", \"3\" => \"31\",\n \"03\" => \"31\", \"4\" => \"30\", \"04\" => \"30\", \"5\" => \"31\", \"05\" => \"31\",\n \"6\" => \"30\", \"06\" => \"30\", \"7\" => \"31\", \"07\" => \"31\", \"8\" => \"31\",\n \"08\" => \"31\", \"9\" => \"30\", \"09\" => \"30\", \"10\" => \"31\", \"11\" => \"30\",\n \"12\" => \"31\" }\n\n ultimo_dia = fim_do_mes[mes]\n\n # anos bissextos\n if ultimo_dia == \"28\" && ((ano % 4 == 0 && ano % 100 != 0) || ano % 400 == 0)\n ultimo_dia = ultimo_dia + 1\n end\n\n return ano + \"-\" + mes + \"-\" + ultimo_dia\n end",
"def get_max_num\n r,t,a = 0, 0, 9**self\n while r < t.to_s.size\n r,t = r + 1, t+a\n end\n return t\n end",
"def max\n @max ||= define_min_and_max && @max\n end",
"def t_max\n @temp.max\n end",
"def get_max_value()\n temp = @symtable.values\n temp.keep_if { |x| x.to_i < 16384 }\n temp.max\n end",
"def test_max_dispersa\n\t\tassert_equal(Fraccion.new(77,12), @h3.max, \"Resultado Incorrecto\" )\n\tend",
"def get_max\n @max ||= calculate_max\n end",
"def get_max_field()\n 0\n end",
"def largest_value\n values.max\n end",
"def max_index\n max :vector\n end",
"def item_max\r\n @item_max || 0\r\n end",
"def text_field_max\n return nil unless hidden_field_max\n hidden_field_max.divmod(hidden_field_step).first * text_field_step\n # fetch_options('max', text_field_name) # default)\n end",
"def problem_66\n max = [0,0]\n (2..1000).each do |d|\n top,bot = d.sqrt_frac {|t,b| (t*t - d*b*b) == 1}\n next unless top\n max = [max,[top,d]].max\n puts \"#{d} #{top} #{bot}\"\n end\n max[1]\nend",
"def max_data_value n\n significant = n.to_s[0].to_i + 1\n plus = [1]\n (n.to_s.size - 1).times{\n plus << 0\n }\n if n % plus.join.to_i == 0\n return n\n else\n plus[0] = plus[0] * significant\n return plus.join.to_i\n end\n end",
"def max\n self.class.max\n end",
"def max\n move(180)\n end",
"def item_max\n @item_max\n end",
"def max_tp\r\n return 100\r\n end",
"def maximum_representable()\n\t(@@roman_of.keys.max * 5) -1\nend",
"def max\n @max ||= begin\n maxes = []\n options[:max].times { |t| maxes << dup_for(max: nil, change: nil, series: nil, extend_cache_life: options[:max] - t, period: period.prev(t + 1)).compute }\n maxes.max\n end if options[:max]\n end",
"def maxValue(sq)\n\n #ini value\n max = sq[0]\n at = 0\n\n for i in 1..(sq.length - 1)\n\n if max < sq[i]\n max = sq[i]\n at = i\n end\n\n end\n\n return at\n end",
"def s_maxage\n\t\t\t\t\tfind_integer_value(S_MAXAGE)\n\t\t\t\tend",
"def find_max\r\n return nil if !@head\r\n cursor = @head\r\n max = cursor.data\r\n while cursor\r\n if cursor.data > max\r\n max = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return max\r\n end",
"def suggestedNumber\r\n return self.maxLength\r\n end",
"def max(_); '100'; end",
"def max(_); '100'; end",
"def max \n @list.reduce(0){ |memo,v| (v>memo ? v : memo) }\n end",
"def findMax(a)\n\ta.length\nend",
"def validar_maximo(campo, valor, maximo)\n\t\tuntil valor<=maximo and valor > 0\n\t\t\tputs \"Ingrese #{campo} valido (máximo #{maximo})\"\n\t\t\tvalor = gets.chomp.to_i\n\t\tend\n\t\treturn valor\n\tend",
"def kadenes_algo(array)\n max_ending_here = array[0]\n max_so_far = array[0]\n\n for num in array\n max_ending_here = [num, max_ending_here + 1].max\n max_so_far = [max_so_far, max_ending_here].max\n end\n\n return max_so_far\n\nend",
"def maxy\n main.maxy\n end",
"def max\n empty? ? -Float::INFINITY : @list.head.value[2]\n end",
"def max\r\n temp = @first\r\n maxValue = -99999\r\n\r\n while !temp.nil?\r\n if temp.value > maxValue then\r\n maxValue = temp.value \r\n end \r\n temp = temp.next\r\n end \r\n maxValue\r\nend",
"def maximum_value\n @maximum_value || store.max\n end",
"def item_max\n return 1\n end",
"def mayor\n max = 0\n for i in 0...@f do\n for j in 0...@c do\n\tif((!@matriz[i].nil?) && (!@matriz[i][j].nil?))\n\t if (max < @matriz[i][j])\n\t max = @matriz[i][j]\n\t end\n\tend\n end\n end\n end",
"def max_descent_speed; end",
"def minimo()\n\t\tminimo = 0;\n\t\t@hash_no_nulos.each do |key,valor|\n\t\t\tif (valor < minimo)\n\t\t\t\tminimo = valor\n\t\t\tend\n end\n\t\treturn minimo\n\tend",
"def max_index\n max_value = @data.max\n Daru::Vector.new({index_of(max_value) => max_value}, name: @name, dtype: @dtype)\n end",
"def maximum\n return self[0]\n end",
"def odb_max\n \"max(#{to_s})\"\n end",
"def max\n MSPhysics::Newton::Hinge.get_max(@address)\n end",
"def max\n if size == 0\n 0/0.0\n else\n self.size - 1\n end\n end",
"def largest(restaurant_menu)\n mas_caro = restaurant_menu.max_by{|k,v| v}\n puts \"El plato mas caro es el #{mas_caro[0]}\"\nend",
"def mini_max\nend",
"def max\n (count * sides + increment) * multiplier\n end",
"def max\n return -1 if @count == 0\n return @array[0]\n end",
"def find_max_value(array)\n \n (find_max_value(scale)).to eq(5)\n (find_max_value(scale_2)).to eq(6)\n (find_max_value(hill)).to eq(5)\n (find_max_value(valley)).to eq(5)\n (find_max_value(zig_zag)).to eq(1000)\n end",
"def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end",
"def max\r\n temp = @first\r\n max_value = @first.value\r\n while !temp.nil?\r\n if temp.value > max_value\r\n max_value = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return max_value\r\n end",
"def max\n @max ||= map {|a| a[0].length}.max\n end",
"def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end",
"def max(hill)\n (2 * (hill.size - 1)).to_s\n end",
"def max\r\n\ttemp = @first\r\n\tmaxValue = nil\r\n\tif !temp.nil? then\r\n\t\tmaxValue = temp.value\r\n\t\ttemp = temp.next\r\n\tend\r\n\twhile !temp.nil?\r\n\t\tif temp.value > maxValue then\r\n\t\t\tmaxValue = temp.value\r\n\t\tend\r\n\t\ttemp = temp.next\r\n\tend\r\n\treturn maxValue\r\n end",
"def max_poss\n res = 1\n @poss.each { |p| res *= p.length }\n res\n end",
"def max_element\n self.to_a.max\n end"
] |
[
"0.7826323",
"0.76851004",
"0.74364275",
"0.71017855",
"0.7057347",
"0.7037908",
"0.7037908",
"0.696704",
"0.696704",
"0.69328886",
"0.69229984",
"0.68976045",
"0.6889512",
"0.68829006",
"0.68647254",
"0.68581295",
"0.6843066",
"0.68346894",
"0.68346894",
"0.68257076",
"0.6805088",
"0.6802272",
"0.6787961",
"0.6786577",
"0.6749107",
"0.67252463",
"0.6693632",
"0.6693392",
"0.6673501",
"0.6652566",
"0.6628386",
"0.6598426",
"0.659579",
"0.65695804",
"0.6559498",
"0.653394",
"0.65293616",
"0.6518943",
"0.65162224",
"0.650847",
"0.6504856",
"0.6493854",
"0.64841986",
"0.6476256",
"0.647546",
"0.64737546",
"0.64732355",
"0.64583063",
"0.645517",
"0.6440044",
"0.6416955",
"0.6405531",
"0.64045835",
"0.64038444",
"0.638325",
"0.6376122",
"0.6357352",
"0.63497746",
"0.6333832",
"0.63254744",
"0.63146996",
"0.63126594",
"0.6284684",
"0.62805",
"0.6272269",
"0.6269622",
"0.62595946",
"0.6252839",
"0.62487155",
"0.62487155",
"0.6238175",
"0.6236338",
"0.6235244",
"0.6234797",
"0.62293625",
"0.62292415",
"0.6223866",
"0.62237775",
"0.6219439",
"0.6218364",
"0.6215619",
"0.62046206",
"0.6203609",
"0.6199088",
"0.61953425",
"0.6191475",
"0.61881274",
"0.6184989",
"0.61795217",
"0.6174841",
"0.6172454",
"0.6172332",
"0.61662877",
"0.61633563",
"0.616044",
"0.61438566",
"0.6142729",
"0.61412734",
"0.6135868",
"0.6135605"
] |
0.6489169
|
42
|
== Metodo calular fila columna Dispersa
|
def calcularFilCol(numElem)
i = 0
num = 0
while i < @fil
j = 0
while j < @col
if (num == numElem)
@filM.push(i)
@colM.push(j)
end
num += 1
j += 1
end
i += 1
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def col; end",
"def columns; end",
"def columns\n end",
"def columnas\n\t\t@renglones_reporte[0].id_columnas\n\tend",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def columns_title\n self.columns.collect{|c|c.label}\n end",
"def columns \n @c\n end",
"def item_column(detail)\n ''\n end",
"def columns; @columns; end",
"def column\n Vedeu.width / 12\n end",
"def column\n Vedeu.width / 12\n end",
"def displayframecolumnvalues\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t\tnew_row='|'+row.join('|')+'|'\r\n\t\t\t\t@output.puts(new_row)\r\n\t\t\tend\r\n\t\tend",
"def columns(line)\n line[ox...(ox + width)] || ''\n end",
"def columns\n 1\n end",
"def col\n horizontals_push; alignments_reset ; widths_reset\n end",
"def real_column; end",
"def columns\n @columns\n end",
"def columns\n @columns || 150\n end",
"def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end",
"def display_col(col)\r\n\r\n print \"Column #{col}: \"\r\n @bingo_board[@cols.index(col)].each {|num| print \"#{num} \"}\r\n puts\r\n\r\n end",
"def columns\n @columns\n end",
"def column_headings\n {\n :line_count => \"Lines\",\n :loc_count => \"LOC\",\n :file_count => \"Classes\",\n :method_count => \"Methods\",\n :average_methods => \"M/C\",\n :method_length => \"LOC/M\",\n :class_length => \"LOC/C\"\n }\n end",
"def columns\n @columns\n end",
"def columns\n @columns\n end",
"def column_title\n return @frequency_data[ :title ]\n end",
"def cols\n @cols\n end",
"def columns\n return [{:id=>\"one\", :display =>'One', :searchable=>false}, {:id=>'two', :display => 'three'}]\n end",
"def each_column\n end",
"def column_value(rec, drawer)\n if (enum = drawer.vc.get_enum(rec.class, @ar_column_info))\n drawer.vc.draw_column_enum(rec, @ar_column_info, enum)\n else\n case @ar_column_info.type\n when :datetime\n drawer.vc.datetime_fmt(rec.send(name))\n when :date\n drawer.vc.date_fmt(rec.send(name))\n when :integer\n rec.send(name).to_s\n when :boolean\n rec.send(name) ? '√' : ''\n else\n # NOTE: rec.send(col.name) is not used since sssn.send(:data)\n # becomes hash rather than actual string-data so that following\n # split() fails for Hash.\n if str = rec.attributes[name]\n draw_trimmed_str(str)\n else\n ''\n end\n end\n end\n end",
"def imc_tabla\n\t\tx = self.indice_masa_corporal\n\n\n\t\tif x < 18.5\n\t\t\treturn \"#{x} < 18.5 -- Bajo peso -- Delgado\"\n\t\telsif x >= 18.5 && x <= 24.9\n\t\t\treturn \"18.5 < #{x} < 24.9 -- Adecuado -- Aceptable\"\n\t\telsif x > 24.9 && x <= 29.9\n\t\t\treturn \"25.0 < #{x} < 29.9 -- Sobrepeso -- Sobrepeso\"\n\t\telsif x > 29.9 && x <= 39.9\n\t\t\treturn \"30.0 < #{x} < 39.9 -- Obesidad grado 1 -- Obesidad\"\n\t\telsif x > 39.9\n\t\t\treturn \" #{x} > 40 -- Obesidad grado 2 -- Obesidad\"\n\t\tend\n\n\tend",
"def columnas(tablero)\r\n\t#Columnas0\r\n\t\te = 0\r\n\t\t@columna0 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna0 << tablero[e,0]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas1\r\n\t\te = 0\r\n\t\t@columna1 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna1 << tablero[e,1]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas2\r\n\t\te = 0\r\n\t\t@columna2 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna2 << tablero[e,2]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas3\r\n\t\te = 0\r\n\t\t@columna3 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna3 << tablero[e,3]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas4\r\n\t\te = 0\r\n\t\t@columna4 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna4 << tablero[e,4]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\r\n\t#Columnas5\r\n\t\te = 0\r\n\t\t@columna5 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna5 << tablero[e,5]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas6\r\n\t\te = 0\r\n\t\t@columna6 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna6 << tablero[e,6]\r\n\t\t\te += 1\r\n\t\tend\r\nend",
"def column_display param, column_name\n defined?(param[:searchable][:col]).nil? ? true : param[:searchable][:col].include?(column_name) ? true : false\n end",
"def venueColumns \n venueLayout[\"columns\"]\n end",
"def columns()\n (cr=@records.get(GRT_COLROW)) ? cr[0] : nil\n end",
"def column(index)\n end",
"def columns\n @columns\n end",
"def columns\n @columns\n end",
"def column(col, by)\n tmp = @display.map {|row| row[col] }.join\n by.times { tmp[0,0]= tmp[-1]; tmp.chop! }\n tmp.each_char.with_index {|c,i| @display[i][col] = c }\n self\n end",
"def ui_columns\n text = name\n text += \"\\n\" + notes if notes\n\n res = [id.to_s.blue, quantity.to_s.light_blue, text]\n if quantity > 1\n # we need to print unit weight and total weight\n value = \"$#{price}\\n$#{price*quantity}\"\n burden = \"#{weight}lbs\\n#{weight*quantity}lbs\"\n else\n value = \"$#{price}\"\n burden = \"#{weight}lbs\"\n end\n res << value\n res << burden\n \n status = []\n status.push('Purchased'.red) if was_bought\n status.push('Magical'.on_blue) if is_magic\n status.push('Was Dropped'.white.on_red) if ! is_had\n res << status.join(\"\\n\")\n res\n end",
"def for_column(subject)\n frm.table(:class=>\"listHier\").row(:text=>/#{Regexp.escape(subject)}/)[4].text\n end",
"def columns\n\t\t\t@columns ||= Txtboard::Column.columns.sort_by(&:order)\n\t\tend",
"def show_column\n @dataset = Dataset.find(params[:dataset_id])\n @variable = Variable.find(params[:variable_id])\n @data = ActiveRecord::Base.connection.select_all(\"SELECT var#{@dataset.identifierccode1_var} as ccode, var#{@dataset.identifieryear_var} as year, var#{@variable.var_id} as data from dataset_#{@dataset.id} ORDER BY var#{@dataset.identifierccode1_var} , var#{@dataset.identifieryear_var} \")\n @pays = ActiveRecord::Base.connection.select_values(\"SELECT var#{@dataset.identifierccode1_var} as ccode from dataset_#{@dataset.id} group by var#{@dataset.identifierccode1_var} ORDER BY var#{@dataset.identifierccode1_var} ASC\")\n @annees = ActiveRecord::Base.connection.select_values(\"SELECT var#{@dataset.identifieryear_var} as annee from dataset_#{@dataset.id} group by var#{@dataset.identifieryear_var} ORDER BY var#{@dataset.identifieryear_var} ASC\")\n @tableau = Array.new\n for annee in @annees\n @tableau[annee.to_i] = Hash.new()\n @pays.each do |pays|\n @tableau[annee.to_i][pays.to_i] = \"#\"\n end\n end\n \n for ligne in @data # pour chaque ligne (annee-pays) du tableau de donnees\n @tableau[ligne['year'].to_i][ligne['ccode'].to_i] = case when ligne['data'] == nil then nil else ligne['data'].to_f end\n end\n render :inline => @tableau[1870..2003].to_json + @annees.to_json\n end",
"def column_content(subject,column)\n\t\tcase column.to_s\n\t\t\twhen 'dob','died_on','reference_date','admit_date'\n\t\t\t\tsubject.send(column).try(:strftime,'%m/%d/%Y')\n#\t\t\twhen 'ccls_consented','ccls_is_eligible'\n#\t\t\t\tYNDK[subject.enrollments.where(:project_id => Project['ccls'].id).first.try(\n#\t\t\t\t\tcolumn.to_s.gsub(/^ccls_/,''))]\n\t\t\twhen 'languages' \n#\t\t\t\tsubject.languages.collect(&:key).join(',')\n\t\t\t\tsubject.subject_languages.collect(&:to_s).join(',')\n\n\t\t\twhen *StudySubject.sunspot_columns\n\t\t\t\t( subject.respond_to?(column) ? subject.try(column) : nil )\n\t\t\twhen /^(.*):(is_eligible|consented)$/\n\t\t\t\tYNDK[Enrollment.where(:study_subject_id => subject.id)\n\t\t\t\t\t.joins(:project)\n\t\t\t\t\t.where(\"projects.description = ?\",$1).first.try($2)]\n\t\tend\n\tend",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def columns\n _columns || columns!\n end",
"def ar_index_colspan\n colspan= 0\n colspan+= 1 if controller.ardata.links.include? :edit\n colspan+= 1 if controller.ardata.links.include? :show\n colspan+= 1 if controller.ardata.links.include? :destroy\n \n if colspan > 0\n content_tag(:th, '', :colspan => colspan) \n else\n \"\"\n end\n end",
"def column_print(things, color=:white)\n # return unless things.any?\n # sizes = things.map{|x|x.size}\n # col_width = sizes.max\n # cols = 80 / (col_width+3)\n # cols = 4 if cols > 4\n \n # if things.size % cols != 0\n # things += [''] * (cols - (things.size % cols))\n # end\n \n # things.map!{|thing| thing.ljust(col_width)}\n \n # things.each_slice(cols) do |slice|\n # puts slice.join(' | ').send(color)\n # end\n puts Term::Table.new(things).to_s.send(color)\n end",
"def columns \n []\n end",
"def column(c=0)\n percent_width(g_col_width, column_width(c))\n end",
"def columns\n @header.to_a\n end",
"def draw_table_titulos_columns(table_info, width_columns = [520])\n table (table_info) do\n rows(0).background_color = 'd7d7d7'\n rows(0).border_width = 1\n columns(0..3).font_style = :bold\n columns(0).border_width = 1\n columns(0..3).size = 9\n self.column_widths = width_columns\n end\n end",
"def col\r\n @lines[@line_num].cursor\r\n end",
"def columns\n @cr[2] & 0x7f\n end",
"def column_header\n (0..upper_bound_x+1)\n .to_a\n .map { |num| num.to_s.rjust((upper_bound_y + 1).to_s.size,'0')}\n .map { |num| num.chars }\n .transpose\n .map { |num| num.join }\n .map { |num| num.rjust(num.size + 5,\" \") }\n .join(\"\\n\") + \"\\n\"\n end",
"def columns\n gtk_instance.columns\n end",
"def _prepare_format #:nodoc:\n fmstr = nil\n fmt = []\n each_column { |c, i|\n ## trying a zero for hidden columns\n ## worked but an extra space is added below and the sep\n w = c.width\n case c.align\n when :right\n #fmt << \"%.#{w}s \"\n fmt << \"%#{w}.#{w}s \"\n else\n fmt << \"%-#{w}.#{w}s \"\n end\n }\n ## the next line will put a separator after hidden columns also\n fmstr = fmt.join(@y)\n #puts \"format: #{fmstr} \" # 2011-12-09 23:09:57\n return fmstr\n end",
"def excel_col()\n ( ( ( (self - 1)/26>=1) ? ( (self - 1)/26+64).chr: '') + ((self - 1)%26+65).chr)\n end",
"def col(num)\n \"#{27.chr}[3#{num.to_s}m\"\nend",
"def get_columns_name\r\n columns = []\r\n if @columns != nil\r\n @columns.each do |column|\r\n columns.push column\r\n end\r\n end\r\n \r\n if @stats != nil and @stats.length > 0\r\n @stats.each do |stat|\r\n columns.push stat.to_column_name\r\n end\r\n end\r\n \r\n return columns\r\n end",
"def list_columns\n columns\n end",
"def column_name; end",
"def notacion(columna, fila)\n ambiguedades = @tablero.movibles_a(columna, fila).select do |pieza|\n (@columna != pieza.columna or @fila != pieza.fila) and @color == pieza.color and self.class == pieza.class\n end\n\n notacion = inicial\n if ambiguedades.any? { |pieza| @fila == pieza.fila } and ambiguedades.any? { |pieza| @columna == pieza.columna }\n notacion << \"#{@columna.to_lttr}#{@fila}\"\n elsif ambiguedades.any? { |pieza| @columna == pieza.columna }\n notacion << \"#{@fila}\"\n elsif !ambiguedades.empty?\n notacion << \"#{@columna.to_lttr}\"\n end\n\n notacion << \"x\" if @tablero[columna][fila]\n notacion << \"#{columna.to_lttr}#{fila}\"\n end",
"def to_tabla\n\t\t\t\"#{@nombre}#{' ' * (15-@nombre.size)} #{@proteinas.round(1)} #{@glucidos.round(1)} #{@lipidos.round(1)} #{valor_energetico.round(2)}\"\n\t\tend",
"def draw_column_description(side = 0, y = @draw_y)\n @max_y = write_page_text(@enemy.enemy.bestiary_description, y, '',\n :ex, :max_width, side * max_width)\n end",
"def column_space(); @column_space; end",
"def to_s\n columns.each{|c| \"#{c}: #{self.send(c)}\\n\"}\n end",
"def get_column_name(type,index)\n\t\tcase type\n\t\t\twhen 'day'\n\t\t\t\tget_from_date(type,index)\n\t\t\twhen 'week'\n\t\t\t\tget_from_date(type,index)+\" - \"+get_to_date(type,index)\n\t\t\twhen 'month'\n\t\t\t\tdate = Date.today+index.month\n\t\t\t\tl(:\"cpm.months.#{date.strftime('%B')}\")+\" \"+date.strftime('%Y')\n\t\tend\n\tend",
"def column_value(rec, drawer)\n rec.inspect\n end",
"def display_columns(input)\n output = \"\"\n input.each_with_index do |element, index|\n # spaces to add inbetween = column.length - word.length\n output += \"#{element.capitalize + (\" \" * (15 - element.to_s.chars.count))}\"\n if index % 4 == 0 && index != 0\n output += \"\\n\"\n end\n end\n puts \"\"\n puts ColorizedString[output].bold\n end",
"def name\n self[:name] || (title ? Array(title).join(\"\\n\") : \"_col=#{colnum}\")\n end",
"def display(line, column = T.unsafe(nil)); end",
"def display(line, column = T.unsafe(nil)); end",
"def display(line, column = T.unsafe(nil)); end",
"def columns\n [\"#{@base}.*\"]\n end",
"def get_columns()\n db = SQLite3::Database.open(\"cash.db\")\n db.execute(\"select Valeur, Cours, Variation, Ouverture, Haut, Bas from boursier\") do |v|\n puts v.join(\" \")\n end\nend",
"def show_column_list( enum, subheading )\n\t\tpr = self.prompt\n\t\titems = nil\n\n\t\tif enum.first.respond_to?( :name )\n\t\t\titems = enum.map( &:name ).map( &:to_s ).uniq\n\t\telse\n\t\t\titems = enum.map( &:oid ).uniq\n\t\tend\n\n\t\tpr.say( \"\\n\" )\n\t\tpr.say( pr.color(subheading, :subheader) )\n\t\tpr.say( pr.list(items.sort_by(&:downcase), :columns_down) )\n\tend",
"def draw_columns\n @sections[:body][:fields].each do |field, settings|\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }).symbolize_keys!)]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n draw_line(@posY + @sections[:body][:settings][:height]/2)\n field = settings[2][:column] || field.to_s.split('_').inject('') do |str, part|\n str << part.camelize << \" \"\n end\n draw_text field, settings\n end\n draw_line(@posY - @sections[:body][:settings][:height]/2)\n set_pos_y @sections[:body][:settings][:height]\n end",
"def grid_row_undisplayed_columns\n []\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def get_display_field_header\n self.statement\n end",
"def inspect\n to_table.render :ascii\n end",
"def column_with_headings n, method = :value\n column n, method, headings_with_rows\n end",
"def acc_details_desc_columns\n all(:xpath, \"//div[@id='#{ACC_SETTINGS_DIV_ID}']/div/dl/span/dt\").map{ |span| span.text}\n end",
"def col(num)\n namespace + '_col_' + num.to_s\n end",
"def subjects_column\n list = []\n subjects.each { |subject| list << subject.name }\n list.join(';')\n end",
"def resources_column\n list = []\n resources.each { |rss| list << rss.name }\n list.join(';')\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}#{codigo_beneficiario}#{''.rjust(uso_exclusivo_header, ' ')}\"\n end",
"def columns\n self.class.instance_variable_get(:@columns)\n end",
"def gtfs_cols\n @@gtfs_cols[self]\n end",
"def show_text_column(*methods)\n return show_header_column(methods) if is_header\n\n content = get_methods_text_value(model, methods)\n content_tag :td, content\n end",
"def get_columns_visible_sql\n if self.columns_visible.blank?\n return ' * '\n else\n return (JSON.parse self.columns_visible).join(', ')\n end\n end",
"def column_name(index)\n \"Column #{index}\"\n end"
] |
[
"0.6991528",
"0.6803789",
"0.67591155",
"0.6737709",
"0.6698797",
"0.6698797",
"0.6698797",
"0.6698797",
"0.6698797",
"0.6698797",
"0.6698797",
"0.66781336",
"0.6561896",
"0.6510314",
"0.63907146",
"0.6379648",
"0.6379648",
"0.6330302",
"0.6223949",
"0.6186932",
"0.61744124",
"0.616406",
"0.6154074",
"0.6150433",
"0.6147414",
"0.6144832",
"0.6136587",
"0.61243826",
"0.6112443",
"0.6112443",
"0.6112093",
"0.61075944",
"0.61033285",
"0.6097657",
"0.6081247",
"0.6077306",
"0.60375524",
"0.60360146",
"0.60238296",
"0.6020878",
"0.60204595",
"0.60131735",
"0.60131735",
"0.60050046",
"0.59952986",
"0.598578",
"0.59830725",
"0.59820694",
"0.5966744",
"0.59584975",
"0.59584975",
"0.59584975",
"0.594563",
"0.59233034",
"0.5919343",
"0.5912122",
"0.5889305",
"0.58859",
"0.58695114",
"0.58660203",
"0.5854219",
"0.5846368",
"0.5839228",
"0.5828179",
"0.58230066",
"0.5820003",
"0.5795463",
"0.5795005",
"0.5790881",
"0.5778951",
"0.57730335",
"0.5763605",
"0.5742774",
"0.5735306",
"0.57322174",
"0.57285607",
"0.5717659",
"0.57174784",
"0.5713681",
"0.5713681",
"0.5713681",
"0.5708947",
"0.5703797",
"0.5703337",
"0.5681075",
"0.5674339",
"0.56669223",
"0.5659166",
"0.5658412",
"0.5655183",
"0.5651013",
"0.56498647",
"0.56473523",
"0.5646459",
"0.56295353",
"0.562007",
"0.56200075",
"0.56148887",
"0.56134593",
"0.5599999",
"0.5597492"
] |
0.0
|
-1
|
== Metodo minimo Dispersa
|
def minimo
min = 0
i = 0
while i < @numElementos
if(@eleM[i] < min)
min = @eleM[i]
end
i += 1
end
#puts "minimo: #{min}"
return min
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def suivre; end",
"def mi_carrera\n\n\tend",
"def unsichtbar_machen()\n end",
"def sigla; @nome; end",
"def sichtbar_machen()\n # TODO\n end",
"def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end",
"def sichtbar_machen()\n end",
"def presentacion\n \"La marca del Ventilador es #{@marca}\"\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def titulo_guia\n titulo = []\n\n t = Especie.find(params[:especie_id])\n a = t.adicional\n\n tipo_region = params[:tipo_region] == \"anp\" ? \"ANP \" : \"Municipio de \"\n \n if a.nombre_comun_principal.present?\n titulo[0] = \"Guía de #{a.nombre_comun_principal}\"\n else\n titulo[0] = \"Guía de #{t.nombre_cientifico}\"\n end\n\n titulo[1] = tipo_region + params[:nombre_region]\n titulo\n end",
"def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend",
"def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end",
"def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}#{codigo_beneficiario}#{''.rjust(uso_exclusivo_header, ' ')}\"\n end",
"def partido\n localidad.partido\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end",
"def nome_perfil\n \tself.descricao\n end",
"def status_da_divulgacao(topico)\n end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def devolver_nombre \n return @nombre\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end",
"def nombre\r\n return @nombre\r\n \r\n end",
"def nombre\n m = []\n m << self.padre.nombre unless self.padre.blank?\n m << self.madre.nombre unless self.madre.blank?\n m = m.join('&')\n n = []\n n << self.padre.apepat unless self.padre.blank? \n n << self.madre.apepat unless self.madre.blank?\n n << \"(#{m})\"\n n.join(' ')\n end",
"def frecuencia_pago_intermediario_w\n case self.frecuencia_pago_intermediario\n when 1\n I18n.t('Sistema.Body.General.Periodos.mensual')\n when 3\n I18n.t('Sistema.Body.General.Periodos.trimestral')\n when 6\n I18n.t('Sistema.Body.General.Periodos.semestral')\n when 12\n I18n.t('Sistema.Body.General.Periodos.anual')\n end\n end",
"def precio\n\t\t@precio\n\tend",
"def generos\n (self.genero == 1) ? \"Masculino\" : \"Femenino\"\n end",
"def mostrar(marca)\n puts \"Marca: #{marca} - Modelo: #{nome}\"\n end",
"def schumann; end",
"def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end",
"def verdi; end",
"def zuruecksetzen()\n end",
"def full_descripcion \n \"#{asunto.nombre} - \"+\"#{nombre}\" \n end",
"def acces_nome\r\n @nome\r\n end",
"def display_commandes\n puts <<-EOT\n\n(Taper 'aide' pour obtenir de l'aide)\n\n EOT\n end",
"def display_commandes\n puts <<-EOT\n\n(Taper 'aide' pour obtenir de l'aide)\n\n EOT\n end",
"def discursarnolocal(pessoa, lugar)\n \"#{pessoa} discursou no #{lugar}\"\nend",
"def show\n add_breadcrumb \"Detalles\", @reqcargos\n end",
"def actionNom\n\t\treturn \"Je sais rien faire :C\"\n\tend",
"def ubicacion\n communes_str = @stats.pluralize_communes\n if @stats.communes.size > 1\n comm_st = \" las comunas de \"\n elsif communes_str == \"\"\n comm_st = \"\"\n else\n comm_st = \" la comuna de \"\n end\n regions_str = @stats.pluralize_regions\n if @stats.regions.size > 1\n reg_st = \" las regiones de \"\n elsif regions_str == \"\"\n reg_st = \"\"\n else\n reg_st = \" la region de \"\n end\n country_str = @stats.pluralize_countries\n if @stats.countries.size > 1\n coun_st = \" los paises \"\n elsif country_str == \"\"\n coun_st = \"\"\n else\n coun_st = \" el pais \"\n end\n\n s = \"La zona elegida se encuentra dentro de \" + comm_st + communes_str +\n \", \" + reg_st + regions_str +\" y \" + coun_st + country_str + \".\"\n return s\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end",
"def multiples_facturas_confirmar_parciales\n @width_layout=1180\n @form_title = I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.orden_despacho_insumos') \n @form_title_record = I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.orden_despacho_insumo') \n end",
"def retorna_nome_produto\n titulo_produto.greenify\n titulo_produto.text\n end",
"def nombre\n\t\t@nombre\n\tend",
"def display_name\n titre\n end",
"def show\n @operacao = 'Visualização'\n end",
"def campoord_inicial\n 'ubicacion'\n end",
"def nombre\n @nombre\n end",
"def nombre()\n\t\tputs \"#{@nombre}\"\t\n\tend",
"def desplegarProceso\n\t\tputs \"id=#{@id} cantBytes=#{@cantBytes} cantPaginas=#{@cantPaginas}\"\n\t\tputs \"marcosRealAsig=#{@marcosRealAsig} marcosSwapAsig=#{@marcosSwapAsig}\"\n\tend",
"def titulares_serial\n Representante.find(self.titular_ids_serial).map(&:nombre)\n end",
"def actionNom\n\t\treturn \"Acheter potion (100or)\"\n\tend",
"def comisiones_asignadas\n asunto.comisiones if asunto\n end",
"def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # zeros 2\n # conta corrente 7\n # digito da conta 1\n # complemento 6\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end",
"def show\n @titulo = \"Ver Pedido\"\n @clase = \"Pedidos\"\n end",
"def chargementJeu(nomJoueur)\n @sauvegardeYaml = SauvegardeYAML.creer(nomJoueur)\n @sauvegarde = @sauvegardeYaml.chargement()\n @joueur = @sauvegarde.joueur\n nom=@joueur.nom.split(\".\")\n @joueur.nom = nom[0]\n print @joueur.nom\n @carte = @sauvegarde.carte\n @nbTour = @sauvegarde.nbTour\n\tend",
"def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end",
"def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end",
"def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end",
"def det\n\t\t\t@frecuencias['determinantes']\n\t\tend",
"def show\n @diagnosticos = Diagnostico.all\n @stock_medicas = StockMedica.where(diagnostico_id == ficha_doc.diagnostico_id) \n end",
"def nomination_status\n if view_status != 3\n return \"\"\n end\n return \"Det går endast att nominera till poster som inte väljs på Terminsmötet\"\n end",
"def povuci_mrezu\n return @mreza\n end",
"def get_nombre; @nombre; end",
"def affichage_bienvenue\nputs\"------------------------------------------------\n|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |\n|Le but du jeu est d'être le dernier survivant !|\n-------------------------------------------------\"\nend",
"def terreno\n\t\treturn @terreno*@cantidad\n\tend",
"def deco_pos; end",
"def show\n ##puts Transacao.find(2).cliente.nome\n ##puts Imposto.find(18).tabela_de_limites.limite_inferior\n end",
"def asignar_titulo_propiedad()\n \n end",
"def cabecera\n puts \"\"\n puts \"\"\n puts \"El examen va a comenzar.\"\n puts \" Debe responder poniendo solo el caracter de la respuesta elegida.\"\n print \" El examen consta de \"\n print @numeroPreguntas\n puts \" preguntas.\"\n end",
"def schubert; end",
"def nome\n @nome\n end",
"def revisa_deuda\n if com_compra.adeudos[:cuentas_con_deuda] == 0\n com_compra.pagado!\n else\n com_compra.pendiente!\n end\n end",
"def titulo\n return nil\n end",
"def titulo\n return nil\n end",
"def notificaciones\n end",
"def nombres_comunes\n datos = eval(naturalista_info.decodifica64)\n datos = datos.first if datos.is_a?(Array)\n return [] unless datos['taxon_names'].present?\n nombres_comunes_faltan = []\n\n # Nombres comunes de la base de catalogos\n nom_comunes = especie.nombres_comunes\n nom_comunes = nom_comunes.map(&:nombre_comun).map{ |nom| I18n.transliterate(nom).downcase }.sort if nom_comunes\n\n datos['taxon_names'].each do |datos_nombres|\n next unless datos_nombres['is_valid']\n next if datos_nombres['lexicon'] == 'Scientific Names'\n\n # Nombre comun de NaturaLista\n nombre = I18n.transliterate(datos_nombres['name']).downcase\n lengua = datos_nombres['lexicon']\n\n if nom_comunes.present?\n next if nom_comunes.include?(nombre)\n end\n nombres_comunes_faltan << \"#{especie.catalogo_id},\\\"#{datos_nombres['name']}\\\",#{lengua},#{especie.nombre_cientifico},#{especie.categoria_taxonomica.nombre_categoria_taxonomica},http://naturalista.conabio.gob.mx/taxa/#{naturalista_id}\"\n end\n\n nombres_comunes_faltan\n end",
"def unsichtbar_machen\n @fuss.unsichtbar_machen\n @stiel.unsichtbar_machen\n @schirm.unsichtbar_machen\n @leuchtstrahl1.unsichtbar_machen\n @leuchtstrahl2.unsichtbar_machen\n @leuchtstrahl3.unsichtbar_machen\n @leuchtstrahl4.unsichtbar_machen\n end",
"def solicitudes_atrasadas\n end",
"def show\n #calculo de presupuesto\n \n end",
"def datos_default\n if new_record?\n lastRecord = MovMovimiento.last\n if lastRecord\n self.hoja = lastRecord.hoja\n end\n\n num_abonos = ComPago.where(com_compra: com_compra).count + 1\n self.concepto = \"Abono #{num_abonos} a compra \\\"#{com_compra.title}\\\"\"\n end\n end",
"def nome\n @nome \n end",
"def titre\n \"Links Analysis du #{Time.now.strftime('%d %m %Y à %H:%M')}\"\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def hide_name\n str = \" utente Fiscosport n° \" + self.id.to_s\n if self.comune_id && self.comune\n str += \" - prov. di \" + self.comune.province.name + \" (\" + self.comune.province.sigla + \")\" unless self.comune.province.nil?\n end\n return (str.nil? || str.blank?) ? \"-\" : str\n end",
"def informacoes_da_conta(local)\n\t\t\t\t\traise NotImplementedError.new('Sobreescreva este método na classe referente ao banco que você esta criando')\n\t\t\t\tend",
"def getNombre\n\t\treturn @nombre\n\tend",
"def getNombre\n\t\treturn @nombre\n\tend",
"def detalles_responsabilidad\n if self.responsabilidad.nil? || responsabilidad_type.eql?(\"Administracion\")\n return responsable_de\n else\n \"Plaza: #{self.responsabilidad.nombre}\"\n end\n end",
"def precio_mercado\n @serie.valor_primer_dia('precio')\n end",
"def relatorios\n end",
"def nombre_completo\n\t\t\"#{nombre} #{apellido}\"\n\tend",
"def sauvegarder(unNom)\n\t\tif nbSaves() >= 8\n\t\t\tdialog = Gtk::Dialog.new(\"Alerte\",\n \t $main_application_window,\n \t :destroy_with_parent,\n \t [ Gtk::Stock::OK, :none ])\n \t\t\tdialog.set_window_position(:center_always)\n\n \t # Ensure that the dialog box is destroyed when the user responds.\n \t dialog.signal_connect('response') { dialog.destroy }\n\n \t # Add the message in a label, and show everything we've added to the dialog.\n \t dialog.child.add(Gtk::Label.new( \"\\nImpossible:nombre maximum de sauvegardes atteint (8/8)!\\n\" ))\n \t dialog.show_all\n\t\telse\n\t\t\t# Serialisation des différentes classes\n\t\t\thypo = @hypo.to_yaml()\n\n\t\t\t# Ecriture dans le fichier\n\t\t\tmonFichier = File.open(\"../sauvegardes/\"+unNom, \"w\")\n\t\t\tmonFichier.write(hypo)\n\t\t\tmonFichier.write(\"***\\n\")\n\t\t\tmonFichier.write(@pseudo)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@inc)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@time)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@cheminMap)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@nbHypo)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\n\t\t\t# Fermeture du fichier\n\t\t\tmonFichier.close\n\t\tend\n\tend",
"def get_titulo\n \"#{@titulo}\" \n end",
"def paterno_materno_nombre\n \"#{paterno} #{materno} #{nombre}\"\n end",
"def devolver_azucar \n\t\treturn @azucares\n\tend",
"def imprimir_nome\n @nome\n end",
"def realizar_cuestionario_demora\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario por Demora\"\n end"
] |
[
"0.6239537",
"0.6209345",
"0.6199985",
"0.612468",
"0.6115583",
"0.6094223",
"0.60552686",
"0.60054874",
"0.5910617",
"0.5839675",
"0.5838946",
"0.5836864",
"0.5836864",
"0.5815958",
"0.57580817",
"0.5744355",
"0.5734378",
"0.57313865",
"0.5700767",
"0.567721",
"0.56764024",
"0.567503",
"0.56616884",
"0.56582505",
"0.56487197",
"0.5640658",
"0.5639829",
"0.56381124",
"0.5632886",
"0.56310725",
"0.56246173",
"0.5622877",
"0.562186",
"0.5611099",
"0.5598165",
"0.55906886",
"0.55906886",
"0.5567916",
"0.55660886",
"0.55566806",
"0.55421484",
"0.5541065",
"0.5541065",
"0.5538244",
"0.553663",
"0.5527618",
"0.5518321",
"0.5517326",
"0.55090106",
"0.5507727",
"0.5506624",
"0.5505541",
"0.55049336",
"0.5497526",
"0.54937094",
"0.54876786",
"0.5486866",
"0.5481935",
"0.54776984",
"0.54775727",
"0.54627013",
"0.545732",
"0.54483885",
"0.54405713",
"0.54371023",
"0.54187906",
"0.5418388",
"0.5413475",
"0.54090655",
"0.54062057",
"0.5403613",
"0.53961176",
"0.53859323",
"0.5381314",
"0.5377693",
"0.53761685",
"0.53756016",
"0.53756016",
"0.5375305",
"0.5374009",
"0.537307",
"0.5367667",
"0.5364938",
"0.53620344",
"0.53556615",
"0.53545386",
"0.53543025",
"0.5348495",
"0.5348256",
"0.5346149",
"0.5346149",
"0.5344324",
"0.53430724",
"0.53405094",
"0.53394425",
"0.5338361",
"0.53324544",
"0.5327396",
"0.53270894",
"0.5320728",
"0.531462"
] |
0.0
|
-1
|
== Metodo maximo Dispersa
|
def maximo
max = 0
i = 0
while i < @numElementos
if(@eleM[i] > max)
max = @eleM[i]
end
i += 1
end
#puts "maximo: #{max}"
return max
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def item_max() @item_max end",
"def maximo()\n\t\tmaximo = 0;\n\t\t@hash_no_nulos.each do |key,valor|\n\t\t\tif (valor > maximo)\n\t\t\t\tmaximo = valor\n\t\t\tend\n end\n\t\treturn maximo\n\tend",
"def max_items\n main.max_items\n end",
"def jugada_max\r\n movimiento.max_by{|x| x.nivel} #Devuelve el objeto de enumeración que da el valor máximo\r\n end",
"def wordMax\n @wordMax\n end",
"def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend",
"def item_max\n @item_max\n end",
"def item_max\r\n @list.size\r\n end",
"def maximum_limit\n 100\n end",
"def largest\n divisors = counts(@max)\n result = ''\n divisors.each_with_index do |total, index|\n if total == divisors.max\n result << \"#{index+1}:#{total} \"\n end\n end\n result.strip\n end",
"def maximum_representable()\n\t(@@roman_of.keys.max * 5) -1\nend",
"def item_max\r\n @item_max || 0\r\n end",
"def max(_); '1000'; end",
"def item_max; 64; end",
"def max_uses\n @attributes[:max_uses]\n end",
"def max_autonomy\n fuel_data = current_fuel_data\n\n (capacity * fuel_data[:autonomy]).to_f\n end",
"def item_max\n return 1\n end",
"def max(_); '100'; end",
"def max(_); '100'; end",
"def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |valor_pos| valor_pos.nivel }\r\n \r\n if jugador_actual == 'O'\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.min\r\n #nivels.max\r\n else\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.max\r\n end\r\n end",
"def item_max\r\r\n @data ? @data.size : 1\r\r\n end",
"def item_max\n return @enumeration.length\n end",
"def item_max\r\n \t@data ? @data.size : 1\r\n end",
"def text_field_max\n return nil unless hidden_field_max\n hidden_field_max.divmod(hidden_field_step).first * text_field_step\n # fetch_options('max', text_field_name) # default)\n end",
"def item_max\n @dataConsumable ? @dataConsumable.size : 1\n end",
"def suggestedNumber\r\n return self.maxLength\r\n end",
"def max\n @max\n end",
"def max\n @max\n end",
"def max\n @maxNumber\n end",
"def max_pages() 1 end",
"def item_max\n @data ? @data.size : 1;\n end",
"def max\n end",
"def max\n end",
"def max; end",
"def max; end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def get_max\n @max\n end",
"def get_max()\n end",
"def largest(restaurant_menu)\n mas_caro = restaurant_menu.max_by{|k,v| v}\n puts \"El plato mas caro es el #{mas_caro[0]}\"\nend",
"def size\n @max\n end",
"def get_max\n\t\t@max.last\n\tend",
"def item_max; @data ? @data.size : 0; end",
"def get_max_field()\n 0\n end",
"def max_tp\r\n return 100\r\n end",
"def get_max_results\n @max_results\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def max\n data.max\n end",
"def maximum\n return @maximum\n end",
"def tempo_max\n @tempo_max ||= data[:tempo_max].to_i\n end",
"def item_max\n return @data.size\n end",
"def item_max\n return @data.size\n end",
"def max\n @n[0]\n end",
"def max=\n end",
"def test_max_dispersa\n\t\tassert_equal(Fraccion.new(77,12), @h3.max, \"Resultado Incorrecto\" )\n\tend",
"def item_max(cat = current_category)\n @list[cat].size\n end",
"def max_opac\n return @battler.max_opac if @battler\n return 255\n end",
"def item_max\n return 0 unless @data\n @data.size\n end",
"def item_max\n @data.nil? ? 0 : @data.size\n end",
"def high_card \n\t\tcards.max\n\tend",
"def getNbRecompense\n return 0\n end",
"def tam\n @Max\n end",
"def storage_max_item_number(item)\n return item.storage_max\n end",
"def max_items\n items_node[:max_items].to_i if items_node[:max_items]\n end",
"def max\n\t\t@max || nil\n\tend",
"def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"def max_pages() Pages.keys.size end",
"def biggest\n # self.compact.sort.last\n self.compact.max\n end",
"def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end",
"def limit\n components.fetch(:size)\n end",
"def item_max=(value)\n @item_max = value\n end",
"def max\n array.length - 1\n end",
"def max_resolution; end",
"def image_error_num( max ); \"每則日誌最多可貼 #{max} 張圖片\"; end",
"def maxvalue\n MAXVALUE\n end",
"def max\n @data[0]\n end",
"def limit; end",
"def limit; end",
"def limit; end",
"def find_max()\r\n self.max\r\n end",
"def max_position\n @words.first[1].length\n end",
"def visible_line_number\r\n item_max\r\n end",
"def item_max\n return @data.nil? ? 0 : @data.size\n end",
"def max_per_page\n nil\n end",
"def maximizable\n @ole.Maximizable\n end",
"def maximizable\n @ole.Maximizable\n end",
"def max\n @max ||= map {|a| a[0].length}.max\n end",
"def max_files\n raw_data['max_files']\n end",
"def max\n max = @valor[0][0]\n i=0\n\tself.fil.times do |i|\n\t j=0\n\t self.col.times do |j|\n\t if (@valor[i][j] > max)\n\t\t max= @valor[i][j]\n\t end\n\t j=j+1\n\t end\n\ti=i+1\n end\n max\n end",
"def maximum\n return self[0]\n end"
] |
[
"0.65625346",
"0.65429854",
"0.6532191",
"0.6414942",
"0.6365341",
"0.6353072",
"0.6309388",
"0.6249202",
"0.62445897",
"0.61857647",
"0.6160141",
"0.61499774",
"0.61337376",
"0.6119092",
"0.61155486",
"0.61053264",
"0.6092025",
"0.60824066",
"0.60824066",
"0.60714746",
"0.60684294",
"0.60659957",
"0.60540205",
"0.6052541",
"0.60478276",
"0.60456496",
"0.6029941",
"0.6029941",
"0.60009456",
"0.59943867",
"0.5978993",
"0.5976514",
"0.5976514",
"0.5973839",
"0.5973839",
"0.59716994",
"0.59716994",
"0.59716994",
"0.59716994",
"0.59716994",
"0.59716994",
"0.5963689",
"0.59546596",
"0.5903169",
"0.5895792",
"0.58764",
"0.58702004",
"0.5857899",
"0.58569825",
"0.5856908",
"0.58548266",
"0.58548266",
"0.58548266",
"0.58548266",
"0.58548266",
"0.58548266",
"0.58548266",
"0.5816091",
"0.58159465",
"0.5807005",
"0.5787724",
"0.5787724",
"0.57874405",
"0.5780126",
"0.5774226",
"0.5758977",
"0.5751647",
"0.57440126",
"0.5736096",
"0.57253087",
"0.5722277",
"0.5722248",
"0.57192314",
"0.5709985",
"0.5709092",
"0.5705498",
"0.57004404",
"0.5693767",
"0.5686019",
"0.56776536",
"0.5662331",
"0.56592464",
"0.5658335",
"0.5645937",
"0.56358635",
"0.56314945",
"0.5617939",
"0.5617939",
"0.5617939",
"0.5613276",
"0.5611317",
"0.55983424",
"0.5597285",
"0.5596077",
"0.5594653",
"0.5594653",
"0.55937546",
"0.55648124",
"0.55627304",
"0.5560249"
] |
0.6220498
|
9
|
== Paso a string Dispersa
|
def to_s
matrizMuestra = Array.new(@fil) {Array.new(@col) {0}}
numEle = 0
i = 0
while i < @numElementos
matrizMuestra[@filM[i]][@colM[i]] = @eleM[i]
i += 1
end
#puts "muestra = #{matrizMuestra}"
return matrizMuestra
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string() end",
"def string?; end",
"def string(*) end",
"def string\n @string\n end",
"def string\n @string\n end",
"def String(p0) end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string\n end",
"def string\n end",
"def string\n end",
"def str; end",
"def str; end",
"def string(str); end",
"def text(str); end",
"def content=(string); end",
"def content=(string); end",
"def text(string); end",
"def text(string); end",
"def str(str); end",
"def str(str); end",
"def str2; end",
"def str2; end",
"def stringOutput\n\t\tend",
"def stringOutput\n\t\tend",
"def string=(p0) end",
"def echo(str)\n\tstr\nend",
"def echo(str)\n\tstr\nend",
"def string=(_arg0); end",
"def show_text(string, *params)\n @content.last << string.strip\n end",
"def string()\n #This is a stub, used for indexing\n end",
"def outo( str )\n outi nil, str\n end",
"def write_string(*text); end",
"def text\n \"STRAT\"\n end",
"def show_text(string, *params)\n @content.last << string.strip\n end",
"def echo(str)\n str\n end",
"def write string\n end",
"def display_string(value)\n return nil unless value\n\n last_resort_string = lambda do\n warn \"AppMap encountered an error inspecting a #{value.class.name}: #{$!.message}\"\n '*Error inspecting variable*'\n end\n\n value_string = \\\n begin\n value.to_s\n rescue NoMethodError\n begin\n value.inspect\n rescue StandardError\n last_resort_string.call\n end\n rescue StandardError\n last_resort_string.call\n end\n\n value_string[0...LIMIT].encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n end",
"def read_string; end",
"def strings; end",
"def shout(str)\n puts str\n end",
"def show\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n end",
"def on_tstring_content(string)\n string\n end",
"def str1; end",
"def str1; end",
"def process\n @string\n end",
"def encode_string_ex; end",
"def text text\n end",
"def str3; end",
"def str3; end",
"def show_text(string, *params)\r\n @content.last << string\r\n end",
"def str1\n 'from string'\nend",
"def track_string(t)\n end",
"def string(text)\n common_string(text, text.event.unicode)\n end",
"def string(text)\n common_string(text, text.event.unicode)\n end",
"def go # method to return below string\n \"vrrrrrrrooom!\"\n end",
"def text(str)\n @serial.write(\"#{str}\\r\")\n end",
"def show_text(string, *params)\n #puts \"#{string.inspect} #{params.inspect}\"\n @content.last << string\n end",
"def echo(str)\n str\nend",
"def affichage_bienvenue\nputs\"------------------------------------------------\n|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |\n|Le but du jeu est d'être le dernier survivant !|\n-------------------------------------------------\"\nend",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def open_text\n \"\"\n end",
"def _raw(string)\n ::Hanami::Utils::Escape::SafeString.new(string)\n end",
"def print(str)\n @output.write(Iconv.iconv(@options[:encoding], \"utf-8//ignore\", str))\n end",
"def my_string\n'Hello World'\nend",
"def string(t)\n @@string_visitor.visit_this(self, t)\n end",
"def string\n @io.string\n end",
"def gritar(texto = \"Ahhhh\")\n\t\ttexto\n\tend",
"def hyperlinkstring(io)\n io.read(4) # length (4 bytes): An unsigned integer that specifies the number of Unicode characters in the string field, including the null-terminating character.\n _db_zero_terminated(io) # string (variable): A null-terminated array of Unicode characters. The number of characters in the array is specified by the length field.\n end",
"def plain\n data = \"Early bird gets the worm. But cookie taste better than worm. So me sleep in. - Cookie Monster\"\n end",
"def string(l, str)\n local(l)\n if str # nil here is bizarre and probably a bug - it means get_arg() was called with nil\n # FIXME: Should rewrite a lot more thoroughly here...\n buf = \"\"\n str.each_byte do |b|\n if b < 32 || b == 92\n buf << @csi\n buf << b.to_s(8)\n elsif b == 34\n buf << '\\\"'\n else\n buf << b.chr\n end\n end\n\n emit(\".asciz\", \"\\\"#{buf}\\\"\")\n end\n end",
"def show_text(string, *params)\n @content.last << string\n end",
"def show_text(string, *params)\n @content.last << string\n end",
"def show_text(string, *params)\n @content.last << string\n end",
"def echo(string)\n string\n end",
"def input_string; end",
"def print_string_message_gdi\n puts %q{Double-quoted strings can include escaped characters such as \\n and \\\\\\\\\nas well as interpolated Ruby expressions like #{Time.now}.}\nend",
"def raw_text\n \"\"\n end",
"def pcos_get_string(*args)\n @p.pcos_get_string(self, *args)\n end",
"def str(str)\n Atoms::Str.new(str)\n end",
"def to_s\n text\n end"
] |
[
"0.708808",
"0.684174",
"0.6806909",
"0.6763421",
"0.6763421",
"0.6744463",
"0.67353565",
"0.67353565",
"0.67353565",
"0.67353565",
"0.67353565",
"0.67353565",
"0.67353565",
"0.67353565",
"0.67353565",
"0.65373075",
"0.65373075",
"0.65373075",
"0.6530416",
"0.6530416",
"0.6527119",
"0.65262717",
"0.64285344",
"0.64285344",
"0.6415836",
"0.6415836",
"0.63940555",
"0.63940555",
"0.6270475",
"0.6270475",
"0.62647736",
"0.62647736",
"0.6257176",
"0.61778486",
"0.61778486",
"0.61626035",
"0.6159346",
"0.6145461",
"0.6143274",
"0.61327744",
"0.60602635",
"0.6040881",
"0.5995756",
"0.59336",
"0.59305847",
"0.5926683",
"0.59244627",
"0.59213084",
"0.59070474",
"0.5905314",
"0.5905214",
"0.5905214",
"0.58802104",
"0.586621",
"0.5864677",
"0.5858043",
"0.5858043",
"0.58397603",
"0.5829353",
"0.5825441",
"0.58249104",
"0.58249104",
"0.5813678",
"0.5802091",
"0.57965004",
"0.5792538",
"0.5790332",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57871085",
"0.57833916",
"0.578119",
"0.5779478",
"0.57698005",
"0.5753258",
"0.5741217",
"0.5735983",
"0.5734783",
"0.57220435",
"0.57134277",
"0.57094306",
"0.57094306",
"0.57094306",
"0.5698205",
"0.56924677",
"0.5681256",
"0.56770116",
"0.5676854",
"0.5672821",
"0.56687176"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.